X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/32d7bb7e1d8c96f93c0d24884fe038c477c4df02..f0e5040e02adc26e25cb54cd345fd3989b25f0a3:/hotline/transaction_handlers.go?ds=sidebyside diff --git a/hotline/transaction_handlers.go b/hotline/transaction_handlers.go index 56f7afa..6816456 100644 --- a/hotline/transaction_handlers.go +++ b/hotline/transaction_handlers.go @@ -253,9 +253,10 @@ func HandleChatSend(cc *ClientConn, t *Transaction) (res []Transaction, err erro formattedMsg = fmt.Sprintf("\r*** %s %s", cc.UserName, t.GetField(fieldData).Data) } + // The ChatID field is used to identify messages as belonging to a private chat. + // All clients *except* Frogblast omit this field for public chat, but Frogblast sends a value of 00 00 00 00. chatID := t.GetField(fieldChatID).Data - // a non-nil chatID indicates the message belongs to a private chat - if chatID != nil { + if chatID != nil && !bytes.Equal([]byte{0, 0, 0, 0}, chatID) { chatInt := binary.BigEndian.Uint32(chatID) privChat := cc.Server.PrivateChats[chatInt] @@ -1293,7 +1294,7 @@ func HandleDelNewsItem(cc *ClientConn, t *Transaction) (res []Transaction, err e } } - if bytes.Compare(cats[delName].Type, []byte{0, 3}) == 0 { + if bytes.Equal(cats[delName].Type, []byte{0, 3}) { if !cc.Authorize(accessNewsDeleteCat) { return append(res, cc.NewErrReply(t, "You are not allowed to delete news categories.")), nil }