mirror of
https://github.com/ergochat/ergo.git
synced 2025-06-01 12:27:35 +02:00
parent
e4aac56bda
commit
7138e76151
@ -44,10 +44,11 @@ func (b *buntdbDatastore) GetAll(table datastore.Table) (result []datastore.KV,
|
||||
tablePrefix := fmt.Sprintf("%x ", table)
|
||||
err = b.db.View(func(tx *buntdb.Tx) error {
|
||||
err := tx.AscendGreaterOrEqual("", tablePrefix, func(key, value string) bool {
|
||||
if !strings.HasPrefix(key, tablePrefix) {
|
||||
encUUID, ok := strings.CutPrefix(key, tablePrefix)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
uuid, err := utils.DecodeUUID(strings.TrimPrefix(key, tablePrefix))
|
||||
uuid, err := utils.DecodeUUID(encUUID)
|
||||
if err == nil {
|
||||
result = append(result, datastore.KV{UUID: uuid, Value: []byte(value)})
|
||||
} else {
|
||||
|
@ -149,11 +149,8 @@ func (server *Server) sendLoginSnomask(nickMask, accountName string) {
|
||||
// to indicate that it should be removed from the list
|
||||
func acceptHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) bool {
|
||||
for _, tNick := range strings.Split(msg.Params[0], ",") {
|
||||
add := true
|
||||
if strings.HasPrefix(tNick, "-") {
|
||||
add = false
|
||||
tNick = strings.TrimPrefix(tNick, "-")
|
||||
}
|
||||
tNick, negPrefix := strings.CutPrefix(tNick, "-")
|
||||
add := !negPrefix
|
||||
|
||||
target := server.clients.Get(tNick)
|
||||
if target == nil {
|
||||
@ -4118,9 +4115,9 @@ func zncHandler(server *Server, client *Client, msg ircmsg.Message, rb *Response
|
||||
// fake handler for unknown commands
|
||||
func unknownCommandHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) bool {
|
||||
var message string
|
||||
if strings.HasPrefix(msg.Command, "/") {
|
||||
if trimmedCmd, initialSlash := strings.CutPrefix(msg.Command, "/"); initialSlash {
|
||||
message = fmt.Sprintf(client.t("Unknown command; if you are using /QUOTE, the correct syntax is /QUOTE %[1]s, not /QUOTE %[2]s"),
|
||||
strings.TrimPrefix(msg.Command, "/"), msg.Command)
|
||||
trimmedCmd, msg.Command)
|
||||
} else {
|
||||
message = client.t("Unknown command")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user