1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 05:46:38 +02:00

irc: reformat some code to make it more readable

This commit is contained in:
Sébastien Helleu
2014-11-01 17:59:02 +01:00
parent 25c775d850
commit de067ff6a0
15 changed files with 3151 additions and 3074 deletions
+5 -3
View File
@@ -290,8 +290,8 @@ irc_bar_item_buffer_modes (void *data, struct t_gui_bar_item *item,
pos_space = strchr(channel->modes, ' ');
if (pos_space)
{
modes_without_args = weechat_strndup (channel->modes,
pos_space - channel->modes);
modes_without_args = weechat_strndup (
channel->modes, pos_space - channel->modes);
}
}
snprintf (modes, sizeof (modes),
@@ -464,7 +464,9 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
if (ptr_nick->prefix[0] != ' ')
{
snprintf (str_prefix, sizeof (str_prefix), "%s%s",
weechat_color (irc_nick_get_prefix_color_name (server, ptr_nick->prefix[0])),
weechat_color (
irc_nick_get_prefix_color_name (
server, ptr_nick->prefix[0])),
ptr_nick->prefix);
}
}
+59 -44
View File
@@ -91,8 +91,8 @@ irc_channel_move_near_server (struct t_irc_server *server, int channel_type,
{
if (ptr_channel->buffer)
{
number_channel = weechat_buffer_get_integer (ptr_channel->buffer,
"number");
number_channel = weechat_buffer_get_integer (
ptr_channel->buffer, "number");
switch (ptr_channel->type)
{
case IRC_CHANNEL_TYPE_CHANNEL:
@@ -188,8 +188,8 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
break;
}
}
current_buffer_number = weechat_buffer_get_integer (weechat_current_buffer (),
"number");
current_buffer_number = weechat_buffer_get_integer (
weechat_current_buffer (), "number");
new_buffer = weechat_buffer_new (buffer_name,
&irc_input_data_cb, NULL,
&irc_buffer_close_cb, NULL);
@@ -216,7 +216,8 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
break;
case IRC_CONFIG_LOOK_BUFFER_POSITION_NEAR_SERVER:
/* move buffer after last channel/pv of server */
irc_channel_move_near_server (server, channel_type, new_buffer);
irc_channel_move_near_server (server, channel_type,
new_buffer);
break;
}
if (ptr_buffer_for_merge)
@@ -235,7 +236,10 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
weechat_buffer_set (new_buffer, "localvar_set_server", server->name);
weechat_buffer_set (new_buffer, "localvar_set_channel", channel_name);
if (server->is_away && server->away_message)
weechat_buffer_set (new_buffer, "localvar_set_away", server->away_message);
{
weechat_buffer_set (new_buffer, "localvar_set_away",
server->away_message);
}
(void) weechat_hook_signal_send ("logger_backlog",
WEECHAT_HOOK_SIGNAL_POINTER,
new_buffer);
@@ -250,15 +254,19 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
}
/* set highlights settings on channel buffer */
weechat_buffer_set(new_buffer, "highlight_words_add",
(channel_type == IRC_CHANNEL_TYPE_CHANNEL) ?
weechat_config_string (irc_config_look_highlight_channel) :
weechat_config_string (irc_config_look_highlight_pv));
weechat_buffer_set(
new_buffer,
"highlight_words_add",
(channel_type == IRC_CHANNEL_TYPE_CHANNEL) ?
weechat_config_string (irc_config_look_highlight_channel) :
weechat_config_string (irc_config_look_highlight_pv));
if (weechat_config_string (irc_config_look_highlight_tags_restrict)
&& weechat_config_string (irc_config_look_highlight_tags_restrict)[0])
{
weechat_buffer_set (new_buffer, "highlight_tags_restrict",
weechat_config_string (irc_config_look_highlight_tags_restrict));
weechat_buffer_set (
new_buffer,
"highlight_tags_restrict",
weechat_config_string (irc_config_look_highlight_tags_restrict));
}
}
@@ -270,19 +278,20 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
new_channel->limit = 0;
if (weechat_hashtable_has_key (server->join_channel_key, channel_name))
{
new_channel->key = strdup (weechat_hashtable_get (server->join_channel_key,
channel_name));
new_channel->key = strdup (
weechat_hashtable_get (server->join_channel_key, channel_name));
weechat_hashtable_remove (server->join_channel_key, channel_name);
}
else
{
new_channel->key = NULL;
}
new_channel->join_msg_received = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
new_channel->join_msg_received = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
new_channel->checking_away = 0;
new_channel->away_message = NULL;
new_channel->has_quit_server = 0;
@@ -351,9 +360,10 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
free (channel_name_lower);
}
(void) weechat_hook_signal_send ((channel_type == IRC_CHANNEL_TYPE_CHANNEL) ?
"irc_channel_opened" : "irc_pv_opened",
WEECHAT_HOOK_SIGNAL_POINTER, new_buffer);
(void) weechat_hook_signal_send (
(channel_type == IRC_CHANNEL_TYPE_CHANNEL) ?
"irc_channel_opened" : "irc_pv_opened",
WEECHAT_HOOK_SIGNAL_POINTER, new_buffer);
/* all is OK, return address of new channel */
return new_channel;
@@ -610,8 +620,9 @@ irc_channel_nick_speaking_add_to_list (struct t_irc_channel *channel,
to_remove = size - IRC_CHANNEL_NICKS_SPEAKING_LIMIT;
for (i = 0; i < to_remove; i++)
{
weechat_list_remove (channel->nicks_speaking[highlight],
weechat_list_get (channel->nicks_speaking[highlight], 0));
weechat_list_remove (
channel->nicks_speaking[highlight],
weechat_list_get (channel->nicks_speaking[highlight], 0));
}
}
}
@@ -650,7 +661,8 @@ irc_channel_nick_speaking_rename (struct t_irc_channel *channel,
{
if (channel->nicks_speaking[i])
{
ptr_item = weechat_list_search (channel->nicks_speaking[i], old_nick);
ptr_item = weechat_list_search (channel->nicks_speaking[i],
old_nick);
if (ptr_item)
weechat_list_set (ptr_item, new_nick);
}
@@ -831,7 +843,8 @@ irc_channel_nick_speaking_time_rename (struct t_irc_server *server,
if (channel->nicks_speaking_time)
{
ptr_nick = irc_channel_nick_speaking_time_search (server, channel, old_nick, 0);
ptr_nick = irc_channel_nick_speaking_time_search (server, channel,
old_nick, 0);
if (ptr_nick)
{
free (ptr_nick->nick);
@@ -857,11 +870,12 @@ irc_channel_join_smart_filtered_add (struct t_irc_channel *channel,
/* create hashtable if needed */
if (!channel->join_smart_filtered)
{
channel->join_smart_filtered = weechat_hashtable_new (64,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_TIME,
NULL,
NULL);
channel->join_smart_filtered = weechat_hashtable_new (
64,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_TIME,
NULL,
NULL);
}
if (!channel->join_smart_filtered)
return;
@@ -935,7 +949,8 @@ irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
return;
/* return if unmasking of smart filtered joins is disabled */
unmask_delay = weechat_config_integer (irc_config_look_smart_filter_join_unmask);
unmask_delay = weechat_config_integer (
irc_config_look_smart_filter_join_unmask);
if (unmask_delay == 0)
return;
@@ -1173,18 +1188,18 @@ irc_channel_display_nick_back_in_pv (struct t_irc_server *server,
{
if (weechat_config_boolean (irc_config_look_display_pv_back))
{
weechat_printf_tags (ptr_channel->buffer,
"irc_nick_back",
_("%s%s%s %s(%s%s%s)%s is back on server"),
weechat_prefix ("join"),
irc_nick_color_for_msg (server, 1, nick,
nickname),
(nick) ? nick->name : nickname,
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_CHAT_HOST,
(nick && nick->host) ? nick->host : "",
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_MESSAGE_JOIN);
weechat_printf_tags (
ptr_channel->buffer,
"irc_nick_back",
_("%s%s%s %s(%s%s%s)%s is back on server"),
weechat_prefix ("join"),
irc_nick_color_for_msg (server, 1, nick, nickname),
(nick) ? nick->name : nickname,
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_CHAT_HOST,
(nick && nick->host) ? nick->host : "",
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_MESSAGE_JOIN);
}
ptr_channel->has_quit_server = 0;
}
File diff suppressed because it is too large Load Diff
+6 -9
View File
@@ -262,7 +262,8 @@ irc_completion_channel_nicks_add_speakers (struct t_gui_completion *completion,
list_size = weechat_list_size (channel->nicks_speaking[highlight]);
for (i = 0; i < list_size; i++)
{
nick = weechat_list_string (weechat_list_get (channel->nicks_speaking[highlight], i));
nick = weechat_list_string (
weechat_list_get (channel->nicks_speaking[highlight], i));
if (nick && irc_nick_search (server, channel, nick))
{
weechat_hook_completion_list_add (completion,
@@ -379,20 +380,16 @@ irc_completion_channel_nicks_hosts_cb (void *data, const char *completion_item,
{
snprintf (buf, length, "%s!%s",
ptr_nick->name, ptr_nick->host);
weechat_hook_completion_list_add (completion,
buf,
0,
WEECHAT_LIST_POS_SORT);
weechat_hook_completion_list_add (
completion, buf, 0, WEECHAT_LIST_POS_SORT);
free (buf);
}
}
}
break;
case IRC_CHANNEL_TYPE_PRIVATE:
weechat_hook_completion_list_add (completion,
ptr_channel->name,
1,
WEECHAT_LIST_POS_SORT);
weechat_hook_completion_list_add (
completion, ptr_channel->name, 1, WEECHAT_LIST_POS_SORT);
break;
}
}
+147 -122
View File
@@ -243,9 +243,11 @@ irc_config_set_nick_colors ()
}
irc_config_nick_colors =
weechat_string_split (weechat_config_string (weechat_config_get ("weechat.color.chat_nick_colors")),
",", 0, 0,
&irc_config_num_nick_colors);
weechat_string_split (
weechat_config_string (
weechat_config_get ("weechat.color.chat_nick_colors")),
",", 0, 0,
&irc_config_num_nick_colors);
}
/*
@@ -338,17 +340,19 @@ irc_config_change_look_display_join_message (void *data,
if (!irc_config_hashtable_display_join_message)
{
irc_config_hashtable_display_join_message = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_display_join_message = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
}
else
weechat_hashtable_remove_all (irc_config_hashtable_display_join_message);
items = weechat_string_split (weechat_config_string (irc_config_look_display_join_message),
",", 0, 0, &num_items);
items = weechat_string_split (
weechat_config_string (irc_config_look_display_join_message),
",", 0, 0, &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@@ -520,16 +524,18 @@ irc_config_change_look_highlight_tags_restrict (void *data,
{
if (ptr_server->buffer)
{
weechat_buffer_set (ptr_server->buffer, "highlight_tags_restrict",
weechat_config_string (irc_config_look_highlight_tags_restrict));
weechat_buffer_set (
ptr_server->buffer, "highlight_tags_restrict",
weechat_config_string (irc_config_look_highlight_tags_restrict));
}
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
if (ptr_channel->buffer)
{
weechat_buffer_set (ptr_channel->buffer, "highlight_tags_restrict",
weechat_config_string (irc_config_look_highlight_tags_restrict));
weechat_buffer_set (
ptr_channel->buffer, "highlight_tags_restrict",
weechat_config_string (irc_config_look_highlight_tags_restrict));
}
}
}
@@ -552,17 +558,19 @@ irc_config_change_look_nick_color_force (void *data,
if (!irc_config_hashtable_nick_color_force)
{
irc_config_hashtable_nick_color_force = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_nick_color_force = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
}
else
weechat_hashtable_remove_all (irc_config_hashtable_nick_color_force);
items = weechat_string_split (weechat_config_string (irc_config_look_nick_color_force),
";", 0, 0, &num_items);
items = weechat_string_split (
weechat_config_string (irc_config_look_nick_color_force),
";", 0, 0, &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@@ -638,9 +646,9 @@ irc_config_change_look_nicks_hide_password (void *data,
nicks_hide_password = weechat_config_string (irc_config_look_nicks_hide_password);
if (nicks_hide_password && nicks_hide_password[0])
{
irc_config_nicks_hide_password = weechat_string_split (nicks_hide_password,
",", 0, 0,
&irc_config_num_nicks_hide_password);
irc_config_nicks_hide_password = weechat_string_split (
nicks_hide_password, ",", 0, 0,
&irc_config_num_nicks_hide_password);
}
}
@@ -764,17 +772,19 @@ irc_config_change_color_mirc_remap (void *data, struct t_config_option *option)
if (!irc_config_hashtable_color_mirc_remap)
{
irc_config_hashtable_color_mirc_remap = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_color_mirc_remap = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
}
else
weechat_hashtable_remove_all (irc_config_hashtable_color_mirc_remap);
items = weechat_string_split (weechat_config_string (irc_config_color_mirc_remap),
";", 0, 0, &num_items);
items = weechat_string_split (
weechat_config_string (irc_config_color_mirc_remap),
";", 0, 0, &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@@ -809,17 +819,19 @@ irc_config_change_color_nick_prefixes (void *data,
if (!irc_config_hashtable_nick_prefixes)
{
irc_config_hashtable_nick_prefixes = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_nick_prefixes = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
}
else
weechat_hashtable_remove_all (irc_config_hashtable_nick_prefixes);
items = weechat_string_split (weechat_config_string (irc_config_color_nick_prefixes),
";", 0, 0, &num_items);
items = weechat_string_split (
weechat_config_string (irc_config_color_nick_prefixes),
";", 0, 0, &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@@ -1069,7 +1081,8 @@ irc_config_server_check_value_cb (void *data,
{
while (weechat_infolist_next (infolist))
{
proxy_name = weechat_infolist_string (infolist, "name");
proxy_name = weechat_infolist_string (infolist,
"name");
if (proxy_name && (strcmp (value, proxy_name) == 0))
{
proxy_found = 1;
@@ -1080,12 +1093,11 @@ irc_config_server_check_value_cb (void *data,
}
if (!proxy_found)
{
weechat_printf (NULL,
_("%s%s: warning: proxy \"%s\" does not "
"exist (you can create it with command "
"/proxy)"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
value);
weechat_printf (
NULL,
_("%s%s: warning: proxy \"%s\" does not exist "
"(you can create it with command /proxy)"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, value);
}
}
break;
@@ -1093,18 +1105,19 @@ irc_config_server_check_value_cb (void *data,
pos_error = irc_config_check_gnutls_priorities (value);
if (pos_error)
{
weechat_printf (NULL,
_("%s%s: invalid priorities string, error "
"at this position in string: \"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
pos_error);
weechat_printf (
NULL,
_("%s%s: invalid priorities string, error at this "
"position in string: \"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME, pos_error);
return 0;
}
break;
case IRC_SERVER_OPTION_SSL_FINGERPRINT:
if (value && value[0] && (strlen (value) != 40))
{
fingerprints = weechat_string_split (value, ",", 0, 0, NULL);
fingerprints = weechat_string_split (value, ",", 0, 0,
NULL);
if (fingerprints)
{
rc = 1;
@@ -1119,12 +1132,11 @@ irc_config_server_check_value_cb (void *data,
weechat_string_free_split (fingerprints);
if (!rc)
{
weechat_printf (NULL,
_("%s%s: fingerprint must have "
"exactly 40 hexadecimal "
"digits"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME);
weechat_printf (
NULL,
_("%s%s: fingerprint must have exactly 40 "
"hexadecimal digits"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return 0;
}
}
@@ -1157,14 +1169,16 @@ irc_config_server_change_cb (void *data, struct t_config_option *option)
switch (index_option)
{
case IRC_SERVER_OPTION_ADDRESSES:
irc_server_set_addresses (ptr_server,
IRC_SERVER_OPTION_STRING(ptr_server,
IRC_SERVER_OPTION_ADDRESSES));
irc_server_set_addresses (
ptr_server,
IRC_SERVER_OPTION_STRING(ptr_server,
IRC_SERVER_OPTION_ADDRESSES));
break;
case IRC_SERVER_OPTION_NICKS:
irc_server_set_nicks (ptr_server,
IRC_SERVER_OPTION_STRING(ptr_server,
IRC_SERVER_OPTION_NICKS));
irc_server_set_nicks (
ptr_server,
IRC_SERVER_OPTION_STRING(ptr_server,
IRC_SERVER_OPTION_NICKS));
break;
case IRC_SERVER_OPTION_AWAY_CHECK:
case IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS:
@@ -1247,12 +1261,13 @@ irc_config_reload (void *data, struct t_config_file *config_file)
{
if (ptr_server->is_connected)
{
weechat_printf (NULL,
_("%s%s: warning: server \"%s\" not found "
"in configuration file, not deleted in "
"memory because it's currently used"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
ptr_server->name);
weechat_printf (
NULL,
_("%s%s: warning: server \"%s\" not found in "
"configuration file, not deleted in memory because it's "
"currently used"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
ptr_server->name);
}
else
irc_server_free (ptr_server);
@@ -1308,7 +1323,8 @@ irc_config_msgbuffer_create_option (void *data,
"weechat|server|current|private", 0, 0, value, value, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE :
WEECHAT_CONFIG_OPTION_SET_ERROR;
}
else
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
@@ -1317,10 +1333,10 @@ irc_config_msgbuffer_create_option (void *data,
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
_("%s%s: error creating \"%s\" => \"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
option_name, value);
weechat_printf (
NULL,
_("%s%s: error creating \"%s\" => \"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME, option_name, value);
}
return rc;
@@ -1387,7 +1403,8 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
NULL, 0, 0, default_value, value, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE :
WEECHAT_CONFIG_OPTION_SET_ERROR;
}
else
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
@@ -1396,10 +1413,10 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
_("%s%s: error creating CTCP \"%s\" => \"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
option_name, value);
weechat_printf (
NULL,
_("%s%s: error creating CTCP \"%s\" => \"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME, option_name, value);
}
return rc;
@@ -1553,7 +1570,8 @@ irc_config_server_new_option (struct t_config_file *config_file,
new_option = weechat_config_new_option (
config_file, section,
option_name, "string",
N_("list of hostname/port or IP/port for server (separated by comma)"),
N_("list of hostname/port or IP/port for server (separated by "
"comma)"),
NULL, 0, 0,
default_value, value,
null_value_allowed,
@@ -1565,8 +1583,8 @@ irc_config_server_new_option (struct t_config_file *config_file,
new_option = weechat_config_new_option (
config_file, section,
option_name, "string",
N_("name of proxy used for this server (optional, proxy must be "
"defined with command /proxy)"),
N_("name of proxy used for this server (optional, proxy must "
"be defined with command /proxy)"),
NULL, 0, 0,
default_value, value,
null_value_allowed,
@@ -1632,7 +1650,8 @@ irc_config_server_new_option (struct t_config_file *config_file,
new_option = weechat_config_new_option (
config_file, section,
option_name, "integer",
N_("size of the key used during the Diffie-Hellman Key Exchange"),
N_("size of the key used during the Diffie-Hellman Key "
"Exchange"),
NULL, 0, INT_MAX,
default_value, value,
null_value_allowed,
@@ -1781,7 +1800,8 @@ irc_config_server_new_option (struct t_config_file *config_file,
new_option = weechat_config_new_option (
config_file, section,
option_name, "integer",
N_("delay (in seconds) before trying again to reconnect to server"),
N_("delay (in seconds) before trying again to reconnect to "
"server"),
NULL, 1, 65535,
default_value, value,
null_value_allowed,
@@ -2090,21 +2110,21 @@ irc_config_server_read_cb (void *data, struct t_config_file *config_file,
{
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
weechat_config_option_set (ptr_server->options[i],
NULL, 1);
weechat_config_option_set (
ptr_server->options[i], NULL, 1);
}
ptr_server->reloaded_from_config = 1;
}
rc = weechat_config_option_set (ptr_server->options[index_option],
value, 1);
rc = weechat_config_option_set (
ptr_server->options[index_option], value, 1);
}
else
{
weechat_printf (NULL,
_("%s%s: error creating server "
"\"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
server_name);
weechat_printf (
NULL,
_("%s%s: error creating server \"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
server_name);
}
}
free (server_name);
@@ -2114,10 +2134,10 @@ irc_config_server_read_cb (void *data, struct t_config_file *config_file,
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
_("%s%s: error creating server option \"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
option_name);
weechat_printf (
NULL,
_("%s%s: error creating server option \"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME, option_name);
}
return rc;
@@ -2248,26 +2268,30 @@ irc_config_init ()
{
struct t_config_section *ptr_section;
irc_config_hashtable_display_join_message = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_nick_color_force = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_nick_prefixes = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_color_mirc_remap = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_display_join_message = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_nick_color_force = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_nick_prefixes = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_color_mirc_remap = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_file = weechat_config_new (IRC_CONFIG_NAME,
&irc_config_reload, NULL);
@@ -2532,9 +2556,9 @@ irc_config_init ()
irc_config_look_nick_color_hash = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_color_hash", "integer",
N_("hash algorithm used to find the color for a nick: djb2 = variant of "
"djb2 (position of letters matters: anagrams of a nick have different "
"color), sum = sum of letters"),
N_("hash algorithm used to find the color for a nick: djb2 = variant "
"of djb2 (position of letters matters: anagrams of a nick have "
"different color), sum = sum of letters"),
"djb2|sum", 0, 0, "sum", NULL, 0, NULL, NULL,
&irc_config_change_look_nick_colors, NULL, NULL, NULL);
irc_config_look_nick_color_stop_chars = weechat_config_new_option (
@@ -3005,8 +3029,9 @@ irc_config_init ()
}
irc_config_section_server = ptr_section;
irc_config_hook_config_nick_colors = weechat_hook_config ("weechat.color.chat_nick_colors",
&irc_config_change_nick_colors_cb, NULL);
irc_config_hook_config_nick_colors = weechat_hook_config (
"weechat.color.chat_nick_colors",
&irc_config_change_nick_colors_cb, NULL);
return 1;
}
+192 -207
View File
@@ -124,23 +124,23 @@ irc_ctcp_display_request (struct t_irc_server *server,
&& !weechat_config_boolean (irc_config_look_display_ctcp_blocked))
return;
weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, nick,
NULL, "ctcp",
(channel) ? channel->buffer : NULL),
date,
irc_protocol_tags (command, "irc_ctcp", NULL,
address),
_("%sCTCP requested by %s%s%s: %s%s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL, nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
ctcp,
IRC_COLOR_RESET,
(arguments) ? " " : "",
(arguments) ? arguments : "",
(reply && !reply[0]) ? _(" (blocked)") : "");
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, nick, NULL, "ctcp",
(channel) ? channel->buffer : NULL),
date,
irc_protocol_tags (command, "irc_ctcp", NULL, address),
_("%sCTCP requested by %s%s%s: %s%s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL, nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
ctcp,
IRC_COLOR_RESET,
(arguments) ? " " : "",
(arguments) ? arguments : "",
(reply && !reply[0]) ? _(" (blocked)") : "");
}
/*
@@ -187,8 +187,8 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server, time_t date,
difftime = ((sec2 * 1000000) + usec2) -
((sec1 * 1000000) + usec1);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (server, nick, NULL,
"ctcp", NULL),
irc_msgbuffer_get_target_buffer (
server, nick, NULL, "ctcp", NULL),
date,
irc_protocol_tags (command, "irc_ctcp", NULL, NULL),
/* TRANSLATORS: %.3fs is a float number + "s" ("seconds") */
@@ -207,48 +207,41 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server, time_t date,
}
else
{
weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server,
nick,
NULL,
"ctcp",
NULL),
date,
irc_protocol_tags (command,
"irc_ctcp",
NULL, address),
_("%sCTCP reply from %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0,
NULL, nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
IRC_COLOR_RESET,
" ",
pos_args);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, nick, NULL, "ctcp", NULL),
date,
irc_protocol_tags (command, "irc_ctcp", NULL, address),
_("%sCTCP reply from %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL, nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
IRC_COLOR_RESET,
" ",
pos_args);
}
pos_space[0] = ' ';
}
else
{
weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, nick,
NULL, "ctcp",
NULL),
date,
irc_protocol_tags (command, NULL, NULL,
address),
_("%sCTCP reply from %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL,
nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
"",
"",
"");
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, nick, NULL, "ctcp", NULL),
date,
irc_protocol_tags (command, NULL, NULL, address),
_("%sCTCP reply from %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL, nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
"",
"",
"");
}
if (pos_end)
@@ -275,13 +268,14 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server,
const char *str_args;
char *str_args_color;
hashtable = irc_server_sendf (server,
IRC_SERVER_SEND_OUTQ_PRIO_LOW | IRC_SERVER_SEND_RETURN_HASHTABLE,
NULL,
"NOTICE %s :\01%s%s%s\01",
nick, ctcp,
(arguments) ? " " : "",
(arguments) ? arguments : "");
hashtable = irc_server_sendf (
server,
IRC_SERVER_SEND_OUTQ_PRIO_LOW | IRC_SERVER_SEND_RETURN_HASHTABLE,
NULL,
"NOTICE %s :\01%s%s%s\01",
nick, ctcp,
(arguments) ? " " : "",
(arguments) ? arguments : "");
if (hashtable)
{
@@ -297,26 +291,24 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server,
str_args_color = irc_color_decode (str_args, 1);
if (!str_args_color)
break;
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server,
nick,
NULL,
"ctcp",
(channel) ? channel->buffer : NULL),
irc_protocol_tags (command,
"irc_ctcp,irc_ctcp_reply,"
"notify_none,no_highlight",
NULL, NULL),
_("%sCTCP reply to %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL,
nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
ctcp,
(str_args_color[0]) ? IRC_COLOR_RESET : "",
(str_args_color[0]) ? " " : "",
str_args_color);
weechat_printf_tags (
irc_msgbuffer_get_target_buffer (
server, nick, NULL, "ctcp",
(channel) ? channel->buffer : NULL),
irc_protocol_tags (
command,
"irc_ctcp,irc_ctcp_reply,notify_none,no_highlight",
NULL, NULL),
_("%sCTCP reply to %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL, nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
ctcp,
(str_args_color[0]) ? IRC_COLOR_RESET : "",
(str_args_color[0]) ? " " : "",
str_args_color);
free (str_args_color);
number++;
}
@@ -343,9 +335,9 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
* $clientinfo: supported CTCP, example:
* ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION
*/
temp = weechat_string_replace (format, "$clientinfo",
"ACTION DCC CLIENTINFO FINGER PING SOURCE "
"TIME USERINFO VERSION");
temp = weechat_string_replace (
format, "$clientinfo",
"ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION");
if (!temp)
return NULL;
res = temp;
@@ -549,11 +541,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
if (!dcc_args)
{
weechat_printf (server->buffer,
_("%s%s: not enough memory for \"%s\" "
"command"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, "privmsg");
weechat_printf (
server->buffer,
_("%s%s: not enough memory for \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
return;
}
@@ -568,10 +559,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos_size = strrchr (pos_file, ' ');
if (!pos_size)
{
weechat_printf (server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, "privmsg");
weechat_printf (
server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
free (dcc_args);
return;
}
@@ -588,10 +579,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
{
weechat_printf (server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, "privmsg");
weechat_printf (
server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
free (dcc_args);
return;
}
@@ -608,10 +599,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos_addr = strrchr (pos_file, ' ');
if (!pos_addr)
{
weechat_printf (server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, "privmsg");
weechat_printf (
server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
free (dcc_args);
return;
}
@@ -674,11 +665,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
if (!dcc_args)
{
weechat_printf (server->buffer,
_("%s%s: not enough memory for \"%s\" "
"command"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, "privmsg");
weechat_printf (
server->buffer,
_("%s%s: not enough memory for \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
return;
}
@@ -693,10 +683,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos_start_resume = strrchr (pos_file, ' ');
if (!pos_start_resume)
{
weechat_printf (server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, "privmsg");
weechat_printf (
server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
free (dcc_args);
return;
}
@@ -712,10 +702,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
{
weechat_printf (server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, "privmsg");
weechat_printf (
server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
free (dcc_args);
return;
}
@@ -771,11 +761,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
if (!dcc_args)
{
weechat_printf (server->buffer,
_("%s%s: not enough memory for \"%s\" "
"command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
"privmsg");
weechat_printf (
server->buffer,
_("%s%s: not enough memory for \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
return;
}
@@ -790,10 +779,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos_start_resume = strrchr (pos_file, ' ');
if (!pos_start_resume)
{
weechat_printf (server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
"privmsg");
weechat_printf (
server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
free (dcc_args);
return;
}
@@ -809,10 +798,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
{
weechat_printf (server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
"privmsg");
weechat_printf (
server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
free (dcc_args);
return;
}
@@ -868,11 +857,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
if (!dcc_args)
{
weechat_printf (server->buffer,
_("%s%s: not enough memory for \"%s\" "
"command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
"privmsg");
weechat_printf (
server->buffer,
_("%s%s: not enough memory for \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
return;
}
@@ -887,10 +875,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos_addr = strchr (pos_file, ' ');
if (!pos_addr)
{
weechat_printf (server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
"privmsg");
weechat_printf (
server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
free (dcc_args);
return;
}
@@ -905,10 +893,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos_port = strchr (pos_addr, ' ');
if (!pos_port)
{
weechat_printf (server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
"privmsg");
weechat_printf (
server->buffer,
_("%s%s: cannot parse \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg");
free (dcc_args);
return;
}
@@ -921,15 +909,15 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
if (weechat_strcasecmp (pos_file, "chat") != 0)
{
weechat_printf (server->buffer,
_("%s%s: unknown DCC CHAT type "
"received from %s%s%s: \"%s\""),
weechat_prefix ("error"),
IRC_PLUGIN_NAME,
irc_nick_color_for_msg (server, 0, NULL, nick),
nick,
IRC_COLOR_RESET,
pos_file);
weechat_printf (
server->buffer,
_("%s%s: unknown DCC CHAT type received from %s%s%s: \"%s\""),
weechat_prefix ("error"),
IRC_PLUGIN_NAME,
irc_nick_color_for_msg (server, 0, NULL, nick),
nick,
IRC_COLOR_RESET,
pos_file);
free (dcc_args);
return;
}
@@ -1018,21 +1006,22 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *command,
irc_channel_nick_speaking_time_remove_old (channel);
irc_channel_nick_speaking_time_add (server, channel, nick,
time (NULL));
weechat_printf_date_tags (channel->buffer,
date,
irc_protocol_tags (command,
(nick_is_me) ?
"irc_action,notify_none,no_highlight" :
"irc_action,notify_message",
nick, address),
"%s%s%s%s%s%s%s",
weechat_prefix ("action"),
irc_nick_mode_for_display (server, ptr_nick, 0),
(ptr_nick) ? ptr_nick->color : ((nick) ? irc_nick_find_color (nick) : IRC_COLOR_CHAT_NICK),
nick,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
weechat_printf_date_tags (
channel->buffer,
date,
irc_protocol_tags (command,
(nick_is_me) ?
"irc_action,notify_none,no_highlight" :
"irc_action,notify_message",
nick, address),
"%s%s%s%s%s%s%s",
weechat_prefix ("action"),
irc_nick_mode_for_display (server, ptr_nick, 0),
(ptr_nick) ? ptr_nick->color : ((nick) ? irc_nick_find_color (nick) : IRC_COLOR_CHAT_NICK),
nick,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
}
else
{
@@ -1044,11 +1033,11 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *command,
remote_nick, 0, 0);
if (!ptr_channel)
{
weechat_printf (server->buffer,
_("%s%s: cannot create new "
"private buffer \"%s\""),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, remote_nick);
weechat_printf (
server->buffer,
_("%s%s: cannot create new private buffer \"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
remote_nick);
}
}
if (ptr_channel)
@@ -1056,21 +1045,22 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *command,
if (!ptr_channel->topic)
irc_channel_set_topic (ptr_channel, address);
weechat_printf_date_tags (ptr_channel->buffer,
date,
irc_protocol_tags (command,
(nick_is_me) ?
"irc_action,notify_none,no_highlight" :
"irc_action,notify_private",
nick, address),
"%s%s%s%s%s%s",
weechat_prefix ("action"),
(nick_is_me) ?
IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick),
nick,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
weechat_printf_date_tags (
ptr_channel->buffer,
date,
irc_protocol_tags (command,
(nick_is_me) ?
"irc_action,notify_none,no_highlight" :
"irc_action,notify_private",
nick, address),
"%s%s%s%s%s%s",
weechat_prefix ("action"),
(nick_is_me) ?
IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick),
nick,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
(void) weechat_hook_signal_send ("irc_pv",
WEECHAT_HOOK_SIGNAL_STRING,
message);
@@ -1119,27 +1109,22 @@ irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *command,
{
if (weechat_config_boolean (irc_config_look_display_ctcp_unknown))
{
weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server,
nick,
NULL,
"ctcp",
(channel) ? channel->buffer : NULL),
date,
irc_protocol_tags (command,
"irc_ctcp",
NULL, address),
_("%sUnknown CTCP requested by %s%s%s: "
"%s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (
server, 0, NULL, nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, nick, NULL, "ctcp",
(channel) ? channel->buffer : NULL),
date,
irc_protocol_tags (command, "irc_ctcp", NULL, address),
_("%sUnknown CTCP requested by %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL, nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
}
}
}
+18 -22
View File
@@ -613,28 +613,24 @@ irc_info_init ()
&irc_info_get_info_cb, NULL);
/* info_hashtable hooks */
weechat_hook_info_hashtable ("irc_message_parse",
N_("parse an IRC message"),
N_("\"message\": IRC message, "
"\"server\": server name (optional)"),
/* TRANSLATORS: please do not translate key names (enclosed by quotes) */
N_("\"tags\": tags, \"message_without_tags\": "
"message without the tags, \"nick\": nick, "
"\"host\": host, \"command\": command, "
"\"channel\": channel, \"arguments\": "
"arguments (includes channel)"),
&irc_info_get_info_hashtable_cb, NULL);
weechat_hook_info_hashtable ("irc_message_split",
N_("split an IRC message (to fit in 512 bytes)"),
N_("\"message\": IRC message, "
"\"server\": server name (optional)"),
/* TRANSLATORS: please do not translate key names (enclosed by quotes) */
N_("\"msg1\" ... \"msgN\": messages to send "
"(without final \"\\r\\n\"), "
"\"args1\" ... \"argsN\": arguments of "
"messages, "
"\"count\": number of messages"),
&irc_info_get_info_hashtable_cb, NULL);
weechat_hook_info_hashtable (
"irc_message_parse",
N_("parse an IRC message"),
N_("\"message\": IRC message, \"server\": server name (optional)"),
/* TRANSLATORS: please do not translate key names (enclosed by quotes) */
N_("\"tags\": tags, \"message_without_tags\": message without the "
"tags, \"nick\": nick, \"host\": host, \"command\": command, "
"\"channel\": channel, \"arguments\": arguments (includes channel)"),
&irc_info_get_info_hashtable_cb, NULL);
weechat_hook_info_hashtable (
"irc_message_split",
N_("split an IRC message (to fit in 512 bytes)"),
N_("\"message\": IRC message, \"server\": server name (optional)"),
/* TRANSLATORS: please do not translate key names (enclosed by quotes) */
N_("\"msg1\" ... \"msgN\": messages to send (without final \"\\r\\n\"), "
"\"args1\" ... \"argsN\": arguments of messages, \"count\": number "
"of messages"),
&irc_info_get_info_hashtable_cb, NULL);
/* infolist hooks */
weechat_hook_infolist ("irc_server",
+41 -32
View File
@@ -64,8 +64,9 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, int action,
else
text2 = strdup (text);
text_decoded = irc_color_decode ((text2) ? text2 : text,
weechat_config_boolean (irc_config_network_colors_send));
text_decoded = irc_color_decode (
(text2) ? text2 : text,
weechat_config_boolean (irc_config_network_colors_send));
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
@@ -85,7 +86,9 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, int action,
}
else
{
str_color = irc_color_for_tags (weechat_config_color (weechat_config_get ("weechat.color.chat_nick_self")));
str_color = irc_color_for_tags (
weechat_config_color (
weechat_config_get ("weechat.color.chat_nick_self")));
snprintf (str_tags, sizeof (str_tags),
"notify_none,no_highlight,prefix_nick_%s",
(str_color) ? str_color : "default");
@@ -95,32 +98,35 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, int action,
ptr_text = (text_decoded) ? text_decoded : ((text2) ? text2 : text);
if (action)
{
weechat_printf_tags (buffer,
irc_protocol_tags ("privmsg",
str_tags,
(ptr_nick) ? ptr_nick->name : ptr_server->nick,
NULL),
"%s%s%s%s%s %s",
weechat_prefix ("action"),
irc_nick_mode_for_display (ptr_server, ptr_nick, 0),
IRC_COLOR_CHAT_NICK_SELF,
ptr_server->nick,
IRC_COLOR_RESET,
ptr_text);
weechat_printf_tags (
buffer,
irc_protocol_tags (
"privmsg", str_tags,
(ptr_nick) ? ptr_nick->name : ptr_server->nick,
NULL),
"%s%s%s%s%s %s",
weechat_prefix ("action"),
irc_nick_mode_for_display (ptr_server, ptr_nick, 0),
IRC_COLOR_CHAT_NICK_SELF,
ptr_server->nick,
IRC_COLOR_RESET,
ptr_text);
}
else
{
weechat_printf_tags (buffer,
irc_protocol_tags ("privmsg",
str_tags,
(ptr_nick) ? ptr_nick->name : ptr_server->nick,
NULL),
"%s%s",
irc_nick_as_prefix (ptr_server,
(ptr_nick) ? ptr_nick : NULL,
(ptr_nick) ? NULL : ptr_server->nick,
IRC_COLOR_CHAT_NICK_SELF),
ptr_text);
weechat_printf_tags (
buffer,
irc_protocol_tags (
"privmsg", str_tags,
(ptr_nick) ? ptr_nick->name : ptr_server->nick,
NULL),
"%s%s",
irc_nick_as_prefix (
ptr_server,
(ptr_nick) ? ptr_nick : NULL,
(ptr_nick) ? NULL : ptr_server->nick,
IRC_COLOR_CHAT_NICK_SELF),
ptr_text);
}
}
@@ -217,8 +223,9 @@ irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags)
ptr_data = weechat_string_input_for_buffer (input_data);
if (!ptr_data)
ptr_data = input_data;
data_with_colors = irc_color_encode (ptr_data,
weechat_config_boolean (irc_config_network_colors_send));
data_with_colors = irc_color_encode (
ptr_data,
weechat_config_boolean (irc_config_network_colors_send));
msg = strdup ((data_with_colors) ? data_with_colors : ptr_data);
if (msg)
@@ -368,10 +375,12 @@ irc_input_send_cb (void *data, const char *signal,
else
{
/* command */
data_with_colors = irc_color_encode (ptr_message,
weechat_config_boolean (irc_config_network_colors_send));
weechat_command (ptr_buffer,
(data_with_colors) ? data_with_colors : ptr_message);
data_with_colors = irc_color_encode (
ptr_message,
weechat_config_boolean (irc_config_network_colors_send));
weechat_command (
ptr_buffer,
(data_with_colors) ? data_with_colors : ptr_message);
if (data_with_colors)
free (data_with_colors);
}
+46 -41
View File
@@ -248,13 +248,20 @@ irc_message_parse_to_hashtable (struct t_irc_server *server,
if (!hashtable)
return NULL;
weechat_hashtable_set (hashtable, "tags", (tags) ? tags : empty_str);
weechat_hashtable_set (hashtable, "message_without_tags", (message_without_tags) ? message_without_tags : empty_str);
weechat_hashtable_set (hashtable, "nick", (nick) ? nick : empty_str);
weechat_hashtable_set (hashtable, "host", (host) ? host : empty_str);
weechat_hashtable_set (hashtable, "command", (command) ? command : empty_str);
weechat_hashtable_set (hashtable, "channel", (channel) ? channel : empty_str);
weechat_hashtable_set (hashtable, "arguments", (arguments) ? arguments : empty_str);
weechat_hashtable_set (hashtable, "tags",
(tags) ? tags : empty_str);
weechat_hashtable_set (hashtable, "message_without_tags",
(message_without_tags) ? message_without_tags : empty_str);
weechat_hashtable_set (hashtable, "nick",
(nick) ? nick : empty_str);
weechat_hashtable_set (hashtable, "host",
(host) ? host : empty_str);
weechat_hashtable_set (hashtable, "command",
(command) ? command : empty_str);
weechat_hashtable_set (hashtable, "channel",
(channel) ? channel : empty_str);
weechat_hashtable_set (hashtable, "arguments",
(arguments) ? arguments : empty_str);
if (tags)
free (tags);
@@ -888,11 +895,11 @@ irc_message_split (struct t_irc_server *server, const char *message)
* ISON :nick1 nick2 nick3
* WALLOPS :some text here
*/
split_ok = irc_message_split_string (hashtable, tags, host, command,
NULL, ":",
(argv_eol[index_args][0] == ':') ?
argv_eol[index_args] + 1 : argv_eol[index_args],
NULL, ' ', max_length_host);
split_ok = irc_message_split_string (
hashtable, tags, host, command, NULL, ":",
(argv_eol[index_args][0] == ':') ?
argv_eol[index_args] + 1 : argv_eol[index_args],
NULL, ' ', max_length_host);
}
else if (weechat_strcasecmp (command, "monitor") == 0)
{
@@ -905,18 +912,17 @@ irc_message_split (struct t_irc_server *server, const char *message)
{
snprintf (monitor_action, sizeof (monitor_action),
"%c ", argv_eol[index_args][0]);
split_ok = irc_message_split_string (hashtable, tags, host, command,
NULL, monitor_action,
argv_eol[index_args] + 2,
NULL, ',', max_length_host);
split_ok = irc_message_split_string (
hashtable, tags, host, command, NULL, monitor_action,
argv_eol[index_args] + 2, NULL, ',', max_length_host);
}
else
{
split_ok = irc_message_split_string (hashtable, tags, host, command,
NULL, ":",
(argv_eol[index_args][0] == ':') ?
argv_eol[index_args] + 1 : argv_eol[index_args],
NULL, ',', max_length_host);
split_ok = irc_message_split_string (
hashtable, tags, host, command, NULL, ":",
(argv_eol[index_args][0] == ':') ?
argv_eol[index_args] + 1 : argv_eol[index_args],
NULL, ',', max_length_host);
}
}
else if (weechat_strcasecmp (command, "join") == 0)
@@ -938,12 +944,11 @@ irc_message_split (struct t_irc_server *server, const char *message)
*/
if (index_args + 1 <= argc - 1)
{
split_ok = irc_message_split_privmsg_notice (hashtable, tags, host,
command,
argv[index_args],
(argv_eol[index_args + 1][0] == ':') ?
argv_eol[index_args + 1] + 1 : argv_eol[index_args + 1],
max_length_host);
split_ok = irc_message_split_privmsg_notice (
hashtable, tags, host, command, argv[index_args],
(argv_eol[index_args + 1][0] == ':') ?
argv_eol[index_args + 1] + 1 : argv_eol[index_args + 1],
max_length_host);
}
}
else if (weechat_strcasecmp (command, "005") == 0)
@@ -951,10 +956,10 @@ irc_message_split (struct t_irc_server *server, const char *message)
/* :server 005 nick MODES=4 CHANLIMIT=#:20 NICKLEN=16 USERLEN=10 ... */
if (index_args + 1 <= argc - 1)
{
split_ok = irc_message_split_005 (hashtable, tags, host, command,
argv[index_args],
(argv_eol[index_args + 1][0] == ':') ?
argv_eol[index_args + 1] + 1 : argv_eol[index_args + 1]);
split_ok = irc_message_split_005 (
hashtable, tags, host, command, argv[index_args],
(argv_eol[index_args + 1][0] == ':') ?
argv_eol[index_args + 1] + 1 : argv_eol[index_args + 1]);
}
}
else if (weechat_strcasecmp (command, "353") == 0)
@@ -969,11 +974,11 @@ irc_message_split (struct t_irc_server *server, const char *message)
{
snprintf (target, sizeof (target), "%s %s",
argv[index_args], argv[index_args + 1]);
split_ok = irc_message_split_string (hashtable, tags, host,
command, target, ":",
(argv_eol[index_args + 2][0] == ':') ?
argv_eol[index_args + 2] + 1 : argv_eol[index_args + 2],
NULL, ' ', -1);
split_ok = irc_message_split_string (
hashtable, tags, host, command, target, ":",
(argv_eol[index_args + 2][0] == ':') ?
argv_eol[index_args + 2] + 1 : argv_eol[index_args + 2],
NULL, ' ', -1);
}
else
{
@@ -982,11 +987,11 @@ irc_message_split (struct t_irc_server *server, const char *message)
snprintf (target, sizeof (target), "%s %s %s",
argv[index_args], argv[index_args + 1],
argv[index_args + 2]);
split_ok = irc_message_split_string (hashtable, tags, host,
command, target, ":",
(argv_eol[index_args + 3][0] == ':') ?
argv_eol[index_args + 3] + 1 : argv_eol[index_args + 3],
NULL, ' ', -1);
split_ok = irc_message_split_string (
hashtable, tags, host, command, target, ":",
(argv_eol[index_args + 3][0] == ':') ?
argv_eol[index_args + 3] + 1 : argv_eol[index_args + 3],
NULL, ' ', -1);
}
}
}
+4 -3
View File
@@ -959,12 +959,13 @@ irc_nick_mode_for_display (struct t_irc_server *server, struct t_irc_nick *nick,
{
str_prefix[0] = '\0';
}
str_prefix_color = weechat_color (irc_nick_get_prefix_color_name (server,
nick->prefix[0]));
str_prefix_color = weechat_color (
irc_nick_get_prefix_color_name (server, nick->prefix[0]));
}
else
{
str_prefix[0] = (prefix && weechat_config_boolean (irc_config_look_nick_mode_empty)) ?
str_prefix[0] = (prefix
&& weechat_config_boolean (irc_config_look_nick_mode_empty)) ?
' ' : '\0';
str_prefix_color = IRC_COLOR_RESET;
}
+82 -83
View File
@@ -505,38 +505,40 @@ irc_notify_display (struct t_irc_server *server, struct t_gui_buffer *buffer,
if ((notify->is_on_server < 0)
|| (!notify->is_on_server && !notify->away_message))
{
weechat_printf (buffer,
" %s%s%s @ %s%s%s: %s%s",
irc_nick_color_for_msg (server, 1, NULL, notify->nick),
notify->nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_SERVER,
notify->server->name,
IRC_COLOR_RESET,
(notify->is_on_server < 0) ? "" : IRC_COLOR_MESSAGE_QUIT,
(notify->is_on_server < 0) ?
/* TRANSLATORS: "unknown" is the status for /notify when ison answer has not been received (check pending) */
_("unknown") :
_("offline"));
weechat_printf (
buffer,
" %s%s%s @ %s%s%s: %s%s",
irc_nick_color_for_msg (server, 1, NULL, notify->nick),
notify->nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_SERVER,
notify->server->name,
IRC_COLOR_RESET,
(notify->is_on_server < 0) ? "" : IRC_COLOR_MESSAGE_QUIT,
(notify->is_on_server < 0) ?
/* TRANSLATORS: "unknown" is the status for /notify when ison answer has not been received (check pending) */
_("unknown") :
_("offline"));
}
else
{
weechat_printf (buffer,
" %s%s%s @ %s%s%s: %s%s %s%s%s%s%s%s",
irc_nick_color_for_msg (server, 1, NULL, notify->nick),
notify->nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_SERVER,
notify->server->name,
IRC_COLOR_RESET,
IRC_COLOR_MESSAGE_JOIN,
_("online"),
IRC_COLOR_RESET,
(notify->away_message) ? " (" : "",
(notify->away_message) ? _("away") : "",
(notify->away_message) ? ": \"" : "",
(notify->away_message) ? notify->away_message : "",
(notify->away_message) ? "\")" : "");
weechat_printf (
buffer,
" %s%s%s @ %s%s%s: %s%s %s%s%s%s%s%s",
irc_nick_color_for_msg (server, 1, NULL, notify->nick),
notify->nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_SERVER,
notify->server->name,
IRC_COLOR_RESET,
IRC_COLOR_MESSAGE_JOIN,
_("online"),
IRC_COLOR_RESET,
(notify->away_message) ? " (" : "",
(notify->away_message) ? _("away") : "",
(notify->away_message) ? ": \"" : "",
(notify->away_message) ? notify->away_message : "",
(notify->away_message) ? "\")" : "");
}
}
@@ -670,28 +672,28 @@ irc_notify_set_is_on_server (struct t_irc_notify *notify, const char *host,
if (notify->is_on_server == is_on_server)
return;
weechat_printf_tags (notify->server->buffer,
irc_notify_get_tags (irc_config_look_notify_tags_ison,
(is_on_server) ? "join" : "quit",
notify->nick),
(notify->is_on_server < 0) ?
((is_on_server) ?
_("%snotify: %s%s%s%s%s%s%s%s%s is connected") :
_("%snotify: %s%s%s%s%s%s%s%s%s is offline")) :
((is_on_server) ?
_("%snotify: %s%s%s%s%s%s%s%s%s has connected") :
_("%snotify: %s%s%s%s%s%s%s%s%s has quit")),
weechat_prefix ("network"),
irc_nick_color_for_msg (notify->server, 1, NULL,
notify->nick),
notify->nick,
(host && host[0]) ? IRC_COLOR_CHAT_DELIMITERS : "",
(host && host[0]) ? " (" : "",
(host && host[0]) ? IRC_COLOR_CHAT_HOST : "",
(host && host[0]) ? host : "",
(host && host[0]) ? IRC_COLOR_CHAT_DELIMITERS : "",
(host && host[0]) ? ")" : "",
(is_on_server) ? IRC_COLOR_MESSAGE_JOIN : IRC_COLOR_MESSAGE_QUIT);
weechat_printf_tags (
notify->server->buffer,
irc_notify_get_tags (irc_config_look_notify_tags_ison,
(is_on_server) ? "join" : "quit",
notify->nick),
(notify->is_on_server < 0) ?
((is_on_server) ?
_("%snotify: %s%s%s%s%s%s%s%s%s is connected") :
_("%snotify: %s%s%s%s%s%s%s%s%s is offline")) :
((is_on_server) ?
_("%snotify: %s%s%s%s%s%s%s%s%s has connected") :
_("%snotify: %s%s%s%s%s%s%s%s%s has quit")),
weechat_prefix ("network"),
irc_nick_color_for_msg (notify->server, 1, NULL, notify->nick),
notify->nick,
(host && host[0]) ? IRC_COLOR_CHAT_DELIMITERS : "",
(host && host[0]) ? " (" : "",
(host && host[0]) ? IRC_COLOR_CHAT_HOST : "",
(host && host[0]) ? host : "",
(host && host[0]) ? IRC_COLOR_CHAT_DELIMITERS : "",
(host && host[0]) ? ")" : "",
(is_on_server) ? IRC_COLOR_MESSAGE_JOIN : IRC_COLOR_MESSAGE_QUIT);
irc_notify_send_signal (notify, (is_on_server) ? "join" : "quit", NULL);
notify->is_on_server = is_on_server;
@@ -717,46 +719,43 @@ irc_notify_set_away_message (struct t_irc_notify *notify,
if (!notify->away_message && away_message)
{
weechat_printf_tags (notify->server->buffer,
irc_notify_get_tags (irc_config_look_notify_tags_whois,
"away",
notify->nick),
_("%snotify: %s%s%s is now away: \"%s\""),
weechat_prefix ("network"),
irc_nick_color_for_msg (notify->server, 1, NULL,
notify->nick),
notify->nick,
IRC_COLOR_RESET,
away_message);
weechat_printf_tags (
notify->server->buffer,
irc_notify_get_tags (
irc_config_look_notify_tags_whois, "away", notify->nick),
_("%snotify: %s%s%s is now away: \"%s\""),
weechat_prefix ("network"),
irc_nick_color_for_msg (notify->server, 1, NULL, notify->nick),
notify->nick,
IRC_COLOR_RESET,
away_message);
irc_notify_send_signal (notify, "away", away_message);
}
else if (notify->away_message && !away_message)
{
weechat_printf_tags (notify->server->buffer,
irc_notify_get_tags (irc_config_look_notify_tags_whois,
"back",
notify->nick),
_("%snotify: %s%s%s is back"),
weechat_prefix ("network"),
irc_nick_color_for_msg (notify->server, 1, NULL,
notify->nick),
notify->nick,
IRC_COLOR_RESET);
weechat_printf_tags (
notify->server->buffer,
irc_notify_get_tags (
irc_config_look_notify_tags_whois, "back", notify->nick),
_("%snotify: %s%s%s is back"),
weechat_prefix ("network"),
irc_nick_color_for_msg (notify->server, 1, NULL, notify->nick),
notify->nick,
IRC_COLOR_RESET);
irc_notify_send_signal (notify, "back", NULL);
}
else if (notify->away_message && away_message)
{
weechat_printf_tags (notify->server->buffer,
irc_notify_get_tags (irc_config_look_notify_tags_whois,
"still_away",
notify->nick),
_("%snotify: %s%s%s is still away: \"%s\""),
weechat_prefix ("network"),
irc_nick_color_for_msg (notify->server, 1, NULL,
notify->nick),
notify->nick,
IRC_COLOR_RESET,
away_message);
weechat_printf_tags (
notify->server->buffer,
irc_notify_get_tags (
irc_config_look_notify_tags_whois, "still_away", notify->nick),
_("%snotify: %s%s%s is still away: \"%s\""),
weechat_prefix ("network"),
irc_nick_color_for_msg (notify->server, 1, NULL, notify->nick),
notify->nick,
IRC_COLOR_RESET,
away_message);
irc_notify_send_signal (notify, "still_away", away_message);
}
File diff suppressed because it is too large Load Diff
+54 -47
View File
@@ -293,10 +293,10 @@ irc_redirect_pattern_new (const char *name, int temp_pattern, int timeout,
if (!cmd_stop || !cmd_stop[0])
{
weechat_printf (NULL,
_("%s%s: missing argument \"%s\" for redirect pattern"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
"cmd_stop");
weechat_printf (
NULL,
_("%s%s: missing argument \"%s\" for redirect pattern"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "cmd_stop");
return NULL;
}
@@ -304,10 +304,10 @@ irc_redirect_pattern_new (const char *name, int temp_pattern, int timeout,
ptr_redirect_pattern = irc_redirect_pattern_search (name);
if (ptr_redirect_pattern)
{
weechat_printf (NULL,
_("%s%s: redirect pattern \"%s\" already exists"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
name);
weechat_printf (
NULL,
_("%s%s: redirect pattern \"%s\" already exists"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, name);
return NULL;
}
@@ -512,42 +512,48 @@ irc_redirect_new (struct t_irc_server *server,
if (!server->is_connected)
{
weechat_printf (NULL,
_("%s%s: no connection to server \"%s\" for redirect"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
server->name);
weechat_printf (
NULL,
_("%s%s: no connection to server \"%s\" for redirect"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, server->name);
return NULL;
}
if (!pattern || !pattern[0])
{
weechat_printf (NULL, _("%s%s: missing argument \"%s\" for redirect"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "pattern");
weechat_printf (
NULL,
_("%s%s: missing argument \"%s\" for redirect"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "pattern");
return NULL;
}
if (!signal || !signal[0])
{
weechat_printf (NULL, _("%s%s: missing argument \"%s\" for redirect"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "signal");
weechat_printf (
NULL,
_("%s%s: missing argument \"%s\" for redirect"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "signal");
return NULL;
}
ptr_redirect_pattern = irc_redirect_pattern_search (pattern);
if (!ptr_redirect_pattern)
{
weechat_printf (NULL, _("%s%s: redirect pattern \"%s\" not found"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
pattern);
weechat_printf (
NULL,
_("%s%s: redirect pattern \"%s\" not found"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, pattern);
return NULL;
}
new_redirect = irc_redirect_new_with_commands (server, pattern, signal,
count, string,
(timeout > 0) ? timeout : ptr_redirect_pattern->timeout,
ptr_redirect_pattern->cmd_start,
ptr_redirect_pattern->cmd_stop,
ptr_redirect_pattern->cmd_extra,
cmd_filter);
new_redirect = irc_redirect_new_with_commands (
server, pattern, signal,
count, string,
(timeout > 0) ? timeout : ptr_redirect_pattern->timeout,
ptr_redirect_pattern->cmd_start,
ptr_redirect_pattern->cmd_stop,
ptr_redirect_pattern->cmd_extra,
cmd_filter);
/*
* remove redirect pattern if it is temporary (created by external
@@ -615,13 +621,12 @@ irc_redirect_init_command (struct t_irc_redirect *redirect,
if (weechat_irc_plugin->debug >= 2)
{
weechat_printf (redirect->server->buffer,
_("%s: starting redirection for command \"%s\" "
"on server \"%s\" (redirect pattern: \"%s\")"),
IRC_PLUGIN_NAME,
redirect->command,
redirect->server->name,
redirect->pattern);
weechat_printf (
redirect->server->buffer,
_("%s: starting redirection for command \"%s\" on server \"%s\" "
"(redirect pattern: \"%s\")"),
IRC_PLUGIN_NAME, redirect->command, redirect->server->name,
redirect->pattern);
}
}
@@ -1254,19 +1259,19 @@ irc_redirect_pattern_hsignal_cb (void *data, const char *signal,
if (!pattern || !pattern[0])
{
weechat_printf (NULL,
_("%s%s: missing argument \"%s\" for redirect "
"pattern"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "pattern");
weechat_printf (
NULL,
_("%s%s: missing argument \"%s\" for redirect pattern"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "pattern");
return WEECHAT_RC_ERROR;
}
if (!cmd_stop || !cmd_stop[0])
{
weechat_printf (NULL,
_("%s%s: missing argument \"%s\" for redirect "
"pattern"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "cmd_stop");
weechat_printf (
NULL,
_("%s%s: missing argument \"%s\" for redirect pattern"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "cmd_stop");
return WEECHAT_RC_ERROR;
}
@@ -1322,17 +1327,19 @@ irc_redirect_command_hsignal_cb (void *data, const char *signal,
if (!server || !server[0])
{
weechat_printf (NULL,
_("%s%s: missing argument \"%s\" for redirect"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "server");
weechat_printf (
NULL,
_("%s%s: missing argument \"%s\" for redirect"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "server");
return WEECHAT_RC_ERROR;
}
ptr_server = irc_server_search (server);
if (!ptr_server)
{
weechat_printf (NULL,
_("%s%s: server \"%s\" not found for redirect"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, server);
weechat_printf (
NULL,
_("%s%s: server \"%s\" not found for redirect"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, server);
return WEECHAT_RC_ERROR;
}
File diff suppressed because it is too large Load Diff
+31 -28
View File
@@ -77,8 +77,9 @@ irc_signal_quit_cb (void *data, const char *signal, const char *type_data,
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
irc_command_quit_server (ptr_server,
(signal_data) ? (char *)signal_data : NULL);
irc_command_quit_server (
ptr_server,
(signal_data) ? (char *)signal_data : NULL);
}
}
@@ -110,20 +111,20 @@ irc_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
ptr_server = ptr_server->next_server)
{
/*
* FIXME: it's not possible to upgrade with SSL servers connected (GnuTLS
* lib can't reload data after upgrade), so we close connection for
* all SSL servers currently connected
* FIXME: it's not possible to upgrade with SSL servers connected
* (GnuTLS library can't reload data after upgrade), so we close
* connection for all SSL servers currently connected
*/
if (ptr_server->is_connected && (ptr_server->ssl_connected || quit))
{
if (!quit)
{
ssl_disconnected++;
weechat_printf (ptr_server->buffer,
_("%s%s: disconnecting from server because upgrade "
"can't work for servers connected via SSL"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME);
weechat_printf (
ptr_server->buffer,
_("%s%s: disconnecting from server because upgrade can't "
"work for servers connected via SSL"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
}
irc_server_disconnect (ptr_server, 0, 0);
/*
@@ -137,13 +138,15 @@ irc_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
}
if (ssl_disconnected > 0)
{
weechat_printf (NULL,
/* TRANSLATORS: "%s" after "%d" is "server" or "servers" */
_("%s%s: disconnected from %d %s (SSL connection "
"not supported with upgrade)"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
ssl_disconnected,
NG_("server", "servers", ssl_disconnected));
weechat_printf (
NULL,
/* TRANSLATORS: "%s" after "%d" is "server" or "servers" */
_("%s%s: disconnected from %d %s (SSL connection not supported "
"with upgrade)"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME,
ssl_disconnected,
NG_("server", "servers", ssl_disconnected));
}
return WEECHAT_RC_OK;
@@ -210,12 +213,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
if (!irc_server_alloc_with_url (argv[i]))
{
weechat_printf (NULL,
_("%s%s: unable to create temporary server "
"\"%s\" (check if there is already a server "
"with this name)"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
argv[i]);
weechat_printf (
NULL,
_("%s%s: unable to create temporary server \"%s\" (check "
"if there is already a server with this name)"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, argv[i]);
}
}
else if (weechat_strcasecmp (argv[i], "--upgrade") == 0)
@@ -228,11 +230,12 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
if (!irc_upgrade_load ())
{
weechat_printf (NULL,
_("%s%s: WARNING: some network connections may "
"still be opened and not visible, you should "
"restart WeeChat now (with /quit)."),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
weechat_printf (
NULL,
_("%s%s: WARNING: some network connections may still be "
"opened and not visible, you should restart WeeChat now "
"(with /quit)."),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
}
}
else