summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-05-01 16:12:17 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-05-01 16:12:17 +0000
commit90cc4b0ee93696e6e6b3208cd2877ae6e786440d (patch)
treed0b0b48f8c97d72c879ad0297d46d9b4f383542f /src/modules
parentf743a782e67b56c35b5b7be7ef357a2ca109c244 (diff)
Provided modules with the ability to sync data on a netjoin
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@767 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_chanprotect.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index a6d6a8a9f..a37b4d325 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -18,8 +18,13 @@ class ModuleChanProtect : public Module
ModuleChanProtect()
{
+
+ // here we initialise our module. Use new to create new instances of the required
+ // classes.
+
Srv = new Server;
Conf = new ConfigReader;
+
// set up our modes. We're using listmodes and not normal extmodes here.
// listmodes only need one parameter as everything else is assumed by the
// nature of the mode thats being created.
@@ -33,6 +38,7 @@ class ModuleChanProtect : public Module
virtual void OnRehash()
{
+ // on a rehash we delete our classes for good measure and create them again.
delete Conf;
Conf = new ConfigReader;
// re-read our config options on a rehash
@@ -188,7 +194,7 @@ class ModuleChanProtect : public Module
{
if (mode_on)
{
- if (!theuser->GetExt("cm_founder_"+std::string(chan->name)))
+ if (!theuser->GetExt("cm_protect_"+std::string(chan->name)))
{
theuser->Extend("cm_protect_"+std::string(chan->name),dummyvalue);
return 1;
@@ -196,7 +202,7 @@ class ModuleChanProtect : public Module
}
else
{
- if (theuser->GetExt("cm_founder_"+std::string(chan->name)))
+ if (theuser->GetExt("cm_protect_"+std::string(chan->name)))
{
theuser->Shrink("cm_protect_"+std::string(chan->name));
return 1;
@@ -225,8 +231,22 @@ class ModuleChanProtect : public Module
return Version(1,0,0,0);
}
- virtual void OnUserConnect(userrec* user)
+ virtual string_list OnChannelSync(chanrec* chan)
{
+ chanuserlist cl = Srv->GetUsers(chan);
+ string_list commands;
+ for (int i = 0; i < cl.size(); i++)
+ {
+ if (cl[i]->GetExt("cm_founder_"+std::string(chan->name)))
+ {
+ commands.push_back("M "+std::string(chan->name)+" +q "+std::string(cl[i]->nick));
+ }
+ if (cl[i]->GetExt("cm_protect_"+std::string(chan->name)))
+ {
+ commands.push_back("M "+std::string(chan->name)+" +a "+std::string(cl[i]->nick));
+ }
+ }
+ return commands;
}
};