Example #1
0
/***********************************************************
remove people online
***********************************************************/
void CommunityBox::RemoveOnline(const std::string & listname, const std::string &_offline)
{
	if(listname == "online")
	{
		CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
			CEGUI::WindowManager::getSingleton().getWindow("Community/onlinelist"));


		std::map<std::string, CEGUI::ListboxItem *>::iterator itmap = _onlines.find(_offline);
		if(itmap != _onlines.end())
		{
			lb->removeItem(itmap->second);
			_onlines.erase(itmap);
		}

		UpdateFriendOnlineStatus(_offline);
	}

	if(listname == "IRC")
	{
		CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
			CEGUI::WindowManager::getSingleton().getWindow("Community/IRClist"));

		CEGUI::ListboxItem *it = lb->findItemWithText(_offline, NULL);
		if(it != NULL)
			lb->removeItem(it);
	}
}
Example #2
0
/***********************************************************
add people online
***********************************************************/
void CommunityBox::AddOnline(const std::string & listname, const std::string &_online,
							 const std::string &_status, const std::string &color)
{
	if(listname == "online")
	{
		CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
			CEGUI::WindowManager::getSingleton().getWindow("Community/onlinelist"));

		std::string dis = "[colour='" + color + "']" + _online;
		if(_status != "")
			dis += " (" + _status + ")";

		std::map<std::string, CEGUI::ListboxItem *>::iterator itmap = _onlines.find(_online);
		if(itmap != _onlines.end())
		{
			itmap->second->setText(dis);
			lb->invalidate();
		}
		else
		{
			CEGUI::ListboxItem *it = new MyComListItem(dis);
			lb->addItem(it);
			_onlines[_online] = it;
		}


		if(IsFriend(_online))
			UpdateFriend(_online);
	}

	if(listname == "IRC")
	{
		CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
			CEGUI::WindowManager::getSingleton().getWindow("Community/IRClist"));

		CEGUI::ListboxItem *it = lb->findItemWithText(_online, NULL);
		if(it == NULL)
			lb->addItem(new MyComListItem(_online));
	}
}