class CommandCheck : public Command
{
public:
- CommandCheck (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"CHECK", "o", 1)
+ CommandCheck(Module* parent) : Command(parent,"CHECK", 1)
{
- syntax = "<nickname>|<ip>|<hostmask>|<channel> <server>";
+ flags_needed = 'o'; syntax = "<nickname>|<ip>|<hostmask>|<channel> <server>";
}
std::string timestring(time_t time)
void dumpExt(User* user, std::string checkstr, Extensible* ext)
{
std::stringstream dumpkeys;
- for(ExtensibleStore::const_iterator i = ext->GetExtList().begin(); i != ext->GetExtList().end(); i++)
+ for(Extensible::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);
CmdResult Handle (const std::vector<std::string> ¶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;
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);
private:
CommandCheck mycommand;
public:
- ModuleCheck(InspIRCd* Me) : Module(Me), mycommand(Me, this)
+ ModuleCheck() : mycommand(this)
{
ServerInstance->AddCommand(&mycommand);
}
{
return Version("CHECK command, view user/channel details", VF_VENDOR|VF_OPTCOMMON);
}
-
- std::string ProtoTranslate(Extensible* item)
- {
- User* u = dynamic_cast<User*>(item);
- Channel* c = dynamic_cast<Channel*>(item);
- if (u)
- return u->nick;
- if (c)
- return c->name;
- return "?";
- }
};
MODULE_INIT(ModuleCheck)