]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_taxonomy.cpp
Commit patch from danieldg that makes a ton of stuff const-safe for latest warn-happy...
[user/henk/code/inspircd.git] / src / modules / m_taxonomy.cpp
index 1fb4f886eae83ac17e23a360e82c6a80fa76f83a..1490d90efad08a58a54e111b23795f3135d31b88 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -23,7 +23,7 @@ class CommandTaxonomy : public Command
        bool& claimed;
  public:
        /* Command 'taxonomy', takes no parameters and needs no special modes */
-       CommandTaxonomy (InspIRCd* Instance, Module* maker, bool &claim) : Command(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>";
@@ -35,8 +35,7 @@ class CommandTaxonomy : public Command
                if (dest)
                {
                        std::deque<std::string> list;
-                       list.clear();
-                       user->GetExtList(list);
+                       dest->GetExtList(list);
                        user->WriteServ("304 " + std::string(user->nick) + ":TAXONOMY ITEMS " + std::string(dest->nick) + " " +ConvToStr(list.size()));
                        for (unsigned int j = 0; j < list.size(); j++)
                        {
@@ -65,20 +64,18 @@ class ModuleTaxonomy : public Module
                // Create a new command
                newcommand = new CommandTaxonomy(ServerInstance, this, claimed);
                ServerInstance->AddCommand(newcommand);
+               Implementation eventlist[] = { I_ProtoSendMetaData };
+               ServerInstance->Modules->Attach(eventlist, this, 1);
        }
 
-       void Implements(char* List)
-       {
-               List[I_ProtoSendMetaData] = 1;
-       }
 
        void ProtoSendMetaData(void* opaque, int target_type, void* target, const std::string &extname, const std::string &extdata)
        {
                if (target_type == TYPE_USER)
                {
-                       User* spool = (User*)opaque;
-                       std::string taxstr = "304 " + std::string(spool->nick) + ":TAXONOMY METADATA "+extname+" = "+extdata;
-                       spool->WriteServ(taxstr);
+                       User* spoolto = (User*)target;
+                       std::string taxstr = "304 " + std::string(spoolto->nick) + ":TAXONOMY METADATA "+extname+" = "+extdata;
+                       spoolto->WriteServ(taxstr);
                        claimed = true;
                }
        }