void ChatChannelList::SendAllChannels(Client *c) { if(!c) return; if(!c->CanListAllChannels()) { c->GeneralChannelMessage("You do not have permission to list all the channels."); return; } c->GeneralChannelMessage("All current channels:"); int ChannelsInLine = 0; LinkedListIterator<ChatChannel*> iterator(ChatChannels); iterator.Reset(); std::string Message; char CountString[10]; while(iterator.MoreElements()) { ChatChannel *CurrentChannel = iterator.GetData(); if(!CurrentChannel || (CurrentChannel->GetMinStatus() > c->GetAccountStatus())) { iterator.Advance(); continue; } if(ChannelsInLine > 0) Message += ", "; sprintf(CountString, "(%i)", CurrentChannel->MemberCount(c->GetAccountStatus())); Message += CurrentChannel->GetName(); Message += CountString; ChannelsInLine++; if(ChannelsInLine == 6) { c->GeneralChannelMessage(Message); ChannelsInLine = 0; Message.clear(); } iterator.Advance(); } if(ChannelsInLine > 0) c->GeneralChannelMessage(Message); }
void ChatChannelList::Process() { LinkedListIterator<ChatChannel*> iterator(ChatChannels); iterator.Reset(); while(iterator.MoreElements()) { ChatChannel *CurrentChannel = iterator.GetData(); if(CurrentChannel && CurrentChannel->ReadyToDelete()) { _log(UCS__TRACE, "Empty temporary password protected channel %s being destroyed.", CurrentChannel->GetName().c_str()); RemoveChannel(CurrentChannel); } iterator.Advance(); } }