From 077a01e8bf226bc5334bbe95f884a5acdc1c913a Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Fri, 18 Jun 2021 01:39:34 -0500 Subject: [PATCH] Print room 'join' and 'create' messages --- application/Server.cpp | 4 +++- application/views/ConversationView.cpp | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/application/Server.cpp b/application/Server.cpp index 266d0a4..5262cc1 100644 --- a/application/Server.cpp +++ b/application/Server.cpp @@ -313,7 +313,9 @@ Server::ImMessage(BMessage* msg) case IM_ROOM_CREATED: case IM_ROOM_JOINED: { - _EnsureConversation(msg); + Conversation* chat = _EnsureConversation(msg); + if (chat != NULL) + chat->ImMessage(msg); break; } case IM_ROOM_PARTICIPANTS: diff --git a/application/views/ConversationView.cpp b/application/views/ConversationView.cpp index b3a6d5c..b862678 100644 --- a/application/views/ConversationView.cpp +++ b/application/views/ConversationView.cpp @@ -1,9 +1,11 @@ /* * Copyright 2009-2011, Andrea Anzani. All rights reserved. + * Copyright 2021, Jaidyn Levesque. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Andrea Anzani, andrea.anzani@gmail.com + * Jaidyn Levesque, jadedctrl@teknik.io */ #include "ConversationView.h" @@ -150,6 +152,18 @@ ConversationView::ImMessage(BMessage* msg) _AppendOrEnqueueMessage(msg); break; } + case IM_ROOM_JOINED: + { + BMessage msg; + msg.AddString("body", "** You joined the room.\n"); + _AppendOrEnqueueMessage(&msg); + } + case IM_ROOM_CREATED: + { + BMessage msg; + msg.AddString("body", "** You created the room.\n"); + _AppendOrEnqueueMessage(&msg); + } case IM_ROOM_PARTICIPANT_JOINED: { _UserMessage("%user% has joined the room.\n",