summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-06 08:20:47 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-06 08:20:47 +0000
commitddcf2ef5bc605107d02e195751ad215af67c7000 (patch)
treec9caf1b145f64013ff9ba18dd3a136799e6db836 /src
parentb13975318539561a39624e95ee41c32f2f749663 (diff)
tidy up WriteMode
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5426 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/helperfuncs.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 3fce34c77..9bb843094 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -170,7 +170,7 @@ void InspIRCd::WriteMode(const char* modes, int flags, const char* text, ...)
int modelen;
va_list argsPtr;
- if ((!text) || (!modes) || (!flags))
+ if (!text || !modes || !flags)
{
this->Log(DEFAULT,"*** BUG *** WriteMode was given an invalid parameter");
return;
@@ -181,14 +181,12 @@ void InspIRCd::WriteMode(const char* modes, int flags, const char* text, ...)
va_end(argsPtr);
modelen = strlen(modes);
- for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
+ if (flags == WM_AND)
{
- userrec* t = (userrec*)(*i);
- bool send_to_user = false;
-
- if (flags == WM_AND)
+ for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
{
- send_to_user = true;
+ userrec* t = *i;
+ bool send_to_user = true;
for (int n = 0; n < modelen; n++)
{
@@ -199,9 +197,16 @@ void InspIRCd::WriteMode(const char* modes, int flags, const char* text, ...)
}
}
}
- else if (flags == WM_OR)
+ if (send_to_user)
+ t->WriteServ("NOTICE %s :%s",t->nick,textbuffer);
+ }
+ else
+ if (flags == WM_OR)
+ {
+ for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
{
- send_to_user = false;
+ userrec* t = *i;
+ bool send_to_user = false;
for (int n = 0; n < modelen; n++)
{
@@ -212,11 +217,8 @@ void InspIRCd::WriteMode(const char* modes, int flags, const char* text, ...)
}
}
}
-
if (send_to_user)
- {
t->WriteServ("NOTICE %s :%s",t->nick,textbuffer);
- }
}
}