diff options
Diffstat (limited to 'src/irc/core/modes.c')
-rw-r--r-- | src/irc/core/modes.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c index 7054182f..cc3d0faf 100644 --- a/src/irc/core/modes.c +++ b/src/irc/core/modes.c @@ -78,7 +78,7 @@ void prefix_add(char prefixes[MAX_USER_PREFIXES+1], char newprefix, SERVER_REC * if (*prefixlst == newprefix) break; /* insert the new prefix here */ - + if (*prefixlst == prefixes[oldpos]) { /* this prefix is present. * the one we are inserting goes after it. @@ -88,7 +88,7 @@ void prefix_add(char prefixes[MAX_USER_PREFIXES+1], char newprefix, SERVER_REC * } prefixlst++; } - + /* newpos is now the position in which we wish to insert the prefix */ newprefixes[newpos++] = newprefix; @@ -274,7 +274,7 @@ void modes_type_b(IRC_CHANNEL_REC *channel, const char *setby, char type, channel->key = g_strdup(arg); } } - + mode_set_arg(channel->server, newmode, type, mode, arg, FALSE); } @@ -285,7 +285,7 @@ void modes_type_c(IRC_CHANNEL_REC *channel, const char *setby, if (mode == 'l') { channel->limit = type == '-' ? 0 : atoi(arg); } - + mode_set_arg(channel->server, newmode, type, mode, arg, FALSE); } @@ -398,7 +398,7 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby, old_key = NULL; } - if (strcmp(newmode->str, channel->mode) != 0) { + if (g_strcmp0(newmode->str, channel->mode) != 0) { g_free(channel->mode); channel->mode = g_strdup(newmode->str); @@ -488,7 +488,7 @@ static void event_mode(IRC_SERVER_REC *server, const char *data, params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &channel, &mode); - if (!ischannel(*channel)) { + if (!server_ischannel(SERVER(server), channel)) { /* user mode change */ parse_user_mode(server, mode); } else { @@ -536,7 +536,7 @@ static void sig_req_usermode_change(IRC_SERVER_REC *server, const char *data, params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &target, &mode); - if (!ischannel(*target)) { + if (!server_ischannel(SERVER(server), target)) { /* we requested a user mode change, save this */ mode = modes_join(NULL, server->wanted_usermode, mode, FALSE); g_free_not_null(server->wanted_usermode); @@ -743,6 +743,7 @@ static char *get_nicks(IRC_SERVER_REC *server, WI_ITEM_REC *item, g_hash_table_lookup(optlist, "yes") == NULL) { /* too many matches */ g_string_free(str, TRUE); + g_strfreev(matches); cmd_params_free(free_arg); signal_emit("error command", 1, @@ -756,7 +757,7 @@ static char *get_nicks(IRC_SERVER_REC *server, WI_ITEM_REC *item, if (str->len > 0) g_string_truncate(str, str->len-1); ret = str->str; g_string_free(str, FALSE); - + g_strfreev(matches); cmd_params_free(free_arg); *ret_channel = channel; @@ -835,14 +836,14 @@ static void cmd_mode(const char *data, IRC_SERVER_REC *server, if (*data == '+' || *data == '-') { target = "*"; - if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_GETREST, &mode)) + if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS, &mode)) return; } else { - if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &target, &mode)) + if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS, &target, &mode)) return; } - if (strcmp(target, "*") == 0) { + if (g_strcmp0(target, "*") == 0) { if (!IS_IRC_CHANNEL(channel)) cmd_param_error(CMDERR_NOT_JOINED); @@ -856,7 +857,7 @@ static void cmd_mode(const char *data, IRC_SERVER_REC *server, target = chanrec->name; irc_send_cmdv(server, "MODE %s", target); - } else if (ischannel(*target)) + } else if (server_ischannel(SERVER(server), target)) channel_set_mode(server, target, mode); else { if (g_ascii_strcasecmp(target, server->nick) == 0) { |