]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_swhois.cpp
Bah
[user/henk/code/inspircd.git] / src / modules / m_swhois.cpp
index 068dfc34196910675cb42f7dfac857a1a43f82bf..97f69c41348795b73f689f3caa658944d09cada9 100644 (file)
@@ -76,7 +76,7 @@ class CommandSwhois : public Command
                 * -- Brain
                 */
                std::deque<std::string>* metadata = new std::deque<std::string>;
-               metadata->push_back(dest->nick);
+               metadata->push_back(dest->uuid);
                metadata->push_back("swhois");          // The metadata id
                metadata->push_back(*text);             // The value to send
                Event event((char*)metadata,(Module*)this,"send_metadata");
@@ -133,6 +133,7 @@ class ModuleSWhois : public Module
                                ServerInstance->SendWhoisLine(user, dest, 320, "%s %s :%s",user->nick,dest->nick,swhois->c_str());
                        }
                }
+
                /* Dont block anything */
                return 0;
        }
@@ -200,13 +201,20 @@ class ModuleSWhois : public Module
                if ((target_type == TYPE_USER) && (extname == "swhois"))
                {
                        User* dest = (User*)target;
-                       // if they dont already have an swhois field, accept the remote server's
+
+                       // if they already have an swhois field, trash it and replace it with the remote one.
                        std::string* text;
-                       if (!dest->GetExt("swhois", text))
+                       if (dest->GetExt("swhois", text))
                        {
-                               std::string* text2 = new std::string(extdata);
-                               dest->Extend("swhois",text2);
+                               dest->Shrink("swhois");
+                               delete text;
                        }
+
+                       if (extdata.empty())
+                               return; // XXX does the command parser even allow sending blank mdata? it needs to here! -- w00t
+
+                       text = new std::string(extdata);
+                       dest->Extend("swhois", text);
                }
        }
        
@@ -255,7 +263,7 @@ class ModuleSWhois : public Module
                std::string *text = new std::string(swhois);
                user->Extend("swhois", text);
                std::deque<std::string>* metadata = new std::deque<std::string>;
-               metadata->push_back(user->nick);
+               metadata->push_back(user->uuid);
                metadata->push_back("swhois");          // The metadata id
                metadata->push_back(*text);             // The value to send
                Event event((char*)metadata,(Module*)this,"send_metadata");