diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-07 16:03:25 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-07 16:03:25 -0700 |
| commit | aeec10158441af3cef925ca55e531a4d5517d5ec (patch) | |
| tree | 8b95f1cdd61ffd4b1b9e97406da6bed6e24e74ae /hotline/transaction_handlers.go | |
| parent | fca1ebde1d6a552ce6e4e995fc12c73450af218b (diff) | |
Backfill tests and clean up
Diffstat (limited to 'hotline/transaction_handlers.go')
| -rw-r--r-- | hotline/transaction_handlers.go | 10 |
1 files changed, 5 insertions, 5 deletions
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 |