From 0ea5cbba318c129742713b71791158ac3c7f3a57 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Thu, 2 Mar 2023 10:51:44 -0800 Subject: [PATCH] Add support for "enhanced" sendinvite --- peer/cwtch_peer.go | 10 ++++++++++ peer/profile_interface.go | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index 560c4fe..7037fd2 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -75,6 +75,16 @@ type cwtchPeer struct { experimentsLock sync.Mutex } +// EnhancedSendInviteMessage encapsulates attempting to send an invite to a conversation and looking up the enhanced message +// useful for UIs. +func (cp *cwtchPeer) EnhancedSendInviteMessage(conversation int, inviteConversationID int) string { + mid, err := cp.SendInviteToConversation(conversation, inviteConversationID) + if err == nil { + return cp.EnhancedGetMessageById(conversation, mid) + } + return "" +} + func (cp *cwtchPeer) EnhancedImportBundle(importString string) string { return cp.ImportBundle(importString).Error() } diff --git a/peer/profile_interface.go b/peer/profile_interface.go index 2954dfa..6e6b830 100644 --- a/peer/profile_interface.go +++ b/peer/profile_interface.go @@ -53,6 +53,10 @@ type SendMessages interface { EnhancedSendMessage(conversation int, message string) string SendInviteToConversation(conversationID int, inviteConversationID int) (int, error) + + // EnhancedSendInviteMessage Attempts to Send an Invite and Immediately Attempts to Lookup the Message in the Database + EnhancedSendInviteMessage(conversation int, inviteConversationID int) string + SendScopedZonedGetValToContact(conversationID int, scope attr.Scope, zone attr.Zone, key string) }