void ClientList::UpdateClientGuild(uint32 char_id, uint32 guild_id) { LinkedListIterator<ClientListEntry*> iterator(clientlist); iterator.Reset(); while(iterator.MoreElements()) { ClientListEntry *cle = iterator.GetData(); if (cle->CharID() == char_id) { cle->SetGuild(guild_id); } iterator.Advance(); } }
void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnection* connection, const char* iName) { LinkedListIterator<ClientListEntry*> iterator(clientlist); char* output = 0; uint32 outsize = 0, outlen = 0; int x = 0, y = 0; int namestrlen = iName == 0 ? 0 : strlen(iName); bool addnewline = false; char newline[3]; if (connection->IsConsole()) strcpy(newline, "\r\n"); else strcpy(newline, "^"); iterator.Reset(); while(iterator.MoreElements()) { ClientListEntry* cle = iterator.GetData(); if (admin >= cle->Admin() && (iName == 0 || namestrlen == 0 || strncasecmp(cle->name(), iName, namestrlen) == 0 || strncasecmp(cle->AccountName(), iName, namestrlen) == 0 || strncasecmp(cle->LSName(), iName, namestrlen) == 0)) { struct in_addr in; in.s_addr = cle->GetIP(); if (addnewline) { AppendAnyLenString(&output, &outsize, &outlen, newline); } AppendAnyLenString(&output, &outsize, &outlen, "ID: %i Acc# %i AccName: %s IP: %s", cle->GetID(), cle->AccountID(), cle->AccountName(), inet_ntoa(in)); AppendAnyLenString(&output, &outsize, &outlen, "%s Stale: %i Online: %i Admin: %i", newline, cle->GetStaleCounter(), cle->Online(), cle->Admin()); if (cle->LSID()) AppendAnyLenString(&output, &outsize, &outlen, "%s LSID: %i LSName: %s WorldAdmin: %i", newline, cle->LSID(), cle->LSName(), cle->WorldAdmin()); if (cle->CharID()) AppendAnyLenString(&output, &outsize, &outlen, "%s CharID: %i CharName: %s Zone: %s (%i)", newline, cle->CharID(), cle->name(), database.GetZoneName(cle->zone()), cle->zone()); if (outlen >= 3072) { connection->SendEmoteMessageRaw(to, 0, 0, 10, output); safe_delete(output); outsize = 0; outlen = 0; addnewline = false; } else addnewline = true; y++; } iterator.Advance(); x++; } AppendAnyLenString(&output, &outsize, &outlen, "%s%i CLEs in memory. %i CLEs listed. numplayers = %i.", newline, x, y, numplayers); connection->SendEmoteMessageRaw(to, 0, 0, 10, output); safe_delete(output); }