X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/d4c152a4dba0eec7c8ecd13732900909f51b1c97..8277fb93fd2c957e5fd609b68a001babea46cdc4:/hotline/transaction_handlers.go diff --git a/hotline/transaction_handlers.go b/hotline/transaction_handlers.go index 20e7651..f4c5a2f 100644 --- a/hotline/transaction_handlers.go +++ b/hotline/transaction_handlers.go @@ -301,7 +301,7 @@ func HandleSendInstantMsg(cc *ClientConn, t *Transaction) (res []Transaction, er msg := t.GetField(fieldData) ID := t.GetField(fieldUserID) - reply := *NewTransaction( + reply := NewTransaction( tranServerMsg, &ID.Data, NewField(fieldData, msg.Data), @@ -316,12 +316,12 @@ func HandleSendInstantMsg(cc *ClientConn, t *Transaction) (res []Transaction, er reply.Fields = append(reply.Fields, NewField(fieldQuotingMsg, t.GetField(fieldQuotingMsg).Data)) } - res = append(res, reply) + res = append(res, *reply) id, _ := byteToInt(ID.Data) - otherClient := cc.Server.Clients[uint16(id)] - if otherClient == nil { - return res, errors.New("ohno") + otherClient, ok := cc.Server.Clients[uint16(id)] + if !ok { + return res, errors.New("invalid client ID") } // Respond with auto reply if other client has it enabled