Print room 'join' and 'create' messages

This commit is contained in:
Jaidyn Ann 2021-06-18 01:39:34 -05:00
parent 48f84377fc
commit 077a01e8bf
2 changed files with 17 additions and 1 deletions

View File

@ -313,7 +313,9 @@ Server::ImMessage(BMessage* msg)
case IM_ROOM_CREATED: case IM_ROOM_CREATED:
case IM_ROOM_JOINED: case IM_ROOM_JOINED:
{ {
_EnsureConversation(msg); Conversation* chat = _EnsureConversation(msg);
if (chat != NULL)
chat->ImMessage(msg);
break; break;
} }
case IM_ROOM_PARTICIPANTS: case IM_ROOM_PARTICIPANTS:

View File

@ -1,9 +1,11 @@
/* /*
* Copyright 2009-2011, Andrea Anzani. All rights reserved. * Copyright 2009-2011, Andrea Anzani. All rights reserved.
* Copyright 2021, Jaidyn Levesque. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Andrea Anzani, andrea.anzani@gmail.com * Andrea Anzani, andrea.anzani@gmail.com
* Jaidyn Levesque, jadedctrl@teknik.io
*/ */
#include "ConversationView.h" #include "ConversationView.h"
@ -150,6 +152,18 @@ ConversationView::ImMessage(BMessage* msg)
_AppendOrEnqueueMessage(msg); _AppendOrEnqueueMessage(msg);
break; 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: case IM_ROOM_PARTICIPANT_JOINED:
{ {
_UserMessage("%user% has joined the room.\n", _UserMessage("%user% has joined the room.\n",