From 2f69f2fa04a915ff6088e9d6d273441854686556 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Fri, 3 Sep 2021 03:35:35 -0500 Subject: [PATCH] No functional change; remove unused 'join' message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … also slight formatting tweaks, safer fetching of a Conversation's list item in MainWindow, and an extra accessor for ConversationListView. --- application/views/AccountsMenu.h | 2 +- application/views/ConversationListView.cpp | 28 +++++++++++----------- application/views/ConversationView.cpp | 14 ----------- application/windows/MainWindow.cpp | 6 ++--- 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/application/views/AccountsMenu.h b/application/views/AccountsMenu.h index 81ccfff..f7422a9 100644 --- a/application/views/AccountsMenu.h +++ b/application/views/AccountsMenu.h @@ -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(); diff --git a/application/views/ConversationListView.cpp b/application/views/ConversationListView.cpp index d574786..ecc2783 100644 --- a/application/views/ConversationListView.cpp +++ b/application/views/ConversationListView.cpp @@ -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); \ + } \ } diff --git a/application/views/ConversationView.cpp b/application/views/ConversationView.cpp index 4285e57..2ac24d0 100644 --- a/application/views/ConversationView.cpp +++ b/application/views/ConversationView.cpp @@ -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"), diff --git a/application/windows/MainWindow.cpp b/application/windows/MainWindow.cpp index ea23963..b5821f1 100644 --- a/application/windows/MainWindow.cpp +++ b/application/windows/MainWindow.cpp @@ -1,4 +1,3 @@ -#include /* * 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) {