|
@@ -6,6 +6,7 @@
|
6
|
6
|
package irc
|
7
|
7
|
|
8
|
8
|
import (
|
|
9
|
+ "errors"
|
9
|
10
|
"fmt"
|
10
|
11
|
"net"
|
11
|
12
|
"net/http"
|
|
@@ -1074,6 +1075,15 @@ func (server *Server) DeleteMessage(target, msgid, accountName string) (err erro
|
1074
|
1075
|
|
1075
|
1076
|
if hist == nil {
|
1076
|
1077
|
err = server.historyDB.DeleteMsgid(msgid, accountName)
|
|
1078
|
+ if err != nil && errors.Is(err, mysql.ErrDBIsNil) {
|
|
1079
|
+ /*
|
|
1080
|
+ hist == nil, and db == nil. We know that the
|
|
1081
|
+ target was not either a current channel or
|
|
1082
|
+ client, and persistent storage is not used.
|
|
1083
|
+ So this is an invalid target. (see #2020)
|
|
1084
|
+ */
|
|
1085
|
+ return errInvalidTarget
|
|
1086
|
+ }
|
1077
|
1087
|
} else {
|
1078
|
1088
|
count := hist.Delete(func(item *history.Item) bool {
|
1079
|
1089
|
return item.Message.Msgid == msgid && (accountName == "*" || item.AccountName == accountName)
|