aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterchatterbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfloaterchatterbox.cpp')
-rw-r--r--linden/indra/newview/llfloaterchatterbox.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloaterchatterbox.cpp b/linden/indra/newview/llfloaterchatterbox.cpp
index 1114635..e7de62c 100644
--- a/linden/indra/newview/llfloaterchatterbox.cpp
+++ b/linden/indra/newview/llfloaterchatterbox.cpp
@@ -88,6 +88,10 @@ void* LLFloaterMyFriends::createGroupsPanel(void* data)
88// 88//
89// LLFloaterChatterBox 89// LLFloaterChatterBox
90// 90//
91
92static std::string sTitle = "Communicate";
93static int sUnreadCount = 0;
94
91LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) : 95LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) :
92 mActiveVoiceFloater(NULL) 96 mActiveVoiceFloater(NULL)
93{ 97{
@@ -122,6 +126,9 @@ LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) :
122 addFloater(LLFloaterChat::getInstance(LLSD()), FALSE); 126 addFloater(LLFloaterChat::getInstance(LLSD()), FALSE);
123 } 127 }
124 mTabContainer->lockTabs(); 128 mTabContainer->lockTabs();
129
130 sUnreadCount = 0;
131 sTitle = getTitle();
125} 132}
126 133
127LLFloaterChatterBox::~LLFloaterChatterBox() 134LLFloaterChatterBox::~LLFloaterChatterBox()
@@ -217,6 +224,53 @@ void LLFloaterChatterBox::setMinimized(BOOL minimized)
217 LLFloaterChat::getInstance()->updateConsoleVisibility(); 224 LLFloaterChat::getInstance()->updateConsoleVisibility();
218} 225}
219 226
227void LLFloaterChatterBox::markAsUnread(bool unread)
228{
229 LLFloaterChatterBox* floater = LLFloaterChatterBox::getInstance();
230
231 // Update IM unread count
232 if (unread)
233 {
234 sUnreadCount++;
235 }
236 else if (!unread)
237 {
238 sUnreadCount--;
239 }
240
241 if (floater)
242 {
243 // Update the title message with the number of unread IMs.
244 // Remove the message when we hit 0.
245 if (sUnreadCount > 0)
246 {
247 // Check for plurals
248 std::string unread_string;
249 if (sUnreadCount == 1)
250 {
251 unread_string = floater->getString("unread_count_string_singular");
252 }
253 else
254 {
255 unread_string = floater->getString("unread_count_string_plural");
256 }
257
258 std::ostringstream unread_count_message;
259 unread_count_message << sTitle << " (" << sUnreadCount << " " << unread_string << ")";
260
261 // Update the floater title
262 floater->setTitle(unread_count_message.str());
263 }
264 else
265 {
266 sUnreadCount = 0;
267
268 // Update the floater title
269 floater->setTitle(sTitle);
270 }
271 }
272}
273
220void LLFloaterChatterBox::removeFloater(LLFloater* floaterp) 274void LLFloaterChatterBox::removeFloater(LLFloater* floaterp)
221{ 275{
222 if (floaterp->getName() == "chat floater") 276 if (floaterp->getName() == "chat floater")