summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/irc/core/irc-servers-reconnect.c2
-rw-r--r--src/irc/core/irc-servers.c2
-rw-r--r--src/irc/core/modes.c10
-rw-r--r--src/irc/core/modes.h6
-rw-r--r--src/perl/irc/Modes.xs3
5 files changed, 14 insertions, 9 deletions
diff --git a/src/irc/core/irc-servers-reconnect.c b/src/irc/core/irc-servers-reconnect.c
index 7ff72eac..f5ad9d6c 100644
--- a/src/irc/core/irc-servers-reconnect.c
+++ b/src/irc/core/irc-servers-reconnect.c
@@ -74,7 +74,7 @@ static int sig_set_user_mode(IRC_SERVER_REC *server)
if (mode == NULL) return 0;
newmode = server->usermode == NULL ? NULL :
- modes_join(server->usermode, mode);
+ modes_join(server->usermode, mode, FALSE);
if (server->usermode == NULL) {
/* server didn't set user mode, just set the new one */
diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c
index 5ce3b45e..c9884dd8 100644
--- a/src/irc/core/irc-servers.c
+++ b/src/irc/core/irc-servers.c
@@ -320,7 +320,7 @@ static int sig_set_user_mode(IRC_SERVER_REC *server)
mode = settings_get_str("usermode");
newmode = server->usermode == NULL ? NULL :
- modes_join(server->usermode, mode);
+ modes_join(server->usermode, mode, FALSE);
if (server->usermode == NULL || strcmp(newmode, server->usermode) != 0)
irc_send_cmdv(server, "MODE %s %s", server->nick, mode);
g_free_not_null(newmode);
diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c
index 057a9c4f..1d692867 100644
--- a/src/irc/core/modes.c
+++ b/src/irc/core/modes.c
@@ -297,8 +297,10 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
g_string_free(newmode, TRUE);
}
-/* add `mode' to `old' - return newly allocated mode. */
-char *modes_join(const char *old, const char *mode)
+/* add `mode' to `old' - return newly allocated mode.
+ `channel' specifies if we're parsing channel mode and we should try
+ to join mode arguments too. */
+char *modes_join(const char *old, const char *mode, int channel)
{
GString *newmode;
char *dup, *modestr, *curmode, type;
@@ -317,7 +319,7 @@ char *modes_join(const char *old, const char *mode)
continue;
}
- if (!HAS_MODE_ARG(type, *curmode))
+ if (!channel || !HAS_MODE_ARG(type, *curmode))
mode_set(newmode, type, *curmode);
else {
mode_set_arg(newmode, type, *curmode,
@@ -341,7 +343,7 @@ static void parse_user_mode(IRC_SERVER_REC *server, const char *modestr)
g_return_if_fail(IS_IRC_SERVER(server));
g_return_if_fail(modestr != NULL);
- newmode = modes_join(server->usermode, modestr);
+ newmode = modes_join(server->usermode, modestr, FALSE);
oldmode = server->usermode;
server->usermode = newmode;
server->server_operator = (strchr(newmode, 'o') != NULL);
diff --git a/src/irc/core/modes.h b/src/irc/core/modes.h
index be318d94..2f007ec4 100644
--- a/src/irc/core/modes.h
+++ b/src/irc/core/modes.h
@@ -23,8 +23,10 @@
void modes_init(void);
void modes_deinit(void);
-/* add `mode' to `old' - return newly allocated mode. */
-char *modes_join(const char *old, const char *mode);
+/* add `mode' to `old' - return newly allocated mode.
+ `channel' specifies if we're parsing channel mode and we should try
+ to join mode arguments too. */
+char *modes_join(const char *old, const char *mode, int channel);
int channel_mode_is_set(IRC_CHANNEL_REC *channel, char mode);
diff --git a/src/perl/irc/Modes.xs b/src/perl/irc/Modes.xs
index ea26ceae..86cb0144 100644
--- a/src/perl/irc/Modes.xs
+++ b/src/perl/irc/Modes.xs
@@ -1,9 +1,10 @@
MODULE = Irssi::Irc PACKAGE = Irssi::Irc
char *
-modes_join(old, mode)
+modes_join(old, mode, channel)
char *old
char *mode
+ int channel
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server