mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
updating user modes were handled as they were channel modes, like +o
etc. thought they needed arguments. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@735 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
28f3e476da
commit
1fa98c2369
@ -74,7 +74,7 @@ static int sig_set_user_mode(IRC_SERVER_REC *server)
|
|||||||
if (mode == NULL) return 0;
|
if (mode == NULL) return 0;
|
||||||
|
|
||||||
newmode = server->usermode == NULL ? NULL :
|
newmode = server->usermode == NULL ? NULL :
|
||||||
modes_join(server->usermode, mode);
|
modes_join(server->usermode, mode, FALSE);
|
||||||
|
|
||||||
if (server->usermode == NULL) {
|
if (server->usermode == NULL) {
|
||||||
/* server didn't set user mode, just set the new one */
|
/* server didn't set user mode, just set the new one */
|
||||||
|
@ -320,7 +320,7 @@ static int sig_set_user_mode(IRC_SERVER_REC *server)
|
|||||||
|
|
||||||
mode = settings_get_str("usermode");
|
mode = settings_get_str("usermode");
|
||||||
newmode = server->usermode == NULL ? NULL :
|
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)
|
if (server->usermode == NULL || strcmp(newmode, server->usermode) != 0)
|
||||||
irc_send_cmdv(server, "MODE %s %s", server->nick, mode);
|
irc_send_cmdv(server, "MODE %s %s", server->nick, mode);
|
||||||
g_free_not_null(newmode);
|
g_free_not_null(newmode);
|
||||||
|
@ -297,8 +297,10 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
|
|||||||
g_string_free(newmode, TRUE);
|
g_string_free(newmode, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add `mode' to `old' - return newly allocated mode. */
|
/* add `mode' to `old' - return newly allocated mode.
|
||||||
char *modes_join(const char *old, const char *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;
|
GString *newmode;
|
||||||
char *dup, *modestr, *curmode, type;
|
char *dup, *modestr, *curmode, type;
|
||||||
@ -317,7 +319,7 @@ char *modes_join(const char *old, const char *mode)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HAS_MODE_ARG(type, *curmode))
|
if (!channel || !HAS_MODE_ARG(type, *curmode))
|
||||||
mode_set(newmode, type, *curmode);
|
mode_set(newmode, type, *curmode);
|
||||||
else {
|
else {
|
||||||
mode_set_arg(newmode, type, *curmode,
|
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(IS_IRC_SERVER(server));
|
||||||
g_return_if_fail(modestr != NULL);
|
g_return_if_fail(modestr != NULL);
|
||||||
|
|
||||||
newmode = modes_join(server->usermode, modestr);
|
newmode = modes_join(server->usermode, modestr, FALSE);
|
||||||
oldmode = server->usermode;
|
oldmode = server->usermode;
|
||||||
server->usermode = newmode;
|
server->usermode = newmode;
|
||||||
server->server_operator = (strchr(newmode, 'o') != NULL);
|
server->server_operator = (strchr(newmode, 'o') != NULL);
|
||||||
|
@ -23,8 +23,10 @@
|
|||||||
void modes_init(void);
|
void modes_init(void);
|
||||||
void modes_deinit(void);
|
void modes_deinit(void);
|
||||||
|
|
||||||
/* add `mode' to `old' - return newly allocated mode. */
|
/* add `mode' to `old' - return newly allocated mode.
|
||||||
char *modes_join(const char *old, const char *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);
|
int channel_mode_is_set(IRC_CHANNEL_REC *channel, char mode);
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
MODULE = Irssi::Irc PACKAGE = Irssi::Irc
|
MODULE = Irssi::Irc PACKAGE = Irssi::Irc
|
||||||
|
|
||||||
char *
|
char *
|
||||||
modes_join(old, mode)
|
modes_join(old, mode, channel)
|
||||||
char *old
|
char *old
|
||||||
char *mode
|
char *mode
|
||||||
|
int channel
|
||||||
|
|
||||||
#*******************************
|
#*******************************
|
||||||
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server
|
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server
|
||||||
|
Loading…
Reference in New Issue
Block a user