irc: add function irc_server_get_chantypes
This commit is contained in:
parent
0c98b0cfa4
commit
691c9a0a0f
@ -675,14 +675,8 @@ irc_channel_is_channel (struct t_irc_server *server, const char *string)
|
||||
first_char[0] = string[0];
|
||||
first_char[1] = '\0';
|
||||
|
||||
/* default global chantypes if no server received */
|
||||
if (!server)
|
||||
return (strpbrk (first_char, irc_channel_default_chantypes)) ? 1 : 0;
|
||||
ptr_chantypes = irc_server_get_chantypes (server);
|
||||
|
||||
/* server chantypes, or option "default_chantypes" as fallback */
|
||||
ptr_chantypes = (server->chantypes) ?
|
||||
server->chantypes :
|
||||
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_CHANTYPES);
|
||||
return (strpbrk (first_char, ptr_chantypes)) ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -707,9 +701,7 @@ irc_channel_get_auto_chantype (struct t_irc_server *server,
|
||||
if (weechat_config_boolean (irc_config_look_join_auto_add_chantype)
|
||||
&& !irc_channel_is_channel (server, channel_name))
|
||||
{
|
||||
ptr_chantypes = (server->chantypes) ?
|
||||
server->chantypes :
|
||||
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_CHANTYPES);
|
||||
ptr_chantypes = irc_server_get_chantypes (server);
|
||||
if (ptr_chantypes && ptr_chantypes[0])
|
||||
{
|
||||
/*
|
||||
|
@ -81,16 +81,7 @@ irc_nick_is_nick (struct t_irc_server *server, const char *string)
|
||||
utf8mapping = (server) ? server->utf8mapping : IRC_SERVER_UTF8MAPPING_NONE;
|
||||
ptr_prefix_chars = (server && server->prefix_chars) ?
|
||||
server->prefix_chars : irc_server_prefix_chars_default;
|
||||
if (server)
|
||||
{
|
||||
ptr_chantypes = (server->chantypes) ?
|
||||
server->chantypes :
|
||||
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_CHANTYPES);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_chantypes = irc_channel_default_chantypes;
|
||||
}
|
||||
ptr_chantypes = irc_server_get_chantypes (server);
|
||||
|
||||
/* check length of nick in bytes (if we have a limit in the server) */
|
||||
if (server && (server->nick_max_length > 0)
|
||||
|
@ -1000,6 +1000,25 @@ irc_server_get_isupport_value (struct t_irc_server *server, const char *feature)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets "chantypes" for the server:
|
||||
* - if server is NULL, returns pointer to irc_channel_default_chantypes
|
||||
* - if server is not NULL, returns either chantypes in the server or
|
||||
* server option "default_chantypes"
|
||||
*/
|
||||
|
||||
const char *
|
||||
irc_server_get_chantypes (struct t_irc_server *server)
|
||||
{
|
||||
if (!server)
|
||||
return irc_channel_default_chantypes;
|
||||
|
||||
if (server->chantypes)
|
||||
return server->chantypes;
|
||||
|
||||
return IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_CHANTYPES);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets "prefix_modes" and "prefix_chars" in server using value of PREFIX in IRC
|
||||
* message 005.
|
||||
|
@ -319,6 +319,7 @@ extern void irc_server_set_host (struct t_irc_server *server,
|
||||
extern const char *irc_server_get_alternate_nick (struct t_irc_server *server);
|
||||
extern const char *irc_server_get_isupport_value (struct t_irc_server *server,
|
||||
const char *feature);
|
||||
extern const char *irc_server_get_chantypes (struct t_irc_server *server);
|
||||
extern void irc_server_set_prefix_modes_chars (struct t_irc_server *server,
|
||||
const char *prefix);
|
||||
extern void irc_server_set_lag (struct t_irc_server *server);
|
||||
|
Loading…
x
Reference in New Issue
Block a user