(jabber) Setting of room subject, reformatting

This commit is contained in:
Jaidyn Ann 2021-07-29 22:13:20 -05:00
parent 89ff195c8d
commit afb181d2f8

View File

@ -98,7 +98,8 @@ JabberHandler::Process(BMessage* msg)
msg->FindInt32("im_what", &im_what); msg->FindInt32("im_what", &im_what);
switch (im_what) { switch (im_what) {
case IM_SET_OWN_STATUS: { case IM_SET_OWN_STATUS:
{
int32 status = msg->FindInt32("status"); int32 status = msg->FindInt32("status");
BString status_msg = msg->FindString("message"); BString status_msg = msg->FindString("message");
@ -115,8 +116,8 @@ JabberHandler::Process(BMessage* msg)
} }
break; break;
} }
case IM_SEND_MESSAGE:
case IM_SEND_MESSAGE: { {
const char* id = msg->FindString("chat_id"); const char* id = msg->FindString("chat_id");
const char* subject = msg->FindString("subject"); const char* subject = msg->FindString("subject");
const char* body = msg->FindString("body"); const char* body = msg->FindString("body");
@ -141,8 +142,8 @@ JabberHandler::Process(BMessage* msg)
_MessageSent(id, subject, body); _MessageSent(id, subject, body);
break; break;
} }
case IM_CREATE_CHAT:
case IM_CREATE_CHAT: { {
const char* user_id = msg->FindString("user_id"); const char* user_id = msg->FindString("user_id");
// TODO: Contact validation, make sure permssion is granted // TODO: Contact validation, make sure permssion is granted
@ -154,23 +155,23 @@ JabberHandler::Process(BMessage* msg)
_ChatCreatedMsg(user_id); _ChatCreatedMsg(user_id);
break; break;
} }
case IM_CREATE_ROOM:
case IM_CREATE_ROOM: { {
BString chat_id; BString chat_id;
if (msg->FindString("chat_id", &chat_id) != B_OK) if (msg->FindString("chat_id", &chat_id) != B_OK)
break; break;
_JoinRoom(chat_id); _JoinRoom(chat_id);
break; break;
} }
case IM_JOIN_ROOM:
case IM_JOIN_ROOM: { {
BString chat_id; BString chat_id;
if (msg->FindString("chat_id", &chat_id) == B_OK) if (msg->FindString("chat_id", &chat_id) == B_OK)
_JoinRoom(chat_id.String()); _JoinRoom(chat_id.String());
break; break;
} }
case IM_LEAVE_ROOM:
case IM_LEAVE_ROOM: { {
BString chat_id = msg->FindString("chat_id"); BString chat_id = msg->FindString("chat_id");
gloox::MUCRoom* room = fRooms.ValueFor(chat_id); gloox::MUCRoom* room = fRooms.ValueFor(chat_id);
@ -185,8 +186,8 @@ JabberHandler::Process(BMessage* msg)
_SendMessage(&left); _SendMessage(&left);
break; break;
} }
case IM_ROOM_INVITE_ACCEPT:
case IM_ROOM_INVITE_ACCEPT: { {
BString chat_id; BString chat_id;
if (msg->FindString("chat_id", &chat_id) != B_OK) if (msg->FindString("chat_id", &chat_id) != B_OK)
break; break;
@ -198,8 +199,8 @@ JabberHandler::Process(BMessage* msg)
_JoinRoom(chat_id.String()); _JoinRoom(chat_id.String());
break; break;
} }
case IM_ROOM_SEND_INVITE:
case IM_ROOM_SEND_INVITE: { {
BString chat_id = msg->FindString("chat_id"); BString chat_id = msg->FindString("chat_id");
gloox::MUCRoom* room = fRooms.ValueFor(chat_id); gloox::MUCRoom* room = fRooms.ValueFor(chat_id);
BString user_id; BString user_id;
@ -209,8 +210,8 @@ JabberHandler::Process(BMessage* msg)
room->invite(gloox::JID(user_id.String()), ""); room->invite(gloox::JID(user_id.String()), "");
break; break;
} }
case IM_GET_ROOM_PARTICIPANTS:
case IM_GET_ROOM_PARTICIPANTS: { {
BString chat_id = msg->FindString("chat_id"); BString chat_id = msg->FindString("chat_id");
gloox::MUCRoom* room = fRooms.ValueFor(chat_id); gloox::MUCRoom* room = fRooms.ValueFor(chat_id);
@ -223,8 +224,8 @@ JabberHandler::Process(BMessage* msg)
} }
break; break;
} }
case IM_GET_ROOM_METADATA:
case IM_GET_ROOM_METADATA: { {
BString chat_id = msg->FindString("chat_id"); BString chat_id = msg->FindString("chat_id");
gloox::MUCRoom* room = fRooms.ValueFor(chat_id); gloox::MUCRoom* room = fRooms.ValueFor(chat_id);
if (room != NULL) if (room != NULL)
@ -240,23 +241,23 @@ JabberHandler::Process(BMessage* msg)
} }
break; break;
} }
case IM_SET_ROOM_SUBJECT:
case IM_ROOM_KICK_PARTICIPANT: {
case IM_ROOM_BAN_PARTICIPANT: BString chat_id = msg->FindString("chat_id");
case IM_ROOM_UNBAN_PARTICIPANT: gloox::MUCRoom* room = fRooms.ValueFor(chat_id);
case IM_ROOM_MUTE_PARTICIPANT: if (room != NULL)
case IM_ROOM_UNMUTE_PARTICIPANT: room->setSubject(msg->GetString("subject", ""));
_MUCModeration(msg);
break; break;
}
case IM_GET_EXTENDED_CONTACT_INFO: { case IM_GET_EXTENDED_CONTACT_INFO:
{
BString user_id; BString user_id;
if (msg->FindString("user_id", &user_id) == B_OK) if (msg->FindString("user_id", &user_id) == B_OK)
fVCardManager->fetchVCard(gloox::JID(user_id.String()), this); fVCardManager->fetchVCard(gloox::JID(user_id.String()), this);
break; break;
} }
case IM_CONTACT_LIST_ADD_CONTACT:
case IM_CONTACT_LIST_ADD_CONTACT: { {
BString user_name = msg->FindString("user_name"); BString user_name = msg->FindString("user_name");
BString user_id; BString user_id;
if (msg->FindString("user_id", &user_id) != B_OK) if (msg->FindString("user_id", &user_id) != B_OK)
@ -268,8 +269,8 @@ JabberHandler::Process(BMessage* msg)
fClient->rosterManager()->synchronize(); fClient->rosterManager()->synchronize();
break; break;
} }
case IM_CONTACT_LIST_REMOVE_CONTACT:
case IM_CONTACT_LIST_REMOVE_CONTACT: { {
BString user_id; BString user_id;
if (msg->FindString("user_id", &user_id) != B_OK) if (msg->FindString("user_id", &user_id) != B_OK)
break; break;
@ -283,8 +284,8 @@ JabberHandler::Process(BMessage* msg)
_SendMessage(&rm); _SendMessage(&rm);
break; break;
} }
case IM_CONTACT_LIST_EDIT_CONTACT:
case IM_CONTACT_LIST_EDIT_CONTACT: { {
BString user_id; BString user_id;
BString user_name = msg->FindString("user_name"); BString user_name = msg->FindString("user_name");
if (msg->FindString("user_id", &user_id) != B_OK) if (msg->FindString("user_id", &user_id) != B_OK)
@ -300,7 +301,13 @@ JabberHandler::Process(BMessage* msg)
} }
break; break;
} }
case IM_ROOM_KICK_PARTICIPANT:
case IM_ROOM_BAN_PARTICIPANT:
case IM_ROOM_UNBAN_PARTICIPANT:
case IM_ROOM_MUTE_PARTICIPANT:
case IM_ROOM_UNMUTE_PARTICIPANT:
_MUCModeration(msg);
break;
default: default:
return B_ERROR; return B_ERROR;
} }