]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Added OnBackgroundTimer method, ticks every 5 seconds approximately
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 12 Apr 2005 18:11:46 +0000 (18:11 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 12 Apr 2005 18:11:46 +0000 (18:11 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1058 e03df62e-2008-0410-955e-edbf42e46eb7

include/modules.h
src/base.cpp
src/inspircd.cpp
src/modules.cpp

index 34549b6c2146a1af1a08508442a182f832912430..a366ebb737079e006d5d6a57e761741bcf08d486 100644 (file)
@@ -367,6 +367,13 @@ class Module : public classbase
         * module).
         */
        virtual void OnLoadModule(Module* mod,std::string name);
+
+       /** Called once every five seconds for background processing.
+        * This timer can be used to control timed features. Its period is not accurate
+        * enough to be used as a clock, but it is gauranteed to be called at least once in
+        * any five second period, directly from the main loop of the server.
+        */
+       virtual void OnBackgroundTimer(time_t curtime);
 };
 
 
index 3dadb24eb6336bd75d061af52d721e23102d756a..72741eb90d4d10fd715e6d5994d76b6449101745 100644 (file)
@@ -54,7 +54,6 @@ char* Extensible::GetExt(std::string key)
        log(DEBUG,"Checking extension items for %s",key.c_str());
        if (this->Extension_Items.find(key) != this->Extension_Items.end())
        {
-               log(DEBUG,"Found item %s %s",key.c_str(),(this->Extension_Items.find(key))->second);
                return (this->Extension_Items.find(key))->second;
        }
        log(DEBUG,"Cant find item %s",key.c_str());
index e5150a566c1da3a4a99e3981be1dfb2019684d5f..d19d42ff270f4cb18abf7ccdc6163ae1731a68e0 100644 (file)
@@ -3764,6 +3764,7 @@ int InspIRCd(void)
                if (((TIME % 5) == 0) && (!expire_run))
                {
                        expire_lines();
+                       FOREACH_MOD OnBackgroundTimer(TIME);
                        expire_run = true;
                }
                if ((TIME % 5) == 1)
index 2b4314deea6c9fde482433261d6bd949a0fd57c0..1fa2300c8df62ab6636069e3f79db6940faccd28 100644 (file)
@@ -330,7 +330,7 @@ string_list Module::OnChannelSync(chanrec* chan) { string_list empty; return emp
 void Module::On005Numeric(std::string &output) { };
 int Module::OnKill(userrec* source, userrec* dest, std::string reason) { return 0; };
 void Module::OnLoadModule(Module* mod,std::string name) { };
-
+void Module::OnBackgroundTimer(time_t curtime) { };
 
 // server is a wrapper class that provides methods to all of the C-style
 // exports in the core
@@ -589,7 +589,7 @@ bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message)
 {
        zombie->fd = alive->fd;
        alive->fd = FD_MAGIC_NUMBER;
-       Write(zombie->fd,"NICK %s",zombie->nick);
+       Write(zombie->fd,":%s!%s@%s NICK %s",alive->nick,alive->ident,alive->host,zombie->nick);
        kill_link(alive,message.c_str());
         for (int i = 0; i != MAXCHANS; i++)
         {
@@ -597,7 +597,18 @@ bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message)
                 {
                         if (zombie->chans[i].channel->name)
                         {
-                               Write(zombie->fd,"JOIN %s",zombie->chans[i].channel->name);
+                               chanrec* Ptr = zombie->chans[i].channel;
+                               WriteFrom(zombie->fd,zombie,"JOIN %s",Ptr->name);
+                               if (Ptr->topicset)
+                               {
+                                       WriteServ(zombie->fd,"332 %s %s :%s", zombie->nick, Ptr->name, Ptr->topic);
+                                       WriteServ(zombie->fd,"333 %s %s %s %d", zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset);
+                               }
+                               userlist(zombie,Ptr);
+                               WriteServ(zombie->fd,"366 %s %s :End of /NAMES list.", zombie->nick, Ptr->name);
+                               WriteServ(zombie->fd,"324 %s %s +%s",zombie->nick, Ptr->name,chanmodes(Ptr));
+                               WriteServ(zombie->fd,"329 %s %s %d", zombie->nick, Ptr->name, Ptr->created);
+
                         }
                 }
         }