diff options
author | James Cook <james@lindenlab.com> | 2008-04-30 23:30:09 +0000 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2008-04-30 23:30:09 +0000 |
commit | 36fccc3888c5dc318a8a235da8a5cae4faeb637d (patch) | |
tree | 021e439fe9fa3a285062d70bf0b8c0f799471681 /indra/newview/llmutelist.cpp | |
parent | cf2a96375f62316b98c2dddd57f812f7565584be (diff) |
svn merge -r 86190:86191 maint-ui-11-merge (EFFECTIVE MERGE: -r 84579:85724 maint-ui-11-qa).
Diffstat (limited to 'indra/newview/llmutelist.cpp')
-rw-r--r-- | indra/newview/llmutelist.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 24eb9ee34a..6edd9d0b7d 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -62,6 +62,12 @@ #include "llviewergenericmessage.h" // for gGenericDispatcher #include "llviewerwindow.h" #include "llworld.h" //for particle system banning +#include "llchat.h" +#include "llfloaterchat.h" +#include "llimpanel.h" +#include "llimview.h" +#include "llnotify.h" +#include "lluistring.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" @@ -437,6 +443,78 @@ void LLMuteList::updateRemove(const LLMute& mute) gAgent.sendReliableMessage(); } +void notify_automute_callback(const LLUUID& agent_id, const char* first_name, const char* last_name, BOOL is_group, void* user_data) +{ + U32 temp_data = (U32)user_data; + LLMuteList::EAutoReason reason = (LLMuteList::EAutoReason)temp_data; + LLUIString auto_message; + + switch (reason) + { + default: + case LLMuteList::AR_IM: + auto_message = LLNotifyBox::getTemplateMessage("AutoUnmuteByIM"); + break; + case LLMuteList::AR_INVENTORY: + auto_message = LLNotifyBox::getTemplateMessage("AutoUnmuteByInventory"); + break; + case LLMuteList::AR_MONEY: + auto_message = LLNotifyBox::getTemplateMessage("AutoUnmuteByMoney"); + break; + } + + auto_message.setArg("[FIRST]", first_name); + auto_message.setArg("[LAST]", last_name); + + if (reason == LLMuteList::AR_IM) + { + LLFloaterIMPanel *timp = gIMMgr->findFloaterBySession(agent_id); + if (timp) + { + timp->addHistoryLine(auto_message.getString()); + } + } + + LLChat auto_chat(auto_message.getString()); + LLFloaterChat::addChat(auto_chat, FALSE, FALSE); +} + + +BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason, const LLString& first_name, const LLString& last_name) +{ + BOOL removed = FALSE; + + if (isMuted(agent_id)) + { + LLMute automute(agent_id, "", LLMute::AGENT); + removed = TRUE; + remove(automute); + + if (first_name.empty() && last_name.empty()) + { + char cache_first[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ + char cache_last[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ + if (gCacheName->getName(agent_id, cache_first, cache_last)) + { + // name in cache, call callback directly + notify_automute_callback(agent_id, cache_first, cache_last, FALSE, (void *)reason); + } + else + { + // not in cache, lookup name from cache + gCacheName->get(agent_id, FALSE, notify_automute_callback, (void *)reason); + } + } + else + { + // call callback directly + notify_automute_callback(agent_id, first_name.c_str(), last_name.c_str(), FALSE, (void *)reason); + } + } + + return removed; +} + std::vector<LLMute> LLMuteList::getMutes() const { |