X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_check.cpp;h=6f9c32fb1290e05b1637bcbe9a1c553603d88037;hb=bd1471bc08be28bc2554d35fdaeb078338b14266;hp=5e154feea5ed7423d8d4294baa2dd66ec25d683f;hpb=58d7827bb1bd3d90f38a1c199f6f41ae9f24885c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 5e154feea..6f9c32fb1 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -73,8 +73,10 @@ class CommandCheck : public Command { char timebuf[60]; struct tm *mytime = gmtime(&time); - strftime(timebuf, 59, "%Y-%m-%d %H:%M:%S UTC (%s)", mytime); - return std::string(timebuf); + strftime(timebuf, 59, "%Y-%m-%d %H:%M:%S UTC (", mytime); + std::string ret(timebuf); + ret.append(ConvToStr(time)).push_back(')'); + return ret; } void dumpExt(User* user, const std::string& checkstr, Extensible* ext) @@ -126,7 +128,7 @@ class CommandCheck : public Command user->SendText(checkstr + " realname " + targuser->fullname); user->SendText(checkstr + " modes +" + targuser->FormatModes()); user->SendText(checkstr + " snomasks " + GetSnomasks(targuser)); - user->SendText(checkstr + " server " + targuser->server); + user->SendText(checkstr + " server " + targuser->server->GetName()); user->SendText(checkstr + " uid " + targuser->uuid); user->SendText(checkstr + " signon " + timestring(targuser->signon)); user->SendText(checkstr + " nickts " + timestring(targuser->age)); @@ -149,7 +151,7 @@ class CommandCheck : public Command { std::string umodes; std::string cmodes; - for(char c='A'; c < 'z'; c++) + for(char c='A'; c <= 'z'; c++) { ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_USER); if (mh && mh->NeedsOper() && loctarg->HasModePermission(c, MODETYPE_USER)) @@ -160,7 +162,7 @@ class CommandCheck : public Command } user->SendText(checkstr + " modeperms user=" + umodes + " channel=" + cmodes); std::string opcmds; - for(std::set::iterator i = oper->AllowedOperCommands.begin(); i != oper->AllowedOperCommands.end(); i++) + for (OperInfo::PrivSet::const_iterator i = oper->AllowedOperCommands.begin(); i != oper->AllowedOperCommands.end(); ++i) { opcmds.push_back(' '); opcmds.append(*i); @@ -168,7 +170,7 @@ class CommandCheck : public Command std::stringstream opcmddump(opcmds); user->SendText(checkstr + " commandperms", opcmddump); std::string privs; - for(std::set::iterator i = oper->AllowedPrivs.begin(); i != oper->AllowedPrivs.end(); i++) + for (OperInfo::PrivSet::const_iterator i = oper->AllowedPrivs.begin(); i != oper->AllowedPrivs.end(); ++i) { privs.push_back(' '); privs.append(*i); @@ -180,8 +182,8 @@ class CommandCheck : public Command if (loctarg) { - user->SendText(checkstr + " clientaddr " + irc::sockets::satouser(loctarg->client_sa)); - user->SendText(checkstr + " serveraddr " + irc::sockets::satouser(loctarg->server_sa)); + user->SendText(checkstr + " clientaddr " + loctarg->client_sa.str()); + user->SendText(checkstr + " serveraddr " + loctarg->server_sa.str()); std::string classname = loctarg->GetClass()->name; if (!classname.empty()) @@ -190,10 +192,14 @@ class CommandCheck : public Command else user->SendText(checkstr + " onip " + targuser->GetIPString()); - for (UCListIter i = targuser->chans.begin(); i != targuser->chans.end(); i++) + for (User::ChanList::iterator i = targuser->chans.begin(); i != targuser->chans.end(); i++) { - Channel* c = *i; - chliststr.append(c->GetPrefixChar(targuser)).append(c->name).append(" "); + Membership* memb = *i; + Channel* c = memb->chan; + char prefix = memb->GetPrefixChar(); + if (prefix) + chliststr.push_back(prefix); + chliststr.append(c->name).push_back(' '); } std::stringstream dump(chliststr); @@ -220,17 +226,18 @@ class CommandCheck : public Command /* now the ugly bit, spool current members of a channel. :| */ - const UserMembList *ulist= targchan->GetUsers(); + const Channel::MemberMap& ulist = targchan->GetUsers(); /* note that unlike /names, we do NOT check +i vs in the channel */ - for (UserMembCIter i = ulist->begin(); i != ulist->end(); i++) + for (Channel::MemberMap::const_iterator i = ulist.begin(); i != ulist.end(); ++i) { /* * Unlike Asuka, I define a clone as coming from the same host. --w00t */ - user->SendText("%s member %-3lu %s%s (%s@%s) %s ", - checkstr.c_str(), ServerInstance->Users->GlobalCloneCount(i->first), - targchan->GetAllPrefixChars(i->first), i->first->nick.c_str(), + const UserManager::CloneCounts& clonecount = ServerInstance->Users->GetCloneCounts(i->first); + user->SendText("%s member %-3u %s%s (%s@%s) %s ", + checkstr.c_str(), clonecount.global, + i->second->GetAllPrefixChars(), i->first->nick.c_str(), i->first->ident.c_str(), i->first->dhost.c_str(), i->first->fullname.c_str()); } @@ -246,7 +253,8 @@ class CommandCheck : public Command long x = 0; /* hostname or other */ - for (user_hash::const_iterator a = ServerInstance->Users->clientlist->begin(); a != ServerInstance->Users->clientlist->end(); a++) + const user_hash& users = ServerInstance->Users->GetUsers(); + for (user_hash::const_iterator a = users.begin(); a != users.end(); ++a) { if (InspIRCd::Match(a->second->host, parameters[0], ascii_case_insensitive_map) || InspIRCd::Match(a->second->dhost, parameters[0], ascii_case_insensitive_map)) {