From 2bbe0c48d60c7f056c64111a162b47053f254668 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 13 Jun 2023 10:17:24 -0700 Subject: [PATCH 1/2] Force cid conversation to string in DeleteContact event --- peer/cwtch_peer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index aa15c2d..956c323 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -770,7 +770,7 @@ func (cp *cwtchPeer) DeleteConversation(id int) error { ci, err := cp.storage.GetConversation(id) if err == nil && ci != nil { log.Debugf("deleting %v", ci) - cp.eventBus.Publish(event.NewEventList(event.DeleteContact, event.RemotePeer, ci.Handle, event.ConversationID, id)) + cp.eventBus.Publish(event.NewEventList(event.DeleteContact, event.RemotePeer, ci.Handle, event.ConversationID, strconv.Itoa(id))) return cp.storage.DeleteConversation(id) } return fmt.Errorf("could not delete conversation, did not exist") From 96058944631a14488502c2e803f1d4f124fdb337 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 13 Jun 2023 10:26:20 -0700 Subject: [PATCH 2/2] Force Error Log if NewEventList attempts to publish an invalid field --- event/eventmanager.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/event/eventmanager.go b/event/eventmanager.go index 26c6c2a..04f506d 100644 --- a/event/eventmanager.go +++ b/event/eventmanager.go @@ -46,6 +46,8 @@ func NewEventList(eventType Type, args ...interface{}) Event { val, vok := args[i+1].(string) if kok && vok { data[key] = val + } else { + log.Errorf("attempted to send a field that could not be parsed to a string: %v %v", args[i], args[i+1]) } } return Event{EventType: eventType, EventID: GetRandNumber().String(), Data: data}