X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_check.cpp;h=df42d4608fd3cf690ab27e4c4bb38e03e8df03a1;hb=a8878569083bfa4753e9e118adee0ed1da6a0325;hp=964a8c0756268a90128324bf0ae2512316ce9535;hpb=6d57bbe05c31c79eaad02fe81cfb9c1ed6b79c58;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 964a8c075..df42d4608 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -20,9 +20,9 @@ class CommandCheck : public Command { public: - CommandCheck (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"CHECK", "o", 1) + CommandCheck(Module* parent) : Command(parent,"CHECK", 1) { - syntax = "||| "; + flags_needed = 'o'; syntax = "||| "; } std::string timestring(time_t time) @@ -38,14 +38,12 @@ class CommandCheck : public Command std::stringstream dumpkeys; for(ExtensibleStore::const_iterator i = ext->GetExtList().begin(); i != ext->GetExtList().end(); i++) { - ExtensionItem* item = Extensible::GetItem(i->first); - std::string value; - if (item) - value = item->serialize(creator, ext, i->second); - if (value.empty()) - dumpkeys << " " << i->first; - else - ServerInstance->DumpText(user, checkstr + " meta:" + i->first + " " + value); + ExtensionItem* item = i->first; + std::string value = item->serialize(FORMAT_USER, ext, i->second); + if (!value.empty()) + ServerInstance->DumpText(user, checkstr + " meta:" + item->key + " " + value); + else if (!item->key.empty()) + dumpkeys << " " << item->key; } if (!dumpkeys.str().empty()) ServerInstance->DumpText(user,checkstr + " metadata", dumpkeys); @@ -53,7 +51,7 @@ class CommandCheck : public Command CmdResult Handle (const std::vector ¶meters, User *user) { - if (parameters.size() > 1 && parameters[1] != ServerInstance->Config->ServerName) + if (parameters.size() > 1 && parameters[1] != ServerInstance->Config->ServerName.c_str()) return CMD_SUCCESS; User *targuser; @@ -115,7 +113,12 @@ class CommandCheck : public Command else ServerInstance->DumpText(user, checkstr + " onip " + targuser->GetIPString()); - chliststr = targuser->ChannelList(targuser); + for (UCListIter i = targuser->chans.begin(); i != targuser->chans.end(); i++) + { + Channel* c = *i; + chliststr.append(c->GetPrefixChar(targuser)).append(c->name).append(" "); + } + std::stringstream dump(chliststr); ServerInstance->DumpText(user,checkstr + " onchans", dump); @@ -140,10 +143,10 @@ class CommandCheck : public Command /* now the ugly bit, spool current members of a channel. :| */ - CUList *ulist= targchan->GetUsers(); + const UserMembList *ulist= targchan->GetUsers(); /* note that unlike /names, we do NOT check +i vs in the channel */ - for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++) + for (UserMembCIter i = ulist->begin(); i != ulist->end(); i++) { char tmpbuf[MAXBUF]; /* @@ -198,7 +201,7 @@ class ModuleCheck : public Module private: CommandCheck mycommand; public: - ModuleCheck(InspIRCd* Me) : Module(Me), mycommand(Me, this) + ModuleCheck() : mycommand(this) { ServerInstance->AddCommand(&mycommand); } @@ -211,17 +214,6 @@ class ModuleCheck : public Module { return Version("CHECK command, view user/channel details", VF_VENDOR|VF_OPTCOMMON); } - - std::string ProtoTranslate(Extensible* item) - { - User* u = dynamic_cast(item); - Channel* c = dynamic_cast(item); - if (u) - return u->nick; - if (c) - return c->name; - return "?"; - } }; MODULE_INIT(ModuleCheck)