From 1b8bf9fd3ade825af8eff592dd3bf8380dc33b2e Mon Sep 17 00:00:00 2001 From: "LGG@LGG-LAPPY" Date: Wed, 19 Oct 2011 03:02:03 -0500 Subject: [PATCH] Moved the freind remove code out of the floater so it works even when it is closed. --- indra/newview/lggcontactsets.cpp | 17 +++++++++++++++++ indra/newview/lggcontactsets.h | 9 +++++++-- indra/newview/lggcontactsetsfloater.cpp | 12 ------------ 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/indra/newview/lggcontactsets.cpp b/indra/newview/lggcontactsets.cpp index dc33b0bee0..0987a32f83 100644 --- a/indra/newview/lggcontactsets.cpp +++ b/indra/newview/lggcontactsets.cpp @@ -33,10 +33,12 @@ LGGContactSets::LGGContactSets() { sInstance = this; sInstance->loadFromDisk(); + LLAvatarTracker::instance().addObserver(this); } LGGContactSets::~LGGContactSets() { + LLAvatarTracker::instance().removeObserver(sInstance); sInstance = NULL; } @@ -49,6 +51,21 @@ LGGContactSets* LGGContactSets::getInstance() return sInstance; } } +void LGGContactSets::changed(U32 mask) +{ + if(mask & (LLFriendObserver::REMOVE)) + { + const std::set& changed_items = LLAvatarTracker::instance().getChangedIDs(); + std::set::const_iterator id_it = changed_items.begin(); + std::set::const_iterator id_end = changed_items.end(); + for (;id_it != id_end; ++id_it) + { + //if we are fortunate enough to be the viewer of choice when + //someone removes a friend, go and clean up the contact sets + LGGContactSets::getInstance()->removeFriendFromAllGroups(*id_it); + } + } +} LLColor4 LGGContactSets::toneDownColor(LLColor4 inColor, float strength, bool usedForBackground) { if(usedForBackground) diff --git a/indra/newview/lggcontactsets.h b/indra/newview/lggcontactsets.h index a653e22d17..08a700f40c 100644 --- a/indra/newview/lggcontactsets.h +++ b/indra/newview/lggcontactsets.h @@ -1,4 +1,3 @@ -#include "v4color.h" /* Copyright (C) 2011 Greg Hendrickson (LordGregGreg Back) This is free software; you can redistribute it and/or modify it @@ -19,13 +18,19 @@ #ifndef LGG_FRIENDS_GROUPS_H #define LGG_FRIENDS_GROUPS_H -class LGGContactSets + +#include "v4color.h" +//#include "llcallingcard.h" +class LGGContactSets//: public LLFriendObserver { LGGContactSets(); ~LGGContactSets(); static LGGContactSets* sInstance; public: static LGGContactSets* getInstance(); + + virtual void changed(U32 mask); + static LLColor4 toneDownColor(LLColor4 inColor, float strength, bool usedForBackground=FALSE); BOOL saveGroupToDisk(std::string groupName, std::string fileName); diff --git a/indra/newview/lggcontactsetsfloater.cpp b/indra/newview/lggcontactsetsfloater.cpp index fa90f2ebf2..c25d2b20e5 100644 --- a/indra/newview/lggcontactsetsfloater.cpp +++ b/indra/newview/lggcontactsetsfloater.cpp @@ -172,18 +172,6 @@ void lggContactSetsFloater::processProperties(void* data, EAvatarProcessorType t void lggContactSetsFloater::changed(U32 mask) { - if(mask & (LLFriendObserver::REMOVE)) - { - const std::set& changed_items = LLAvatarTracker::instance().getChangedIDs(); - std::set::const_iterator id_it = changed_items.begin(); - std::set::const_iterator id_end = changed_items.end(); - for (;id_it != id_end; ++id_it) - { - //if we are fortunate enough to be the viewer of choice when - //someone removes a friend, go and clean up the contact sets - LGGContactSets::getInstance()->removeFriendFromAllGroups(*id_it); - } - } if(mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE )) { sInstance->generateCurrentList();