From d63fe22afed0495955beef8a1fb9f6a6c01820fc Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Thu, 1 Jul 2021 20:18:10 -0500 Subject: [PATCH] (purple) Handle outgoing invites Fixes #23 --- protocols/purple/PurpleApp.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/protocols/purple/PurpleApp.cpp b/protocols/purple/PurpleApp.cpp index c2483f6..7eae8d0 100644 --- a/protocols/purple/PurpleApp.cpp +++ b/protocols/purple/PurpleApp.cpp @@ -222,6 +222,23 @@ PurpleApp::ImMessage(BMessage* msg) SendMessage(_AccountFromMessage(msg), roster); break; } + case IM_ROOM_SEND_INVITE: + { + PurpleAccount* account = _AccountFromMessage(msg); + PurpleConversation* conv = _ConversationFromMessage(msg); + PurpleConvChat* chat = purple_conversation_get_chat_data(conv); + BString user_id = msg->FindString("user"); + BString body = msg->FindString("body"); + + if (chat == NULL || user_id.IsEmpty() == true) + break; + if (body.IsEmpty() == true) + body = "(Invite)"; + + purple_conv_chat_invite_user(chat, user_id.String(), body.String(), + false); + break; + } case IM_ROOM_INVITE_ACCEPT: { PurpleAccount* account = _AccountFromMessage(msg);