From f5c3e3782bfeb3ffb634f86eadb8ffecbc36f176 Mon Sep 17 00:00:00 2001 From: w00t Date: Wed, 2 Jan 2008 22:58:47 +0000 Subject: Add param 'opername' to event OnPostOper. This will help make a (slightly nicer) version of dz's patch to allow modes in git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8615 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/modules.h | 3 ++- include/users.h | 2 +- src/commands/cmd_oper.cpp | 2 +- src/modules.cpp | 2 +- src/modules/m_operflood.cpp | 2 +- src/modules/m_operjoin.cpp | 2 +- src/modules/m_opermodes.cpp | 2 +- src/users.cpp | 4 ++-- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/modules.h b/include/modules.h index e40b1d31b..5529862f4 100644 --- a/include/modules.h +++ b/include/modules.h @@ -588,9 +588,10 @@ class CoreExport Module : public Extensible * 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 opername The name of the oper that the user is opering up to. Only valid locally. Empty string otherwise. * @param opertype The opers type name */ - virtual void OnPostOper(User* user, const std::string &opertype); + virtual void OnPostOper(User* user, const std::string &opername, const std::string &opertype); /** Called whenever a user types /INFO. * The User will contain the information of the user who typed the command. Modules may use this diff --git a/include/users.h b/include/users.h index f28a12c75..cd2e98bd4 100644 --- a/include/users.h +++ b/include/users.h @@ -888,7 +888,7 @@ class CoreExport User : public connection * This will also give the +o usermode. * @param opertype The oper type to oper as */ - void Oper(const std::string &opertype); + void Oper(const std::string &opertype, const std::string &opername); /** Call this method to find the matching for a user, and to check them against it. */ diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp index 55277b1ba..8d4eae8cb 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -108,7 +108,7 @@ CmdResult CommandOper::Handle (const char** parameters, int, User *user) ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",user->nick,user->ident,user->host,irc::Spacify(OperType),parameters[0]); user->WriteServ("381 %s :You are now %s %s",user->nick, strchr("aeiouAEIOU", *OperType) ? "an" : "a", irc::Spacify(OperType)); if (!user->IsModeSet('o')) - user->Oper(OperType); + user->Oper(OperType, LoginName); } else { diff --git a/src/modules.cpp b/src/modules.cpp index 6fecc1f50..0ee715b27 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -120,7 +120,7 @@ int Module::OnUserPreJoin(User*, Channel*, const char*, std::string&) { return void Module::OnMode(User*, void*, int, const std::string&) { } Version Module::GetVersion() { return Version(1,0,0,0,VF_VENDOR,-1); } void Module::OnOper(User*, const std::string&) { } -void Module::OnPostOper(User*, const std::string&) { } +void Module::OnPostOper(User*, const std::string&, const std::string &) { } void Module::OnInfo(User*) { } void Module::OnWhois(User*, User*) { } int Module::OnUserPreInvite(User*, User*, Channel*) { return 0; } diff --git a/src/modules/m_operflood.cpp b/src/modules/m_operflood.cpp index 807472b19..1b704cc22 100644 --- a/src/modules/m_operflood.cpp +++ b/src/modules/m_operflood.cpp @@ -28,7 +28,7 @@ public: return Version(1,1,0,1,VF_VENDOR,API_VERSION); } - void OnPostOper(User* user, const std::string &opertype) + void OnPostOper(User* user, const std::string &opertype, const std::string &opername) { if(!IS_LOCAL(user)) return; diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index c8b4b1eaa..e9379e943 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -70,7 +70,7 @@ class ModuleOperjoin : public Module return Version(1,1,0,1,VF_VENDOR,API_VERSION); } - virtual void OnPostOper(User* user, const std::string &opertype) + virtual void OnPostOper(User* user, const std::string &opertype, const std::string &opername) { if (!IS_LOCAL(user)) return; diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index d46aaef21..6389b029d 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -49,7 +49,7 @@ class ModuleModesOnOper : public Module return Version(1,1,0,1,VF_VENDOR,API_VERSION); } - virtual void OnPostOper(User* user, const std::string &opertype) + virtual void OnPostOper(User* user, const std::string &opertype, const std::string &opername) { // whenever a user opers, go through the oper types, find their , // and if they have one apply their modes. The mode string can contain +modes diff --git a/src/users.cpp b/src/users.cpp index e384bc748..f5395f3b3 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -647,7 +647,7 @@ const char* User::GetWriteError() return this->WriteError.c_str(); } -void User::Oper(const std::string &opertype) +void User::Oper(const std::string &opertype, const std::string &opername) { char* mycmd; char* savept; @@ -692,7 +692,7 @@ void User::Oper(const std::string &opertype) free(Classes); } - FOREACH_MOD(I_OnPostOper,OnPostOper(this, opertype)); + FOREACH_MOD(I_OnPostOper,OnPostOper(this, opertype, opername)); } catch (...) -- cgit v1.2.3