Chat-O-Matic/application/views/UserItem.cpp
Jaidyn Ann ad1c7b5782 Receive lists and changes in room participants from protocols
Two new messages were added to the protocol API to do this:
M_ROOM_PARTICIPANTS, which can be used when someone joins a room, or
on joining a room to send a full list of users, and IM_ROOM_PARTICIPANT_LEFT,
for when a user has left the room/disconnected.

IM_SET_STATUS no longer assumes received data comes from contacts, but
any general user.

UserItem was made to reflect changes in the User's name.

Chat messages can now be reliably received in a given room. :)
2021-06-02 16:53:03 -05:00

38 lines
478 B
C++

/*
* Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#include "UserItem.h"
#include "NotifyMessage.h"
#include "User.h"
UserItem::UserItem(const char* name, User* user)
:
BStringItem(name),
fUser(user)
{
}
User*
UserItem::GetUser()
{
return fUser;
}
void
UserItem::ObserveString(int32 what, BString str)
{
switch (what) {
case STR_CONTACT_NAME:
SetText(str);
break;
}
}