mirror of
https://github.com/ergochat/ergo.git
synced 2025-06-03 05:17:49 +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)
|
tablePrefix := fmt.Sprintf("%x ", table)
|
||||||
err = b.db.View(func(tx *buntdb.Tx) error {
|
err = b.db.View(func(tx *buntdb.Tx) error {
|
||||||
err := tx.AscendGreaterOrEqual("", tablePrefix, func(key, value string) bool {
|
err := tx.AscendGreaterOrEqual("", tablePrefix, func(key, value string) bool {
|
||||||
if !strings.HasPrefix(key, tablePrefix) {
|
encUUID, ok := strings.CutPrefix(key, tablePrefix)
|
||||||
|
if !ok {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
uuid, err := utils.DecodeUUID(strings.TrimPrefix(key, tablePrefix))
|
uuid, err := utils.DecodeUUID(encUUID)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
result = append(result, datastore.KV{UUID: uuid, Value: []byte(value)})
|
result = append(result, datastore.KV{UUID: uuid, Value: []byte(value)})
|
||||||
} else {
|
} else {
|
||||||
|
@ -149,11 +149,8 @@ func (server *Server) sendLoginSnomask(nickMask, accountName string) {
|
|||||||
// to indicate that it should be removed from the list
|
// to indicate that it should be removed from the list
|
||||||
func acceptHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) bool {
|
func acceptHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) bool {
|
||||||
for _, tNick := range strings.Split(msg.Params[0], ",") {
|
for _, tNick := range strings.Split(msg.Params[0], ",") {
|
||||||
add := true
|
tNick, negPrefix := strings.CutPrefix(tNick, "-")
|
||||||
if strings.HasPrefix(tNick, "-") {
|
add := !negPrefix
|
||||||
add = false
|
|
||||||
tNick = strings.TrimPrefix(tNick, "-")
|
|
||||||
}
|
|
||||||
|
|
||||||
target := server.clients.Get(tNick)
|
target := server.clients.Get(tNick)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
@ -4118,9 +4115,9 @@ func zncHandler(server *Server, client *Client, msg ircmsg.Message, rb *Response
|
|||||||
// fake handler for unknown commands
|
// fake handler for unknown commands
|
||||||
func unknownCommandHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) bool {
|
func unknownCommandHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) bool {
|
||||||
var message string
|
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"),
|
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 {
|
} else {
|
||||||
message = client.t("Unknown command")
|
message = client.t("Unknown command")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user