From 855c565e2242fa2504fb06f4579abc609de452f5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 27 Mar 2011 00:38:43 +0200 Subject: Add no away to whisper chat context menu. --- src/gui/chat.cpp | 4 +++- src/gui/popupmenu.cpp | 18 ++++++++++++++++++ src/gui/widgets/chattab.h | 7 +++++++ src/localplayer.cpp | 2 ++ 4 files changed, 30 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index d3ebb3955..88dbd1b0a 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -1353,6 +1353,7 @@ void ChatWindow::loadState() { tab->setAllowHighlight(flags & 1); tab->setRemoveNames((flags & 2) / 2); + tab->setNoAway((flags & 4) / 4); } serverConfig.deleteKey("chatWhisper" + toString(num)); serverConfig.deleteKey("chatWhisperFlags" + toString(num)); @@ -1386,7 +1387,8 @@ void ChatWindow::saveState() serverConfig.setValue("chatWhisperFlags" + toString(num), static_cast(tab->getAllowHighlight()) - + (2 * static_cast(tab->getRemoveNames()))); + + (2 * static_cast(tab->getRemoveNames())) + + (4 * static_cast(tab->getNoAway()))); num ++; } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 1cca9daa6..183b006d5 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -492,6 +492,16 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab) mBrowserBox->addRow(strprintf("@@remove name|%s@@", _("Remove name"))); } + if (tab->getNoAway()) + { + mBrowserBox->addRow(strprintf("@@enable away|%s@@", + _("Enable away"))); + } + else + { + mBrowserBox->addRow(strprintf("@@disable away|%s@@", + _("Disable away"))); + } mBrowserBox->addRow("##3---"); if (tab->getType() == ChatTab::TAB_PARTY) @@ -1101,6 +1111,14 @@ void PopupMenu::handleLink(const std::string &link, { mTab->setRemoveNames(true); } + else if (link == "disable away" && mTab) + { + mTab->setNoAway(true); + } + else if (link == "enable away" && mTab) + { + mTab->setNoAway(false); + } else if (link == "guild-pos" && !mNick.empty()) { showChangePos(getX(), getY()); diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index 998ad2e3d..611ca8ef3 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -153,6 +153,12 @@ class ChatTab : public Tab void setRemoveNames(bool n) { mRemoveNames = n; } + bool getNoAway() + { return mNoAway; } + + void setNoAway(bool n) + { mNoAway = n; } + protected: friend class ChatWindow; friend class WhisperWindow; @@ -173,6 +179,7 @@ class ChatTab : public Tab BrowserBox *mTextOutput; bool mAllowHightlight; bool mRemoveNames; + bool mNoAway; }; extern ChatTab *localChatTab; diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 4d085eae4..564c28f78 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -3119,6 +3119,8 @@ void LocalPlayer::afkRespond(ChatTab *tab, const std::string &nick) } else { + if (tab->getNoAway()) + return; tab->chatLog(getName(), msg); } mAfkTime = cur_time; -- cgit v1.2.3-70-g09d2