summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/protocol/bahamut.c22
-rw-r--r--src/protocol/dreamforge.c22
-rw-r--r--src/protocol/hybrid.c18
-rw-r--r--src/protocol/inspircd.c10
-rw-r--r--src/protocol/plexus.c18
-rw-r--r--src/protocol/ptlink.c22
-rw-r--r--src/protocol/rageircd.c18
-rw-r--r--src/protocol/ratbox.c18
-rw-r--r--src/protocol/shadowircd.c16
-rw-r--r--src/protocol/solidircd.c18
-rw-r--r--src/protocol/ultimate2.c20
-rw-r--r--src/protocol/ultimate3.c18
-rw-r--r--src/protocol/unreal31.c18
-rw-r--r--src/protocol/unreal32.c18
-rw-r--r--src/protocol/viagra.c20
15 files changed, 140 insertions, 136 deletions
diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c
index 3cc213a7c..0d6075c22 100644
--- a/src/protocol/bahamut.c
+++ b/src/protocol/bahamut.c
@@ -155,11 +155,15 @@ void bahamut_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
-
- switch (*modes++) {
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
+
+ switch (*modes++) {
case '+':
add = 1;
break;
@@ -1276,15 +1280,11 @@ void bahamut_cmd_quit(char *source, char *buf)
int anope_event_away(char *source, int ac, char **av)
{
- if (ac) {
- return MOD_CONT;
- }
-
if (!source) {
return MOD_CONT;
}
- m_away(source, av[0]);
- return MOD_CONT;
+ m_away(source, (ac ? av[0] : NULL));
+ return MOD_CONT;
}
int anope_event_ping(char *source, int ac, char **av)
diff --git a/src/protocol/dreamforge.c b/src/protocol/dreamforge.c
index 6c77608f5..7632a08f9 100644
--- a/src/protocol/dreamforge.c
+++ b/src/protocol/dreamforge.c
@@ -152,9 +152,13 @@ void dreamforge_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
@@ -648,15 +652,11 @@ void dreamforge_cmd_global(char *source, char *buf)
int anope_event_away(char *source, int ac, char **av)
{
- if (ac) {
- return MOD_CONT;
- }
-
if (!source) {
return MOD_CONT;
}
- m_away(source, av[0]);
- return MOD_CONT;
+ m_away(source, (ac ? av[0] : NULL));
+ return MOD_CONT;
}
int anope_event_topic(char *source, int ac, char **av)
@@ -1041,7 +1041,7 @@ void dreamforge_cmd_bot_nick(char *nick, char *user, char *host,
EnforceQlinedNick(nick, s_BotServ);
send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick,
(long int) time(NULL), user, host, ServerName, real);
- anope_cmd_mode(nick, "MODE %s %s", nick, modes);
+ anope_cmd_mode(nick, nick, "MODE %s", modes);
dreamforge_cmd_sqline(nick, "Reserved for services");
}
@@ -1095,7 +1095,7 @@ void dreamforge_cmd_guest_nick(char *nick, char *user, char *host,
{
send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick,
(long int) time(NULL), user, host, ServerName, real);
- anope_cmd_mode(nick, "MODE %s %s", nick, modes);
+ anope_cmd_mode(nick, nick, "MODE %s", modes);
}
void dreamforge_cmd_svso(char *source, char *nick, char *flag)
diff --git a/src/protocol/hybrid.c b/src/protocol/hybrid.c
index c1a862f16..af21a472e 100644
--- a/src/protocol/hybrid.c
+++ b/src/protocol/hybrid.c
@@ -154,9 +154,13 @@ void hybrid_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
@@ -843,15 +847,11 @@ int anope_event_ping(char *source, int ac, char **av)
int anope_event_away(char *source, int ac, char **av)
{
- if (ac) {
- return MOD_CONT;
- }
-
if (!source) {
return MOD_CONT;
}
- m_away(source, av[0]);
- return MOD_CONT;
+ m_away(source, (ac ? av[0] : NULL));
+ return MOD_CONT;
}
int anope_event_kill(char *source, int ac, char **av)
diff --git a/src/protocol/inspircd.c b/src/protocol/inspircd.c
index 58e5bf50a..babcedaf6 100644
--- a/src/protocol/inspircd.c
+++ b/src/protocol/inspircd.c
@@ -383,9 +383,13 @@ void inspircd_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
diff --git a/src/protocol/plexus.c b/src/protocol/plexus.c
index 2c14a1c34..00be78d3f 100644
--- a/src/protocol/plexus.c
+++ b/src/protocol/plexus.c
@@ -154,9 +154,13 @@ void plexus_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
@@ -926,15 +930,11 @@ int anope_event_ping(char *source, int ac, char **av)
int anope_event_away(char *source, int ac, char **av)
{
- if (ac) {
- return MOD_CONT;
- }
-
if (!source) {
return MOD_CONT;
}
- m_away(source, av[0]);
- return MOD_CONT;
+ m_away(source, (ac ? av[0] : NULL));
+ return MOD_CONT;
}
int anope_event_kill(char *source, int ac, char **av)
diff --git a/src/protocol/ptlink.c b/src/protocol/ptlink.c
index 25c85d739..ede3e0f92 100644
--- a/src/protocol/ptlink.c
+++ b/src/protocol/ptlink.c
@@ -1232,11 +1232,15 @@ void ptlink_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
-
- switch (*modes++) {
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
+
+ switch (*modes++) {
case '+':
add = 1;
break;
@@ -1281,15 +1285,11 @@ int anope_event_ping(char *source, int ac, char **av)
int anope_event_away(char *source, int ac, char **av)
{
- if (ac) {
- return MOD_CONT;
- }
-
if (!source) {
return MOD_CONT;
}
- m_away(source, av[0]);
- return MOD_CONT;
+ m_away(source, (ac ? av[0] : NULL));
+ return MOD_CONT;
}
void ptlink_cmd_bot_nick(char *nick, char *user, char *host, char *real,
diff --git a/src/protocol/rageircd.c b/src/protocol/rageircd.c
index 399d165b7..3db330fc4 100644
--- a/src/protocol/rageircd.c
+++ b/src/protocol/rageircd.c
@@ -790,9 +790,13 @@ void rageircd_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
@@ -906,15 +910,11 @@ void rageircd_cmd_serv_privmsg(char *source, char *dest, char *msg)
int anope_event_away(char *source, int ac, char **av)
{
- if (ac) {
- return MOD_CONT;
- }
-
if (!source) {
return MOD_CONT;
}
- m_away(source, av[0]);
- return MOD_CONT;
+ m_away(source, (ac ? av[0] : NULL));
+ return MOD_CONT;
}
int anope_event_ping(char *source, int ac, char **av)
diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c
index 8059ae1fe..b0887f001 100644
--- a/src/protocol/ratbox.c
+++ b/src/protocol/ratbox.c
@@ -154,9 +154,13 @@ void ratbox_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
@@ -997,15 +1001,11 @@ int anope_event_away(char *source, int ac, char **av)
{
User *u = NULL;
- if (ac) {
- return MOD_CONT;
- }
-
if (UseTS6) {
u = find_byuid(source);
}
-
- m_away((UseTS6 ? (u ? u->nick : source) : source), av[0]);
+
+ m_away((UseTS6 ? (u ? u->nick : source) : source), (ac ? av[0] : NULL));
return MOD_CONT;
}
diff --git a/src/protocol/shadowircd.c b/src/protocol/shadowircd.c
index 6471e1dbe..f07bcd918 100644
--- a/src/protocol/shadowircd.c
+++ b/src/protocol/shadowircd.c
@@ -157,9 +157,13 @@ void shadowircd_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
@@ -1007,13 +1011,9 @@ int anope_event_away(char *source, int ac, char **av)
{
User *u = NULL;
- if (ac) {
- return MOD_CONT;
- }
-
u = find_byuid(source);
- m_away(u->nick, av[0]);
+ m_away(u->nick, (ac ? av[0] : NULL));
return MOD_CONT;
}
diff --git a/src/protocol/solidircd.c b/src/protocol/solidircd.c
index 753793895..e8aab2a42 100644
--- a/src/protocol/solidircd.c
+++ b/src/protocol/solidircd.c
@@ -155,9 +155,13 @@ void solidircd_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
@@ -1301,15 +1305,11 @@ void solidircd_cmd_quit(char *source, char *buf)
int anope_event_away(char *source, int ac, char **av)
{
- if (ac) {
- return MOD_CONT;
- }
-
if (!source) {
return MOD_CONT;
}
- m_away(source, av[0]);
- return MOD_CONT;
+ m_away(source, (ac ? av[0] : NULL));
+ return MOD_CONT;
}
int anope_event_ping(char *source, int ac, char **av)
diff --git a/src/protocol/ultimate2.c b/src/protocol/ultimate2.c
index eb8d29462..cdd7016d5 100644
--- a/src/protocol/ultimate2.c
+++ b/src/protocol/ultimate2.c
@@ -154,9 +154,13 @@ void ultiamte2_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
@@ -1111,15 +1115,11 @@ int anope_event_ping(char *source, int ac, char **av)
int anope_event_away(char *source, int ac, char **av)
{
- if (ac) {
- return MOD_CONT;
- }
-
if (!source) {
return MOD_CONT;
}
- m_away(source, av[0]);
- return MOD_CONT;
+ m_away(source, (ac ? av[0] : NULL));
+ return MOD_CONT;
}
int anope_event_topic(char *source, int ac, char **av)
@@ -1407,7 +1407,7 @@ void ultimate2_cmd_guest_nick(char *nick, char *user, char *host,
{
send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick,
(long int) time(NULL), user, host, ServerName, real);
- anope_cmd_mode(nick, "MODE %s %s", nick, modes);
+ anope_cmd_mode(nick, nick, "MODE %s %s", modes);
}
diff --git a/src/protocol/ultimate3.c b/src/protocol/ultimate3.c
index cf6bee431..2aefc6e07 100644
--- a/src/protocol/ultimate3.c
+++ b/src/protocol/ultimate3.c
@@ -152,9 +152,13 @@ void ultimate3_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
@@ -779,15 +783,11 @@ int anope_event_436(char *source, int ac, char **av)
int anope_event_away(char *source, int ac, char **av)
{
- if (ac) {
- return MOD_CONT;
- }
-
if (!source) {
return MOD_CONT;
}
- m_away(source, av[0]);
- return MOD_CONT;
+ m_away(source, (ac ? av[0] : NULL));
+ return MOD_CONT;
}
int anope_event_topic(char *source, int ac, char **av)
diff --git a/src/protocol/unreal31.c b/src/protocol/unreal31.c
index 4af96c5a3..ef5ab6d30 100644
--- a/src/protocol/unreal31.c
+++ b/src/protocol/unreal31.c
@@ -373,9 +373,13 @@ void unreal_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
@@ -1000,15 +1004,11 @@ int anope_event_436(char *source, int ac, char **av)
int anope_event_away(char *source, int ac, char **av)
{
- if (ac) {
- return MOD_CONT;
- }
-
if (!source) {
return MOD_CONT;
}
- m_away(source, av[0]);
- return MOD_CONT;
+ m_away(source, (ac ? av[0] : NULL));
+ return MOD_CONT;
}
int anope_event_topic(char *source, int ac, char **av)
diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c
index 5790cb5f6..77641e094 100644
--- a/src/protocol/unreal32.c
+++ b/src/protocol/unreal32.c
@@ -427,9 +427,13 @@ void unreal_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
@@ -1173,15 +1177,11 @@ int anope_event_436(char *source, int ac, char **av)
*/
int anope_event_away(char *source, int ac, char **av)
{
- if (ac) {
- return MOD_CONT;
- }
-
if (!source) {
return MOD_CONT;
}
- m_away(source, av[0]);
- return MOD_CONT;
+ m_away(source, (ac ? av[0] : NULL));
+ return MOD_CONT;
}
/*
diff --git a/src/protocol/viagra.c b/src/protocol/viagra.c
index cd9fbe991..56d922887 100644
--- a/src/protocol/viagra.c
+++ b/src/protocol/viagra.c
@@ -157,9 +157,13 @@ void viagra_set_umode(User * user, int ac, char **av)
while (*modes) {
- add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
- ~umodes[(int)
- *modes]);
+ /* This looks better, much better than "add ? (do_add) : (do_remove)".
+ * At least this is readable without paying much attention :) -GD
+ */
+ if (add)
+ user->mode |= umodes[(int) *modes];
+ else
+ user->mode &= ~umodes[(int) *modes];
switch (*modes++) {
case '+':
@@ -886,15 +890,11 @@ void viagra_cmd_quit(char *source, char *buf)
int anope_event_away(char *source, int ac, char **av)
{
- if (ac) {
- return MOD_CONT;
- }
-
if (!source) {
return MOD_CONT;
}
- m_away(source, av[0]);
- return MOD_CONT;
+ m_away(source, (ac ? av[0] : NULL));
+ return MOD_CONT;
}
int anope_event_ping(char *source, int ac, char **av)
@@ -1131,7 +1131,7 @@ int anope_event_motd(char *source, int ac, char **av)
void viagra_cmd_notice_ops(char *source, char *dest, char *buf)
{
- if (!buf) {
+ if (buf) {
send_cmd(NULL, "NOTICE @%s :%s", dest, buf);
}
return;