Exemplo n.º 1
0
void ChatChannel::AddClient(Client *c) {

	if(!c) return;

	DeleteTimer.Disable();

	if(IsClientInChannel(c)) {

		_log(UCS__ERROR, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str());

		return;
	}

	bool HideMe = c->GetHideMe();

	int AccountStatus = c->GetAccountStatus();

	_log(UCS__TRACE, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str());

	LinkedListIterator<Client*> iterator(ClientsInChannel);

	iterator.Reset();

	while(iterator.MoreElements()) {

		Client *CurrentClient = iterator.GetData();

		if(CurrentClient && CurrentClient->IsAnnounceOn())
			if(!HideMe || (CurrentClient->GetAccountStatus() > AccountStatus))
				CurrentClient->AnnounceJoin(this, c);

		iterator.Advance();
	}

	ClientsInChannel.Insert(c);

}