]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_safelist.cpp
Decide that it wasn't quite appropriate :(
[user/henk/code/inspircd.git] / src / modules / m_safelist.cpp
index 4c1356844822f1fb453724186a2bad8b8aaf647b..127990051ca0e5026fd3523adddc7b024ef55d87 100644 (file)
@@ -41,22 +41,28 @@ class ListData
 typedef std::vector<userrec *> UserList;
 UserList listusers;    /* vector of people doing a /list */
 
+/*
+ * To create a timer which recurs every second, we inherit from InspTimer.
+ * InspTimer is only one-shot however, so at the end of each Tick() we simply
+ * insert another of ourselves into the pending queue :)
+ */
 class ListTimer : public InspTimer
 {
  private:
+
        Server* Srv;
+       char buffer[MAXBUF];
+       chanrec *chan;
+
  public:
+
        ListTimer(long interval, Server* Me) : InspTimer(interval,TIME), Srv(Me)
        {
        }
 
        virtual void Tick(time_t TIME)
        {
-               log(DEBUG,"*** Timer tick!");
-
                 bool go_again = true;
-                chanrec *chan;
-                char buffer[MAXBUF];
 
                 while (go_again)
                 {
@@ -87,6 +93,8 @@ class ListTimer : public InspTimer
                                 do
                                 {
                                         log(DEBUG,"Channel %ld",ld->list_position);
+                                       if (!ld->list_position)
+                                               WriteServ(u->fd,"321 %s Channel :Users Name",u->nick);
                                         chan = Srv->GetChannelIndex(ld->list_position);
                                         /* spool details */
                                         if (chan)
@@ -200,13 +208,7 @@ class ModuleSafeList : public Module
                time_t* llt = new time_t;
                *llt = TIME;
                user->Extend("safelist_last",(char*)llt);
-               
-               WriteServ(user->fd,"321 %s Channel :Users Name",user->nick);
-               /*
-                * If we can, we try and fill up the user's sendq right now with the first batch of channels,
-                * which on a small net, may be ALL of them.
-                */
-               this->OnBackgroundTimer(TIME);
+       
                return 1;
        }