summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-12 18:11:46 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-12 18:11:46 +0000
commitf6e9222205dcc2c44f3aca7dfca85a324358b837 (patch)
treefbbfa15f6134b9c03b95ff83c48a09636d324da3
parentcb77b70cbdffdc95612ef951a951fedf14559f27 (diff)
Added OnBackgroundTimer method, ticks every 5 seconds approximately
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1058 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/modules.h7
-rw-r--r--src/base.cpp1
-rw-r--r--src/inspircd.cpp1
-rw-r--r--src/modules.cpp17
4 files changed, 22 insertions, 4 deletions
diff --git a/include/modules.h b/include/modules.h
index 34549b6c2..a366ebb73 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -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);
};
diff --git a/src/base.cpp b/src/base.cpp
index 3dadb24eb..72741eb90 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -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());
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index e5150a566..d19d42ff2 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -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)
diff --git a/src/modules.cpp b/src/modules.cpp
index 2b4314dee..1fa2300c8 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -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);
+
}
}
}