summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDukePyrolator <anope@s15355730.onlinehome-server.info>2010-06-22 22:06:23 +0200
committerDukePyrolator <anope@s15355730.onlinehome-server.info>2010-06-22 22:06:23 +0200
commit959a1a69a5179c6f186026190cd77f8338b5c50a (patch)
treebbffc7c7a620a799612602836440a6c72234e6ed
parent7e872db956da543b321e69cf5ff6c8d0866d9cc4 (diff)
moved FindMessage() into the Anope class
-rw-r--r--include/modules.h1
-rw-r--r--include/services.h7
-rw-r--r--src/modules.cpp42
-rw-r--r--src/process.cpp2
4 files changed, 29 insertions, 23 deletions
diff --git a/include/modules.h b/include/modules.h
index 8643518de..10e169dff 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -129,7 +129,6 @@ extern CoreExport Module *FindModule(const std::string &name);
extern CoreExport Module *FindModule(const ci::string &name);
int protocol_module_init();
extern CoreExport Message *createMessage(const char *name, int (*func)(const char *source, int ac, const char **av));
-std::vector<Message *> FindMessage(const std::string &name);
extern CoreExport bool moduleMinVersion(int major,int minor,int patch,int build);
enum ModuleReturn
diff --git a/include/services.h b/include/services.h
index c72d7d1f0..900c8d49c 100644
--- a/include/services.h
+++ b/include/services.h
@@ -1058,6 +1058,13 @@ class CoreExport Anope
* @return true if the message was found and deleted, else false
*/
static bool DelMessage(Message *m);
+
+ /** Returns a list of pointers to message handlers
+ * @param The message name as sent by the IRCd
+ * @return a vector with pointers to the messagehandlers (you can bind more than one handler to a message)
+ */
+ static std::vector<Message *> FindMessage(const std::string &name);
+
};
/*************************************************************************/
diff --git a/src/modules.cpp b/src/modules.cpp
index 9ca850b57..c32544aa4 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -158,6 +158,27 @@ bool Anope::DelMessage(Message *m)
return false;
}
+/** Find message in the message table
+ * @param name The name of the message were looking for
+ * @return NULL if we cant find it, or a pointer to the Message if we can
+ **/
+std::vector<Message *> Anope::FindMessage(const std::string &name)
+{
+ std::vector<Message *> messages;
+
+ std::multimap<std::string, Message *>::iterator it = MessageMap.find(name);
+
+ if (it == MessageMap.end())
+ return messages;
+
+ std::multimap<std::string, Message *>::iterator upper = MessageMap.upper_bound(name);
+
+ for (; it != upper; ++it)
+ messages.push_back(it->second);
+
+ return messages;
+}
+
/*******************************************************************************
* Command Functions
@@ -200,27 +221,6 @@ int Module::DelCommand(BotInfo *bi, Command *c)
return MOD_ERR_OK;
}
-/**
- * Find a message in the message table
- * @param name The name of the message were looking for
- * @return NULL if we cant find it, or a pointer to the Message if we can
- **/
-std::vector<Message *> FindMessage(const std::string &name)
-{
- std::vector<Message *> messages;
-
- std::multimap<std::string, Message *>::iterator it = MessageMap.find(name);
-
- if (it == MessageMap.end())
- return messages;
-
- std::multimap<std::string, Message *>::iterator upper = MessageMap.upper_bound(name);
-
- for (; it != upper; ++it)
- messages.push_back(it->second);
-
- return messages;
-}
/*******************************************************************************
* Module Callback Functions
diff --git a/src/process.cpp b/src/process.cpp
index a240a0008..15e0cdad5 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -361,7 +361,7 @@ void process(const std::string &buffer)
}
/* Do something with the message. */
- std::vector<Message *> messages = FindMessage(cmd);
+ std::vector<Message *> messages = Anope::FindMessage(cmd);
if (!messages.empty())
{