]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_safelist.cpp
Remove some debug (im on a crusade to make debug mode useful, but at the same time...
[user/henk/code/inspircd.git] / src / modules / m_safelist.cpp
index aebcc534e29e8d351d6200a3311100e5c88a92e9..7441f0ea59f00b1a027952e58728a40af5c32fe0 100644 (file)
@@ -2,19 +2,14 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- *                       E-mail:
- *                <brain@chatspike.net>
- *               <Craig@chatspike.net>
- *     
- * Written by Craig Edwards, Craig McLure, and others.
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
  *
  * ---------------------------------------------------
  */
-
-using namespace std;
  
 #include "users.h"
 #include "channels.h"
@@ -83,7 +78,7 @@ class ListTimer : public InspTimer
                                userrec* u = (userrec*)(*iter);
                                ListData* ld;
                                u->GetExt("safelist_cache", ld);
-                               if ((size_t)ld->list_position > ServerInstance->chanlist.size())
+                               if ((size_t)ld->list_position > ServerInstance->chanlist->size())
                                {
                                        u->Shrink("safelist_cache");
                                        DELETE(ld);
@@ -104,7 +99,19 @@ class ListTimer : public InspTimer
                                        chan = ServerInstance->GetChannelIndex(ld->list_position);
                                        /* spool details */
                                        bool has_user = (chan && chan->HasUser(u));
-                                       if ((chan) && (((!(chan->modes[CM_PRIVATE])) && (!(chan->modes[CM_SECRET]))) || (has_user)))
+                                       if ((chan) && (chan->modes[CM_PRIVATE]))
+                                       {
+                                               bool display = match(chan->name, ld->glob.c_str());
+                                               long users = chan->GetUserCounter();
+                                               if ((users) && (display))
+                                               {
+                                                       int counter = snprintf(buffer, MAXBUF, "322 %s *", u->nick);
+                                                       amount_sent += counter + ServerNameSize;
+                                                       ServerInstance->Log(DEBUG, "m_safelist.so: Sent %ld of safe %ld / 4", amount_sent, u->sendqmax);
+                                                       u->WriteServ(std::string(buffer));
+                                               }
+                                       }
+                                       else if ((chan) && (((!(chan->modes[CM_PRIVATE])) && (!(chan->modes[CM_SECRET]))) || (has_user)))
                                        {
                                                bool display = match(chan->name, ld->glob.c_str());
                                                long users = chan->GetUserCounter();
@@ -164,7 +171,7 @@ class ModuleSafeList : public Module
  
        virtual Version GetVersion()
        {
-               return Version(1,0,0,0,VF_VENDOR,API_VERSION);
+               return Version(1,1,0,0,VF_VENDOR,API_VERSION);
        }
  
        void Implements(char* List)
@@ -205,6 +212,10 @@ class ModuleSafeList : public Module
                        return 1;
                }
 
+               /* Work around mIRC suckyness. YOU SUCK, KHALED! */
+               if ((pcnt == 1) && (*parameters[0] == '<'))
+                       pcnt = 0;
+
                time_t* last_list_time;
                user->GetExt("safelist_last", last_list_time);
                if (last_list_time)
@@ -212,6 +223,8 @@ class ModuleSafeList : public Module
                        if (ServerInstance->Time() < (*last_list_time)+60)
                        {
                                user->WriteServ("NOTICE %s :*** Woah there, slow down a little, you can't /LIST so often!",user->nick);
+                               user->WriteServ("321 %s Channel :Users Name",user->nick);
+                               user->WriteServ("323 %s :End of channel list.",user->nick);
                                return 1;
                        }