Fix Issue 385: Group chat announces in window not in Instant message

Improved Ignore Group functions
Best viewed without space changes.
This commit is contained in:
Lirusaito
2013-01-26 21:47:32 -05:00
parent 1582bf43c5
commit 4e96dccd7c
2 changed files with 46 additions and 33 deletions

View File

@@ -1339,38 +1339,34 @@ void LLIMMgr::saveIgnoreGroup()
void LLIMMgr::updateIgnoreGroup(const LLUUID& group_id, bool ignore) void LLIMMgr::updateIgnoreGroup(const LLUUID& group_id, bool ignore)
{ {
if (group_id.notNull()) if (group_id.isNull()) return;
{
std::list<LLUUID>::iterator found =
std::find( mIgnoreGroupList.begin(), mIgnoreGroupList.end(),
group_id);
if (found != mIgnoreGroupList.end() && !ignore) if (getIgnoreGroup(group_id) == ignore)
{ {
// change from ignored to not ignored // nothing to do
// llinfos << "unignoring group " << group_id << llendl; // llinfos << "no change to group " << group_id << ", it is already "
mIgnoreGroupList.remove(group_id); // << (ignore ? "" : "not ") << "ignored" << llendl;
} return;
else if (found == mIgnoreGroupList.end() && ignore) }
{ else if (!ignore)
// change from not ignored to ignored {
// llinfos << "ignoring group " << group_id << llendl; // change from ignored to not ignored
mIgnoreGroupList.push_back(group_id); // llinfos << "unignoring group " << group_id << llendl;
} mIgnoreGroupList.remove(group_id);
else }
{ else //if (ignore)
// nothing to do {
// llinfos << "no change to group " << group_id << ", it is already " // change from not ignored to ignored
// << (ignore ? "" : "not ") << "ignored" << llendl; // llinfos << "ignoring group " << group_id << llendl;
} mIgnoreGroupList.push_back(group_id);
} }
} }
bool LLIMMgr::getIgnoreGroup(const LLUUID& group_id) bool LLIMMgr::getIgnoreGroup(const LLUUID& group_id) const
{ {
if (group_id.notNull()) if (group_id.notNull())
{ {
std::list<LLUUID>::iterator found = std::list<LLUUID>::const_iterator found =
std::find( mIgnoreGroupList.begin(), mIgnoreGroupList.end(), std::find( mIgnoreGroupList.begin(), mIgnoreGroupList.end(),
group_id); group_id);
@@ -1628,10 +1624,12 @@ public:
{ {
return; return;
} }
bool group = gAgent.isInGroup(session_id);
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c // [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c
if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIMFROM)) ) if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIMFROM)) )
{ {
if (gAgent.isInGroup(session_id)) // Group chat: don't accept the invite if not an exception if (group) // Group chat: don't accept the invite if not an exception
{ {
if (!gRlvHandler.canReceiveIM(session_id)) if (!gRlvHandler.canReceiveIM(session_id))
return; return;
@@ -1667,14 +1665,29 @@ public:
message_params["region_id"].asUUID(), message_params["region_id"].asUUID(),
ll_vector3_from_sd(message_params["position"]), ll_vector3_from_sd(message_params["position"]),
true); true);
LLGroupData group_data;
gAgent.getGroupData(session_id, group_data);
std::string prepend_msg; std::string prepend_msg;
if (gAgent.isInGroup(session_id)&& gSavedSettings.getBOOL("OptionShowGroupNameInChatIM")) if (group)
{ {
prepend_msg = "["; if (gIMMgr->getIgnoreGroup(session_id))
prepend_msg += group_data.mName; {
prepend_msg += "] "; // Tell the server we've left group chat
std::string name;
gAgent.buildFullname(name);
pack_instant_message(gMessageSystem, gAgentID, false, gAgent.getSessionID(), from_id,
name, LLStringUtil::null, IM_ONLINE, IM_SESSION_LEAVE, session_id);
gAgent.sendReliableMessage();
gIMMgr->removeSession(session_id);
return;
}
else if (gSavedSettings.getBOOL("OptionShowGroupNameInChatIM"))
{
LLGroupData group_data;
gAgent.getGroupData(session_id, group_data);
prepend_msg = "[";
prepend_msg += group_data.mName;
prepend_msg += "] ";
}
} }
else else
{ {

View File

@@ -176,7 +176,7 @@ public:
void saveIgnoreGroup(); void saveIgnoreGroup();
void updateIgnoreGroup(const LLUUID& group_id, bool ignore); void updateIgnoreGroup(const LLUUID& group_id, bool ignore);
// Returns true if group chat is ignored for the UUID, false if not // Returns true if group chat is ignored for the UUID, false if not
bool getIgnoreGroup(const LLUUID& group_id); bool getIgnoreGroup(const LLUUID& group_id) const;
private: private:
// create a panel and update internal representation for // create a panel and update internal representation for