diff options
-rw-r--r-- | src/irc/irc-mode.c | 12 | ||||
-rw-r--r-- | src/irc/irc.h | 1 | ||||
-rw-r--r-- | weechat/src/irc/irc-mode.c | 12 | ||||
-rw-r--r-- | weechat/src/irc/irc.h | 1 |
4 files changed, 20 insertions, 6 deletions
diff --git a/src/irc/irc-mode.c b/src/irc/irc-mode.c index cc1cd243c..ba76c7dfc 100644 --- a/src/irc/irc-mode.c +++ b/src/irc/irc-mode.c @@ -298,9 +298,15 @@ irc_mode_user_set (t_irc_server *server, char *modes) int irc_mode_nick_prefix_allowed (t_irc_server *server, char prefix) { - /* if server did not send any prefix info, then consider this prefix is allowed */ + char str[2]; + + /* if server did not send any prefix info, then use default prefixes */ if (!server->prefix) - return 1; - + { + str[0] = prefix; + str[1] = '\0'; + return (strpbrk (str, IRC_DEFAULT_PREFIXES_LIST)) ? 1 : 0; + } + return (strchr (server->prefix, prefix) != NULL); } diff --git a/src/irc/irc.h b/src/irc/irc.h index a52d446a6..570a254ca 100644 --- a/src/irc/irc.h +++ b/src/irc/irc.h @@ -53,6 +53,7 @@ #define PREFIX_SEND_MOD "<==" #define IRC_DEFAULT_PORT 6667 +#define IRC_DEFAULT_PREFIXES_LIST "@%+~&!-" /* nick types */ diff --git a/weechat/src/irc/irc-mode.c b/weechat/src/irc/irc-mode.c index cc1cd243c..ba76c7dfc 100644 --- a/weechat/src/irc/irc-mode.c +++ b/weechat/src/irc/irc-mode.c @@ -298,9 +298,15 @@ irc_mode_user_set (t_irc_server *server, char *modes) int irc_mode_nick_prefix_allowed (t_irc_server *server, char prefix) { - /* if server did not send any prefix info, then consider this prefix is allowed */ + char str[2]; + + /* if server did not send any prefix info, then use default prefixes */ if (!server->prefix) - return 1; - + { + str[0] = prefix; + str[1] = '\0'; + return (strpbrk (str, IRC_DEFAULT_PREFIXES_LIST)) ? 1 : 0; + } + return (strchr (server->prefix, prefix) != NULL); } diff --git a/weechat/src/irc/irc.h b/weechat/src/irc/irc.h index a52d446a6..570a254ca 100644 --- a/weechat/src/irc/irc.h +++ b/weechat/src/irc/irc.h @@ -53,6 +53,7 @@ #define PREFIX_SEND_MOD "<==" #define IRC_DEFAULT_PORT 6667 +#define IRC_DEFAULT_PREFIXES_LIST "@%+~&!-" /* nick types */ |