|
@@ -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"
|
|
@@ -1090,6 +1091,15 @@ func (server *Server) DeleteMessage(target, msgid, accountName string) (err erro
|
1090
|
1091
|
|
1091
|
1092
|
if hist == nil {
|
1092
|
1093
|
err = server.historyDB.DeleteMsgid(msgid, accountName)
|
|
1094
|
+ if err != nil && errors.Is(err, mysql.ErrDBIsNil) {
|
|
1095
|
+ /*
|
|
1096
|
+ hist == nil, and db == nil. We know that the
|
|
1097
|
+ target was not either a current channel or
|
|
1098
|
+ client, and persistent storage is not used.
|
|
1099
|
+ So this is an invalid target. (see #2020)
|
|
1100
|
+ */
|
|
1101
|
+ return errInvalidTarget
|
|
1102
|
+ }
|
1093
|
1103
|
} else {
|
1094
|
1104
|
count := hist.Delete(func(item *history.Item) bool {
|
1095
|
1105
|
return item.Message.Msgid == msgid && (accountName == "*" || item.AccountName == accountName)
|