*/
#include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
/* $ModDesc: Provides the /TAXONOMY command, used to view all metadata attached to a user */
-/** Handle /WOOT
+/** Handle /TAXONOMY
*/
-class cmd_taxonomy : public command_t
+class CommandTaxonomy : public Command
{
Module* Creator;
bool& claimed;
public:
/* Command 'taxonomy', takes no parameters and needs no special modes */
- cmd_taxonomy (InspIRCd* Instance, Module* maker, bool &claim) : command_t(Instance,"TAXONOMY", 'o', 1), Creator(maker), claimed(claim)
+ CommandTaxonomy (InspIRCd* Instance, Module* maker, bool &claim) : Command(Instance,"TAXONOMY", 'o', 1), Creator(maker), claimed(claim)
{
this->source = "m_taxonomy.so";
+ syntax = "<nickname>";
}
- CmdResult Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, User *user)
{
- userrec* dest = ServerInstance->FindNick(parameters[0]);
+ User* dest = ServerInstance->FindNick(parameters[0]);
if (dest)
{
std::deque<std::string> list;
}
user->WriteServ("304 " + std::string(user->nick) + ":TAXONOMY END");
}
- return CMD_FAILURE;
+ return CMD_LOCALONLY;
}
};
class ModuleTaxonomy : public Module
{
- cmd_taxonomy* newcommand;
+ CommandTaxonomy* newcommand;
bool claimed;
public:
ModuleTaxonomy(InspIRCd* Me)
{
// Create a new command
- newcommand = new cmd_taxonomy(ServerInstance, this, claimed);
+ newcommand = new CommandTaxonomy(ServerInstance, this, claimed);
ServerInstance->AddCommand(newcommand);
}
{
if (target_type == TYPE_USER)
{
- userrec* spool = (userrec*)opaque;
+ User* spool = (User*)opaque;
std::string taxstr = "304 " + std::string(spool->nick) + ":TAXONOMY METADATA "+extname+" = "+extdata;
spool->WriteServ(taxstr);
claimed = true;
}
};
-MODULE_INIT(ModuleTaxonomy);
-
+MODULE_INIT(ModuleTaxonomy)