summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-08-29 19:26:05 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-08-29 19:26:05 +0000
commit18a0499ce7ad4b0eaca8b4bcecb209bca9cf9e60 (patch)
tree13105b6ab44ac3deedaffc8d6d9ba6ca9d8194e0
parentcc5ad03e4ed14055dec81364b0759eaa7854051d (diff)
downloadirssi-18a0499ce7ad4b0eaca8b4bcecb209bca9cf9e60.zip
/mode #channel -oooo... would deop the first 3, and then op the rest.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@636 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/irc/core/modes.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c
index b33cf6b8..10227dcc 100644
--- a/src/irc/core/modes.c
+++ b/src/irc/core/modes.c
@@ -446,7 +446,7 @@ void channel_set_singlemode(IRC_SERVER_REC *server, const char *channel,
void channel_set_mode(IRC_SERVER_REC *server, const char *channel,
const char *mode)
{
- char *modestr, *curmode, *orig, type;
+ char *modestr, *curmode, *orig, type, prevtype;
GString *tmode, *targs;
int count;
@@ -459,22 +459,28 @@ void channel_set_mode(IRC_SERVER_REC *server, const char *channel,
orig = modestr = g_strdup(mode);
- type = '+';
+ type = '+'; prevtype = '\0';
curmode = cmd_get_param(&modestr);
for (; *curmode != '\0'; curmode++) {
- if (*curmode == '+' || *curmode == '-')
+ if (*curmode == '+' || *curmode == '-') {
type = *curmode;
+ continue;
+ }
if (count == server->max_modes_in_cmd &&
HAS_MODE_ARG(type, *curmode)) {
irc_send_cmdv(server, "MODE %s %s%s",
channel, tmode->str, targs->str);
- count = 0;
+ count = 0; prevtype = '\0';
g_string_truncate(tmode, 0);
g_string_truncate(targs, 0);
}
+ if (type != prevtype) {
+ prevtype = type;
+ g_string_append_c(tmode, type);
+ }
g_string_append_c(tmode, *curmode);
if (HAS_MODE_ARG(type, *curmode)) {