diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-23 08:45:03 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-23 08:45:03 +0000 |
commit | 938e0759c3b9775d1a7751d0e975a1e1f78df979 (patch) | |
tree | 90384fdefc7306a2d929643ddb35d28c42357549 | |
parent | ff6f4149d99dbc632f171d8ceac6f175989c0bfc (diff) |
Hopefully sped things up here -- I need to check this out on a box that I can run ircd on and test. For now, it compiles.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2642 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/m_blockcolor.cpp | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index f63caf6c5..6f612f6b2 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -63,13 +63,26 @@ class ModuleBlockColor : public Module { chanrec* c = (chanrec*)dest; char ctext[MAXBUF]; + char *ctptr = ctext; snprintf(ctext,MAXBUF,"%s",text.c_str()); + + if (c->IsCustomModeSet('c')) { - if ((strchr(ctext,'\2')) || (strchr(ctext,'\3')) || (strchr(ctext,31))) + /* Instead of using strchr() here, do our own loop. Hopefully faster. --w00t */ + while (ctptr && *ctptr) { - WriteServ(user->fd,"404 %s %s :Can't send colors to channel (+c set)",user->nick, c->name); - return 1; + switch (*ctptr) + { + case 2: + case 3: + case 31: + WriteServ(user->fd,"404 %s %s :Can't send colors to channel (+c set)",user->nick, c->name); + return 1; + break; + } + + *ctptr++; } } } @@ -82,13 +95,26 @@ class ModuleBlockColor : public Module { chanrec* c = (chanrec*)dest; char ctext[MAXBUF]; + char *ctptr = ctext; snprintf(ctext,MAXBUF,"%s",text.c_str()); + + if (c->IsCustomModeSet('c')) { - if ((strchr(ctext,'\2')) || (strchr(ctext,'\3')) || (strchr(ctext,31))) + /* Instead of using strchr() here, do our own loop. Hopefully faster. --w00t */ + while (ctptr && *ctptr) { - WriteServ(user->fd,"404 %s %s :Can't send colors to channel (+c set)",user->nick, c->name); - return 1; + switch (*ctptr) + { + case 2: + case 3: + case 31: + WriteServ(user->fd,"404 %s %s :Can't send colors to channel (+c set)",user->nick, c->name); + return 1; + break; + } + + *ctptr++; } } } |