summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-18 21:33:21 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-18 21:33:21 +0300
commit25907c03212110f10c910b0ef90a416dff450ca7 (patch)
treefa409f004887619041e19f06f289d5ecb1c89e59 /src/net/ea
parent772daf48072915d598014c25a33ff3dc96e43bce (diff)
downloadmv-25907c03212110f10c910b0ef90a416dff450ca7.tar.gz
mv-25907c03212110f10c910b0ef90a416dff450ca7.tar.bz2
mv-25907c03212110f10c910b0ef90a416dff450ca7.tar.xz
mv-25907c03212110f10c910b0ef90a416dff450ca7.zip
Add option to show/hide guild online messages.
Disabled by default.
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/gui/guildtab.cpp10
-rw-r--r--src/net/ea/gui/guildtab.h4
-rw-r--r--src/net/ea/guildhandler.cpp4
3 files changed, 17 insertions, 1 deletions
diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp
index ff433f606..b764a9f85 100644
--- a/src/net/ea/gui/guildtab.cpp
+++ b/src/net/ea/gui/guildtab.cpp
@@ -23,6 +23,7 @@
#include "net/ea/gui/guildtab.h"
#include "chatlogger.h"
+#include "configuration.h"
#include "guild.h"
#include "localplayer.h"
#include "soundmanager.h"
@@ -51,10 +52,13 @@ GuildTab::GuildTab(const Widget2 *const widget) :
&getThemeColor(Theme::GUILD_CHAT_TAB_HIGHLIGHTED_OUTLINE));
setSelectedTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB_SELECTED),
&getThemeColor(Theme::GUILD_CHAT_TAB_SELECTED_OUTLINE));
+ mShowOnline = config.getBoolValue("showGuildOnline");
+ config.addListener("showGuildOnline", this);
}
GuildTab::~GuildTab()
{
+ config.removeListeners(this);
}
bool GuildTab::handleCommand(const std::string &type, const std::string &args)
@@ -155,4 +159,10 @@ void GuildTab::playNewMessageSound()
sound.playGuiSound(SOUND_GUILD);
}
+void GuildTab::optionChanged(const std::string &value)
+{
+ if (value == "showGuildOnline")
+ mShowOnline = config.getBoolValue("showGuildOnline");
+}
+
} // namespace Ea
diff --git a/src/net/ea/gui/guildtab.h b/src/net/ea/gui/guildtab.h
index 020c6d7c9..d7b48f09f 100644
--- a/src/net/ea/gui/guildtab.h
+++ b/src/net/ea/gui/guildtab.h
@@ -31,7 +31,7 @@ namespace Ea
/**
* A tab for a guild chat channel.
*/
-class GuildTab : public ChatTab
+class GuildTab : public ChatTab, public ConfigListener
{
public:
GuildTab(const Widget2 *const widget);
@@ -52,6 +52,8 @@ class GuildTab : public ChatTab
void playNewMessageSound() override;
+ void optionChanged(const std::string &value) override;
+
protected:
void handleInput(const std::string &msg) override;
diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp
index 7c2592617..e9ec8c97d 100644
--- a/src/net/ea/guildhandler.cpp
+++ b/src/net/ea/guildhandler.cpp
@@ -149,7 +149,11 @@ void GuildHandler::processGuildMemberLogin(Net::MessageIn &msg)
{
GuildMember *const m = taGuild->getMember(accountId, charId);
if (m)
+ {
m->setOnline(online);
+ if (guildTab)
+ guildTab->showOnline(m->getName(), online);
+ }
}
}