No functional change; remove unused 'join' message

… also slight formatting tweaks, safer fetching of a Conversation's
list item in MainWindow, and an extra accessor for
ConversationListView.
This commit is contained in:
Jaidyn Ann 2021-09-03 03:35:35 -05:00
parent 3689f6cee3
commit 2f69f2fa04
4 changed files with 17 additions and 33 deletions

View File

@ -24,7 +24,7 @@ public:
virtual void ObserveInteger(int32 what, int32 value);
void SetDefaultSelection(BMenuItem* item);
int64 GetDefaultSelection() { return fDefaultSelection; }
static int64 GetDefaultSelection() { return fDefaultSelection; }
private:
void _PopulateMenu();

View File

@ -242,20 +242,20 @@ ConversationListView::_ConversationPopUp()
}
#define add_flag_item(name, flag) { \
msg = new BMessage(APP_ROOM_FLAG); \
msg->AddString("chat_id", id); \
msg->AddInt64("instance", instance); \
msg->AddInt32("flag", flag); \
\
item = new BMenuItem(name, msg); \
item->SetTarget(Window()); \
\
if (!(chat->DisallowedFlags() &flag)) { \
if (chat->GetFlags() & flag) \
item->SetMarked(true); \
menu->AddItem(item); \
} \
#define add_flag_item(name, flag) { \
msg = new BMessage(APP_ROOM_FLAG); \
msg->AddString("chat_id", id); \
msg->AddInt64("instance", instance); \
msg->AddInt32("flag", flag); \
\
item = new BMenuItem(name, msg); \
item->SetTarget(Window()); \
\
if (!(chat->DisallowedFlags() &flag)) { \
if (chat->GetFlags() & flag) \
item->SetMarked(true); \
menu->AddItem(item); \
} \
}

View File

@ -136,20 +136,6 @@ ConversationView::ImMessage(BMessage* msg)
fReceiveView->ScrollToBottom();
break;
}
case IM_ROOM_JOINED:
{
BMessage msg;
msg.AddString("body", B_TRANSLATE("** You joined the room.\n"));
_AppendOrEnqueueMessage(&msg);
fReceiveView->ScrollToBottom();
}
case IM_ROOM_CREATED:
{
BMessage msg;
msg.AddString("body", B_TRANSLATE("** You created the room.\n"));
_AppendOrEnqueueMessage(&msg);
fReceiveView->ScrollToBottom();
}
case IM_ROOM_PARTICIPANT_JOINED:
{
_UserMessage(B_TRANSLATE("%user% has joined the room.\n"),

View File

@ -1,4 +1,3 @@
#include <iostream>
/*
* Copyright 2009-2011, Andrea Anzani. All rights reserved.
* Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved.
@ -641,9 +640,8 @@ MainWindow::_EnsureConversationItem(BMessage* msg)
BString chat_id = msg->FindString("chat_id");
Conversation* chat = fServer->ConversationById(chat_id, msg->FindInt64("instance"));
ConversationItem* item = chat->GetListItem();
if (chat != NULL) {
ConversationItem* item;
if (chat != NULL && (item = chat->GetListItem()) != NULL) {
if (fListView->HasItem(item))
fListView->InvalidateItem(fListView->IndexOf(item));
else if (item != NULL) {