summaryrefslogtreecommitdiff
path: root/src/process.c
diff options
context:
space:
mode:
authorAdam <Adam@drink-coca-cola.info>2010-05-14 20:35:38 -0400
committerAdam <Adam@anope.org>2010-06-18 21:01:53 -0400
commitf049124905bd9f53439293e873003cb027a17b91 (patch)
tree352ed9251fd47055dd770aa2d5eabb20247e4b43 /src/process.c
parent81a45520a773732c9f46785f27aa1956150775d7 (diff)
Rewrote the hashing system to use std::tr1::unordered_map
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/process.c b/src/process.c
index ca9e2c069..7a015c64b 100644
--- a/src/process.c
+++ b/src/process.c
@@ -12,7 +12,6 @@
*/
#include "services.h"
-#include "messages.h"
#include "modules.h"
/*************************************************************************/
@@ -283,14 +282,12 @@ int split_buf(char *buf, const char ***argv, int colon_special)
void process(const std::string &buffer)
{
int retVal = 0;
- Message *current = NULL;
char source[64];
char cmd[64];
char buf[512]; /* Longest legal IRC command line */
char *s;
int ac; /* Parameters for the command */
const char **av;
- Message *m;
/* zero out the buffers before we do much else */
*buf = '\0';
@@ -346,19 +343,21 @@ void process(const std::string &buffer)
}
/* Do something with the message. */
- m = find_message(cmd);
- if (m) {
- if (m->func) {
- retVal = m->func(source, ac, av);
- if (retVal == MOD_CONT) {
- current = m->next;
- while (current && current->func && retVal == MOD_CONT) {
- retVal = current->func(source, ac, av);
- current = current->next;
- }
- }
+ std::vector<Message *> messages = FindMessage(cmd);
+
+ if (!messages.empty())
+ {
+ retVal = MOD_CONT;
+
+ for (std::vector<Message *>::iterator it = messages.begin(); retVal == MOD_CONT && it != messages.end(); ++it)
+ {
+ Message *m = *it;
+
+ if (m->func)
+ retVal = m->func(source, ac, av);
}
- } else
+ }
+ else
Alog(LOG_DEBUG) << "unknown message from server (" << buffer << ")";
/* Free argument list we created */