diff --git a/application/preferences/AppPreferences.cpp b/application/preferences/AppPreferences.cpp index ecb8fe1..41f59e4 100644 --- a/application/preferences/AppPreferences.cpp +++ b/application/preferences/AppPreferences.cpp @@ -44,6 +44,7 @@ AppPreferences::Load() HideDeskbar = settings.GetBool("HideDeskbar", false); DisableReplicant = settings.GetBool("DisableReplicant", true); DisableQuitConfirm = settings.GetBool("DisableQuitConfirm", false); + MembershipUpdates = settings.GetBool("MembershipUpdates", true); IgnoreEmoticons = settings.GetBool("IgnoreEmoticons", true); HideOffline = settings.GetBool("HideOffline", false); @@ -79,6 +80,7 @@ AppPreferences::Save() settings.AddBool("DisableReplicant", DisableReplicant); settings.AddBool("DisableQuitConfirm", DisableQuitConfirm); settings.AddBool("IgnoreEmoticons", IgnoreEmoticons); + settings.AddBool("MembershipUpdates", MembershipUpdates); settings.AddBool("HideOffline", HideOffline); settings.AddFloat("MainWindowListWeight", MainWindowListWeight); diff --git a/application/preferences/AppPreferences.h b/application/preferences/AppPreferences.h index f0b0078..ae0eda1 100644 --- a/application/preferences/AppPreferences.h +++ b/application/preferences/AppPreferences.h @@ -1,7 +1,7 @@ /* * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. * Copyright 2012, Casalinuovo Dario. All rights reserved. - * Copyright 2021, Jaidyn Levesque + * Copyright 2021-2022, Jaidyn Levesque * All rights reserved. Distributed under the terms of the MIT license. */ #ifndef _APP_PREFERENCES_H @@ -33,6 +33,7 @@ public: bool DisableQuitConfirm; bool IgnoreEmoticons; + bool MembershipUpdates; bool HideOffline; diff --git a/application/preferences/PreferencesChatWindow.cpp b/application/preferences/PreferencesChatWindow.cpp index baaa2ce..5b50703 100644 --- a/application/preferences/PreferencesChatWindow.cpp +++ b/application/preferences/PreferencesChatWindow.cpp @@ -1,7 +1,7 @@ /* * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. * Copyright 2012, Dario Casalinuovo. All rights reserved. - * Copyright 2021, Jaidyn Levesque. All rights reserved. + * Copyright 2021-2022, Jaidyn Levesque. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -21,6 +21,7 @@ const uint32 kIgnoreEmoticons = 'CBhe'; +const uint32 kMembershipUpdates = 'CBmu'; PreferencesChatWindow::PreferencesChatWindow() @@ -29,6 +30,9 @@ PreferencesChatWindow::PreferencesChatWindow() BBox* chatBox = new BBox("chatBox"); chatBox->SetLabel(B_TRANSLATE("Chat settings")); + fMembershipUpdates = new BCheckBox("MembershipUpdates", + B_TRANSLATE("Show join/part messages"), new BMessage(kMembershipUpdates)); + fIgnoreEmoticons = new BCheckBox("IgnoreEmoticons", B_TRANSLATE("Ignore emoticons"), new BMessage(kIgnoreEmoticons)); fIgnoreEmoticons->SetEnabled(false); // No emoticon support currently @@ -38,6 +42,7 @@ PreferencesChatWindow::PreferencesChatWindow() BLayoutBuilder::Group<>(chatBox, B_VERTICAL) .SetInsets(spacing, spacing * 2, spacing, spacing) + .Add(fMembershipUpdates) .Add(fIgnoreEmoticons) .End(); @@ -54,6 +59,8 @@ PreferencesChatWindow::AttachedToWindow() { fIgnoreEmoticons->SetTarget(this); fIgnoreEmoticons->SetValue(AppPreferences::Get()->IgnoreEmoticons); + fMembershipUpdates->SetTarget(this); + fMembershipUpdates->SetValue(AppPreferences::Get()->MembershipUpdates); } @@ -62,8 +69,10 @@ PreferencesChatWindow::MessageReceived(BMessage* message) { switch (message->what) { case kIgnoreEmoticons: - AppPreferences::Get()->IgnoreEmoticons - = fIgnoreEmoticons->Value(); + AppPreferences::Get()->IgnoreEmoticons = fIgnoreEmoticons->Value(); + break; + case kMembershipUpdates: + AppPreferences::Get()->MembershipUpdates = fMembershipUpdates->Value(); break; default: BView::MessageReceived(message); diff --git a/application/preferences/PreferencesChatWindow.h b/application/preferences/PreferencesChatWindow.h index 2ad1c98..fae2add 100644 --- a/application/preferences/PreferencesChatWindow.h +++ b/application/preferences/PreferencesChatWindow.h @@ -19,6 +19,7 @@ public: private: BCheckBox* fIgnoreEmoticons; + BCheckBox* fMembershipUpdates; }; #endif // _PREFERENCES_BEHAVIOR_H diff --git a/application/views/ConversationView.cpp b/application/views/ConversationView.cpp index e52da46..a610a12 100644 --- a/application/views/ConversationView.cpp +++ b/application/views/ConversationView.cpp @@ -145,16 +145,18 @@ ConversationView::ImMessage(BMessage* msg) } case IM_ROOM_PARTICIPANT_JOINED: { - _UserMessage(B_TRANSLATE("%user% has joined the room.\n"), - B_TRANSLATE("%user% has joined the room (%body%).\n"), - msg); + if (AppPreferences::Get()->MembershipUpdates == true) + _UserMessage(B_TRANSLATE("%user% has joined the room.\n"), + B_TRANSLATE("%user% has joined the room (%body%).\n"), + msg); break; } case IM_ROOM_PARTICIPANT_LEFT: { - _UserMessage(B_TRANSLATE("%user% has left the room.\n"), - B_TRANSLATE("%user% has left the room (%body%).\n"), - msg); + if (AppPreferences::Get()->MembershipUpdates == true) + _UserMessage(B_TRANSLATE("%user% has left the room.\n"), + B_TRANSLATE("%user% has left the room (%body%).\n"), + msg); break; } case IM_ROOM_PARTICIPANT_KICKED: