]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_callerid.cpp
m_mlock Remove unnecessary iteration
[user/henk/code/inspircd.git] / src / modules / m_callerid.cpp
index 7c80aa6577ffa1a97b869ca89c22dbf2fb33dbf9..f24c38b653acbfa074eee188a393497e84dd25e8 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "inspircd.h"
 
-/* $ModDesc: Implementation of callerid (umode +g & /accept, ala hybrid etc) */
+/* $ModDesc: Implementation of callerid, usermode +g, /accept */
 
 class callerid_data
 {
@@ -54,11 +54,8 @@ class callerid_data
                        }
 
                        User *u = ServerInstance->FindNick(tok);
-                       if (!u)
-                       {
-                               continue;
-                       }
-                       accepting.insert(u);
+                       if ((u) && (u->registered == REG_ALL) && (!u->quitting) && (!IS_SERVER(u)))
+                               accepting.insert(u);
                }
        }
 
@@ -165,18 +162,12 @@ public:
                                tok.erase(0, 1); // Remove the dash.
                        }
                        User* u = ServerInstance->FindNick(tok);
-                       if (u)
-                       {
-                               if (dash)
-                                       out.append("-");
-                               out.append(u->uuid);
-                       }
-                       else
-                       {
-                               if (dash)
-                                       out.append("-");
-                               out.append(tok);
-                       }
+                       if ((!u) || (u->registered != REG_ALL) || (u->quitting) || (IS_SERVER(u)))
+                               continue;
+
+                       if (dash)
+                               out.append("-");
+                       out.append(u->uuid);
                }
                parameter = out;
        }
@@ -212,7 +203,7 @@ public:
                else
                {
                        User* whotoadd = ServerInstance->FindNick(tok[0] == '+' ? tok.substr(1) : tok);
-                       if (whotoadd)
+                       if ((whotoadd) && (whotoadd->registered == REG_ALL) && (!whotoadd->quitting) && (!IS_SERVER(whotoadd)))
                                return (AddAccept(user, whotoadd) ? CMD_SUCCESS : CMD_FAILURE);
                        else
                        {
@@ -346,7 +337,7 @@ public:
                ServerInstance->Modules->AddService(cmd);
                ServerInstance->Modules->AddService(cmd.extInfo);
 
-               Implementation eventlist[] = { I_OnRehash, I_OnUserPreNick, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage };
+               Implementation eventlist[] = { I_OnRehash, I_OnUserPostNick, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage };
                ServerInstance->Modules->Attach(eventlist, this, 6);
        }
 
@@ -356,7 +347,7 @@ public:
 
        virtual Version GetVersion()
        {
-               return Version("Implementation of callerid (umode +g & /accept, ala hybrid etc)", VF_COMMON | VF_VENDOR);
+               return Version("Implementation of callerid, usermode +g, /accept", VF_COMMON | VF_VENDOR);
        }
 
        virtual void On005Numeric(std::string& output)
@@ -408,11 +399,10 @@ public:
                return MOD_RES_PASSTHRU;
        }
 
-       ModResult OnUserPreNick(User* user, const std::string& newnick)
+       void OnUserPostNick(User* user, const std::string& oldnick)
        {
                if (!tracknick)
                        RemoveFromAllAccepts(user);
-               return MOD_RES_PASSTHRU;
        }
 
        void OnUserQuit(User* user, const std::string& message, const std::string& oper_message)