summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2005-05-02 22:37:32 +0000
committergeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2005-05-02 22:37:32 +0000
commit22bf8b43b8d5ad4addff2ea9398e5da870699292 (patch)
treeeb0e6374b598f0e2312256e73cf48764dafcc2f3
parent7a1d87fd7b9d4a471d5971ef8c9d48f9238811fa (diff)
BUILD : 1.7.8 (758) BUGS : 332 NOTES : FIXED: anope_event_away() doing dangerous things with ac/av, viagra had issues in notice_ops, anope_cmd_mode() used wrongly for dreamforge and ultimate2
git-svn-id: svn://svn.anope.org/anope/trunk@758 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@520 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--Changes2
-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
-rw-r--r--version.log6
17 files changed, 147 insertions, 137 deletions
diff --git a/Changes b/Changes
index e6d67c8c1..66a5b8b84 100644
--- a/Changes
+++ b/Changes
@@ -24,6 +24,8 @@ Provided by Anope Dev. <dev@anope.org> - 2005
02/13 A Internal Event support, see EVENTS in the doc folder for help [ #00]
02/05 A Support for Unreal 3.2 +I channel mode. [ #00]
02/03 A Merged anope-win32 branch into the main, now Win32 ready. [ #00]
+05/03 F Wrong variable checking in anope_event_away(). [ #00]
+05/02 F Wrong use of anope_cmd_mode() for dreamforge and ultimate2. [#332]
05/02 F Usermode +R instead of +Z used for services roots with Ultimate3. [#361]
05/02 F Getting op if you had access to protect and not op on a channel. [#355]
05/01 F Typo in include/extern.h with restore_unsynced_topics. [#354]
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;
diff --git a/version.log b/version.log
index de556a2eb..97c9358b0 100644
--- a/version.log
+++ b/version.log
@@ -8,10 +8,14 @@
VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="8"
-VERSION_BUILD="757"
+VERSION_BUILD="758"
# $Log$
#
+# BUILD : 1.7.8 (758)
+# BUGS : 332
+# NOTES : FIXED: anope_event_away() doing dangerous things with ac/av, viagra had issues in notice_ops, anope_cmd_mode() used wrongly for dreamforge and ultimate2
+#
# BUILD : 1.7.8 (757)
# BUGS : 355 361
# NOTES : FIXED: Seperated +q/+a and +o in chan_set_correct_modes, and used +Z (and not +R) for services roots with ultimate3.