]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_swhois.cpp
Remove m_silence: this is 1.2 only. m_silence_ext is a fully backwards compatible...
[user/henk/code/inspircd.git] / src / modules / m_swhois.cpp
index dabc5c4a429b520c0d9a9313c17ee8fc054a22bf..350ebd648553d97955396e6635938d8bf33d12ff 100644 (file)
@@ -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);
                }
        }
        
@@ -270,7 +278,7 @@ class ModuleSWhois : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
        }
 };