summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-01-29 21:43:34 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-01-29 21:43:34 +0000
commit3ba6fa6d7f81cc1c20a3ad4a7d2aa9521e9b36a8 (patch)
treeff08611cfb296239a377b1100168526882d69751
parent4e0b300c989087428e78c624437c8c2596d0525a (diff)
Created OnPostOper that can be gauranteed to be called *after* opering (by ALL modules) is done
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2973 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/modules.h11
-rw-r--r--src/cmd_oper.cpp1
-rw-r--r--src/modules.cpp1
-rw-r--r--src/modules/extra/m_sqloper.cpp1
-rw-r--r--src/modules/m_operjoin.cpp10
-rw-r--r--src/modules/m_opermodes.cpp10
6 files changed, 29 insertions, 5 deletions
diff --git a/include/modules.h b/include/modules.h
index 5b706e8b2..65e5a9ea3 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -288,7 +288,7 @@ enum Implementation { I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUse
I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnStats, I_OnChangeLocalUserHost, I_OnChangeLocalUserGecos, I_OnLocalTopicChange,
I_OnPostLocalTopicChange, I_OnEvent, I_OnRequest, I_OnOperCompre, I_OnGlobalOper, I_OnGlobalConnect, I_OnAddBan, I_OnDelBan,
I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister,
- I_OnOperCompare, I_OnChannelDelete };
+ I_OnOperCompare, I_OnChannelDelete, I_OnPostOper };
/** Base class for all InspIRCd modules
* This class is the base class for InspIRCd modules. All modules must inherit from this class,
@@ -482,6 +482,15 @@ class Module : public classbase
* @param opertype The opers type name
*/
virtual void OnOper(userrec* user, std::string opertype);
+
+ /** Called after a user opers locally.
+ * This is identical to Module::OnOper(), except it is called after OnOper so that other modules
+ * can be gauranteed to already have processed the oper-up, for example m_spanningtree has sent
+ * out the OPERTYPE, etc.
+ * @param user The user who is opering up
+ * @param opertype The opers type name
+ */
+ virtual void OnPostOper(userrec* user, std::string opertype);
/** Called whenever a user types /INFO.
* The userrec will contain the information of the user who typed the command. Modules may use this
diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp
index a99e53e14..a98a778d3 100644
--- a/src/cmd_oper.cpp
+++ b/src/cmd_oper.cpp
@@ -117,6 +117,7 @@ void cmd_oper::Handle (char **parameters, int pcnt, userrec *user)
FOREACH_MOD(I_OnOper,OnOper(user,OperType));
log(DEFAULT,"OPER: %s!%s@%s opered as type: %s",user->nick,user->ident,user->host,OperType);
AddOper(user);
+ FOREACH_MOD(I_OnPostOper,OnPostOper(user,OperType));
}
}
else
diff --git a/src/modules.cpp b/src/modules.cpp
index 0a2115916..1fc9494ce 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -231,6 +231,7 @@ int Module::OnExtendedMode(userrec* user, void* target, char modechar, int type
void Module::OnMode(userrec* user, void* dest, int target_type, std::string text) { };
Version Module::GetVersion() { return Version(1,0,0,0,VF_VENDOR); }
void Module::OnOper(userrec* user, std::string opertype) { };
+void Module::OnPostOper(userrec* user, std::string opertype) { };
void Module::OnInfo(userrec* user) { };
void Module::OnWhois(userrec* source, userrec* dest) { };
int Module::OnUserPreInvite(userrec* source,userrec* dest,chanrec* channel) { return 0; };
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp
index 14c373f28..aefc8528d 100644
--- a/src/modules/extra/m_sqloper.cpp
+++ b/src/modules/extra/m_sqloper.cpp
@@ -172,6 +172,7 @@ class ModuleSQLOper : public Module
WriteServ(user->fd,"MODE %s :+o",user->nick);
FOREACH_MOD(I_OnOper,OnOper(user,rowresult->GetField("type")));
AddOper(user);
+ FOREACH_MOD(I_OnPostOper,OnPostOper(user,rowresult->GetField("type")));
log(DEFAULT,"OPER: %s!%s@%s opered as type: %s",user->nick,user->ident,user->host,rowresult->GetField("type").c_str());
}
break;
diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp
index 1e767bd86..01be11587 100644
--- a/src/modules/m_operjoin.cpp
+++ b/src/modules/m_operjoin.cpp
@@ -27,7 +27,13 @@ class ModuleOperjoin : public Module
void Implements(char* List)
{
- List[I_OnOper] = 1;
+ List[I_OnPostOper] = List[I_OnRehash] = 1;
+ }
+
+ virtual void OnRehash(std::string parameter)
+ {
+ delete Conf;
+ Conf = new ConfigReader;
}
virtual ~ModuleOperjoin()
@@ -40,7 +46,7 @@ class ModuleOperjoin : public Module
return Version(1,0,0,1,VF_VENDOR);
}
- virtual void OnOper(userrec* user, std::string opertype)
+ virtual void OnPostOper(userrec* user, std::string opertype)
{
if(operChan != "")
{
diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp
index a49cb34e8..c7ca62a69 100644
--- a/src/modules/m_opermodes.cpp
+++ b/src/modules/m_opermodes.cpp
@@ -40,7 +40,13 @@ class ModuleModesOnOper : public Module
void Implements(char* List)
{
- List[I_OnOper] = 1;
+ List[I_OnPostOper] = List[I_OnRehash] = 1;
+ }
+
+ virtual void OnRehash(std::string parameter)
+ {
+ delete Conf;
+ Conf = new ConfigReader;
}
virtual ~ModuleModesOnOper()
@@ -53,7 +59,7 @@ class ModuleModesOnOper : public Module
return Version(1,0,0,1,VF_VENDOR);
}
- virtual void OnOper(userrec* user, std::string opertype)
+ virtual void OnPostOper(userrec* user, std::string opertype)
{
// whenever a user opers, go through the oper types, find their <type:modes>,
// and if they have one apply their modes. The mode string can contain +modes