summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorAdam <Adam@drink-coca-cola.info>2010-05-06 14:42:21 -0400
committerAdam <Adam@anope.org>2010-06-18 20:58:55 -0400
commita93be9ff1c417d73015fd53a9ee778ea2a642328 (patch)
treea87c2cd3c4577ad0b9d7d9b4d70505a8648e851e /src/modules
parent5d437d9ab5988c36def1a78c7d3d3077eb6804e3 (diff)
Added two events called in ns_info and cs_info that allows modules to easially add info output. Made os_info use this
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/os_info.c53
1 files changed, 17 insertions, 36 deletions
diff --git a/src/modules/os_info.c b/src/modules/os_info.c
index 87d8ea298..b486e32f6 100644
--- a/src/modules/os_info.c
+++ b/src/modules/os_info.c
@@ -409,8 +409,8 @@ class OSInfo : public Module
this->InsertLanguage(LANG_RU, LANG_NUM_STRINGS, langtable_ru);
this->InsertLanguage(LANG_IT, LANG_NUM_STRINGS, langtable_it);
- Implementation i[] = { I_OnNickServHelp, I_OnChanServHelp, I_OnPostCommand, I_OnDatabaseReadMetadata, I_OnDatabaseWriteMetadata };
- ModuleManager::Attach(i, this, 5);
+ Implementation i[] = { I_OnNickServHelp, I_OnChanServHelp, I_OnNickInfo, I_OnChanInfo, I_OnDatabaseReadMetadata, I_OnDatabaseWriteMetadata };
+ ModuleManager::Attach(i, this, 6);
}
~OSInfo()
@@ -439,42 +439,23 @@ class OSInfo : public Module
}
}
- void OnPostCommand(User *u, const std::string &service, const ci::string &command, const std::vector<ci::string> &params)
+ void OnNickInfo(User *u, NickAlias *na, bool)
{
- if (command == "INFO")
+ if (is_oper(u))
{
- if (service == Config.s_NickServ)
- {
- const char *nick = params[0].c_str();
- NickAlias *na = NULL;
-
- if (is_oper(u)) /* Only show our goodies to opers */
- {
- if ((na = findnick(nick))) /* ok we've found the user */
- {
- /* If we have any info on this user */
- char *c;
- if (na->nc->GetExtArray("os_info", c))
- u->SendMessage(Config.s_NickServ, " OperInfo: %s", c);
- }
- }
- }
- else if (service == Config.s_ChanServ)
- {
- const char *chan = params[0].c_str();
- ChannelInfo *ci = NULL;
-
- if (is_oper(u)) /* Only show our goodies to opers */
- {
- if ((ci = cs_findchan(chan)))
- {
- /* If we have any info on this channel */
- char *c;
- if (ci->GetExtArray("os_info", c))
- u->SendMessage(Config.s_ChanServ, " OperInfo: %s", c);
- }
- }
- }
+ char *c;
+ if (na->nc->GetExtArray("os_info", c))
+ u->SendMessage(Config.s_NickServ, " OperInfo: %s", c);
+ }
+ }
+
+ void OnChanInfo(User *u, ChannelInfo *ci, bool)
+ {
+ if (is_oper(u))
+ {
+ char *c;
+ if (ci->GetExtArray("os_info", c))
+ u->SendMessage(Config.s_ChanServ, " OperInfo: %s", c);
}
}