diff options
-rw-r--r-- | src/plugins/irc/irc-bar-item.c | 8 | ||||
-rw-r--r-- | src/plugins/irc/irc-channel.c | 103 | ||||
-rw-r--r-- | src/plugins/irc/irc-command.c | 1062 | ||||
-rw-r--r-- | src/plugins/irc/irc-completion.c | 15 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.c | 269 | ||||
-rw-r--r-- | src/plugins/irc/irc-ctcp.c | 399 | ||||
-rw-r--r-- | src/plugins/irc/irc-info.c | 40 | ||||
-rw-r--r-- | src/plugins/irc/irc-input.c | 73 | ||||
-rw-r--r-- | src/plugins/irc/irc-message.c | 87 | ||||
-rw-r--r-- | src/plugins/irc/irc-nick.c | 7 | ||||
-rw-r--r-- | src/plugins/irc/irc-notify.c | 165 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 2750 | ||||
-rw-r--r-- | src/plugins/irc/irc-redirect.c | 101 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 1087 | ||||
-rw-r--r-- | src/plugins/irc/irc.c | 59 |
15 files changed, 3151 insertions, 3074 deletions
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c index 26cbbd3e9..62af8e6d0 100644 --- a/src/plugins/irc/irc-bar-item.c +++ b/src/plugins/irc/irc-bar-item.c @@ -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); } } diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index dcbbf1591..13ef73e80 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -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; } diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 60ceea56f..87e9c6cf0 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -92,11 +92,11 @@ irc_command_mode_nicks (struct t_irc_server *server, { if (strcmp (argv[i], "*") == 0) { - weechat_printf (NULL, - _("%s%s: \"-yes\" argument is required for " - "nick \"*\" (security reason), see /help %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - command); + weechat_printf ( + NULL, + _("%s%s: \"-yes\" argument is required for nick \"*\" " + "(security reason), see /help %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, command); return; } } @@ -333,11 +333,11 @@ irc_command_exec_all_channels (struct t_irc_server *server, } if (!excluded) { - cmd_vars_replaced = irc_message_replace_vars (ptr_server, - ptr_channel->name, - str_command); + cmd_vars_replaced = irc_message_replace_vars ( + ptr_server, ptr_channel->name, str_command); weechat_command (ptr_channel->buffer, - (cmd_vars_replaced) ? cmd_vars_replaced : str_command); + (cmd_vars_replaced) ? + cmd_vars_replaced : str_command); if (cmd_vars_replaced) free (cmd_vars_replaced); } @@ -517,7 +517,8 @@ irc_command_exec_all_servers (const char *exclude_servers, const char *command) NULL, str_command); weechat_command (ptr_server->buffer, - (cmd_vars_replaced) ? cmd_vars_replaced : str_command); + (cmd_vars_replaced) ? + cmd_vars_replaced : str_command); if (cmd_vars_replaced) free (cmd_vars_replaced); } @@ -588,19 +589,18 @@ irc_command_me_channel_display (struct t_irc_server *server, irc_color_decode (arguments, weechat_config_boolean (irc_config_network_colors_send)) : NULL; ptr_nick = irc_nick_search (server, channel, server->nick); - weechat_printf_tags (channel->buffer, - irc_protocol_tags ("privmsg", - "irc_action,notify_none,no_highlight", - server->nick, - NULL), - "%s%s%s%s%s%s%s", - weechat_prefix ("action"), - irc_nick_mode_for_display (server, ptr_nick, 0), - IRC_COLOR_CHAT_NICK_SELF, - server->nick, - (string) ? IRC_COLOR_RESET : "", - (string) ? " " : "", - (string) ? string : ""); + weechat_printf_tags ( + channel->buffer, + irc_protocol_tags ("privmsg", "irc_action,notify_none,no_highlight", + server->nick, NULL), + "%s%s%s%s%s%s%s", + weechat_prefix ("action"), + irc_nick_mode_for_display (server, ptr_nick, 0), + IRC_COLOR_CHAT_NICK_SELF, + server->nick, + (string) ? IRC_COLOR_RESET : "", + (string) ? " " : "", + (string) ? string : ""); if (string) free (string); } @@ -619,12 +619,13 @@ irc_command_me_channel (struct t_irc_server *server, char hash_key[32]; const char *str_args; - hashtable = irc_server_sendf (server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_HASHTABLE, - NULL, - "PRIVMSG %s :\01ACTION %s\01", - channel->name, - (arguments && arguments[0]) ? arguments : ""); + hashtable = irc_server_sendf ( + server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_HASHTABLE, + NULL, + "PRIVMSG %s :\01ACTION %s\01", + channel->name, + (arguments && arguments[0]) ? arguments : ""); if (hashtable) { number = 1; @@ -970,11 +971,11 @@ irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc, pos_channel = ptr_channel->name; else { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "ban"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "ban"); return WEECHAT_RC_OK; } } @@ -1000,10 +1001,11 @@ irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc, { if (!ptr_channel) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, "ban"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "ban"); return WEECHAT_RC_OK; } irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, @@ -1030,20 +1032,18 @@ irc_command_connect_one_server (struct t_irc_server *server, if (server->is_connected) { - weechat_printf (NULL, - _("%s%s: already connected to server " - "\"%s\"!"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - server->name); + weechat_printf ( + NULL, + _("%s%s: already connected to server \"%s\"!"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, server->name); return 0; } if (server->hook_connect) { - weechat_printf (NULL, - _("%s%s: currently connecting to server " - "\"%s\"!"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - server->name); + weechat_printf ( + NULL, + _("%s%s: currently connecting to server \"%s\"!"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, server->name); return 0; } @@ -1197,15 +1197,17 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc, if (ptr_server) { ptr_server->temp_server = 1; - weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_ADDRESSES], - argv[i], 1); - weechat_printf (NULL, - _("%s: server %s%s%s created " - "(temporary server, NOT SAVED!)"), - IRC_PLUGIN_NAME, - IRC_COLOR_CHAT_SERVER, - ptr_server->name, - IRC_COLOR_RESET); + weechat_config_option_set ( + ptr_server->options[IRC_SERVER_OPTION_ADDRESSES], + argv[i], 1); + weechat_printf ( + NULL, + _("%s: server %s%s%s created (temporary " + "server, NOT SAVED!)"), + IRC_PLUGIN_NAME, + IRC_COLOR_CHAT_SERVER, + ptr_server->name, + IRC_COLOR_RESET); irc_server_apply_command_line_options (ptr_server, argc, argv); if (!irc_command_connect_one_server (ptr_server, 0, 0)) @@ -1214,12 +1216,12 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc, } if (!ptr_server) { - 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 @@ -1292,20 +1294,19 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc, irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "PRIVMSG %s :\01PING %s\01", argv[1], str_time); - weechat_printf (irc_msgbuffer_get_target_buffer (ptr_server, - argv[1], - NULL, "ctcp", - NULL), - _("%sCTCP query to %s%s%s: %s%s%s%s%s"), - weechat_prefix ("network"), - irc_nick_color_for_msg (ptr_server, 0, NULL, argv[1]), - argv[1], - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - irc_cmd, - IRC_COLOR_RESET, - " ", - str_time); + weechat_printf ( + irc_msgbuffer_get_target_buffer ( + ptr_server, argv[1], NULL, "ctcp", NULL), + _("%sCTCP query to %s%s%s: %s%s%s%s%s"), + weechat_prefix ("network"), + irc_nick_color_for_msg (ptr_server, 0, NULL, argv[1]), + argv[1], + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + irc_cmd, + IRC_COLOR_RESET, + " ", + str_time); } else { @@ -1315,20 +1316,19 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc, irc_cmd, (argv_eol[3]) ? " " : "", (argv_eol[3]) ? argv_eol[3] : ""); - weechat_printf (irc_msgbuffer_get_target_buffer (ptr_server, - argv[1], - NULL, "ctcp", - NULL), - _("%sCTCP query to %s%s%s: %s%s%s%s%s"), - weechat_prefix ("network"), - irc_nick_color_for_msg (ptr_server, 0, NULL, argv[1]), - argv[1], - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - irc_cmd, - IRC_COLOR_RESET, - (argv_eol[3]) ? " " : "", - (argv_eol[3]) ? argv_eol[3] : ""); + weechat_printf ( + irc_msgbuffer_get_target_buffer ( + ptr_server, argv[1], NULL, "ctcp", NULL), + _("%sCTCP query to %s%s%s: %s%s%s%s%s"), + weechat_prefix ("network"), + irc_nick_color_for_msg (ptr_server, 0, NULL, argv[1]), + argv[1], + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + irc_cmd, + IRC_COLOR_RESET, + (argv_eol[3]) ? " " : "", + (argv_eol[3]) ? argv_eol[3] : ""); } free (irc_cmd); @@ -1381,11 +1381,11 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc, { if (!ptr_channel) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can not be executed " - "on a server buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "cycle"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can not be executed on a server " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "cycle"); return WEECHAT_RC_OK; } @@ -1402,10 +1402,11 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc, { if (!ptr_channel) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can not be executed on " - "a server buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, "part"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can not be executed on a server " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "part"); return WEECHAT_RC_OK; } @@ -1472,11 +1473,11 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc, sizeof (str_address), NULL, 0, NI_NUMERICHOST); if (rc != 0) { - weechat_printf (ptr_server->buffer, - _("%s%s: unable to resolve local address of server " - "socket: error %d %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - rc, gai_strerror (rc)); + weechat_printf ( + ptr_server->buffer, + _("%s%s: unable to resolve local address of server socket: error " + "%d %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, rc, gai_strerror (rc)); return WEECHAT_RC_OK; } @@ -1559,10 +1560,10 @@ irc_command_dehalfop (void *data, struct t_gui_buffer *buffer, int argc, if (!ptr_channel || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be executed in " - "a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, "dehalfop"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "dehalfop"); return WEECHAT_RC_OK; } @@ -1599,10 +1600,10 @@ irc_command_deop (void *data, struct t_gui_buffer *buffer, int argc, if (!ptr_channel || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be executed in " - "a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, "deop"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "deop"); return WEECHAT_RC_OK; } @@ -1639,10 +1640,10 @@ irc_command_devoice (void *data, struct t_gui_buffer *buffer, int argc, if (!ptr_channel || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, "devoice"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "devoice"); return WEECHAT_RC_OK; } @@ -1741,17 +1742,18 @@ irc_command_disconnect_one_server (struct t_irc_server *server, if ((!server->is_connected) && (!server->hook_connect) && (!server->hook_fd) && (server->reconnect_start == 0)) { - weechat_printf (server->buffer, - _("%s%s: not connected to server \"%s\"!"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - server->name); + weechat_printf ( + server->buffer, + _("%s%s: not connected to server \"%s\"!"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, server->name); return 0; } if (server->reconnect_start > 0) { - weechat_printf (server->buffer, - _("%s: auto-reconnection is cancelled"), - IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s: auto-reconnection is cancelled"), + IRC_PLUGIN_NAME); } irc_command_quit_server (server, reason); irc_server_disconnect (server, 0, 0); @@ -1826,10 +1828,10 @@ irc_command_disconnect (void *data, struct t_gui_buffer *buffer, int argc, } else { - weechat_printf (NULL, - _("%s%s: server \"%s\" not found"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[1]); + weechat_printf ( + NULL, + _("%s%s: server \"%s\" not found"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, argv[1]); disconnect_ok = 0; } } @@ -1856,10 +1858,10 @@ irc_command_halfop (void *data, struct t_gui_buffer *buffer, int argc, if (!ptr_channel || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, "halfop"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "halfop"); return WEECHAT_RC_OK; } @@ -1890,16 +1892,17 @@ irc_command_ignore_display (struct t_irc_ignore *ignore) mask = weechat_strndup (ignore->mask + 1, strlen (ignore->mask) - 2); - weechat_printf (NULL, - _(" %s[%s%d%s]%s mask: %s / server: %s / channel: %s"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - ignore->number, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (mask) ? mask : ignore->mask, - (ignore->server) ? ignore->server : "*", - (ignore->channel) ? ignore->channel : "*"); + weechat_printf ( + NULL, + _(" %s[%s%d%s]%s mask: %s / server: %s / channel: %s"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + ignore->number, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (mask) ? mask : ignore->mask, + (ignore->server) ? ignore->server : "*", + (ignore->channel) ? ignore->channel : "*"); if (mask) free (mask); @@ -2157,11 +2160,10 @@ irc_command_invite (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; error: - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "invite"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "invite"); return WEECHAT_RC_OK; } @@ -2205,11 +2207,10 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments, if (server->sock < 0) { - weechat_printf (NULL, - _("%s%s: command \"%s\" must be executed on " - "connected irc server"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "join"); + weechat_printf ( + NULL, + _("%s%s: command \"%s\" must be executed on connected irc server"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "join"); return; } @@ -2451,11 +2452,11 @@ irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc, { if (!ptr_channel || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "kick"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "kick"); return WEECHAT_RC_OK; } pos_channel = ptr_channel->name; @@ -2502,11 +2503,11 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc, { if (!ptr_channel || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "kickban"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "kickban"); return WEECHAT_RC_OK; } pos_channel = ptr_channel->name; @@ -2528,9 +2529,10 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc, if (strcmp (nick_only, "*") == 0) { - weechat_printf (ptr_server->buffer, - _("%s%s: mask must begin with nick"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + ptr_server->buffer, + _("%s%s: mask must begin with nick"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); free (nick_only); return WEECHAT_RC_OK; } @@ -2683,28 +2685,31 @@ irc_command_list (void *data, struct t_gui_buffer *buffer, int argc, { if (ptr_regex) { - ptr_server->cmd_list_regexp = malloc (sizeof (*ptr_server->cmd_list_regexp)); + ptr_server->cmd_list_regexp = malloc ( + sizeof (*ptr_server->cmd_list_regexp)); if (ptr_server->cmd_list_regexp) { - if ((ret = weechat_string_regcomp (ptr_server->cmd_list_regexp, ptr_regex, - REG_EXTENDED | REG_ICASE | REG_NOSUB)) != 0) + if ((ret = weechat_string_regcomp ( + ptr_server->cmd_list_regexp, ptr_regex, + REG_EXTENDED | REG_ICASE | REG_NOSUB)) != 0) { regerror (ret, ptr_server->cmd_list_regexp, buf, sizeof(buf)); - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" is not a valid regular " - "expression (%s)"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv_eol[1], buf); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" is not a valid regular expression " + "(%s)"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + argv_eol[1], buf); return WEECHAT_RC_OK; } } else { - weechat_printf (ptr_server->buffer, - _("%s%s: not enough memory for regular " - "expression"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + ptr_server->buffer, + _("%s%s: not enough memory for regular expression"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); return WEECHAT_RC_OK; } } @@ -2801,10 +2806,10 @@ irc_command_me (void *data, struct t_gui_buffer *buffer, int argc, char **argv, if (!ptr_channel) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can not be executed " - "on a server buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, "me"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can not be executed on a server buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "me"); return WEECHAT_RC_OK; } @@ -2864,11 +2869,11 @@ irc_command_mode (void *data, struct t_gui_buffer *buffer, int argc, /* channel not specified, check we are on channel and use it */ if (!ptr_channel) { - weechat_printf (ptr_server->buffer, - _("%s%s: you must specify channel for \"%s\" " - "command if you're not in a channel"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "mode"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: you must specify channel for \"%s\" command if " + "you're not in a channel"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "mode"); return WEECHAT_RC_OK; } irc_command_mode_server (ptr_server, "MODE", ptr_channel, @@ -2975,12 +2980,11 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, || ((ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL) && (ptr_channel->type != IRC_CHANNEL_TYPE_PRIVATE))) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel or private " - "buffer"), - weechat_prefix ("error"), - IRC_PLUGIN_NAME, "msg *"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "or private buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "msg *"); return WEECHAT_RC_OK; } string = irc_color_decode (argv_eol[arg_text], @@ -3018,31 +3022,34 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, { if (ptr_channel) { - string = irc_color_decode (argv_eol[arg_text], - weechat_config_boolean (irc_config_network_colors_send)); + string = irc_color_decode ( + argv_eol[arg_text], + weechat_config_boolean (irc_config_network_colors_send)); if (status_msg) { /* * message to channel ops/voiced * (to "@#channel" or "+#channel") */ - weechat_printf_tags (ptr_channel->buffer, - "notify_none,no_highlight", - "%s%s%s -> %s%s%s: %s", - weechat_prefix ("network"), - "Msg", - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - targets[i], - IRC_COLOR_RESET, - (string) ? string : argv_eol[arg_text]); + weechat_printf_tags ( + ptr_channel->buffer, + "notify_none,no_highlight", + "%s%s%s -> %s%s%s: %s", + weechat_prefix ("network"), + "Msg", + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + targets[i], + IRC_COLOR_RESET, + (string) ? string : argv_eol[arg_text]); } else { /* standard message (to "#channel") */ - irc_input_user_message_display (ptr_channel->buffer, - 0, - (string) ? string : argv_eol[arg_text]); + irc_input_user_message_display ( + ptr_channel->buffer, + 0, + (string) ? string : argv_eol[arg_text]); } if (string) free (string); @@ -3071,24 +3078,26 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, if (hide_password) { /* hide password in message displayed using modifier */ - msg_pwd_hidden = weechat_hook_modifier_exec ("irc_message_auth", - ptr_server->name, - argv_eol[arg_text]); + msg_pwd_hidden = weechat_hook_modifier_exec ( + "irc_message_auth", + ptr_server->name, + argv_eol[arg_text]); string = irc_color_decode ( (msg_pwd_hidden) ? msg_pwd_hidden : argv_eol[arg_text], weechat_config_boolean (irc_config_network_colors_send)); - weechat_printf (ptr_server->buffer, - "%sMSG%s(%s%s%s)%s: %s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (ptr_server, 0, - NULL, targets[i]), - targets[i], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (string) ? - string : ((msg_pwd_hidden) ? - msg_pwd_hidden : argv_eol[arg_text])); + weechat_printf ( + ptr_server->buffer, + "%sMSG%s(%s%s%s)%s: %s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (ptr_server, 0, NULL, + targets[i]), + targets[i], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (string) ? + string : ((msg_pwd_hidden) ? + msg_pwd_hidden : argv_eol[arg_text])); if (string) free (string); if (msg_pwd_hidden) @@ -3096,33 +3105,34 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, } else { - string = irc_color_decode (argv_eol[arg_text], - weechat_config_boolean (irc_config_network_colors_send)); + string = irc_color_decode ( + argv_eol[arg_text], + weechat_config_boolean (irc_config_network_colors_send)); ptr_channel = irc_channel_search (ptr_server, targets[i]); if (ptr_channel) { - irc_input_user_message_display (ptr_channel->buffer, - 0, - (string) ? string : argv_eol[arg_text]); + irc_input_user_message_display ( + ptr_channel->buffer, + 0, + (string) ? string : argv_eol[arg_text]); } else { - weechat_printf_tags (ptr_server->buffer, - irc_protocol_tags ("privmsg", - "notify_none,no_highlight", - ptr_server->nick, - NULL), - "%sMSG%s(%s%s%s)%s: %s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (ptr_server, 0, - NULL, - targets[i]), - targets[i], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (string) ? string : argv_eol[arg_text]); + weechat_printf_tags ( + ptr_server->buffer, + irc_protocol_tags ( + "privmsg", "notify_none,no_highlight", + ptr_server->nick, NULL), + "%sMSG%s(%s%s%s)%s: %s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg ( + ptr_server, 0, NULL, targets[i]), + targets[i], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (string) ? string : argv_eol[arg_text]); } if (string) free (string); @@ -3164,11 +3174,11 @@ irc_command_names (void *data, struct t_gui_buffer *buffer, int argc, { if (!ptr_channel || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "names"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "names"); return WEECHAT_RC_OK; } irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, @@ -3275,11 +3285,12 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc, if (ptr_channel) is_channel = 1; } - hashtable = irc_server_sendf (ptr_server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_HASHTABLE, - NULL, - "NOTICE %s :%s", - argv[arg_target], argv_eol[arg_text]); + hashtable = irc_server_sendf ( + ptr_server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_HASHTABLE, + NULL, + "NOTICE %s :%s", + argv[arg_target], argv_eol[arg_text]); if (hashtable) { number = 1; @@ -3289,24 +3300,24 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc, str_args = weechat_hashtable_get (hashtable, hash_key); if (!str_args) break; - string = irc_color_decode (str_args, - weechat_config_boolean (irc_config_network_colors_send)); - weechat_printf_tags (irc_msgbuffer_get_target_buffer (ptr_server, - argv[arg_target], - "notice", - NULL, - (ptr_channel) ? ptr_channel->buffer : NULL), - "notify_none,no_highlight", - "%s%s%s%s -> %s%s%s: %s", - weechat_prefix ("network"), - IRC_COLOR_NOTICE, - /* TRANSLATORS: "Notice" is command name in IRC protocol (translation is frequently the same word) */ - _("Notice"), - IRC_COLOR_RESET, - (is_channel) ? IRC_COLOR_CHAT_CHANNEL : irc_nick_color_for_msg (ptr_server, 0, NULL, argv[arg_target]), - argv[arg_target], - IRC_COLOR_RESET, - (string) ? string : str_args); + string = irc_color_decode ( + str_args, + weechat_config_boolean (irc_config_network_colors_send)); + weechat_printf_tags ( + irc_msgbuffer_get_target_buffer ( + ptr_server, argv[arg_target], "notice", NULL, + (ptr_channel) ? ptr_channel->buffer : NULL), + "notify_none,no_highlight", + "%s%s%s%s -> %s%s%s: %s", + weechat_prefix ("network"), + IRC_COLOR_NOTICE, + /* TRANSLATORS: "Notice" is command name in IRC protocol (translation is frequently the same word) */ + _("Notice"), + IRC_COLOR_RESET, + (is_channel) ? IRC_COLOR_CHAT_CHANNEL : irc_nick_color_for_msg (ptr_server, 0, NULL, argv[arg_target]), + argv[arg_target], + IRC_COLOR_RESET, + (string) ? string : str_args); if (string) free (string); number++; @@ -3355,20 +3366,21 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc, ptr_server = irc_server_search (argv[3]); if (!ptr_server) { - weechat_printf (NULL, - _("%s%s: server \"%s\" not found"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[3]); + weechat_printf ( + NULL, + _("%s%s: server \"%s\" not found"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, argv[3]); return WEECHAT_RC_OK; } } if (!ptr_server) { - weechat_printf (NULL, - _("%s%s: server must be specified because you are " - "not on an irc server or channel"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + NULL, + _("%s%s: server must be specified because you are not on an " + "irc server or channel"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); return WEECHAT_RC_OK; } @@ -3384,18 +3396,20 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc, ptr_notify = irc_notify_search (ptr_server, argv[2]); if (ptr_notify) { - weechat_printf (NULL, - _("%s%s: notify already exists"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + NULL, + _("%s%s: notify already exists"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); return WEECHAT_RC_OK; } if ((ptr_server->monitor > 0) && (ptr_server->notify_count >= ptr_server->monitor)) { - weechat_printf (ptr_server->buffer, - _("%sMonitor list is full (%d)"), - weechat_prefix ("error"), ptr_server->monitor); + weechat_printf ( + ptr_server->buffer, + _("%sMonitor list is full (%d)"), + weechat_prefix ("error"), ptr_server->monitor); return WEECHAT_RC_OK; } @@ -3403,19 +3417,21 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc, if (ptr_notify) { irc_notify_set_server_option (ptr_server); - weechat_printf (ptr_server->buffer, - _("%s: notification added for %s%s%s"), - IRC_PLUGIN_NAME, - irc_nick_color_for_msg (ptr_server, 1, - NULL, ptr_notify->nick), - ptr_notify->nick, - weechat_color ("reset")); + weechat_printf ( + ptr_server->buffer, + _("%s: notification added for %s%s%s"), + IRC_PLUGIN_NAME, + irc_nick_color_for_msg (ptr_server, 1, NULL, ptr_notify->nick), + ptr_notify->nick, + weechat_color ("reset")); irc_notify_check_now (ptr_notify); } else { - weechat_printf (NULL, _("%s%s: error adding notification"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + NULL, + _("%s%s: error adding notification"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); } return WEECHAT_RC_OK; @@ -3432,20 +3448,21 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc, ptr_server = irc_server_search (argv[3]); if (!ptr_server) { - weechat_printf (NULL, - _("%s%s: server \"%s\" not found"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[3]); + weechat_printf ( + NULL, + _("%s%s: server \"%s\" not found"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, argv[3]); return WEECHAT_RC_OK; } } if (!ptr_server) { - weechat_printf (NULL, - _("%s%s: server must be specified because you are " - "not on an irc server or channel"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + NULL, + _("%s%s: server must be specified because you are not on an " + "irc server or channel"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); return WEECHAT_RC_OK; } @@ -3455,13 +3472,17 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc, { irc_notify_free_all (ptr_server); irc_notify_set_server_option (ptr_server); - weechat_printf (NULL, _("%s: all notifications deleted"), - IRC_PLUGIN_NAME); + weechat_printf ( + NULL, + _("%s: all notifications deleted"), + IRC_PLUGIN_NAME); } else { - weechat_printf (NULL, _("%s: no notification in list"), - IRC_PLUGIN_NAME); + weechat_printf ( + NULL, + _("%s: no notification in list"), + IRC_PLUGIN_NAME); } } else @@ -3469,21 +3490,23 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc, ptr_notify = irc_notify_search (ptr_server, argv[2]); if (ptr_notify) { - weechat_printf (ptr_server->buffer, - _("%s: notification deleted for %s%s%s"), - IRC_PLUGIN_NAME, - irc_nick_color_for_msg (ptr_server, 1, - NULL, ptr_notify->nick), - ptr_notify->nick, - weechat_color ("reset")); + weechat_printf ( + ptr_server->buffer, + _("%s: notification deleted for %s%s%s"), + IRC_PLUGIN_NAME, + irc_nick_color_for_msg (ptr_server, 1, NULL, + ptr_notify->nick), + ptr_notify->nick, + weechat_color ("reset")); irc_notify_free (ptr_server, ptr_notify, 1); irc_notify_set_server_option (ptr_server); } else { - weechat_printf (NULL, - _("%s%s: notification not found"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + NULL, + _("%s%s: notification not found"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); return WEECHAT_RC_OK; } } @@ -3511,10 +3534,10 @@ irc_command_op (void *data, struct t_gui_buffer *buffer, int argc, char **argv, if (!ptr_channel || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, "op"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "op"); return WEECHAT_RC_OK; } @@ -3619,12 +3642,11 @@ irc_command_part (void *data, struct t_gui_buffer *buffer, int argc, { if (!ptr_channel) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel or " - "private buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "part"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "or private buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "part"); return WEECHAT_RC_OK; } channel_name = ptr_channel->name; @@ -3635,11 +3657,11 @@ irc_command_part (void *data, struct t_gui_buffer *buffer, int argc, { if (!ptr_channel) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel or private " - "buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, "part"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel or " + "private buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "part"); return WEECHAT_RC_OK; } if (!ptr_channel->nicks) @@ -3749,11 +3771,10 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc, nicks[i], 1, 0); if (!ptr_channel) { - weechat_printf (ptr_server->buffer, - _("%s%s: cannot create new private " - "buffer \"%s\""), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - nicks[i]); + weechat_printf ( + ptr_server->buffer, + _("%s%s: cannot create new private buffer \"%s\""), + weechat_prefix ("error"), IRC_PLUGIN_NAME, nicks[i]); } } @@ -3822,11 +3843,11 @@ irc_command_quiet (void *data, struct t_gui_buffer *buffer, int argc, pos_channel = ptr_channel->name; else { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "quiet"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "quiet"); return WEECHAT_RC_OK; } } @@ -3853,10 +3874,11 @@ irc_command_quiet (void *data, struct t_gui_buffer *buffer, int argc, { if (!ptr_channel) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, "quiet"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "quiet"); return WEECHAT_RC_OK; } irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, @@ -4014,10 +4036,10 @@ irc_command_reconnect (void *data, struct t_gui_buffer *buffer, int argc, } else { - weechat_printf (NULL, - _("%s%s: server \"%s\" not found"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[i]); + weechat_printf ( + NULL, + _("%s%s: server \"%s\" not found"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, argv[i]); reconnect_ok = 0; } } @@ -4096,11 +4118,10 @@ irc_command_remove (void *data, struct t_gui_buffer *buffer, int argc, if (!ptr_channel_name) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "remove"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "remove"); return WEECHAT_RC_OK; } @@ -4202,11 +4223,11 @@ irc_command_samode (void *data, struct t_gui_buffer *buffer, int argc, /* channel not specified, check we are on channel and use it */ if (!ptr_channel) { - weechat_printf (ptr_server->buffer, - _("%s%s: you must specify channel for \"%s\" " - "command if you're not in a channel"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "samode"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: you must specify channel for \"%s\" command if " + "you're not in a channel"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "samode"); return WEECHAT_RC_OK; } irc_command_mode_server (ptr_server, "SAMODE", ptr_channel, @@ -4229,11 +4250,11 @@ irc_command_samode (void *data, struct t_gui_buffer *buffer, int argc, } else { - weechat_printf (ptr_server->buffer, - _("%s%s: you must specify channel for \"%s\" " - "command if you're not in a channel"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "samode"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: you must specify channel for \"%s\" command if " + "you're not in a channel"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "samode"); return WEECHAT_RC_OK; } } @@ -4652,28 +4673,32 @@ irc_command_display_server (struct t_irc_server *server, int with_detail) { num_channels = irc_server_get_channel_count (server); num_pv = irc_server_get_pv_count (server); - weechat_printf (NULL, " %s %s%s %s[%s%s%s]%s%s, %d %s, %d pv", - (server->is_connected) ? "*" : " ", - IRC_COLOR_CHAT_SERVER, - server->name, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (server->is_connected) ? - _("connected") : _("not connected"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (server->temp_server) ? _(" (temporary)") : "", - num_channels, - NG_("channel", "channels", num_channels), - num_pv); + weechat_printf ( + NULL, + " %s %s%s %s[%s%s%s]%s%s, %d %s, %d pv", + (server->is_connected) ? "*" : " ", + IRC_COLOR_CHAT_SERVER, + server->name, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (server->is_connected) ? + _("connected") : _("not connected"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (server->temp_server) ? _(" (temporary)") : "", + num_channels, + NG_("channel", "channels", num_channels), + num_pv); } else { - weechat_printf (NULL, " %s%s%s%s", - IRC_COLOR_CHAT_SERVER, - server->name, - IRC_COLOR_RESET, - (server->temp_server) ? _(" (temporary)") : ""); + weechat_printf ( + NULL, + " %s%s%s%s", + IRC_COLOR_CHAT_SERVER, + server->name, + IRC_COLOR_RESET, + (server->temp_server) ? _(" (temporary)") : ""); } } } @@ -4764,33 +4789,34 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, ptr_server2 = irc_server_casesearch (argv[2]); if (ptr_server2) { - weechat_printf (NULL, - _("%s%s: server \"%s\" already exists, " - "can't create it!"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - ptr_server2->name); + weechat_printf ( + NULL, + _("%s%s: server \"%s\" already exists, can't create it!"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, ptr_server2->name); return WEECHAT_RC_OK; } new_server = irc_server_alloc (argv[2]); if (!new_server) { - weechat_printf (NULL, - _("%s%s: unable to create server"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + NULL, + _("%s%s: unable to create server"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); return WEECHAT_RC_OK; } - weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_ADDRESSES], - argv[3], 1); + weechat_config_option_set ( + new_server->options[IRC_SERVER_OPTION_ADDRESSES], argv[3], 1); irc_server_apply_command_line_options (new_server, argc, argv); - weechat_printf (NULL, - _("%s: server %s%s%s created"), - IRC_PLUGIN_NAME, - IRC_COLOR_CHAT_SERVER, - new_server->name, - IRC_COLOR_RESET); + weechat_printf ( + NULL, + _("%s: server %s%s%s created"), + IRC_PLUGIN_NAME, + IRC_COLOR_CHAT_SERVER, + new_server->name, + IRC_COLOR_RESET); /* do not connect to server after creating it */ /* @@ -4810,11 +4836,11 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, server_found = irc_server_search (argv[2]); if (!server_found) { - weechat_printf (NULL, - _("%s%s: server \"%s\" not found for " - "\"%s\" command"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[2], "server copy"); + weechat_printf ( + NULL, + _("%s%s: server \"%s\" not found for \"%s\" command"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + argv[2], "server copy"); return WEECHAT_RC_OK; } @@ -4822,11 +4848,11 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, ptr_server2 = irc_server_casesearch (argv[3]); if (ptr_server2) { - weechat_printf (NULL, - _("%s%s: server \"%s\" already exists for " - "\"%s\" command"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - ptr_server2->name, "server copy"); + weechat_printf ( + NULL, + _("%s%s: server \"%s\" already exists for \"%s\" command"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + ptr_server2->name, "server copy"); return WEECHAT_RC_OK; } @@ -4834,16 +4860,16 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, new_server = irc_server_copy (server_found, argv[3]); if (new_server) { - weechat_printf (NULL, - _("%s: server %s%s%s has been copied to " - "%s%s%s"), - IRC_PLUGIN_NAME, - IRC_COLOR_CHAT_SERVER, - argv[2], - IRC_COLOR_RESET, - IRC_COLOR_CHAT_SERVER, - argv[3], - IRC_COLOR_RESET); + weechat_printf ( + NULL, + _("%s: server %s%s%s has been copied to %s%s%s"), + IRC_PLUGIN_NAME, + IRC_COLOR_CHAT_SERVER, + argv[2], + IRC_COLOR_RESET, + IRC_COLOR_CHAT_SERVER, + argv[3], + IRC_COLOR_RESET); return WEECHAT_RC_OK; } @@ -4859,11 +4885,11 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, server_found = irc_server_search (argv[2]); if (!server_found) { - weechat_printf (NULL, - _("%s%s: server \"%s\" not found for " - "\"%s\" command"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[2], "server rename"); + weechat_printf ( + NULL, + _("%s%s: server \"%s\" not found for \"%s\" command"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + argv[2], "server rename"); return WEECHAT_RC_OK; } @@ -4871,27 +4897,27 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, ptr_server2 = irc_server_casesearch (argv[3]); if (ptr_server2) { - weechat_printf (NULL, - _("%s%s: server \"%s\" already exists for " - "\"%s\" command"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - ptr_server2->name, "server rename"); + weechat_printf ( + NULL, + _("%s%s: server \"%s\" already exists for \"%s\" command"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + ptr_server2->name, "server rename"); return WEECHAT_RC_OK; } /* rename server */ if (irc_server_rename (server_found, argv[3])) { - weechat_printf (NULL, - _("%s: server %s%s%s has been renamed to " - "%s%s%s"), - IRC_PLUGIN_NAME, - IRC_COLOR_CHAT_SERVER, - argv[2], - IRC_COLOR_RESET, - IRC_COLOR_CHAT_SERVER, - argv[3], - IRC_COLOR_RESET); + weechat_printf ( + NULL, + _("%s: server %s%s%s has been renamed to %s%s%s"), + IRC_PLUGIN_NAME, + IRC_COLOR_CHAT_SERVER, + argv[2], + IRC_COLOR_RESET, + IRC_COLOR_CHAT_SERVER, + argv[3], + IRC_COLOR_RESET); return WEECHAT_RC_OK; } @@ -4907,33 +4933,35 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, server_found = irc_server_search (argv[2]); if (!server_found) { - weechat_printf (NULL, - _("%s%s: server \"%s\" not found for " - "\"%s\" command"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[2], "server keep"); + weechat_printf ( + NULL, + _("%s%s: server \"%s\" not found for \"%s\" command"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + argv[2], "server keep"); return WEECHAT_RC_OK; } /* check that is it temporary server */ if (!server_found->temp_server) { - weechat_printf (NULL, - _("%s%s: server \"%s\" is not a temporary server"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[2], "server keep"); + weechat_printf ( + NULL, + _("%s%s: server \"%s\" is not a temporary server"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + argv[2], "server keep"); return WEECHAT_RC_OK; } /* remove temporary flag on server */ server_found->temp_server = 0; - weechat_printf (NULL, - _("%s: server %s%s%s is not temporary any more"), - IRC_PLUGIN_NAME, - IRC_COLOR_CHAT_SERVER, - argv[2], - IRC_COLOR_RESET); + weechat_printf ( + NULL, + _("%s: server %s%s%s is not temporary any more"), + IRC_PLUGIN_NAME, + IRC_COLOR_CHAT_SERVER, + argv[2], + IRC_COLOR_RESET); return WEECHAT_RC_OK; } @@ -4947,32 +4975,32 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, server_found = irc_server_search (argv[2]); if (!server_found) { - weechat_printf (NULL, - _("%s%s: server \"%s\" not found for " - "\"%s\" command"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[2], "server del"); + weechat_printf ( + NULL, + _("%s%s: server \"%s\" not found for \"%s\" command"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + argv[2], "server del"); return WEECHAT_RC_OK; } if (server_found->is_connected) { - weechat_printf (NULL, - _("%s%s: you can not delete server \"%s\" " - "because you are connected to. " - "Try \"/disconnect %s\" before."), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[2], argv[2]); + weechat_printf ( + NULL, + _("%s%s: you can not delete server \"%s\" because you are " + "connected to. Try \"/disconnect %s\" before."), + weechat_prefix ("error"), IRC_PLUGIN_NAME, argv[2], argv[2]); return WEECHAT_RC_OK; } server_name = strdup (server_found->name); irc_server_free (server_found); - weechat_printf (NULL, - _("%s: server %s%s%s has been deleted"), - IRC_PLUGIN_NAME, - IRC_COLOR_CHAT_SERVER, - (server_name) ? server_name : "???", - IRC_COLOR_RESET); + weechat_printf ( + NULL, + _("%s: server %s%s%s has been deleted"), + IRC_PLUGIN_NAME, + IRC_COLOR_CHAT_SERVER, + (server_name) ? server_name : "???", + IRC_COLOR_RESET); if (server_name) free (server_name); @@ -4989,11 +5017,11 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, irc_server_outqueue_free_all (ptr_server2, i); } } - weechat_printf (NULL, - _("%s: messages outqueue DELETED for all " - "servers. Some messages from you or " - "WeeChat may have been lost!"), - IRC_PLUGIN_NAME); + weechat_printf ( + NULL, + _("%s: messages outqueue DELETED for all servers. Some messages " + "from you or WeeChat may have been lost!"), + IRC_PLUGIN_NAME); return WEECHAT_RC_OK; } @@ -5266,11 +5294,11 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc, } else { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "topic"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "topic"); return WEECHAT_RC_OK; } } @@ -5284,8 +5312,9 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc, } else { - new_topic_color = irc_color_encode (new_topic, - weechat_config_boolean (irc_config_network_colors_send)); + new_topic_color = irc_color_encode ( + new_topic, + weechat_config_boolean (irc_config_network_colors_send)); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "TOPIC %s :%s", channel_name, @@ -5371,11 +5400,11 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc, pos_channel = ptr_channel->name; else { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "unban"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "unban"); return WEECHAT_RC_OK; } } @@ -5430,11 +5459,11 @@ irc_command_unquiet (void *data, struct t_gui_buffer *buffer, int argc, pos_channel = ptr_channel->name; else { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "unquiet"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "unquiet"); return WEECHAT_RC_OK; } } @@ -5570,10 +5599,10 @@ irc_command_voice (void *data, struct t_gui_buffer *buffer, int argc, if (!ptr_channel || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)) { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, "voice"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "voice"); return WEECHAT_RC_OK; } @@ -5633,11 +5662,11 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc, pos_channel = ptr_channel->name; else { - weechat_printf (ptr_server->buffer, - _("%s%s: \"%s\" command can only be " - "executed in a channel buffer"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - "wallchops"); + weechat_printf ( + ptr_server->buffer, + _("%s%s: \"%s\" command can only be executed in a channel " + "buffer"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, "wallchops"); return WEECHAT_RC_OK; } } @@ -5645,24 +5674,25 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc, ptr_channel = irc_channel_search (ptr_server, pos_channel); if (!ptr_channel) { - weechat_printf (ptr_server->buffer, - _("%s%s: you are not on channel \"%s\""), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - pos_channel); + weechat_printf ( + ptr_server->buffer, + _("%s%s: you are not on channel \"%s\""), + weechat_prefix ("error"), IRC_PLUGIN_NAME, pos_channel); return WEECHAT_RC_OK; } - weechat_printf (ptr_channel->buffer, - "%s%s%sOp%s -> %s%s%s: %s", - weechat_prefix ("network"), - IRC_COLOR_NOTICE, - /* TRANSLATORS: "Notice" is command name in IRC protocol (translation is frequently the same word) */ - _("Notice"), - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - ptr_channel->name, - IRC_COLOR_RESET, - argv_eol[pos_args]); + weechat_printf ( + ptr_channel->buffer, + "%s%s%sOp%s -> %s%s%s: %s", + weechat_prefix ("network"), + IRC_COLOR_NOTICE, + /* TRANSLATORS: "Notice" is command name in IRC protocol (translation is frequently the same word) */ + _("Notice"), + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + ptr_channel->name, + IRC_COLOR_RESET, + argv_eol[pos_args]); support_wallchops = irc_server_get_isupport_value (ptr_server, "WALLCHOPS"); diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c index f667f1b9a..4c508af88 100644 --- a/src/plugins/irc/irc-completion.c +++ b/src/plugins/irc/irc-completion.c @@ -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; } } diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index eed9a6915..27dc6c471 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -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; } diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c index fcdf59446..42c61e7af 100644 --- a/src/plugins/irc/irc-ctcp.c +++ b/src/plugins/irc/irc-ctcp.c @@ -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 : ""); } } } diff --git a/src/plugins/irc/irc-info.c b/src/plugins/irc/irc-info.c index ad5c91097..0abc1f788 100644 --- a/src/plugins/irc/irc-info.c +++ b/src/plugins/irc/irc-info.c @@ -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", diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c index 39f467bd1..eb9d7f7f5 100644 --- a/src/plugins/irc/irc-input.c +++ b/src/plugins/irc/irc-input.c @@ -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); } diff --git a/src/plugins/irc/irc-message.c b/src/plugins/irc/irc-message.c index 7721c57b3..e062b4e31 100644 --- a/src/plugins/irc/irc-message.c +++ b/src/plugins/irc/irc-message.c @@ -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); } } } diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index 182a3fbd8..bd14631cf 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -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; } diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c index fa9085b03..d8438a442 100644 --- a/src/plugins/irc/irc-notify.c +++ b/src/plugins/irc/irc-notify.c @@ -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); } diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 883e859d4..3ba40e417 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -210,14 +210,14 @@ IRC_PROTOCOL_CALLBACK(authenticate) if (irc_server_sasl_enabled (server)) { - sasl_mechanism = IRC_SERVER_OPTION_INTEGER(server, - IRC_SERVER_OPTION_SASL_MECHANISM); - sasl_username = weechat_string_eval_expression (IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_SASL_USERNAME), - NULL, NULL, NULL); - sasl_password = weechat_string_eval_expression (IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_SASL_PASSWORD), - NULL, NULL, NULL); + sasl_mechanism = IRC_SERVER_OPTION_INTEGER( + server, IRC_SERVER_OPTION_SASL_MECHANISM); + sasl_username = weechat_string_eval_expression ( + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SASL_USERNAME), + NULL, NULL, NULL); + sasl_password = weechat_string_eval_expression ( + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SASL_PASSWORD), + NULL, NULL, NULL); answer = NULL; switch (sasl_mechanism) { @@ -247,11 +247,12 @@ IRC_PROTOCOL_CALLBACK(authenticate) } else { - weechat_printf (server->buffer, - _("%s%s: error building answer for " - "SASL authentication, using mechanism \"%s\""), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - irc_sasl_mechanism_string[IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SASL_MECHANISM)]); + weechat_printf ( + server->buffer, + _("%s%s: error building answer for SASL authentication, " + "using mechanism \"%s\""), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + irc_sasl_mechanism_string[IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SASL_MECHANISM)]); irc_server_sendf (server, 0, NULL, "CAP END"); } if (sasl_username) @@ -313,12 +314,12 @@ IRC_PROTOCOL_CALLBACK(cap) if (argc > 4) { ptr_caps = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]; - weechat_printf_date_tags (server->buffer, date, NULL, - _("%s%s: client capability, server " - "supports: %s"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, - ptr_caps); + weechat_printf_date_tags ( + server->buffer, date, NULL, + _("%s%s: client capability, server supports: %s"), + weechat_prefix ("network"), + IRC_PLUGIN_NAME, + ptr_caps); /* auto-enable capabilities only when connecting to server */ if (!server->is_connected) @@ -370,11 +371,11 @@ IRC_PROTOCOL_CALLBACK(cap) weechat_string_free_split (caps_supported); if (cap_req[0]) { - weechat_printf (server->buffer, - _("%s%s: client capability, requesting: %s"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, - cap_req); + weechat_printf ( + server->buffer, + _("%s%s: client capability, requesting: %s"), + weechat_prefix ("network"), IRC_PLUGIN_NAME, + cap_req); irc_server_sendf (server, 0, NULL, "CAP REQ :%s", cap_req); } @@ -382,10 +383,10 @@ IRC_PROTOCOL_CALLBACK(cap) irc_server_sendf (server, 0, NULL, "CAP END"); if (sasl_requested && !sasl_to_do) { - weechat_printf (server->buffer, - _("%s%s: client capability: sasl not supported"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: client capability: sasl not supported"), + weechat_prefix ("network"), IRC_PLUGIN_NAME); } } if (cap_option) @@ -400,12 +401,10 @@ IRC_PROTOCOL_CALLBACK(cap) if (argc > 4) { ptr_caps = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]; - weechat_printf_date_tags (server->buffer, date, NULL, - _("%s%s: client capability, currently " - "enabled: %s"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, - ptr_caps); + weechat_printf_date_tags ( + server->buffer, date, NULL, + _("%s%s: client capability, currently enabled: %s"), + weechat_prefix ("network"), IRC_PLUGIN_NAME, ptr_caps); } } else if (strcmp (argv[3], "ACK") == 0) @@ -413,11 +412,10 @@ IRC_PROTOCOL_CALLBACK(cap) if (argc > 4) { ptr_caps = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]; - weechat_printf_date_tags (server->buffer, date, NULL, - _("%s%s: client capability, enabled: %s"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, - ptr_caps); + weechat_printf_date_tags ( + server->buffer, date, NULL, + _("%s%s: client capability, enabled: %s"), + weechat_prefix ("network"), IRC_PLUGIN_NAME, ptr_caps); sasl_to_do = 0; caps_supported = weechat_string_split (ptr_caps, " ", 0, 0, &num_caps_supported); @@ -476,10 +474,10 @@ IRC_PROTOCOL_CALLBACK(cap) if (argc > 4) { ptr_caps = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]; - weechat_printf_date_tags (server->buffer, date, NULL, - _("%s%s: client capability, refused: %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - ptr_caps); + weechat_printf_date_tags ( + server->buffer, date, NULL, + _("%s%s: client capability, refused: %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, ptr_caps); if (!server->is_connected) irc_server_sendf (server, 0, NULL, "CAP END"); } @@ -503,14 +501,13 @@ IRC_PROTOCOL_CALLBACK(error) ptr_args = (argv_eol[1][0] == ':') ? argv_eol[1] + 1 : argv_eol[1]; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - NULL), - date, - irc_protocol_tags (command, NULL, NULL, NULL), - "%s%s", - weechat_prefix ("error"), - ptr_args); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), + date, + irc_protocol_tags (command, NULL, NULL, NULL), + "%s%s", + weechat_prefix ("error"), + ptr_args); if (strncmp (ptr_args, "Closing Link", 12) == 0) { @@ -560,11 +557,9 @@ IRC_PROTOCOL_CALLBACK(generic_error) weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( - server, - NULL, - command, - ((strcmp (command, "401") == 0) || (strcmp (command, "402") == 0)) ? - "whois" : NULL, + server, NULL, command, + ((strcmp (command, "401") == 0) + || (strcmp (command, "402") == 0)) ? "whois" : NULL, ptr_buffer), date, irc_protocol_tags (command, NULL, NULL, NULL), @@ -594,25 +589,22 @@ IRC_PROTOCOL_CALLBACK(invite) IRC_PROTOCOL_MIN_ARGS(4); IRC_PROTOCOL_CHECK_HOST; - if (!ignored) - { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, nick, - command, NULL, - NULL), - date, - irc_protocol_tags (command, "notify_highlight", - nick, address), - _("%sYou have been invited to %s%s%s by " - "%s%s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - (argv[3][0] == ':') ? argv[3] + 1 : argv[3], - IRC_COLOR_RESET, - irc_nick_color_for_msg (server, 1, NULL, - nick), - nick, - IRC_COLOR_RESET); - } + if (ignored) + return WEECHAT_RC_OK; + + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, nick, command, NULL, NULL), + date, + irc_protocol_tags (command, "notify_highlight", nick, address), + _("%sYou have been invited to %s%s%s by %s%s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + (argv[3][0] == ':') ? argv[3] + 1 : argv[3], + IRC_COLOR_RESET, + irc_nick_color_for_msg (server, 1, NULL, nick), + nick, + IRC_COLOR_RESET); + return WEECHAT_RC_OK; } @@ -772,7 +764,10 @@ IRC_PROTOCOL_CALLBACK(join) * (option irc.look.smart_filter_join_unmask) */ if (smart_filter) - irc_channel_join_smart_filtered_add (ptr_channel, nick, time (NULL)); + { + irc_channel_join_smart_filtered_add (ptr_channel, nick, + time (NULL)); + } /* display message in private if private has flag "has_quit_server" */ if (!local_join) @@ -815,47 +810,39 @@ IRC_PROTOCOL_CALLBACK(kick) if (pos_comment) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_channel->buffer), - date, - irc_protocol_tags (command, NULL, NULL, - address), - _("%s%s%s%s has kicked %s%s%s %s(%s%s%s)"), - weechat_prefix ("quit"), - irc_nick_color_for_msg (server, 1, ptr_nick, - nick), - nick, - IRC_COLOR_MESSAGE_QUIT, - irc_nick_color_for_msg (server, 1, - ptr_nick_kicked, - argv[3]), - argv[3], - IRC_COLOR_MESSAGE_QUIT, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - pos_comment, - IRC_COLOR_CHAT_DELIMITERS); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, + ptr_channel->buffer), + date, + irc_protocol_tags (command, NULL, NULL, address), + _("%s%s%s%s has kicked %s%s%s %s(%s%s%s)"), + weechat_prefix ("quit"), + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_MESSAGE_QUIT, + irc_nick_color_for_msg (server, 1, ptr_nick_kicked, argv[3]), + argv[3], + IRC_COLOR_MESSAGE_QUIT, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + pos_comment, + IRC_COLOR_CHAT_DELIMITERS); } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_channel->buffer), - date, - irc_protocol_tags (command, NULL, NULL, - address), - _("%s%s%s%s has kicked %s%s%s"), - weechat_prefix ("quit"), - irc_nick_color_for_msg (server, 1, ptr_nick, - nick), - nick, - IRC_COLOR_MESSAGE_QUIT, - irc_nick_color_for_msg (server, 1, - ptr_nick_kicked, - argv[3]), - argv[3], - IRC_COLOR_MESSAGE_QUIT); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, + ptr_channel->buffer), + date, + irc_protocol_tags (command, NULL, NULL, address), + _("%s%s%s%s has kicked %s%s%s"), + weechat_prefix ("quit"), + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_MESSAGE_QUIT, + irc_nick_color_for_msg (server, 1, ptr_nick_kicked, argv[3]), + argv[3], + IRC_COLOR_MESSAGE_QUIT); } if (irc_server_strcasecmp (server, argv[3], server->nick) == 0) @@ -880,7 +867,8 @@ IRC_PROTOCOL_CALLBACK(kick) if (rejoin) { - if (IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTOREJOIN_DELAY) == 0) + if (IRC_SERVER_OPTION_INTEGER(server, + IRC_SERVER_OPTION_AUTOREJOIN_DELAY) == 0) { /* immediately rejoin if delay is 0 */ irc_channel_rejoin (server, ptr_channel); @@ -889,10 +877,12 @@ IRC_PROTOCOL_CALLBACK(kick) { /* rejoin channel later, according to delay */ ptr_channel->hook_autorejoin = - weechat_hook_timer (IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTOREJOIN_DELAY) * 1000, - 0, 1, - &irc_channel_autorejoin_cb, - ptr_channel); + weechat_hook_timer ( + IRC_SERVER_OPTION_INTEGER(server, + IRC_SERVER_OPTION_AUTOREJOIN_DELAY) * 1000, + 0, 1, + &irc_channel_autorejoin_cb, + ptr_channel); } } @@ -938,39 +928,35 @@ IRC_PROTOCOL_CALLBACK(kill) if (pos_comment) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_channel->buffer), - date, - irc_protocol_tags (command, NULL, NULL, - address), - _("%s%sYou were killed by %s%s%s %s(%s%s%s)"), - weechat_prefix ("quit"), - IRC_COLOR_MESSAGE_QUIT, - irc_nick_color_for_msg (server, 1, - ptr_nick, nick), - nick, - IRC_COLOR_MESSAGE_QUIT, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - pos_comment, - IRC_COLOR_CHAT_DELIMITERS); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, + ptr_channel->buffer), + date, + irc_protocol_tags (command, NULL, NULL, address), + _("%s%sYou were killed by %s%s%s %s(%s%s%s)"), + weechat_prefix ("quit"), + IRC_COLOR_MESSAGE_QUIT, + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_MESSAGE_QUIT, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + pos_comment, + IRC_COLOR_CHAT_DELIMITERS); } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_channel->buffer), - date, - irc_protocol_tags (command, NULL, NULL, - address), - _("%s%sYou were killed by %s%s%s"), - weechat_prefix ("quit"), - IRC_COLOR_MESSAGE_QUIT, - irc_nick_color_for_msg (server, 1, - ptr_nick, nick), - nick, - IRC_COLOR_MESSAGE_QUIT); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, + ptr_channel->buffer), + date, + irc_protocol_tags (command, NULL, NULL, address), + _("%s%sYou were killed by %s%s%s"), + weechat_prefix ("quit"), + IRC_COLOR_MESSAGE_QUIT, + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_MESSAGE_QUIT); } if (irc_server_strcasecmp (server, argv[2], server->nick) == 0) @@ -1029,45 +1015,41 @@ IRC_PROTOCOL_CALLBACK(mode) local_mode = (irc_server_strcasecmp (server, nick, server->nick) == 0); ptr_nick = irc_nick_search (server, ptr_channel, nick); ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_buffer), - date, - irc_protocol_tags (command, - (smart_filter && !local_mode) ? - "irc_smart_filter" : NULL, - NULL, address), - _("%sMode %s%s %s[%s%s%s]%s by %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - (ptr_channel) ? ptr_channel->name : argv[2], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - pos_modes, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - irc_nick_color_for_msg (server, 1, ptr_nick, - nick), - nick); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, + ptr_buffer), + date, + irc_protocol_tags (command, + (smart_filter && !local_mode) ? + "irc_smart_filter" : NULL, + NULL, address), + _("%sMode %s%s %s[%s%s%s]%s by %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + (ptr_channel) ? ptr_channel->name : argv[2], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + pos_modes, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick); } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - NULL), - date, - irc_protocol_tags (command, NULL, NULL, - address), - _("%sUser mode %s[%s%s%s]%s by %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - pos_modes, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - irc_nick_color_for_msg (server, 1, NULL, - nick), - nick); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), + date, + irc_protocol_tags (command, NULL, NULL, address), + _("%sUser mode %s[%s%s%s]%s by %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + pos_modes, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + irc_nick_color_for_msg (server, 1, NULL, nick), + nick); irc_mode_user_set (server, pos_modes, 0); } @@ -1111,18 +1093,15 @@ IRC_PROTOCOL_CALLBACK(nick) "irc_nick1_%s,irc_nick2_%s", nick, new_nick); - weechat_printf_date_tags (server->buffer, - date, - irc_protocol_tags (command, - str_tags, - NULL, - address), - _("%sYou are now known as " - "%s%s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_NICK_SELF, - new_nick, - IRC_COLOR_RESET); + weechat_printf_date_tags ( + server->buffer, + date, + irc_protocol_tags (command, str_tags, NULL, address), + _("%sYou are now known as %s%s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_NICK_SELF, + new_nick, + IRC_COLOR_RESET); /* enable hotlist */ weechat_buffer_set (NULL, "hotlist", "+"); @@ -1145,12 +1124,15 @@ IRC_PROTOCOL_CALLBACK(nick) free (ptr_channel->pv_remote_nick_color); ptr_channel->pv_remote_nick_color = NULL; } - buffer_name = irc_buffer_build_name (server->name, ptr_channel->name); - weechat_buffer_set (ptr_channel->buffer, "name", buffer_name); - weechat_buffer_set (ptr_channel->buffer, "short_name", - ptr_channel->name); + buffer_name = irc_buffer_build_name (server->name, + ptr_channel->name); + weechat_buffer_set (ptr_channel->buffer, + "name", buffer_name); weechat_buffer_set (ptr_channel->buffer, - "localvar_set_channel", ptr_channel->name); + "short_name", ptr_channel->name); + weechat_buffer_set (ptr_channel->buffer, + "localvar_set_channel", + ptr_channel->name); } break; case IRC_CHANNEL_TYPE_CHANNEL: @@ -1205,31 +1187,30 @@ IRC_PROTOCOL_CALLBACK(nick) (smart_filter) ? "irc_smart_filter," : "", nick, new_nick); - weechat_printf_date_tags (ptr_channel->buffer, - date, - irc_protocol_tags (command, - str_tags, - NULL, - address), - _("%s%s%s%s is now known as " - "%s%s%s"), - weechat_prefix ("network"), - weechat_config_boolean(irc_config_look_color_nicks_in_server_messages) ? - old_color : IRC_COLOR_CHAT_NICK, - nick, - IRC_COLOR_RESET, - irc_nick_color_for_msg ( - server, 0, ptr_nick, - new_nick), - new_nick, - IRC_COLOR_RESET); + weechat_printf_date_tags ( + ptr_channel->buffer, + date, + irc_protocol_tags (command, str_tags, NULL, + address), + _("%s%s%s%s is now known as %s%s%s"), + weechat_prefix ("network"), + weechat_config_boolean(irc_config_look_color_nicks_in_server_messages) ? + old_color : IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_RESET, + irc_nick_color_for_msg (server, 0, ptr_nick, + new_nick), + new_nick, + IRC_COLOR_RESET); } irc_channel_nick_speaking_rename (ptr_channel, nick, new_nick); - irc_channel_nick_speaking_time_rename (server, ptr_channel, + irc_channel_nick_speaking_time_rename (server, + ptr_channel, nick, new_nick); irc_channel_join_smart_filtered_rename (ptr_channel, - nick, new_nick); + nick, + new_nick); } if (old_color) @@ -1340,7 +1321,8 @@ IRC_PROTOCOL_CALLBACK(notice) pos = strchr (pos_args, end_char); if (pos && (pos > pos_args + 1)) { - channel = weechat_strndup (pos_args + 1, pos - pos_args - 1); + channel = weechat_strndup (pos_args + 1, + pos - pos_args - 1); if (channel && irc_channel_search (server, channel)) { is_channel = 1; @@ -1367,28 +1349,28 @@ IRC_PROTOCOL_CALLBACK(notice) irc_channel_join_smart_filtered_unmask (ptr_channel, nick); ptr_nick = irc_nick_search (server, ptr_channel, nick); - weechat_printf_date_tags ((ptr_channel) ? ptr_channel->buffer : server->buffer, - date, - irc_protocol_tags (command, - (is_channel_orig) ? - "notify_message" : - weechat_config_string (irc_config_look_notice_welcome_tags), - nick, address), - "%s%s%s%s%s%s%s(%s%s%s)%s: %s", - weechat_prefix ("network"), - IRC_COLOR_NOTICE, - (is_channel_orig) ? "" : "Pv", - /* TRANSLATORS: "Notice" is command name in IRC protocol (translation is frequently the same word) */ - _("Notice"), - (status_notice[0]) ? ":" : "", - status_notice, - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 0, - ptr_nick, nick), - (nick && nick[0]) ? nick : "?", - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - pos_args); + weechat_printf_date_tags ( + (ptr_channel) ? ptr_channel->buffer : server->buffer, + date, + irc_protocol_tags (command, + (is_channel_orig) ? + "notify_message" : + weechat_config_string (irc_config_look_notice_welcome_tags), + nick, address), + "%s%s%s%s%s%s%s(%s%s%s)%s: %s", + weechat_prefix ("network"), + IRC_COLOR_NOTICE, + (is_channel_orig) ? "" : "Pv", + /* TRANSLATORS: "Notice" is command name in IRC protocol (translation is frequently the same word) */ + _("Notice"), + (status_notice[0]) ? ":" : "", + status_notice, + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 0, ptr_nick, nick), + (nick && nick[0]) ? nick : "?", + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + pos_args); } else { @@ -1411,7 +1393,8 @@ IRC_PROTOCOL_CALLBACK(notice) } ptr_channel = NULL; - if (nick && weechat_config_integer (irc_config_look_notice_as_pv) != IRC_CONFIG_LOOK_NOTICE_AS_PV_NEVER) + if (nick + && weechat_config_integer (irc_config_look_notice_as_pv) != IRC_CONFIG_LOOK_NOTICE_AS_PV_NEVER) { ptr_channel = irc_channel_search (server, nick); if (!ptr_channel @@ -1436,18 +1419,17 @@ IRC_PROTOCOL_CALLBACK(notice) if (!ptr_channel->topic) irc_channel_set_topic (ptr_channel, address); - weechat_printf_date_tags (ptr_channel->buffer, - date, - irc_protocol_tags (command, - "notify_private", - nick, address), - "%s%s%s%s: %s", - weechat_prefix ("network"), - irc_nick_color_for_msg (server, 0, - NULL, nick), - nick, - IRC_COLOR_RESET, - pos_args); + weechat_printf_date_tags ( + ptr_channel->buffer, + date, + irc_protocol_tags (command, "notify_private", nick, + address), + "%s%s%s%s: %s", + weechat_prefix ("network"), + irc_nick_color_for_msg (server, 0, NULL, nick), + nick, + IRC_COLOR_RESET, + pos_args); if ((ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE) && ptr_channel->has_quit_server) { @@ -1465,23 +1447,22 @@ IRC_PROTOCOL_CALLBACK(notice) */ if (nick && (irc_server_strcasecmp (server, server->nick, nick) == 0)) { - weechat_printf_date_tags (ptr_buffer, - date, - irc_protocol_tags (command, - (notify_private) ? "notify_private" : NULL, - server->nick, - address), - "%s%s%s%s -> %s%s%s: %s", - weechat_prefix ("network"), - IRC_COLOR_NOTICE, - /* TRANSLATORS: "Notice" is command name in IRC protocol (translation is frequently the same word) */ - _("Notice"), - IRC_COLOR_RESET, - irc_nick_color_for_msg ( - server, 0, NULL, pos_target), - pos_target, - IRC_COLOR_RESET, - pos_args); + weechat_printf_date_tags ( + ptr_buffer, + date, + irc_protocol_tags (command, + (notify_private) ? "notify_private" : NULL, + server->nick, address), + "%s%s%s%s -> %s%s%s: %s", + weechat_prefix ("network"), + IRC_COLOR_NOTICE, + /* TRANSLATORS: "Notice" is command name in IRC protocol (translation is frequently the same word) */ + _("Notice"), + IRC_COLOR_RESET, + irc_nick_color_for_msg (server, 0, NULL, pos_target), + pos_target, + IRC_COLOR_RESET, + pos_args); } else { @@ -1492,8 +1473,7 @@ IRC_PROTOCOL_CALLBACK(notice) date, irc_protocol_tags (command, (notify_private) ? "notify_private" : NULL, - nick, - address), + nick, address), "%s%s%s%s", weechat_prefix ("network"), nick_address, @@ -1556,71 +1536,65 @@ IRC_PROTOCOL_CALLBACK(part) display_host = weechat_config_boolean (irc_config_look_display_host_quit); if (pos_comment) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_channel->buffer), - date, - irc_protocol_tags (command, - (local_part - || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL) - || !weechat_config_boolean (irc_config_look_smart_filter) - || !weechat_config_boolean (irc_config_look_smart_filter_quit) - || ptr_nick_speaking) ? - NULL : "irc_smart_filter", - nick, - address), - _("%s%s%s%s%s%s%s%s%s%s has left %s%s%s " - "%s(%s%s%s)"), - weechat_prefix ("quit"), - irc_nick_color_for_msg ( - server, 1, ptr_nick, nick), - nick, - IRC_COLOR_CHAT_DELIMITERS, - (display_host) ? " (" : "", - IRC_COLOR_CHAT_HOST, - (display_host) ? address : "", - IRC_COLOR_CHAT_DELIMITERS, - (display_host) ? ")" : "", - IRC_COLOR_MESSAGE_QUIT, - IRC_COLOR_CHAT_CHANNEL, - ptr_channel->name, - IRC_COLOR_MESSAGE_QUIT, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_REASON_QUIT, - pos_comment, - IRC_COLOR_CHAT_DELIMITERS); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_channel->buffer), + date, + irc_protocol_tags (command, + (local_part + || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL) + || !weechat_config_boolean (irc_config_look_smart_filter) + || !weechat_config_boolean (irc_config_look_smart_filter_quit) + || ptr_nick_speaking) ? + NULL : "irc_smart_filter", + nick, address), + _("%s%s%s%s%s%s%s%s%s%s has left %s%s%s %s(%s%s%s)"), + weechat_prefix ("quit"), + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_CHAT_DELIMITERS, + (display_host) ? " (" : "", + IRC_COLOR_CHAT_HOST, + (display_host) ? address : "", + IRC_COLOR_CHAT_DELIMITERS, + (display_host) ? ")" : "", + IRC_COLOR_MESSAGE_QUIT, + IRC_COLOR_CHAT_CHANNEL, + ptr_channel->name, + IRC_COLOR_MESSAGE_QUIT, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_REASON_QUIT, + pos_comment, + IRC_COLOR_CHAT_DELIMITERS); } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_channel->buffer), - date, - irc_protocol_tags (command, - (local_part - || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL) - || !weechat_config_boolean (irc_config_look_smart_filter) - || !weechat_config_boolean (irc_config_look_smart_filter_quit) - || ptr_nick_speaking) ? - NULL : "irc_smart_filter", - nick, - address), - _("%s%s%s%s%s%s%s%s%s%s has left " - "%s%s%s"), - weechat_prefix ("quit"), - irc_nick_color_for_msg ( - server, 1, ptr_nick, nick), - nick, - IRC_COLOR_CHAT_DELIMITERS, - (display_host) ? " (" : "", - IRC_COLOR_CHAT_HOST, - (display_host) ? address : "", - IRC_COLOR_CHAT_DELIMITERS, - (display_host) ? ")" : "", - IRC_COLOR_MESSAGE_QUIT, - IRC_COLOR_CHAT_CHANNEL, - ptr_channel->name, - IRC_COLOR_MESSAGE_QUIT); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_channel->buffer), + date, + irc_protocol_tags (command, + (local_part + || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL) + || !weechat_config_boolean (irc_config_look_smart_filter) + || !weechat_config_boolean (irc_config_look_smart_filter_quit) + || ptr_nick_speaking) ? + NULL : "irc_smart_filter", + nick, address), + _("%s%s%s%s%s%s%s%s%s%s has left %s%s%s"), + weechat_prefix ("quit"), + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_CHAT_DELIMITERS, + (display_host) ? " (" : "", + IRC_COLOR_CHAT_HOST, + (display_host) ? address : "", + IRC_COLOR_CHAT_DELIMITERS, + (display_host) ? ")" : "", + IRC_COLOR_MESSAGE_QUIT, + IRC_COLOR_CHAT_CHANNEL, + ptr_channel->name, + IRC_COLOR_MESSAGE_QUIT); } } @@ -1647,10 +1621,12 @@ IRC_PROTOCOL_CALLBACK(part) free (join_string); } else - irc_command_join_server (server, ptr_channel->name, 1, 1); + irc_command_join_server (server, ptr_channel->name, + 1, 1); } else - irc_command_join_server (server, ptr_channel->name, 1, 1); + irc_command_join_server (server, ptr_channel->name, + 1, 1); } else { @@ -1723,14 +1699,14 @@ IRC_PROTOCOL_CALLBACK(pong) } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, NULL), - date, - irc_protocol_tags (command, NULL, NULL, NULL), - "PONG%s%s", - (argc >= 4) ? ": " : "", - (argc >= 4) ? ((argv_eol[3][0] == ':') ? - argv_eol[3] + 1 : argv_eol[3]) : ""); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), + date, + irc_protocol_tags (command, NULL, NULL, NULL), + "PONG%s%s", + (argc >= 4) ? ": " : "", + (argc >= 4) ? ((argv_eol[3][0] == ':') ? + argv_eol[3] + 1 : argv_eol[3]) : ""); } return WEECHAT_RC_OK; @@ -1809,48 +1785,49 @@ IRC_PROTOCOL_CALLBACK(privmsg) if (status_msg[0]) { /* message to channel ops/voiced (to "@#channel" or "+#channel") */ - weechat_printf_date_tags (ptr_channel->buffer, - date, - irc_protocol_tags (command, - "notify_message", - nick, address), - "%s%s%s%s%s(%s%s%s)%s: %s", - weechat_prefix ("network"), - "Msg", - (status_msg[0]) ? ":" : "", - status_msg, - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg ( - server, 0, ptr_nick, nick), - (nick && nick[0]) ? nick : "?", - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - pos_args); + weechat_printf_date_tags ( + ptr_channel->buffer, + date, + irc_protocol_tags (command, "notify_message", nick, + address), + "%s%s%s%s%s(%s%s%s)%s: %s", + weechat_prefix ("network"), + "Msg", + (status_msg[0]) ? ":" : "", + status_msg, + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 0, ptr_nick, nick), + (nick && nick[0]) ? nick : "?", + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + pos_args); } else { /* standard message (to "#channel") */ - str_color = irc_color_for_tags (irc_nick_find_color_name ((ptr_nick) ? ptr_nick->name : nick)); + str_color = irc_color_for_tags ( + irc_nick_find_color_name ((ptr_nick) ? ptr_nick->name : nick)); snprintf (str_tags, sizeof (str_tags), "notify_message,prefix_nick_%s", (str_color) ? str_color : "default"); if (str_color) free (str_color); - weechat_printf_date_tags (ptr_channel->buffer, - date, - irc_protocol_tags (command, str_tags, - nick, address), - "%s%s", - irc_nick_as_prefix (server, ptr_nick, - (ptr_nick) ? NULL : nick, - NULL), - pos_args); + weechat_printf_date_tags ( + ptr_channel->buffer, + date, + irc_protocol_tags (command, str_tags, nick, address), + "%s%s", + irc_nick_as_prefix (server, ptr_nick, + (ptr_nick) ? NULL : nick, + NULL), + pos_args); } - irc_channel_nick_speaking_add (ptr_channel, - nick, - weechat_string_has_highlight (pos_args, - server->nick)); + irc_channel_nick_speaking_add ( + ptr_channel, + nick, + weechat_string_has_highlight (pos_args, + server->nick)); irc_channel_nick_speaking_time_remove_old (ptr_channel); irc_channel_nick_speaking_time_add (server, ptr_channel, nick, time (NULL)); @@ -1891,13 +1868,24 @@ IRC_PROTOCOL_CALLBACK(privmsg) irc_channel_set_topic (ptr_channel, address); if (nick_is_me) - 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"))); + } else { if (weechat_config_boolean (irc_config_look_color_pv_nick_like_channel)) - str_color = irc_color_for_tags (irc_nick_find_color_name (nick)); + { + str_color = irc_color_for_tags ( + irc_nick_find_color_name (nick)); + } else - str_color = irc_color_for_tags (weechat_config_color (weechat_config_get ("weechat.color.chat_nick_other"))); + { + str_color = irc_color_for_tags ( + weechat_config_color ( + weechat_config_get ("weechat.color.chat_nick_other"))); + } } if (nick_is_me) { @@ -1916,15 +1904,16 @@ IRC_PROTOCOL_CALLBACK(privmsg) } if (str_color) free (str_color); - weechat_printf_date_tags (ptr_channel->buffer, - date, - irc_protocol_tags (command, str_tags, nick, - address), - "%s%s", - irc_nick_as_prefix (server, NULL, nick, - (nick_is_me) ? - IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick)), - pos_args); + weechat_printf_date_tags ( + ptr_channel->buffer, + date, + irc_protocol_tags (command, str_tags, nick, address), + "%s%s", + irc_nick_as_prefix ( + server, NULL, nick, + (nick_is_me) ? + IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick)), + pos_args); if (ptr_channel->has_quit_server) ptr_channel->has_quit_server = 0; @@ -1987,64 +1976,63 @@ IRC_PROTOCOL_CALLBACK(quit) display_host = weechat_config_boolean (irc_config_look_display_host_quit); if (pos_comment && pos_comment[0]) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_channel->buffer), - date, - irc_protocol_tags (command, - (local_quit - || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL) - || !weechat_config_boolean (irc_config_look_smart_filter) - || !weechat_config_boolean (irc_config_look_smart_filter_quit) - || ptr_nick_speaking) ? - NULL : "irc_smart_filter", - nick, - address), - _("%s%s%s%s%s%s%s%s%s%s has quit " - "%s(%s%s%s)"), - weechat_prefix ("quit"), - (ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE) ? - irc_nick_color_for_pv (ptr_channel, nick) : irc_nick_color_for_msg (server, 1, ptr_nick, nick), - nick, - IRC_COLOR_CHAT_DELIMITERS, - (display_host) ? " (" : "", - IRC_COLOR_CHAT_HOST, - (display_host) ? address : "", - IRC_COLOR_CHAT_DELIMITERS, - (display_host) ? ")" : "", - IRC_COLOR_MESSAGE_QUIT, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_REASON_QUIT, - pos_comment, - IRC_COLOR_CHAT_DELIMITERS); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_channel->buffer), + date, + irc_protocol_tags ( + command, + (local_quit + || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL) + || !weechat_config_boolean (irc_config_look_smart_filter) + || !weechat_config_boolean (irc_config_look_smart_filter_quit) + || ptr_nick_speaking) ? + NULL : "irc_smart_filter", + nick, address), + _("%s%s%s%s%s%s%s%s%s%s has quit %s(%s%s%s)"), + weechat_prefix ("quit"), + (ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE) ? + irc_nick_color_for_pv (ptr_channel, nick) : irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_CHAT_DELIMITERS, + (display_host) ? " (" : "", + IRC_COLOR_CHAT_HOST, + (display_host) ? address : "", + IRC_COLOR_CHAT_DELIMITERS, + (display_host) ? ")" : "", + IRC_COLOR_MESSAGE_QUIT, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_REASON_QUIT, + pos_comment, + IRC_COLOR_CHAT_DELIMITERS); } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_channel->buffer), - date, - irc_protocol_tags (command, - (local_quit - || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL) - || !weechat_config_boolean (irc_config_look_smart_filter) - || !weechat_config_boolean (irc_config_look_smart_filter_quit) - || ptr_nick_speaking) ? - NULL : "irc_smart_filter", - nick, - address), - _("%s%s%s%s%s%s%s%s%s%s has quit"), - weechat_prefix ("quit"), - (ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE) ? - irc_nick_color_for_pv (ptr_channel, nick) : irc_nick_color_for_msg (server, 1, ptr_nick, nick), - nick, - IRC_COLOR_CHAT_DELIMITERS, - (display_host) ? " (" : "", - IRC_COLOR_CHAT_HOST, - (display_host) ? address : "", - IRC_COLOR_CHAT_DELIMITERS, - (display_host) ? ")" : "", - IRC_COLOR_MESSAGE_QUIT); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_channel->buffer), + date, + irc_protocol_tags ( + command, + (local_quit + || (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL) + || !weechat_config_boolean (irc_config_look_smart_filter) + || !weechat_config_boolean (irc_config_look_smart_filter_quit) + || ptr_nick_speaking) ? + NULL : "irc_smart_filter", + nick, address), + _("%s%s%s%s%s%s%s%s%s%s has quit"), + weechat_prefix ("quit"), + (ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE) ? + irc_nick_color_for_pv (ptr_channel, nick) : irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_CHAT_DELIMITERS, + (display_host) ? " (" : "", + IRC_COLOR_CHAT_HOST, + (display_host) ? address : "", + IRC_COLOR_CHAT_DELIMITERS, + (display_host) ? ")" : "", + IRC_COLOR_MESSAGE_QUIT); } } if (!local_quit && ptr_nick) @@ -2074,24 +2062,24 @@ IRC_PROTOCOL_CALLBACK(server_mode_reason) if (irc_server_strcasecmp (server, server->nick, argv[2]) == 0) { pos_mode = argv[3]; - pos_args = (argc > 4) ? ((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL; + pos_args = (argc > 4) ? + ((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL; } else { pos_mode = argv[2]; - pos_args = (argc > 3) ? ((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL; + pos_args = (argc > 3) ? + ((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL; } - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s: %s", - weechat_prefix ("network"), - pos_mode, - (pos_args) ? pos_args : ""); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s: %s", + weechat_prefix ("network"), + pos_mode, + (pos_args) ? pos_args : ""); return WEECHAT_RC_OK; } @@ -2116,15 +2104,13 @@ IRC_PROTOCOL_CALLBACK(numeric) pos_args = (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]; } - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s", - weechat_prefix ("network"), - pos_args); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s", + weechat_prefix ("network"), + pos_args); return WEECHAT_RC_OK; } @@ -2169,59 +2155,56 @@ IRC_PROTOCOL_CALLBACK(topic) if (pos_topic && pos_topic[0]) { - topic_color = irc_color_decode (pos_topic, - weechat_config_boolean (irc_config_network_colors_receive)); + topic_color = irc_color_decode ( + pos_topic, + weechat_config_boolean (irc_config_network_colors_receive)); if (weechat_config_boolean (irc_config_look_display_old_topic) && ptr_channel && ptr_channel->topic && ptr_channel->topic[0]) { - old_topic_color = irc_color_decode (ptr_channel->topic, - weechat_config_boolean (irc_config_network_colors_receive)); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_buffer), - date, - irc_protocol_tags (command, NULL, NULL, - address), - _("%s%s%s%s has changed topic for %s%s%s " - "from \"%s%s%s\" to \"%s%s%s\""), - weechat_prefix ("network"), - irc_nick_color_for_msg ( - server, 1, ptr_nick, nick), - nick, - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - argv[2], - IRC_COLOR_RESET, - IRC_COLOR_TOPIC_OLD, - (old_topic_color) ? old_topic_color : ptr_channel->topic, - IRC_COLOR_RESET, - IRC_COLOR_TOPIC_NEW, - (topic_color) ? topic_color : pos_topic, - IRC_COLOR_RESET); + old_topic_color = irc_color_decode ( + ptr_channel->topic, + weechat_config_boolean (irc_config_network_colors_receive)); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_buffer), + date, + irc_protocol_tags (command, NULL, NULL, address), + _("%s%s%s%s has changed topic for %s%s%s from \"%s%s%s\" to " + "\"%s%s%s\""), + weechat_prefix ("network"), + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + argv[2], + IRC_COLOR_RESET, + IRC_COLOR_TOPIC_OLD, + (old_topic_color) ? old_topic_color : ptr_channel->topic, + IRC_COLOR_RESET, + IRC_COLOR_TOPIC_NEW, + (topic_color) ? topic_color : pos_topic, + IRC_COLOR_RESET); if (old_topic_color) free (old_topic_color); } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_buffer), - date, - irc_protocol_tags (command, NULL, NULL, - address), - _("%s%s%s%s has changed topic for %s%s%s " - "to \"%s%s%s\""), - weechat_prefix ("network"), - irc_nick_color_for_msg ( - server, 1, ptr_nick, nick), - nick, - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - argv[2], - IRC_COLOR_RESET, - IRC_COLOR_TOPIC_NEW, - (topic_color) ? topic_color : pos_topic, - IRC_COLOR_RESET); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_buffer), + date, + irc_protocol_tags (command, NULL, NULL, address), + _("%s%s%s%s has changed topic for %s%s%s to \"%s%s%s\""), + weechat_prefix ("network"), + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + argv[2], + IRC_COLOR_RESET, + IRC_COLOR_TOPIC_NEW, + (topic_color) ? topic_color : pos_topic, + IRC_COLOR_RESET); } if (topic_color) free (topic_color); @@ -2231,47 +2214,44 @@ IRC_PROTOCOL_CALLBACK(topic) if (weechat_config_boolean (irc_config_look_display_old_topic) && ptr_channel && ptr_channel->topic && ptr_channel->topic[0]) { - old_topic_color = irc_color_decode (ptr_channel->topic, - weechat_config_boolean (irc_config_network_colors_receive)); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_buffer), - date, - irc_protocol_tags (command, NULL, NULL, - address), - _("%s%s%s%s has unset topic for %s%s%s " - "(old topic: \"%s%s%s\")"), - weechat_prefix ("network"), - irc_nick_color_for_msg ( - server, 1, ptr_nick, nick), - nick, - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - argv[2], - IRC_COLOR_RESET, - IRC_COLOR_TOPIC_OLD, - (old_topic_color) ? old_topic_color : ptr_channel->topic, - IRC_COLOR_RESET); + old_topic_color = irc_color_decode ( + ptr_channel->topic, + weechat_config_boolean (irc_config_network_colors_receive)); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_buffer), + date, + irc_protocol_tags (command, NULL, NULL, address), + _("%s%s%s%s has unset topic for %s%s%s (old topic: " + "\"%s%s%s\")"), + weechat_prefix ("network"), + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + argv[2], + IRC_COLOR_RESET, + IRC_COLOR_TOPIC_OLD, + (old_topic_color) ? old_topic_color : ptr_channel->topic, + IRC_COLOR_RESET); if (old_topic_color) free (old_topic_color); } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_buffer), - date, - irc_protocol_tags (command, NULL, NULL, - address), - _("%s%s%s%s has unset topic for %s%s%s"), - weechat_prefix ("network"), - irc_nick_color_for_msg ( - server, 1, ptr_nick, nick), - nick, - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - argv[2], - IRC_COLOR_RESET); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_buffer), + date, + irc_protocol_tags (command, NULL, NULL, address), + _("%s%s%s%s has unset topic for %s%s%s"), + weechat_prefix ("network"), + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + argv[2], + IRC_COLOR_RESET); } } @@ -2298,15 +2278,14 @@ IRC_PROTOCOL_CALLBACK(wallops) return WEECHAT_RC_OK; nick_address = irc_protocol_nick_address (server, 0, NULL, nick, address); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, nick, - command, NULL, - NULL), - date, - irc_protocol_tags (command, NULL, nick, address), - _("%sWallops from %s: %s"), - weechat_prefix ("network"), - (nick_address[0]) ? nick_address : "?", - (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, nick, command, NULL, NULL), + date, + irc_protocol_tags (command, NULL, nick, address), + _("%sWallops from %s: %s"), + weechat_prefix ("network"), + (nick_address[0]) ? nick_address : "?", + (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]); return WEECHAT_RC_OK; } @@ -2552,26 +2531,26 @@ IRC_PROTOCOL_CALLBACK(221) { IRC_PROTOCOL_MIN_ARGS(4); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[2], - command, NULL, NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - address), - _("%sUser mode for %s%s%s is %s[%s%s%s]"), - weechat_prefix ("network"), - irc_nick_color_for_msg (server, 1, NULL, argv[2]), - argv[2], - IRC_COLOR_RESET, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3], - IRC_COLOR_CHAT_DELIMITERS); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, argv[2], command, NULL, NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, address), + _("%sUser mode for %s%s%s is %s[%s%s%s]"), + weechat_prefix ("network"), + irc_nick_color_for_msg (server, 1, NULL, argv[2]), + argv[2], + IRC_COLOR_RESET, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3], + IRC_COLOR_CHAT_DELIMITERS); if (irc_server_strcasecmp (server, argv[2], server->nick) == 0) { - irc_mode_user_set (server, - (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3], - 1); + irc_mode_user_set ( + server, + (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3], + 1); } return WEECHAT_RC_OK; @@ -2607,21 +2586,19 @@ IRC_PROTOCOL_CALLBACK(301) || (strcmp (ptr_channel->away_message, pos_away_msg) != 0)) { ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[3], - command, "whois", - ptr_buffer), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, address), - _("%s%s[%s%s%s]%s is away: %s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, - NULL, argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - pos_away_msg); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, argv[3], command, "whois", ptr_buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, address), + _("%s%s[%s%s%s]%s is away: %s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + pos_away_msg); if (ptr_channel) { if (ptr_channel->away_message) @@ -2645,15 +2622,14 @@ IRC_PROTOCOL_CALLBACK(303) { IRC_PROTOCOL_MIN_ARGS(4); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - _("%sUsers online: %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_NICK, - (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + _("%sUsers online: %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_NICK, + (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]); return WEECHAT_RC_OK; } @@ -2671,15 +2647,14 @@ IRC_PROTOCOL_CALLBACK(305) if (argc > 3) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "unaway", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s", - weechat_prefix ("network"), - (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "unaway", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s", + weechat_prefix ("network"), + (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]); } server->is_away = 0; @@ -2703,15 +2678,14 @@ IRC_PROTOCOL_CALLBACK(306) if (argc > 3) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "away", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s", - weechat_prefix ("network"), - (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "away", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s", + weechat_prefix ("network"), + (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]); } server->is_away = 1; @@ -2733,20 +2707,19 @@ IRC_PROTOCOL_CALLBACK(whois_nick_msg) { IRC_PROTOCOL_MIN_ARGS(5); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[3], - command, "whois", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s[%s%s%s] %s%s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, argv[3], command, "whois", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s] %s%s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); return WEECHAT_RC_OK; } @@ -2762,20 +2735,19 @@ IRC_PROTOCOL_CALLBACK(whowas_nick_msg) { IRC_PROTOCOL_MIN_ARGS(5); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[3], - command, "whowas", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s[%s%s%s] %s%s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, argv[3], command, "whowas", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s] %s%s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); return WEECHAT_RC_OK; } @@ -2791,24 +2763,23 @@ IRC_PROTOCOL_CALLBACK(311) { IRC_PROTOCOL_MIN_ARGS(8); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[3], - command, "whois", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s[%s%s%s] (%s%s@%s%s)%s: %s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - argv[4], - argv[5], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (argv_eol[7][0] == ':') ? argv_eol[7] + 1 : argv_eol[7]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, argv[3], command, "whois", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s] (%s%s@%s%s)%s: %s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + argv[4], + argv[5], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (argv_eol[7][0] == ':') ? argv_eol[7] + 1 : argv_eol[7]); return WEECHAT_RC_OK; } @@ -2824,24 +2795,23 @@ IRC_PROTOCOL_CALLBACK(312) { IRC_PROTOCOL_MIN_ARGS(6); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[3], - command, "whois", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s[%s%s%s] %s%s %s(%s%s%s)", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - argv[4], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5], - IRC_COLOR_CHAT_DELIMITERS); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, argv[3], command, "whois", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s] %s%s %s(%s%s%s)", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + argv[4], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5], + IRC_COLOR_CHAT_DELIMITERS); return WEECHAT_RC_OK; } @@ -2857,24 +2827,23 @@ IRC_PROTOCOL_CALLBACK(314) { IRC_PROTOCOL_MIN_ARGS(8); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[3], - command, "whowas", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - _("%s%s[%s%s%s] (%s%s@%s%s)%s was %s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - argv[4], - argv[5], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (argv_eol[7][0] == ':') ? argv_eol[7] + 1 : argv_eol[7]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, argv[3], command, "whowas", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + _("%s%s[%s%s%s] (%s%s@%s%s)%s was %s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + argv[4], + argv[5], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (argv_eol[7][0] == ':') ? argv_eol[7] + 1 : argv_eol[7]); return WEECHAT_RC_OK; } @@ -2899,20 +2868,19 @@ IRC_PROTOCOL_CALLBACK(315) } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "who", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s[%s%s%s]%s %s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "who", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s]%s %s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); } return WEECHAT_RC_OK; @@ -2946,69 +2914,65 @@ IRC_PROTOCOL_CALLBACK(317) if (day > 0) { - weechat_printf_date_tags (ptr_buffer, - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - _("%s%s[%s%s%s]%s idle: %s%d %s%s, " - "%s%02d %s%s %s%02d %s%s %s%02d " - "%s%s, signon at: %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, - argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - day, - IRC_COLOR_RESET, - NG_("day", "days", day), - IRC_COLOR_CHAT_CHANNEL, - hour, - IRC_COLOR_RESET, - NG_("hour", "hours", hour), - IRC_COLOR_CHAT_CHANNEL, - min, - IRC_COLOR_RESET, - NG_("minute", "minutes", min), - IRC_COLOR_CHAT_CHANNEL, - sec, - IRC_COLOR_RESET, - NG_("second", "seconds", sec), - IRC_COLOR_CHAT_CHANNEL, - weechat_util_get_time_string (&datetime)); + weechat_printf_date_tags ( + ptr_buffer, + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + _("%s%s[%s%s%s]%s idle: %s%d %s%s, %s%02d %s%s %s%02d %s%s %s%02d " + "%s%s, signon at: %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + day, + IRC_COLOR_RESET, + NG_("day", "days", day), + IRC_COLOR_CHAT_CHANNEL, + hour, + IRC_COLOR_RESET, + NG_("hour", "hours", hour), + IRC_COLOR_CHAT_CHANNEL, + min, + IRC_COLOR_RESET, + NG_("minute", "minutes", min), + IRC_COLOR_CHAT_CHANNEL, + sec, + IRC_COLOR_RESET, + NG_("second", "seconds", sec), + IRC_COLOR_CHAT_CHANNEL, + weechat_util_get_time_string (&datetime)); } else { - weechat_printf_date_tags (ptr_buffer, - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - _("%s%s[%s%s%s]%s idle: %s%02d %s%s " - "%s%02d %s%s %s%02d %s%s, " - "signon at: %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, - argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - hour, - IRC_COLOR_RESET, - NG_("hour", "hours", hour), - IRC_COLOR_CHAT_CHANNEL, - min, - IRC_COLOR_RESET, - NG_("minute", "minutes", min), - IRC_COLOR_CHAT_CHANNEL, - sec, - IRC_COLOR_RESET, - NG_("second", "seconds", sec), - IRC_COLOR_CHAT_CHANNEL, - weechat_util_get_time_string (&datetime)); + weechat_printf_date_tags ( + ptr_buffer, + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + _("%s%s[%s%s%s]%s idle: %s%02d %s%s %s%02d %s%s %s%02d %s%s, " + "signon at: %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + hour, + IRC_COLOR_RESET, + NG_("hour", "hours", hour), + IRC_COLOR_CHAT_CHANNEL, + min, + IRC_COLOR_RESET, + NG_("minute", "minutes", min), + IRC_COLOR_CHAT_CHANNEL, + sec, + IRC_COLOR_RESET, + NG_("second", "seconds", sec), + IRC_COLOR_CHAT_CHANNEL, + weechat_util_get_time_string (&datetime)); } return WEECHAT_RC_OK; @@ -3030,17 +2994,16 @@ IRC_PROTOCOL_CALLBACK(321) pos_args = (argc > 4) ? ((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "list", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s%s%s", - weechat_prefix ("network"), - argv[3], - (pos_args) ? " " : "", - (pos_args) ? pos_args : ""); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "list", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s%s%s", + weechat_prefix ("network"), + argv[3], + (pos_args) ? " " : "", + (pos_args) ? pos_args : ""); return WEECHAT_RC_OK; } @@ -3064,23 +3027,22 @@ IRC_PROTOCOL_CALLBACK(322) if (!server->cmd_list_regexp || (regexec (server->cmd_list_regexp, argv[3], 0, NULL, 0) == 0)) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "list", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s%s%s(%s%s%s)%s%s%s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - argv[4], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (pos_topic && pos_topic[0]) ? ": " : "", - (pos_topic && pos_topic[0]) ? pos_topic : ""); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "list", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s%s%s(%s%s%s)%s%s%s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + argv[4], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (pos_topic && pos_topic[0]) ? ": " : "", + (pos_topic && pos_topic[0]) ? pos_topic : ""); } return WEECHAT_RC_OK; @@ -3102,15 +3064,13 @@ IRC_PROTOCOL_CALLBACK(323) pos_args = (argc > 3) ? ((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "list", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s", - weechat_prefix ("network"), - (pos_args && pos_args[0]) ? pos_args : ""); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, "list", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s", + weechat_prefix ("network"), + (pos_args && pos_args[0]) ? pos_args : ""); return WEECHAT_RC_OK; } @@ -3144,12 +3104,10 @@ IRC_PROTOCOL_CALLBACK(324) { weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( - server, NULL, - command, NULL, + server, NULL, command, NULL, (ptr_channel) ? ptr_channel->buffer : NULL), date, - irc_protocol_tags (command, "irc_numeric", NULL, - address), + irc_protocol_tags (command, "irc_numeric", NULL, address), _("%sMode %s%s %s[%s%s%s]"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, @@ -3189,41 +3147,39 @@ IRC_PROTOCOL_CALLBACK(327) if (pos_realname && pos_realname[0]) { - weechat_printf_date_tags (ptr_buffer, - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s[%s%s%s] %s%s %s %s(%s%s%s)", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, - argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - argv[4], - argv[5], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - pos_realname, - IRC_COLOR_CHAT_DELIMITERS); + weechat_printf_date_tags ( + ptr_buffer, + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s] %s%s %s %s(%s%s%s)", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + argv[4], + argv[5], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + pos_realname, + IRC_COLOR_CHAT_DELIMITERS); } else { - weechat_printf_date_tags (ptr_buffer, - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s[%s%s%s] %s%s %s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, - argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - argv[4], - argv[5]); + weechat_printf_date_tags ( + ptr_buffer, + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s] %s%s %s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + argv[4], + argv[5]); } return WEECHAT_RC_OK; @@ -3245,19 +3201,18 @@ IRC_PROTOCOL_CALLBACK(328) ptr_channel = irc_channel_search (server, argv[3]); if (ptr_channel) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_channel->buffer), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - _("%sURL for %s%s%s: %s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_RESET, - (argv_eol[4][0] == ':') ? - argv_eol[4] + 1 : argv_eol[4]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_channel->buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + _("%sURL for %s%s%s: %s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_RESET, + (argv_eol[4][0] == ':') ? + argv_eol[4] + 1 : argv_eol[4]); } return WEECHAT_RC_OK; @@ -3287,33 +3242,31 @@ IRC_PROTOCOL_CALLBACK(329) if (weechat_hashtable_has_key (ptr_channel->join_msg_received, command) || weechat_hashtable_has_key (irc_config_hashtable_display_join_message, command)) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_channel->buffer), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - /* TRANSLATORS: "%s" after "created on" is a date */ - _("%sChannel created on %s"), - weechat_prefix ("network"), - weechat_util_get_time_string (&datetime)); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_channel->buffer), + date, + irc_protocol_tags (command, "irc_numeric", + NULL, NULL), + /* TRANSLATORS: "%s" after "created on" is a date */ + _("%sChannel created on %s"), + weechat_prefix ("network"), + weechat_util_get_time_string (&datetime)); } } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - NULL), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - /* TRANSLATORS: "%s" after "created on" is a date */ - _("%sChannel %s%s%s created on %s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_RESET, - weechat_util_get_time_string (&datetime)); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + /* TRANSLATORS: "%s" after "created on" is a date */ + _("%sChannel %s%s%s created on %s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_RESET, + weechat_util_get_time_string (&datetime)); } if (ptr_channel) @@ -3341,45 +3294,40 @@ IRC_PROTOCOL_CALLBACK(330_343) if (argc >= 6) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[3], - command, "whois", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s[%s%s%s] %s%s %s%s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, - argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5], - irc_nick_color_for_msg (server, 1, NULL, - argv[4]), - argv[4]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, argv[3], command, "whois", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s] %s%s %s%s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5], + irc_nick_color_for_msg (server, 1, NULL, argv[4]), + argv[4]); } else { ptr_channel = (irc_channel_is_channel (server, argv[3])) ? irc_channel_search (server, argv[3]) : NULL; ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[3], - command, "whois", - ptr_buffer), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s[%s%s%s] %s%s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, - argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, argv[3], command, "whois", ptr_buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s] %s%s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); } return WEECHAT_RC_OK; @@ -3401,16 +3349,15 @@ IRC_PROTOCOL_CALLBACK(331) ptr_channel = irc_channel_search (server, argv[3]); ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[3], - command, NULL, - ptr_buffer), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - _("%sNo topic set for channel %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - argv[3]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, argv[3], command, NULL, ptr_buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + _("%sNo topic set for channel %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + argv[3]); return WEECHAT_RC_OK; } @@ -3463,19 +3410,18 @@ IRC_PROTOCOL_CALLBACK(332) || (weechat_hashtable_has_key (ptr_channel->join_msg_received, command)) || weechat_hashtable_has_key (irc_config_hashtable_display_join_message, command)) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_buffer), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - _("%sTopic for %s%s%s is \"%s%s\""), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_RESET, - (topic_color) ? topic_color : ((pos_topic) ? pos_topic : ""), - IRC_COLOR_RESET); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + _("%sTopic for %s%s%s is \"%s%s\""), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_RESET, + (topic_color) ? topic_color : ((pos_topic) ? pos_topic : ""), + IRC_COLOR_RESET); } if (topic_color) @@ -3527,42 +3473,36 @@ IRC_PROTOCOL_CALLBACK(333) { if (topic_nick) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_channel->buffer), - date, - irc_protocol_tags (command, - "irc_numeric", - NULL, NULL), - /* TRANSLATORS: "%s" after "on" is a date */ - _("%sTopic set by %s%s%s%s%s%s%s%s%s on %s"), - weechat_prefix ("network"), - irc_nick_color_for_msg (server, 1, - ptr_nick, - topic_nick), - topic_nick, - IRC_COLOR_CHAT_DELIMITERS, - (topic_address && topic_address[0]) ? " (" : "", - IRC_COLOR_CHAT_HOST, - (topic_address) ? topic_address : "", - IRC_COLOR_CHAT_DELIMITERS, - (topic_address && topic_address[0]) ? ")" : "", - IRC_COLOR_RESET, - weechat_util_get_time_string (&datetime)); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_channel->buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + /* TRANSLATORS: "%s" after "on" is a date */ + _("%sTopic set by %s%s%s%s%s%s%s%s%s on %s"), + weechat_prefix ("network"), + irc_nick_color_for_msg (server, 1, ptr_nick, topic_nick), + topic_nick, + IRC_COLOR_CHAT_DELIMITERS, + (topic_address && topic_address[0]) ? " (" : "", + IRC_COLOR_CHAT_HOST, + (topic_address) ? topic_address : "", + IRC_COLOR_CHAT_DELIMITERS, + (topic_address && topic_address[0]) ? ")" : "", + IRC_COLOR_RESET, + weechat_util_get_time_string (&datetime)); } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - ptr_channel->buffer), - date, - irc_protocol_tags (command, - "irc_numeric", - NULL, NULL), - /* TRANSLATORS: "%s" after "on" is a date */ - _("%sTopic set on %s"), - weechat_prefix ("network"), - weechat_util_get_time_string (&datetime)); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_channel->buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + /* TRANSLATORS: "%s" after "on" is a date */ + _("%sTopic set on %s"), + weechat_prefix ("network"), + weechat_util_get_time_string (&datetime)); } } } @@ -3570,46 +3510,42 @@ IRC_PROTOCOL_CALLBACK(333) { if (topic_nick) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - NULL), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - /* TRANSLATORS: "%s" after "on" is a date */ - _("%sTopic for %s%s%s set by %s%s%s%s%s%s%s%s%s on %s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_RESET, - irc_nick_color_for_msg (server, 1, - ptr_nick, - topic_nick), - topic_nick, - IRC_COLOR_CHAT_DELIMITERS, - (topic_address && topic_address[0]) ? " (" : "", - IRC_COLOR_CHAT_HOST, - (topic_address) ? topic_address : "", - IRC_COLOR_CHAT_DELIMITERS, - (topic_address && topic_address[0]) ? ")" : "", - IRC_COLOR_RESET, - weechat_util_get_time_string (&datetime)); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + /* TRANSLATORS: "%s" after "on" is a date */ + _("%sTopic for %s%s%s set by %s%s%s%s%s%s%s%s%s on %s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_RESET, + irc_nick_color_for_msg (server, 1, ptr_nick, topic_nick), + topic_nick, + IRC_COLOR_CHAT_DELIMITERS, + (topic_address && topic_address[0]) ? " (" : "", + IRC_COLOR_CHAT_HOST, + (topic_address) ? topic_address : "", + IRC_COLOR_CHAT_DELIMITERS, + (topic_address && topic_address[0]) ? ")" : "", + IRC_COLOR_RESET, + weechat_util_get_time_string (&datetime)); } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - NULL), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - /* TRANSLATORS: "%s" after "on" is a date */ - _("%sTopic for %s%s%s set on %s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_RESET, - weechat_util_get_time_string (&datetime)); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + /* TRANSLATORS: "%s" after "on" is a date */ + _("%sTopic for %s%s%s set on %s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_RESET, + weechat_util_get_time_string (&datetime)); } } @@ -3630,22 +3566,21 @@ IRC_PROTOCOL_CALLBACK(338) { IRC_PROTOCOL_MIN_ARGS(6); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[3], - command, "whois", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s[%s%s%s]%s %s %s%s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, argv[3]), - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5], - IRC_COLOR_CHAT_HOST, - argv[4]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, argv[3], command, "whois", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s]%s %s %s%s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5], + IRC_COLOR_CHAT_HOST, + argv[4]); return WEECHAT_RC_OK; } @@ -3661,22 +3596,21 @@ IRC_PROTOCOL_CALLBACK(341) { IRC_PROTOCOL_MIN_ARGS(5); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[2], - command, NULL, NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - address), - _("%s%s%s%s has invited %s%s%s to %s%s%s"), - weechat_prefix ("network"), - irc_nick_color_for_msg (server, 1, NULL, argv[2]), - argv[2], - IRC_COLOR_RESET, - irc_nick_color_for_msg (server, 1, NULL, argv[3]), - argv[3], - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - argv[4], - IRC_COLOR_RESET); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, argv[2], command, NULL, NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, address), + _("%s%s%s%s has invited %s%s%s to %s%s%s"), + weechat_prefix ("network"), + irc_nick_color_for_msg (server, 1, NULL, argv[2]), + argv[2], + IRC_COLOR_RESET, + irc_nick_color_for_msg (server, 1, NULL, argv[3]), + argv[3], + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + argv[4], + IRC_COLOR_RESET); return WEECHAT_RC_OK; } @@ -3692,19 +3626,17 @@ IRC_PROTOCOL_CALLBACK(344) { IRC_PROTOCOL_MIN_ARGS(5); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "reop", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - _("%sChannel reop %s%s%s: %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_RESET, - IRC_COLOR_CHAT_HOST, - (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, "reop", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + _("%sChannel reop %s%s%s: %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_RESET, + IRC_COLOR_CHAT_HOST, + (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); return WEECHAT_RC_OK; } @@ -3720,18 +3652,16 @@ IRC_PROTOCOL_CALLBACK(345) { IRC_PROTOCOL_MIN_ARGS(5); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "reop", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s%s%s: %s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_RESET, - (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, "reop", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s%s%s: %s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_RESET, + (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); return WEECHAT_RC_OK; } @@ -3764,63 +3694,59 @@ IRC_PROTOCOL_CALLBACK(346) if (argc >= 7) { datetime = (time_t)(atol (argv[6])); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "invitelist", - ptr_buffer), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - /* TRANSLATORS: "%s" after "on" is a date */ - _("%s%s[%s%s%s] %s%s%s invited by %s " - "on %s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - argv[4], - IRC_COLOR_RESET, - (nick_address[0]) ? nick_address : "?", - weechat_util_get_time_string (&datetime)); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "invitelist", ptr_buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + /* TRANSLATORS: "%s" after "on" is a date */ + _("%s%s[%s%s%s] %s%s%s invited by %s on %s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + argv[4], + IRC_COLOR_RESET, + (nick_address[0]) ? nick_address : "?", + weechat_util_get_time_string (&datetime)); } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "invitelist", - ptr_buffer), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - _("%s%s[%s%s%s] %s%s%s invited by %s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - argv[4], - IRC_COLOR_RESET, - (nick_address[0]) ? nick_address : "?"); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "invitelist", ptr_buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + _("%s%s[%s%s%s] %s%s%s invited by %s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + argv[4], + IRC_COLOR_RESET, + (nick_address[0]) ? nick_address : "?"); } } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "invitelist", - ptr_buffer), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - _("%s%s[%s%s%s] %s%s%s invited"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - argv[4], - IRC_COLOR_RESET); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "invitelist", ptr_buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + _("%s%s[%s%s%s] %s%s%s invited"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + argv[4], + IRC_COLOR_RESET); } return WEECHAT_RC_OK; @@ -3847,21 +3773,20 @@ IRC_PROTOCOL_CALLBACK(347) ptr_channel = irc_channel_search (server, argv[3]); ptr_buffer = (ptr_channel && ptr_channel->nicks) ? ptr_channel->buffer : server->buffer; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "invitelist", - ptr_buffer), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s[%s%s%s]%s%s%s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (pos_args) ? " " : "", - (pos_args) ? pos_args : ""); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "invitelist", ptr_buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s]%s%s%s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (pos_args) ? " " : "", + (pos_args) ? pos_args : ""); return WEECHAT_RC_OK; } @@ -3895,8 +3820,8 @@ IRC_PROTOCOL_CALLBACK(348) { datetime = (time_t)(atol (argv[6])); weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer (server, NULL, command, - "exceptionlist", ptr_buffer), + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "exceptionlist", ptr_buffer), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), /* TRANSLATORS: "%s" after "on" is a date */ @@ -3916,8 +3841,8 @@ IRC_PROTOCOL_CALLBACK(348) else { weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer (server, NULL, command, - "exceptionlist", ptr_buffer), + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "exceptionlist", ptr_buffer), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), _("%s%s[%s%s%s]%s exception %s%s%s by %s"), @@ -3936,8 +3861,8 @@ IRC_PROTOCOL_CALLBACK(348) else { weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer (server, NULL, command, - "exceptionlist", ptr_buffer), + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "exceptionlist", ptr_buffer), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), _("%s%s[%s%s%s]%s exception %s%s"), @@ -3975,21 +3900,20 @@ IRC_PROTOCOL_CALLBACK(349) ptr_channel = irc_channel_search (server, argv[3]); ptr_buffer = (ptr_channel && ptr_channel->nicks) ? ptr_channel->buffer : server->buffer; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "exceptionlist", - ptr_buffer), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s[%s%s%s]%s%s%s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (pos_args) ? " " : "", - (pos_args) ? pos_args : ""); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "exceptionlist", ptr_buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s]%s%s%s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (pos_args) ? " " : "", + (pos_args) ? pos_args : ""); return WEECHAT_RC_OK; } @@ -4012,26 +3936,26 @@ IRC_PROTOCOL_CALLBACK(351) if (argc > 5) { - weechat_printf_date_tags (ptr_buffer, - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s %s (%s)", - weechat_prefix ("network"), - argv[3], - argv[4], - (argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5]); + weechat_printf_date_tags ( + ptr_buffer, + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s %s (%s)", + weechat_prefix ("network"), + argv[3], + argv[4], + (argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5]); } else { - weechat_printf_date_tags (ptr_buffer, - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s %s", - weechat_prefix ("network"), - argv[3], - argv[4]); + weechat_printf_date_tags ( + ptr_buffer, + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s %s", + weechat_prefix ("network"), + argv[3], + argv[4]); } return WEECHAT_RC_OK; @@ -4103,33 +4027,30 @@ IRC_PROTOCOL_CALLBACK(352) /* display output of who (manual who from user) */ if (!ptr_channel || (ptr_channel->checking_away <= 0)) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "who", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s[%s%s%s] %s%s %s(%s%s@%s%s)%s " - "%s%s%s%s(%s)", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, - argv[7]), - argv[7], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - argv[4], - argv[5], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (pos_attr) ? pos_attr : "", - (pos_attr) ? " " : "", - (pos_hopcount) ? pos_hopcount : "", - (pos_hopcount) ? " " : "", - (pos_realname) ? pos_realname : ""); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "who", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s] %s%s %s(%s%s@%s%s)%s %s%s%s%s(%s)", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + irc_nick_color_for_msg (server, 1, NULL, argv[7]), + argv[7], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + argv[4], + argv[5], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (pos_attr) ? pos_attr : "", + (pos_attr) ? " " : "", + (pos_hopcount) ? pos_hopcount : "", + (pos_hopcount) ? " " : "", + (pos_realname) ? pos_realname : ""); } return WEECHAT_RC_OK; @@ -4215,11 +4136,11 @@ IRC_PROTOCOL_CALLBACK(353) if (!irc_nick_new (server, ptr_channel, nickname, pos_host, prefixes, 0)) { - weechat_printf (server->buffer, - _("%s%s: cannot create nick \"%s\" " - "for channel \"%s\""), - weechat_prefix ("error"), - IRC_PLUGIN_NAME, nickname, ptr_channel->name); + weechat_printf ( + server->buffer, + _("%s%s: cannot create nick \"%s\" for channel \"%s\""), + weechat_prefix ("error"), IRC_PLUGIN_NAME, nickname, + ptr_channel->name); } } else if (!ptr_channel && str_nicks) @@ -4232,8 +4153,9 @@ IRC_PROTOCOL_CALLBACK(353) if (prefixes) { strcat (str_nicks, - weechat_color (irc_nick_get_prefix_color_name (server, - prefixes[0]))); + weechat_color ( + irc_nick_get_prefix_color_name (server, + prefixes[0]))); strcat (str_nicks, prefixes); } if (weechat_config_boolean (irc_config_look_color_nicks_in_names)) @@ -4255,21 +4177,20 @@ IRC_PROTOCOL_CALLBACK(353) if (!ptr_channel) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "names", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - _("%sNicks %s%s%s: %s[%s%s%s]"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - pos_channel, - IRC_COLOR_RESET, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (str_nicks) ? str_nicks : "", - IRC_COLOR_CHAT_DELIMITERS); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "names", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + _("%sNicks %s%s%s: %s[%s%s%s]"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + pos_channel, + IRC_COLOR_RESET, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (str_nicks) ? str_nicks : "", + IRC_COLOR_CHAT_DELIMITERS); } if (str_nicks) @@ -4372,21 +4293,21 @@ IRC_PROTOCOL_CALLBACK(366) i++; } } - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "names", - ptr_channel->buffer), - date, - irc_protocol_tags (command, - "irc_numeric", - NULL, NULL), - _("%sNicks %s%s%s: %s[%s%s]"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - ptr_channel->name, - IRC_COLOR_RESET, - IRC_COLOR_CHAT_DELIMITERS, - string, - IRC_COLOR_CHAT_DELIMITERS); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "names", + ptr_channel->buffer), + date, + irc_protocol_tags ( + command, "irc_numeric", NULL, NULL), + _("%sNicks %s%s%s: %s[%s%s]"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + ptr_channel->name, + IRC_COLOR_RESET, + IRC_COLOR_CHAT_DELIMITERS, + string, + IRC_COLOR_CHAT_DELIMITERS); free (string); } } @@ -4446,24 +4367,23 @@ IRC_PROTOCOL_CALLBACK(366) num_normal, IRC_COLOR_RESET, NG_("normal", "normals", num_normal)); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "names", - ptr_channel->buffer), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - _("%sChannel %s%s%s: %s%d%s %s %s(%s%s)"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - ptr_channel->name, - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - num_nicks, - IRC_COLOR_RESET, - NG_("nick", "nicks", num_nicks), - IRC_COLOR_CHAT_DELIMITERS, - str_nicks_count, - IRC_COLOR_CHAT_DELIMITERS); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "names", ptr_channel->buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + _("%sChannel %s%s%s: %s%d%s %s %s(%s%s)"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + ptr_channel->name, + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + num_nicks, + IRC_COLOR_RESET, + NG_("nick", "nicks", num_nicks), + IRC_COLOR_CHAT_DELIMITERS, + str_nicks_count, + IRC_COLOR_CHAT_DELIMITERS); } if (!weechat_hashtable_has_key (ptr_channel->join_msg_received, command)) @@ -4475,18 +4395,17 @@ IRC_PROTOCOL_CALLBACK(366) } else { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "names", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s%s%s: %s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_RESET, - (argv[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "names", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s%s%s: %s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_RESET, + (argv[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); } if (ptr_channel) @@ -4529,8 +4448,8 @@ IRC_PROTOCOL_CALLBACK(367) { datetime = (time_t)(atol (argv[6])); weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer (server, NULL, command, - "banlist", ptr_buffer), + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "banlist", ptr_buffer), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), /* TRANSLATORS: "%s" after "on" is a date */ @@ -4549,8 +4468,8 @@ IRC_PROTOCOL_CALLBACK(367) else { weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer (server, NULL, command, - "banlist", ptr_buffer), + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "banlist", ptr_buffer), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), _("%s%s[%s%s%s] %s%s%s banned by %s"), @@ -4568,8 +4487,8 @@ IRC_PROTOCOL_CALLBACK(367) else { weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer (server, NULL, command, "banlist", - ptr_buffer), + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "banlist", ptr_buffer), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), _("%s%s[%s%s%s] %s%s%s banned"), @@ -4607,21 +4526,20 @@ IRC_PROTOCOL_CALLBACK(368) ptr_channel = irc_channel_search (server, argv[3]); ptr_buffer = (ptr_channel && ptr_channel->nicks) ? ptr_channel->buffer : server->buffer; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "banlist", - ptr_buffer), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s[%s%s%s]%s%s%s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (pos_args) ? " " : "", - (pos_args) ? pos_args : ""); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "banlist", ptr_buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s]%s%s%s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (pos_args) ? " " : "", + (pos_args) ? pos_args : ""); return WEECHAT_RC_OK; } @@ -4650,21 +4568,20 @@ IRC_PROTOCOL_CALLBACK(432) alternate_nick = irc_server_get_alternate_nick (server); if (!alternate_nick) { - weechat_printf_date_tags (ptr_buffer, date, NULL, - _("%s%s: all declared nicknames are " - "already in use or invalid, closing " - "connection with server"), - weechat_prefix ("error"), - IRC_PLUGIN_NAME); + weechat_printf_date_tags ( + ptr_buffer, date, NULL, + _("%s%s: all declared nicknames are already in use or " + "invalid, closing connection with server"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); irc_server_disconnect (server, 0, 1); return WEECHAT_RC_OK; } - weechat_printf_date_tags (ptr_buffer, date, NULL, - _("%s%s: nickname \"%s\" is invalid, " - "trying nickname \"%s\""), - weechat_prefix ("error"), - IRC_PLUGIN_NAME, server->nick, alternate_nick); + weechat_printf_date_tags ( + ptr_buffer, date, NULL, + _("%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + server->nick, alternate_nick); irc_server_set_nick (server, alternate_nick); @@ -4694,21 +4611,21 @@ IRC_PROTOCOL_CALLBACK(433) alternate_nick = irc_server_get_alternate_nick (server); if (!alternate_nick) { - weechat_printf_date_tags (ptr_buffer, date, NULL, - _("%s%s: all declared nicknames are " - "already in use, closing " - "connection with server"), - weechat_prefix ("error"), - IRC_PLUGIN_NAME); + weechat_printf_date_tags ( + ptr_buffer, date, NULL, + _("%s%s: all declared nicknames are already in use, closing " + "connection with server"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); irc_server_disconnect (server, 0, 1); return WEECHAT_RC_OK; } - weechat_printf_date_tags (ptr_buffer, date, NULL, - _("%s%s: nickname \"%s\" is already in use, " - "trying nickname \"%s\""), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, server->nick, alternate_nick); + weechat_printf_date_tags ( + ptr_buffer, date, NULL, + _("%s%s: nickname \"%s\" is already in use, trying nickname " + "\"%s\""), + weechat_prefix ("network"), IRC_PLUGIN_NAME, + server->nick, alternate_nick); irc_server_set_nick (server, alternate_nick); @@ -4752,21 +4669,21 @@ IRC_PROTOCOL_CALLBACK(437) alternate_nick = irc_server_get_alternate_nick (server); if (!alternate_nick) { - weechat_printf_date_tags (ptr_buffer, date, NULL, - _("%s%s: all declared nicknames are " - "already in use or invalid, closing " - "connection with server"), - weechat_prefix ("error"), - IRC_PLUGIN_NAME); + weechat_printf_date_tags ( + ptr_buffer, date, NULL, + _("%s%s: all declared nicknames are already in use or " + "invalid, closing connection with server"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); irc_server_disconnect (server, 0, 1); return WEECHAT_RC_OK; } - weechat_printf_date_tags (ptr_buffer, date, NULL, - _("%s%s: nickname \"%s\" is unavailable, " - "trying nickname \"%s\""), - weechat_prefix ("error"), - IRC_PLUGIN_NAME, server->nick, alternate_nick); + weechat_printf_date_tags ( + ptr_buffer, date, NULL, + _("%s%s: nickname \"%s\" is unavailable, trying nickname " + "\"%s\""), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + server->nick, alternate_nick); irc_server_set_nick (server, alternate_nick); @@ -4795,26 +4712,26 @@ IRC_PROTOCOL_CALLBACK(438) if (argc >= 5) { - weechat_printf_date_tags (ptr_buffer, - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s (%s => %s)", - weechat_prefix ("network"), - (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4], - argv[2], - argv[3]); + weechat_printf_date_tags ( + ptr_buffer, + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s (%s => %s)", + weechat_prefix ("network"), + (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4], + argv[2], + argv[3]); } else { - weechat_printf_date_tags (ptr_buffer, - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s %s", - weechat_prefix ("network"), - argv[2], - argv[3]); + weechat_printf_date_tags ( + ptr_buffer, + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s %s", + weechat_prefix ("network"), + argv[2], + argv[3]); } return WEECHAT_RC_OK; @@ -4849,8 +4766,8 @@ IRC_PROTOCOL_CALLBACK(728) { datetime = (time_t)(atol (argv[7])); weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer (server, NULL, command, - "quietlist", ptr_buffer), + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "quietlist", ptr_buffer), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), /* TRANSLATORS: "%s" after "on" is a date */ @@ -4869,8 +4786,8 @@ IRC_PROTOCOL_CALLBACK(728) else { weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer (server, NULL, command, - "quietlist", ptr_buffer), + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "quietlist", ptr_buffer), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), _("%s%s[%s%s%s] %s%s%s quieted by %s"), @@ -4888,8 +4805,8 @@ IRC_PROTOCOL_CALLBACK(728) else { weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer (server, NULL, command, - "quietlist", ptr_buffer), + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "quietlist", ptr_buffer), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), _("%s%s[%s%s%s] %s%s%s quieted"), @@ -4927,21 +4844,20 @@ IRC_PROTOCOL_CALLBACK(729) ptr_channel = irc_channel_search (server, argv[3]); ptr_buffer = (ptr_channel && ptr_channel->nicks) ? ptr_channel->buffer : server->buffer; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "quietlist", - ptr_buffer), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s[%s%s%s]%s%s%s", - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_CHANNEL, - argv[3], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_RESET, - (pos_args) ? " " : "", - (pos_args) ? pos_args : ""); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "quietlist", ptr_buffer), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s[%s%s%s]%s%s%s", + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_CHANNEL, + argv[3], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_RESET, + (pos_args) ? " " : "", + (pos_args) ? pos_args : ""); return WEECHAT_RC_OK; } @@ -5038,15 +4954,14 @@ IRC_PROTOCOL_CALLBACK(732) pos_args = (argc > 3) ? ((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "monitor", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s", - weechat_prefix ("network"), - (pos_args && pos_args[0]) ? pos_args : ""); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "monitor", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s", + weechat_prefix ("network"), + (pos_args && pos_args[0]) ? pos_args : ""); return WEECHAT_RC_OK; } @@ -5067,15 +4982,14 @@ IRC_PROTOCOL_CALLBACK(733) pos_args = (argc > 3) ? ((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL; - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "monitor", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s", - weechat_prefix ("network"), - (pos_args && pos_args[0]) ? pos_args : ""); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "monitor", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s", + weechat_prefix ("network"), + (pos_args && pos_args[0]) ? pos_args : ""); return WEECHAT_RC_OK; } @@ -5091,16 +5005,15 @@ IRC_PROTOCOL_CALLBACK(734) { IRC_PROTOCOL_MIN_ARGS(5); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, "monitor", - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s (%s)", - weechat_prefix ("error"), - (argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5], - argv[3]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, "monitor", NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s (%s)", + weechat_prefix ("error"), + (argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5], + argv[3]); return WEECHAT_RC_OK; } @@ -5116,19 +5029,17 @@ IRC_PROTOCOL_CALLBACK(900) { IRC_PROTOCOL_MIN_ARGS(6); - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, argv[3], - command, NULL, - NULL), - date, - irc_protocol_tags (command, "irc_numeric", NULL, - NULL), - "%s%s %s(%s%s%s)", - weechat_prefix ("network"), - (argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - argv[3], - IRC_COLOR_CHAT_DELIMITERS); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, argv[3], command, NULL, NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s %s(%s%s%s)", + weechat_prefix ("network"), + (argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + argv[3], + IRC_COLOR_CHAT_DELIMITERS); return WEECHAT_RC_OK; } @@ -5146,15 +5057,13 @@ IRC_PROTOCOL_CALLBACK(901) if (argc >= 7) { - weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL, - command, NULL, - NULL), - date, - irc_protocol_tags (command, "irc_numeric", - NULL, NULL), - "%s%s", - weechat_prefix ("network"), - (argv_eol[6][0] == ':') ? argv_eol[6] + 1 : argv_eol[6]); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), + date, + irc_protocol_tags (command, "irc_numeric", NULL, NULL), + "%s%s", + weechat_prefix ("network"), + (argv_eol[6][0] == ':') ? argv_eol[6] + 1 : argv_eol[6]); } else { @@ -5495,8 +5404,11 @@ irc_protocol_recv_command (struct t_irc_server *server, } nick = (nick1) ? strdup (nick1) : NULL; address = (address1) ? strdup (address1) : NULL; - address_color = (address) ? irc_color_decode (address, - weechat_config_boolean (irc_config_network_colors_receive)) : NULL; + address_color = (address) ? + irc_color_decode ( + address, + weechat_config_boolean (irc_config_network_colors_receive)) : + NULL; host = (host1) ? strdup (host1) : NULL; if (host) { @@ -5505,16 +5417,20 @@ irc_protocol_recv_command (struct t_irc_server *server, pos_space[0] = '\0'; } host_no_color = (host) ? irc_color_decode (host, 0) : NULL; - host_color = (host) ? irc_color_decode (host, - weechat_config_boolean (irc_config_network_colors_receive)) : NULL; + host_color = (host) ? + irc_color_decode ( + host, + weechat_config_boolean (irc_config_network_colors_receive)) : + NULL; /* check if message is ignored or not */ ptr_channel = NULL; if (msg_channel) ptr_channel = irc_channel_search (server, msg_channel); - message_ignored = irc_ignore_check (server, - (ptr_channel) ? ptr_channel->name : msg_channel, - nick, host_no_color); + message_ignored = irc_ignore_check ( + server, + (ptr_channel) ? ptr_channel->name : msg_channel, + nick, host_no_color); /* send signal with received command, even if command is ignored */ irc_server_send_signal (server, "irc_raw_in", msg_command, @@ -5531,7 +5447,8 @@ irc_protocol_recv_command (struct t_irc_server *server, cmd_found = -1; for (i = 0; irc_protocol_messages[i].name; i++) { - if (weechat_strcasecmp (irc_protocol_messages[i].name, msg_command) == 0) + if (weechat_strcasecmp (irc_protocol_messages[i].name, + msg_command) == 0) { cmd_found = i; break; @@ -5574,10 +5491,15 @@ irc_protocol_recv_command (struct t_irc_server *server, if (irc_message) { if (decode_color) - dup_irc_message = irc_color_decode (irc_message, - weechat_config_boolean (irc_config_network_colors_receive)); + { + dup_irc_message = irc_color_decode ( + irc_message, + weechat_config_boolean (irc_config_network_colors_receive)); + } else + { dup_irc_message = strdup (irc_message); + } } else dup_irc_message = NULL; diff --git a/src/plugins/irc/irc-redirect.c b/src/plugins/irc/irc-redirect.c index 553507967..da63f0ae3 100644 --- a/src/plugins/irc/irc-redirect.c +++ b/src/plugins/irc/irc-redirect.c @@ -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; } diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index d954b79e3..01b62a0ea 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -325,14 +325,14 @@ irc_server_sasl_enabled (struct t_irc_server *server) int sasl_mechanism, rc; char *sasl_username, *sasl_password; - sasl_mechanism = IRC_SERVER_OPTION_INTEGER(server, - IRC_SERVER_OPTION_SASL_MECHANISM); - sasl_username = weechat_string_eval_expression (IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_SASL_USERNAME), - NULL, NULL, NULL); - sasl_password = weechat_string_eval_expression (IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_SASL_PASSWORD), - NULL, NULL, NULL); + sasl_mechanism = IRC_SERVER_OPTION_INTEGER( + server, IRC_SERVER_OPTION_SASL_MECHANISM); + sasl_username = weechat_string_eval_expression ( + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SASL_USERNAME), + NULL, NULL, NULL); + sasl_password = weechat_string_eval_expression ( + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SASL_PASSWORD), + NULL, NULL, NULL); /* * SASL is enabled if using mechanism "external" @@ -403,11 +403,12 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses) /* set new addresses/ports */ if (addresses && addresses[0]) { - server->addresses_array = weechat_string_split (addresses, - ",", 0, 0, - &server->addresses_count); - server->ports_array = malloc (server->addresses_count * sizeof (server->ports_array[0])); - server->retry_array = malloc (server->addresses_count * sizeof (server->retry_array[0])); + server->addresses_array = weechat_string_split ( + addresses, ",", 0, 0, &server->addresses_count); + server->ports_array = malloc ( + server->addresses_count * sizeof (server->ports_array[0])); + server->retry_array = malloc ( + server->addresses_count * sizeof (server->retry_array[0])); for (i = 0; i < server->addresses_count; i++) { pos = strchr (server->addresses_array[i], '/'); @@ -474,9 +475,9 @@ irc_server_set_nicks (struct t_irc_server *server, const char *nicks) } /* set new nicks */ - server->nicks_array = weechat_string_split ((nicks) ? nicks : IRC_SERVER_DEFAULT_NICKS, - ",", 0, 0, - &server->nicks_count); + server->nicks_array = weechat_string_split ( + (nicks) ? nicks : IRC_SERVER_DEFAULT_NICKS, + ",", 0, 0, &server->nicks_count); } /* @@ -1200,9 +1201,10 @@ irc_server_alloc_with_url (const char *irc_url) "%s/%s", pos_address, (pos_port && pos_port[0]) ? pos_port : default_port); - weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_ADDRESSES], - server_address, - 1); + weechat_config_option_set ( + ptr_server->options[IRC_SERVER_OPTION_ADDRESSES], + server_address, + 1); free (server_address); } } @@ -1221,21 +1223,24 @@ irc_server_alloc_with_url (const char *irc_url) snprintf (server_nicks, length, "%s,%s1,%s2,%s3,%s4", pos_nick, pos_nick, pos_nick, pos_nick, pos_nick); - weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_NICKS], - server_nicks, - 1); + weechat_config_option_set ( + ptr_server->options[IRC_SERVER_OPTION_NICKS], + server_nicks, + 1); free (server_nicks); } } if (pos_password && pos_password[0]) { - weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_PASSWORD], - pos_password, - 1); + weechat_config_option_set ( + ptr_server->options[IRC_SERVER_OPTION_PASSWORD], + pos_password, + 1); } - weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_AUTOCONNECT], - "on", - 1); + weechat_config_option_set ( + ptr_server->options[IRC_SERVER_OPTION_AUTOCONNECT], + "on", + 1); /* autojoin */ if (pos_channel && pos_channel[0]) { @@ -1252,9 +1257,10 @@ irc_server_alloc_with_url (const char *irc_url) } if (server_autojoin) { - weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_AUTOJOIN], - server_autojoin, - 1); + weechat_config_option_set ( + ptr_server->options[IRC_SERVER_OPTION_AUTOJOIN], + server_autojoin, + 1); free (server_autojoin); } } @@ -1574,16 +1580,18 @@ irc_server_copy (struct t_irc_server *server, const char *new_name) { if (!weechat_infolist_integer (infolist, "value_is_null")) { - option_name = weechat_infolist_string (infolist, "option_name"); + option_name = weechat_infolist_string (infolist, + "option_name"); pos = strrchr (option_name, '.'); if (pos) { index_option = irc_server_search_option (pos + 1); if (index_option >= 0) { - weechat_config_option_set (new_server->options[index_option], - weechat_infolist_string (infolist, "value"), - 1); + weechat_config_option_set ( + new_server->options[index_option], + weechat_infolist_string (infolist, "value"), + 1); } } } @@ -1630,8 +1638,8 @@ irc_server_rename (struct t_irc_server *server, const char *new_server_name) { while (weechat_infolist_next (infolist)) { - ptr_option = weechat_config_get (weechat_infolist_string (infolist, - "full_name")); + ptr_option = weechat_config_get ( + weechat_infolist_string (infolist, "full_name")); if (ptr_option) { option_name = weechat_infolist_string (infolist, "option_name"); @@ -1668,7 +1676,8 @@ irc_server_rename (struct t_irc_server *server, const char *new_server_name) { if (ptr_channel->buffer) { - buffer_name = irc_buffer_build_name (server->name, ptr_channel->name); + buffer_name = irc_buffer_build_name (server->name, + ptr_channel->name); weechat_buffer_set (ptr_channel->buffer, "name", buffer_name); weechat_buffer_set (ptr_channel->buffer, "localvar_set_server", server->name); @@ -1747,19 +1756,21 @@ irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf) if (!server) { - weechat_printf (NULL, - _("%s%s: sending data to server: null pointer (please " - "report problem to developers)"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + NULL, + _("%s%s: sending data to server: null pointer (please report " + "problem to developers)"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); return 0; } if (size_buf <= 0) { - weechat_printf (server->buffer, - _("%s%s: sending data to server: empty buffer (please " - "report problem to developers)"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: sending data to server: empty buffer (please report " + "problem to developers)"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); return 0; } @@ -1775,20 +1786,20 @@ irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf) #ifdef HAVE_GNUTLS if (server->ssl_connected) { - weechat_printf (server->buffer, - _("%s%s: sending data to server: error %d %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - rc, - gnutls_strerror (rc)); + weechat_printf ( + server->buffer, + _("%s%s: sending data to server: error %d %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + rc, gnutls_strerror (rc)); } else #endif { - weechat_printf (server->buffer, - _("%s%s: sending data to server: error %d %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - errno, - strerror (errno)); + weechat_printf ( + server->buffer, + _("%s%s: sending data to server: error %d %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + errno, strerror (errno)); } } @@ -1857,10 +1868,12 @@ irc_server_outqueue_send (struct t_irc_server *server) switch (priority) { case 0: - anti_flood = IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_HIGH); + anti_flood = IRC_SERVER_OPTION_INTEGER( + server, IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_HIGH); break; default: - anti_flood = IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_LOW); + anti_flood = IRC_SERVER_OPTION_INTEGER( + server, IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_LOW); break; } if (server->outqueue[priority] @@ -1890,28 +1903,33 @@ irc_server_outqueue_send (struct t_irc_server *server) pos[0] = '\r'; /* send signal with command that will be sent to server */ - irc_server_send_signal (server, "irc_out", - server->outqueue[priority]->command, - server->outqueue[priority]->message_after_mod, - NULL); - tags_to_send = irc_server_get_tags_to_send (server->outqueue[priority]->tags); - irc_server_send_signal (server, "irc_outtags", - server->outqueue[priority]->command, - server->outqueue[priority]->message_after_mod, - (tags_to_send) ? tags_to_send : ""); + irc_server_send_signal ( + server, "irc_out", + server->outqueue[priority]->command, + server->outqueue[priority]->message_after_mod, + NULL); + tags_to_send = irc_server_get_tags_to_send ( + server->outqueue[priority]->tags); + irc_server_send_signal ( + server, "irc_outtags", + server->outqueue[priority]->command, + server->outqueue[priority]->message_after_mod, + (tags_to_send) ? tags_to_send : ""); if (tags_to_send) free (tags_to_send); /* send command */ - irc_server_send (server, server->outqueue[priority]->message_after_mod, - strlen (server->outqueue[priority]->message_after_mod)); + irc_server_send ( + server, server->outqueue[priority]->message_after_mod, + strlen (server->outqueue[priority]->message_after_mod)); server->last_user_message = time_now; /* start redirection if redirect is set */ if (server->outqueue[priority]->redirect) { - irc_redirect_init_command (server->outqueue[priority]->redirect, - server->outqueue[priority]->message_after_mod); + irc_redirect_init_command ( + server->outqueue[priority]->redirect, + server->outqueue[priority]->message_after_mod); } } irc_server_outqueue_free (server, priority, @@ -2021,10 +2039,12 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags, switch (queue_msg - 1) { case 0: - anti_flood = IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_HIGH); + anti_flood = IRC_SERVER_OPTION_INTEGER( + server, IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_HIGH); break; default: - anti_flood = IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_LOW); + anti_flood = IRC_SERVER_OPTION_INTEGER( + server, IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_LOW); break; } @@ -2208,12 +2228,16 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags, if (ret_hashtable) { - snprintf (hash_key, sizeof (hash_key), "msg%d", ret_number); - weechat_hashtable_set (ret_hashtable, hash_key, str_message); + snprintf (hash_key, sizeof (hash_key), + "msg%d", ret_number); + weechat_hashtable_set (ret_hashtable, + hash_key, str_message); if (str_args) { - snprintf (hash_key, sizeof (hash_key), "args%d", ret_number); - weechat_hashtable_set (ret_hashtable, hash_key, str_args); + snprintf (hash_key, sizeof (hash_key), + "args%d", ret_number); + weechat_hashtable_set (ret_hashtable, + hash_key, str_args); } ret_number++; } @@ -2307,7 +2331,8 @@ irc_server_msgq_add_msg (struct t_irc_server *server, const char *msg) */ void -irc_server_msgq_add_unterminated (struct t_irc_server *server, const char *string) +irc_server_msgq_add_unterminated (struct t_irc_server *server, + const char *string) { char *unterminated_message2; @@ -2419,9 +2444,10 @@ irc_server_msgq_flush () snprintf (str_modifier, sizeof (str_modifier), "irc_in_%s", (command) ? command : "unknown"); - new_msg = weechat_hook_modifier_exec (str_modifier, - irc_recv_msgq->server->name, - ptr_data); + new_msg = weechat_hook_modifier_exec ( + str_modifier, + irc_recv_msgq->server->name, + ptr_data); if (command) free (command); @@ -2446,9 +2472,10 @@ irc_server_msgq_flush () if (new_msg) { - irc_raw_print (irc_recv_msgq->server, - IRC_RAW_FLAG_RECV | IRC_RAW_FLAG_MODIFIED, - ptr_msg); + irc_raw_print ( + irc_recv_msgq->server, + IRC_RAW_FLAG_RECV | IRC_RAW_FLAG_MODIFIED, + ptr_msg); } irc_message_parse (irc_recv_msgq->server, ptr_msg, @@ -2470,7 +2497,8 @@ irc_server_msgq_flush () { if (nick && (!host || (strcmp (nick, host) != 0))) { - snprintf (modifier_data, sizeof (modifier_data), + snprintf (modifier_data, + sizeof (modifier_data), "%s.%s.%s", weechat_plugin->name, irc_recv_msgq->server->name, @@ -2478,20 +2506,21 @@ irc_server_msgq_flush () } else { - snprintf (modifier_data, sizeof (modifier_data), + snprintf (modifier_data, + sizeof (modifier_data), "%s.%s", weechat_plugin->name, irc_recv_msgq->server->name); } } - msg_decoded = weechat_hook_modifier_exec ("charset_decode", - modifier_data, - ptr_msg); + msg_decoded = weechat_hook_modifier_exec ( + "charset_decode", modifier_data, ptr_msg); /* replace WeeChat internal color codes by "?" */ msg_decoded_without_color = - weechat_string_remove_color ((msg_decoded) ? msg_decoded : ptr_msg, - "?"); + weechat_string_remove_color ( + (msg_decoded) ? msg_decoded : ptr_msg, + "?"); /* call modifier after charset */ ptr_msg2 = (msg_decoded_without_color) ? @@ -2499,9 +2528,10 @@ irc_server_msgq_flush () snprintf (str_modifier, sizeof (str_modifier), "irc_in2_%s", (command) ? command : "unknown"); - new_msg2 = weechat_hook_modifier_exec (str_modifier, - irc_recv_msgq->server->name, - ptr_msg2); + new_msg2 = weechat_hook_modifier_exec ( + str_modifier, + irc_recv_msgq->server->name, + ptr_msg2); if (new_msg2 && (strcmp (ptr_msg2, new_msg2) == 0)) { free (new_msg2); @@ -2540,11 +2570,12 @@ irc_server_msgq_flush () else ptr_msg3 = ptr_msg2; } - irc_protocol_recv_command (irc_recv_msgq->server, - ptr_msg3, - tags, - command, - channel); + irc_protocol_recv_command ( + irc_recv_msgq->server, + ptr_msg3, + tags, + command, + channel); } } @@ -2654,16 +2685,17 @@ irc_server_recv_cb (void *data, int fd) || ((num_read != GNUTLS_E_AGAIN) && (num_read != GNUTLS_E_INTERRUPTED))) { - weechat_printf (server->buffer, - _("%s%s: reading data on socket: error %d %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - num_read, - (num_read == 0) ? _("(connection closed by peer)") : - gnutls_strerror (num_read)); - weechat_printf (server->buffer, - _("%s%s: disconnecting from server..."), - weechat_prefix ("network"), - IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: reading data on socket: error %d %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + num_read, + (num_read == 0) ? _("(connection closed by peer)") : + gnutls_strerror (num_read)); + weechat_printf ( + server->buffer, + _("%s%s: disconnecting from server..."), + weechat_prefix ("network"), IRC_PLUGIN_NAME); irc_server_disconnect (server, !server->is_connected, 1); } } @@ -2673,16 +2705,17 @@ irc_server_recv_cb (void *data, int fd) if ((num_read == 0) || ((errno != EAGAIN) && (errno != EWOULDBLOCK))) { - weechat_printf (server->buffer, - _("%s%s: reading data on socket: error %d %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - errno, - (num_read == 0) ? _("(connection closed by peer)") : - strerror (errno)); - weechat_printf (server->buffer, - _("%s%s: disconnecting from server..."), - weechat_prefix ("network"), - IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: reading data on socket: error %d %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + errno, + (num_read == 0) ? _("(connection closed by peer)") : + strerror (errno)); + weechat_printf ( + server->buffer, + _("%s%s: disconnecting from server..."), + weechat_prefix ("network"), IRC_PLUGIN_NAME); irc_server_disconnect (server, !server->is_connected, 1); } } @@ -2717,9 +2750,10 @@ irc_server_timer_connection_cb (void *data, int remaining_calls) if (!server->is_connected) { - weechat_printf (server->buffer, - _("%s%s: connection timeout (message 001 not received)"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: connection timeout (message 001 not received)"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); irc_server_disconnect (server, !server->is_connected, 1); } @@ -2866,7 +2900,8 @@ irc_server_timer_cb (void *data, int remaining_calls) else { /* check away (only if lag check was not done) */ - away_check = IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_AWAY_CHECK); + away_check = IRC_SERVER_OPTION_INTEGER( + ptr_server, IRC_SERVER_OPTION_AWAY_CHECK); if (!ptr_server->cap_away_notify && (away_check > 0) && ((ptr_server->last_away_check == 0) @@ -2912,14 +2947,14 @@ irc_server_timer_cb (void *data, int remaining_calls) if ((weechat_config_integer (irc_config_network_lag_reconnect) > 0) && (ptr_server->lag >= weechat_config_integer (irc_config_network_lag_reconnect) * 1000)) { - weechat_printf (ptr_server->buffer, - _("%s%s: lag is high, reconnecting to " - "server %s%s%s"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, - IRC_COLOR_CHAT_SERVER, - ptr_server->name, - IRC_COLOR_RESET); + weechat_printf ( + ptr_server->buffer, + _("%s%s: lag is high, reconnecting to server %s%s%s"), + weechat_prefix ("network"), + IRC_PLUGIN_NAME, + IRC_COLOR_CHAT_SERVER, + ptr_server->name, + IRC_COLOR_RESET); irc_server_disconnect (ptr_server, 0, 1); } else @@ -3091,32 +3126,35 @@ irc_server_reconnect_schedule (struct t_irc_server *server) seconds = server->reconnect_delay % 60; if ((minutes > 0) && (seconds > 0)) { - weechat_printf (server->buffer, - _("%s%s: reconnecting to server in %d %s, %d %s"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, - minutes, - NG_("minute", "minutes", minutes), - seconds, - NG_("second", "seconds", seconds)); + weechat_printf ( + server->buffer, + _("%s%s: reconnecting to server in %d %s, %d %s"), + weechat_prefix ("network"), + IRC_PLUGIN_NAME, + minutes, + NG_("minute", "minutes", minutes), + seconds, + NG_("second", "seconds", seconds)); } else if (minutes > 0) { - weechat_printf (server->buffer, - _("%s%s: reconnecting to server in %d %s"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, - minutes, - NG_("minute", "minutes", minutes)); + weechat_printf ( + server->buffer, + _("%s%s: reconnecting to server in %d %s"), + weechat_prefix ("network"), + IRC_PLUGIN_NAME, + minutes, + NG_("minute", "minutes", minutes)); } else { - weechat_printf (server->buffer, - _("%s%s: reconnecting to server in %d %s"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, - seconds, - NG_("second", "seconds", seconds)); + weechat_printf ( + server->buffer, + _("%s%s: reconnecting to server in %d %s"), + weechat_prefix ("network"), + IRC_PLUGIN_NAME, + seconds, + NG_("second", "seconds", seconds)); } } else @@ -3146,7 +3184,8 @@ irc_server_login (struct t_irc_server *server) IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_REALNAME), NULL, NULL, NULL); - capabilities = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_CAPABILITIES); + capabilities = IRC_SERVER_OPTION_STRING( + server, IRC_SERVER_OPTION_CAPABILITIES); if (password && password[0]) irc_server_sendf (server, 0, NULL, "PASS %s", password); @@ -3170,12 +3209,13 @@ irc_server_login (struct t_irc_server *server) username2 = (username && username[0]) ? weechat_string_replace (username, " ", "_") : strdup ("weechat"); - irc_server_sendf (server, 0, NULL, - "NICK %s\n" - "USER %s 0 * :%s", - server->nick, - (username2) ? username2 : "weechat", - (realname && realname[0]) ? realname : ((username2) ? username2 : "weechat")); + irc_server_sendf ( + server, 0, NULL, + "NICK %s\n" + "USER %s 0 * :%s", + server->nick, + (username2) ? username2 : "weechat", + (realname && realname[0]) ? realname : ((username2) ? username2 : "weechat")); if (username2) free (username2); @@ -3205,14 +3245,16 @@ irc_server_switch_address (struct t_irc_server *server, int connection) { if (server->addresses_count > 1) { - irc_server_set_index_current_address (server, - (server->index_current_address + 1) % server->addresses_count); - weechat_printf (server->buffer, - _("%s%s: switching address to %s/%d"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, - server->current_address, - server->current_port); + irc_server_set_index_current_address ( + server, + (server->index_current_address + 1) % server->addresses_count); + weechat_printf ( + server->buffer, + _("%s%s: switching address to %s/%d"), + weechat_prefix ("network"), + IRC_PLUGIN_NAME, + server->current_address, + server->current_port); if (connection) { if (server->index_current_address == 0) @@ -3253,13 +3295,14 @@ irc_server_connect_cb (void *data, int status, int gnutls_rc, int sock, if (server->current_ip) free (server->current_ip); server->current_ip = (ip_address) ? strdup (ip_address) : NULL; - weechat_printf (server->buffer, - _("%s%s: connected to %s/%d (%s)"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, - server->current_address, - server->current_port, - (server->current_ip) ? server->current_ip : "?"); + weechat_printf ( + server->buffer, + _("%s%s: connected to %s/%d (%s)"), + weechat_prefix ("network"), + IRC_PLUGIN_NAME, + server->current_address, + server->current_port, + (server->current_ip) ? server->current_ip : "?"); server->hook_fd = weechat_hook_fd (server->sock, 1, 0, 0, &irc_server_recv_cb, @@ -3268,129 +3311,135 @@ irc_server_connect_cb (void *data, int status, int gnutls_rc, int sock, irc_server_login (server); break; case WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND: - weechat_printf (server->buffer, - (proxy && proxy[0]) ? - _("%s%s: proxy address \"%s\" not found") : - _("%s%s: address \"%s\" not found"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - server->current_address); + weechat_printf ( + server->buffer, + (proxy && proxy[0]) ? + _("%s%s: proxy address \"%s\" not found") : + _("%s%s: address \"%s\" not found"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + server->current_address); if (error && error[0]) { - weechat_printf (server->buffer, - _("%s%s: error: %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - error); + weechat_printf ( + server->buffer, + _("%s%s: error: %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, error); } irc_server_close_connection (server); irc_server_switch_address (server, 1); break; case WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND: - weechat_printf (server->buffer, - (proxy && proxy[0]) ? - _("%s%s: proxy IP address not found") : - _("%s%s: IP address not found"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + (proxy && proxy[0]) ? + _("%s%s: proxy IP address not found") : + _("%s%s: IP address not found"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); if (error && error[0]) { - weechat_printf (server->buffer, - _("%s%s: error: %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - error); + weechat_printf ( + server->buffer, + _("%s%s: error: %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, error); } irc_server_close_connection (server); irc_server_switch_address (server, 1); break; case WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED: - weechat_printf (server->buffer, - (proxy && proxy[0]) ? - _("%s%s: proxy connection refused") : - _("%s%s: connection refused"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + (proxy && proxy[0]) ? + _("%s%s: proxy connection refused") : + _("%s%s: connection refused"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); if (error && error[0]) { - weechat_printf (server->buffer, - _("%s%s: error: %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - error); + weechat_printf ( + server->buffer, + _("%s%s: error: %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, error); } irc_server_close_connection (server); server->current_retry++; irc_server_switch_address (server, 1); break; case WEECHAT_HOOK_CONNECT_PROXY_ERROR: - weechat_printf (server->buffer, - _("%s%s: proxy fails to establish " - "connection to server " - "(check username/password if used " - "and if server address/port is allowed by " - "proxy)"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: proxy fails to establish connection to server (check " + "username/password if used and if server address/port is " + "allowed by proxy)"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); if (error && error[0]) { - weechat_printf (server->buffer, - _("%s%s: error: %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - error); + weechat_printf ( + server->buffer, + _("%s%s: error: %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, error); } irc_server_close_connection (server); irc_server_switch_address (server, 1); break; case WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR: - weechat_printf (server->buffer, - _("%s%s: unable to set local hostname/IP"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: unable to set local hostname/IP"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); if (error && error[0]) { - weechat_printf (server->buffer, - _("%s%s: error: %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - error); + weechat_printf ( + server->buffer, + _("%s%s: error: %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, error); } irc_server_close_connection (server); irc_server_reconnect_schedule (server); break; case WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR: - weechat_printf (server->buffer, - _("%s%s: TLS init error"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: TLS init error"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); if (error && error[0]) { - weechat_printf (server->buffer, - _("%s%s: error: %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - error); + weechat_printf ( + server->buffer, + _("%s%s: error: %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, error); } irc_server_close_connection (server); server->current_retry++; irc_server_reconnect_schedule (server); break; case WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR: - weechat_printf (server->buffer, - _("%s%s: TLS handshake failed"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: TLS handshake failed"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); if (error && error[0]) { - weechat_printf (server->buffer, - _("%s%s: error: %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - error); + weechat_printf ( + server->buffer, + _("%s%s: error: %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, error); } #ifdef HAVE_GNUTLS if (gnutls_rc == GNUTLS_E_DH_PRIME_UNACCEPTABLE) { - weechat_printf (server->buffer, - _("%s%s: you should play with option " - "irc.server.%s.ssl_dhkey_size (current " - "value is %d, try a lower value like %d or " - "%d)"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - server->name, - IRC_SERVER_OPTION_INTEGER (server, - IRC_SERVER_OPTION_SSL_DHKEY_SIZE), - IRC_SERVER_OPTION_INTEGER (server, - IRC_SERVER_OPTION_SSL_DHKEY_SIZE) / 2, - IRC_SERVER_OPTION_INTEGER (server, - IRC_SERVER_OPTION_SSL_DHKEY_SIZE) / 4); + weechat_printf ( + server->buffer, + _("%s%s: you should play with option " + "irc.server.%s.ssl_dhkey_size (current value is %d, try " + "a lower value like %d or %d)"), + weechat_prefix ("error"), + IRC_PLUGIN_NAME, + server->name, + IRC_SERVER_OPTION_INTEGER ( + server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE), + IRC_SERVER_OPTION_INTEGER ( + server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE) / 2, + IRC_SERVER_OPTION_INTEGER ( + server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE) / 4); } #else (void) gnutls_rc; @@ -3400,44 +3449,47 @@ irc_server_connect_cb (void *data, int status, int gnutls_rc, int sock, irc_server_switch_address (server, 1); break; case WEECHAT_HOOK_CONNECT_MEMORY_ERROR: - weechat_printf (server->buffer, - _("%s%s: not enough memory"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: not enough memory"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); if (error && error[0]) { - weechat_printf (server->buffer, - _("%s%s: error: %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - error); + weechat_printf ( + server->buffer, + _("%s%s: error: %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, error); } irc_server_close_connection (server); irc_server_reconnect_schedule (server); break; case WEECHAT_HOOK_CONNECT_TIMEOUT: - weechat_printf (server->buffer, - _("%s%s: timeout"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: timeout"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); if (error && error[0]) { - weechat_printf (server->buffer, - _("%s%s: error: %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - error); + weechat_printf ( + server->buffer, + _("%s%s: error: %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, error); } irc_server_close_connection (server); server->current_retry++; irc_server_switch_address (server, 1); break; case WEECHAT_HOOK_CONNECT_SOCKET_ERROR: - weechat_printf (server->buffer, - _("%s%s: unable to create socket"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: unable to create socket"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); if (error && error[0]) { - weechat_printf (server->buffer, - _("%s%s: error: %s"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - error); + weechat_printf ( + server->buffer, + _("%s%s: error: %s"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, error); } irc_server_close_connection (server); server->current_retry++; @@ -3539,8 +3591,9 @@ irc_server_create_buffer (struct t_irc_server *server) if (weechat_config_string (irc_config_look_highlight_tags_restrict) && weechat_config_string (irc_config_look_highlight_tags_restrict)[0]) { - weechat_buffer_set (server->buffer, "highlight_tags_restrict", - weechat_config_string (irc_config_look_highlight_tags_restrict)); + weechat_buffer_set ( + server->buffer, "highlight_tags_restrict", + weechat_config_string (irc_config_look_highlight_tags_restrict)); } irc_server_set_buffer_title (server); @@ -3621,10 +3674,10 @@ irc_server_check_certificate_fingerprint (struct t_irc_server *server, fingerprint_server, &fingerprint_size) != GNUTLS_E_SUCCESS) { - weechat_printf (server->buffer, - _("%sgnutls: failed to calculate certificate " - "fingerprint"), - weechat_prefix ("error")); + weechat_printf ( + server->buffer, + _("%sgnutls: failed to calculate certificate fingerprint"), + weechat_prefix ("error")); return 0; } @@ -3709,20 +3762,21 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, if (action == WEECHAT_HOOK_CONNECT_GNUTLS_CB_VERIFY_CERT) { - weechat_printf (server->buffer, - _("%sgnutls: connected using %d-bit Diffie-Hellman " - "shared secret exchange"), - weechat_prefix ("network"), - IRC_SERVER_OPTION_INTEGER (server, - IRC_SERVER_OPTION_SSL_DHKEY_SIZE)); + weechat_printf ( + server->buffer, + _("%sgnutls: connected using %d-bit Diffie-Hellman shared secret " + "exchange"), + weechat_prefix ("network"), + IRC_SERVER_OPTION_INTEGER (server, + IRC_SERVER_OPTION_SSL_DHKEY_SIZE)); /* initialize the certificate structure */ if (gnutls_x509_crt_init (&cert_temp) != GNUTLS_E_SUCCESS) { - weechat_printf (server->buffer, - _("%sgnutls: failed to initialize certificate " - "structure"), - weechat_prefix ("error")); + weechat_printf ( + server->buffer, + _("%sgnutls: failed to initialize certificate structure"), + weechat_prefix ("error")); rc = -1; goto end; } @@ -3742,12 +3796,13 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, cert_list = gnutls_certificate_get_peers (tls_session, &cert_list_len); if (cert_list) { - weechat_printf (server->buffer, - NG_("%sgnutls: receiving %d certificate", - "%sgnutls: receiving %d certificates", - cert_list_len), - weechat_prefix ("network"), - cert_list_len); + weechat_printf ( + server->buffer, + NG_("%sgnutls: receiving %d certificate", + "%sgnutls: receiving %d certificates", + cert_list_len), + weechat_prefix ("network"), + cert_list_len); for (i = 0; i < cert_list_len; i++) { @@ -3755,10 +3810,10 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, &cert_list[i], GNUTLS_X509_FMT_DER) != GNUTLS_E_SUCCESS) { - weechat_printf (server->buffer, - _("%sgnutls: failed to import " - "certificate[%d]"), - weechat_prefix ("error"), i + 1); + weechat_printf ( + server->buffer, + _("%sgnutls: failed to import certificate[%d]"), + weechat_prefix ("error"), i + 1); rc = -1; goto end; } @@ -3769,9 +3824,8 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, /* check if fingerprint matches the first certificate */ if (fingerprint && fingerprint[0]) { - fingerprint_match = irc_server_check_certificate_fingerprint (server, - cert_temp, - fingerprint); + fingerprint_match = irc_server_check_certificate_fingerprint ( + server, cert_temp, fingerprint); } /* check if hostname matches in the first certificate */ if (gnutls_x509_crt_check_hostname (cert_temp, @@ -3783,18 +3837,22 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, #if LIBGNUTLS_VERSION_NUMBER >= 0x010706 /* display infos about certificate */ #if LIBGNUTLS_VERSION_NUMBER < 0x020400 - rinfo = gnutls_x509_crt_print (cert_temp, GNUTLS_X509_CRT_ONELINE, &cinfo); + rinfo = gnutls_x509_crt_print (cert_temp, + GNUTLS_X509_CRT_ONELINE, &cinfo); #else - rinfo = gnutls_x509_crt_print (cert_temp, GNUTLS_CRT_PRINT_ONELINE, &cinfo); + rinfo = gnutls_x509_crt_print (cert_temp, + GNUTLS_CRT_PRINT_ONELINE, &cinfo); #endif if (rinfo == 0) { - weechat_printf (server->buffer, - _("%s - certificate[%d] info:"), - weechat_prefix ("network"), i + 1); - weechat_printf (server->buffer, - "%s - %s", - weechat_prefix ("network"), cinfo.data); + weechat_printf ( + server->buffer, + _("%s - certificate[%d] info:"), + weechat_prefix ("network"), i + 1); + weechat_printf ( + server->buffer, + "%s - %s", + weechat_prefix ("network"), cinfo.data); gnutls_free (cinfo.data); } #endif @@ -3805,18 +3863,20 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, cert_time = gnutls_x509_crt_get_expiration_time (cert_temp); if (cert_time < time (NULL)) { - weechat_printf (server->buffer, - _("%sgnutls: certificate has expired"), - weechat_prefix ("error")); + weechat_printf ( + server->buffer, + _("%sgnutls: certificate has expired"), + weechat_prefix ("error")); rc = -1; } /* check activation date */ cert_time = gnutls_x509_crt_get_activation_time (cert_temp); if (cert_time > time (NULL)) { - weechat_printf (server->buffer, - _("%sgnutls: certificate is not yet activated"), - weechat_prefix ("error")); + weechat_printf ( + server->buffer, + _("%sgnutls: certificate is not yet activated"), + weechat_prefix ("error")); rc = -1; } } @@ -3830,18 +3890,19 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, { if (fingerprint_match) { - weechat_printf (server->buffer, - _("%sgnutls: certificate fingerprint " - "matches"), - weechat_prefix ("network")); + weechat_printf ( + server->buffer, + _("%sgnutls: certificate fingerprint matches"), + weechat_prefix ("network")); } else { - weechat_printf (server->buffer, - _("%sgnutls: certificate fingerprint does " - "NOT match (check value of option " - "irc.server.%s.ssl_fingerprint)"), - weechat_prefix ("error"), server->name); + weechat_printf ( + server->buffer, + _("%sgnutls: certificate fingerprint does NOT match " + "(check value of option " + "irc.server.%s.ssl_fingerprint)"), + weechat_prefix ("error"), server->name); rc = -1; } goto end; @@ -3849,11 +3910,11 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, if (!hostname_match) { - weechat_printf (server->buffer, - _("%sgnutls: the hostname in the " - "certificate does NOT match \"%s\""), - weechat_prefix ("error"), - server->current_address); + weechat_printf ( + server->buffer, + _("%sgnutls: the hostname in the certificate does NOT " + "match \"%s\""), + weechat_prefix ("error"), server->current_address); rc = -1; } } @@ -3861,9 +3922,10 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, /* verify the peer’s certificate */ if (gnutls_certificate_verify_peers2 (tls_session, &status) < 0) { - weechat_printf (server->buffer, - _("%sgnutls: error while checking peer's certificate"), - weechat_prefix ("error")); + weechat_printf ( + server->buffer, + _("%sgnutls: error while checking peer's certificate"), + weechat_prefix ("error")); rc = -1; goto end; } @@ -3871,41 +3933,45 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, /* check if certificate is trusted */ if (status & GNUTLS_CERT_INVALID) { - weechat_printf (server->buffer, - _("%sgnutls: peer's certificate is NOT trusted"), - weechat_prefix ("error")); + weechat_printf ( + server->buffer, + _("%sgnutls: peer's certificate is NOT trusted"), + weechat_prefix ("error")); rc = -1; } else { - weechat_printf (server->buffer, - _("%sgnutls: peer's certificate is trusted"), - weechat_prefix ("network")); + weechat_printf ( + server->buffer, + _("%sgnutls: peer's certificate is trusted"), + weechat_prefix ("network")); } /* check if certificate issuer is known */ if (status & GNUTLS_CERT_SIGNER_NOT_FOUND) { - weechat_printf (server->buffer, - _("%sgnutls: peer's certificate issuer is unknown"), - weechat_prefix ("error")); + weechat_printf ( + server->buffer, + _("%sgnutls: peer's certificate issuer is unknown"), + weechat_prefix ("error")); rc = -1; } /* check that certificate is not revoked */ if (status & GNUTLS_CERT_REVOKED) { - weechat_printf (server->buffer, - _("%sgnutls: the certificate has been revoked"), - weechat_prefix ("error")); + weechat_printf ( + server->buffer, + _("%sgnutls: the certificate has been revoked"), + weechat_prefix ("error")); rc = -1; } } else if (action == WEECHAT_HOOK_CONNECT_GNUTLS_CB_SET_CERT) { /* using client certificate if it exists */ - cert_path0 = (char *) IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_SSL_CERT); + cert_path0 = (char *) IRC_SERVER_OPTION_STRING( + server, IRC_SERVER_OPTION_SSL_CERT); if (cert_path0 && cert_path0[0]) { weechat_dir = weechat_info_get ("weechat_dir", ""); @@ -3918,9 +3984,10 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, cert_str = weechat_file_get_content (cert_path2); if (cert_str) { - weechat_printf (server->buffer, - _("%sgnutls: sending one certificate"), - weechat_prefix ("network")); + weechat_printf ( + server->buffer, + _("%sgnutls: sending one certificate"), + weechat_prefix ("network")); filedatum.data = (unsigned char *) cert_str; filedatum.size = strlen (cert_str); @@ -3937,19 +4004,21 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, GNUTLS_X509_FMT_PEM); if (ret < 0) { - ret = gnutls_x509_privkey_import_pkcs8 (server->tls_cert_key, - &filedatum, - GNUTLS_X509_FMT_PEM, - NULL, - GNUTLS_PKCS_PLAIN); + ret = gnutls_x509_privkey_import_pkcs8 ( + server->tls_cert_key, + &filedatum, + GNUTLS_X509_FMT_PEM, + NULL, + GNUTLS_PKCS_PLAIN); } if (ret < 0) { - weechat_printf (server->buffer, - _("%sgnutls: invalid certificate \"%s\", " - "error: %s"), - weechat_prefix ("error"), cert_path2, - gnutls_strerror (ret)); + weechat_printf ( + server->buffer, + _("%sgnutls: invalid certificate \"%s\", error: " + "%s"), + weechat_prefix ("error"), cert_path2, + gnutls_strerror (ret)); rc = -1; } else @@ -3978,13 +4047,13 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, #endif if (rinfo == 0) { - weechat_printf (server->buffer, - _("%s - client certificate info (%s):"), - weechat_prefix ("network"), - cert_path2); - weechat_printf (server->buffer, "%s - %s", - weechat_prefix ("network"), - cinfo.data); + weechat_printf ( + server->buffer, + _("%s - client certificate info (%s):"), + weechat_prefix ("network"), cert_path2); + weechat_printf ( + server->buffer, "%s - %s", + weechat_prefix ("network"), cinfo.data); gnutls_free (cinfo.data); } #endif @@ -3994,10 +4063,10 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session, } else { - weechat_printf (server->buffer, - _("%sgnutls: unable to read certificate " - "\"%s\""), - weechat_prefix ("error"), cert_path2); + weechat_printf ( + server->buffer, + _("%sgnutls: unable to read certificate \"%s\""), + weechat_prefix ("error"), cert_path2); } } @@ -4036,7 +4105,8 @@ irc_server_connect (struct t_irc_server *server) { int length; char *option_name; - struct t_config_option *proxy_type, *proxy_ipv6, *proxy_address, *proxy_port; + struct t_config_option *proxy_type, *proxy_ipv6, *proxy_address; + struct t_config_option *proxy_port; const char *proxy, *str_proxy_type, *str_proxy_address; server->disconnected = 0; @@ -4055,11 +4125,10 @@ irc_server_connect (struct t_irc_server *server) if (!server->current_address) { - weechat_printf (server->buffer, - _("%s%s: unknown address for server \"%s\", " - "cannot connect"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - server->name); + weechat_printf ( + server->buffer, + _("%s%s: unknown address for server \"%s\", cannot connect"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, server->name); return 0; } @@ -4094,9 +4163,10 @@ irc_server_connect (struct t_irc_server *server) option_name = malloc (length); if (!option_name) { - weechat_printf (server->buffer, - _("%s%s: not enough memory"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: not enough memory"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); return 0; } snprintf (option_name, length, "weechat.proxy.%s.type", proxy); @@ -4110,11 +4180,11 @@ irc_server_connect (struct t_irc_server *server) free (option_name); if (!proxy_type || !proxy_address) { - weechat_printf (server->buffer, - _("%s%s: proxy \"%s\" not found for server " - "\"%s\", cannot connect"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, proxy, - server->name); + weechat_printf ( + server->buffer, + _("%s%s: proxy \"%s\" not found for server \"%s\", cannot " + "connect"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, proxy, server->name); return 0; } str_proxy_type = weechat_config_string (proxy_type); @@ -4122,77 +4192,80 @@ irc_server_connect (struct t_irc_server *server) if (!str_proxy_type[0] || !proxy_ipv6 || !str_proxy_address[0] || !proxy_port) { - weechat_printf (server->buffer, - _("%s%s: missing proxy settings, check options " - "for proxy \"%s\""), - weechat_prefix ("error"), IRC_PLUGIN_NAME, proxy); + weechat_printf ( + server->buffer, + _("%s%s: missing proxy settings, check options for proxy " + "\"%s\""), + weechat_prefix ("error"), IRC_PLUGIN_NAME, proxy); return 0; } } if (!server->nicks_array) { - weechat_printf (server->buffer, - _("%s%s: nicks not defined for server \"%s\", " - "cannot connect"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - server->name); + weechat_printf ( + server->buffer, + _("%s%s: nicks not defined for server \"%s\", cannot connect"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, server->name); return 0; } #ifndef HAVE_GNUTLS if (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) { - weechat_printf (server->buffer, - _("%s%s: cannot connect with SSL because WeeChat " - "was not built with GnuTLS support"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: cannot connect with SSL because WeeChat was not built " + "with GnuTLS support"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); return 0; } #endif if (proxy_type) { - weechat_printf (server->buffer, - _("%s%s: connecting to server %s/%d%s via %s " - "proxy %s/%d%s..."), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, - server->current_address, - server->current_port, - (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? - " (SSL)" : "", - str_proxy_type, - str_proxy_address, - weechat_config_integer (proxy_port), - (weechat_config_boolean (proxy_ipv6)) ? " (IPv6)" : ""); - weechat_log_printf (_("Connecting to server %s/%d%s via %s proxy " - "%s/%d%s..."), - server->current_address, - server->current_port, - (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? - " (SSL)" : "", - str_proxy_type, - str_proxy_address, - weechat_config_integer (proxy_port), - (weechat_config_boolean (proxy_ipv6)) ? " (IPv6)" : ""); + weechat_printf ( + server->buffer, + _("%s%s: connecting to server %s/%d%s via %s proxy %s/%d%s..."), + weechat_prefix ("network"), + IRC_PLUGIN_NAME, + server->current_address, + server->current_port, + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? + " (SSL)" : "", + str_proxy_type, + str_proxy_address, + weechat_config_integer (proxy_port), + (weechat_config_boolean (proxy_ipv6)) ? " (IPv6)" : ""); + weechat_log_printf ( + _("Connecting to server %s/%d%s via %s proxy %s/%d%s..."), + server->current_address, + server->current_port, + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? + " (SSL)" : "", + str_proxy_type, + str_proxy_address, + weechat_config_integer (proxy_port), + (weechat_config_boolean (proxy_ipv6)) ? " (IPv6)" : ""); } else { - weechat_printf (server->buffer, - _("%s%s: connecting to server %s/%d%s..."), - weechat_prefix ("network"), - IRC_PLUGIN_NAME, - server->current_address, - server->current_port, - (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? - " (SSL)" : ""); - weechat_log_printf (_("%s%s: connecting to server %s/%d%s..."), - "", - IRC_PLUGIN_NAME, - server->current_address, - server->current_port, - (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? - " (SSL)" : ""); + weechat_printf ( + server->buffer, + _("%s%s: connecting to server %s/%d%s..."), + weechat_prefix ("network"), + IRC_PLUGIN_NAME, + server->current_address, + server->current_port, + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? + " (SSL)" : ""); + weechat_log_printf ( + _("%s%s: connecting to server %s/%d%s..."), + "", + IRC_PLUGIN_NAME, + server->current_address, + server->current_port, + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? + " (SSL)" : ""); } /* close connection if opened */ @@ -4203,28 +4276,30 @@ irc_server_connect (struct t_irc_server *server) #ifdef HAVE_GNUTLS if (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) server->ssl_connected = 1; - server->hook_connect = weechat_hook_connect (proxy, - server->current_address, - server->current_port, - proxy_type ? weechat_config_integer (proxy_ipv6) : IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6), - server->current_retry, - (server->ssl_connected) ? &server->gnutls_sess : NULL, - (server->ssl_connected) ? irc_server_gnutls_callback : NULL, - IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE), - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_PRIORITIES), - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME), - &irc_server_connect_cb, - server); + server->hook_connect = weechat_hook_connect ( + proxy, + server->current_address, + server->current_port, + proxy_type ? weechat_config_integer (proxy_ipv6) : IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6), + server->current_retry, + (server->ssl_connected) ? &server->gnutls_sess : NULL, + (server->ssl_connected) ? irc_server_gnutls_callback : NULL, + IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE), + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_PRIORITIES), + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME), + &irc_server_connect_cb, + server); #else - server->hook_connect = weechat_hook_connect (proxy, - server->current_address, - server->current_port, - proxy_type ? weechat_config_integer (proxy_ipv6) : IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6), - server->current_retry, - NULL, NULL, 0, NULL, - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME), - &irc_server_connect_cb, - server); + server->hook_connect = weechat_hook_connect ( + proxy, + server->current_address, + server->current_port, + proxy_type ? weechat_config_integer (proxy_ipv6) : IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6), + server->current_retry, + NULL, NULL, 0, NULL, + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME), + &irc_server_connect_cb, + server); #endif /* send signal "irc_server_connecting" with server name */ @@ -4241,10 +4316,10 @@ irc_server_connect (struct t_irc_server *server) void irc_server_reconnect (struct t_irc_server *server) { - weechat_printf (server->buffer, - _("%s%s: reconnecting to server..."), - weechat_prefix ("network"), - IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: reconnecting to server..."), + weechat_prefix ("network"), IRC_PLUGIN_NAME); server->reconnect_start = 0; @@ -4304,10 +4379,10 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address, ptr_channel->hook_autorejoin = NULL; } weechat_buffer_set (ptr_channel->buffer, "localvar_del_away", ""); - weechat_printf (ptr_channel->buffer, - _("%s%s: disconnected from server"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME); + weechat_printf ( + ptr_channel->buffer, + _("%s%s: disconnected from server"), + weechat_prefix ("network"), IRC_PLUGIN_NAME); } /* remove away status on server buffer */ weechat_buffer_set (server->buffer, "localvar_del_away", ""); @@ -4317,10 +4392,10 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address, if (server->buffer) { - weechat_printf (server->buffer, - _("%s%s: disconnected from server"), - weechat_prefix ("network"), - IRC_PLUGIN_NAME); + weechat_printf ( + server->buffer, + _("%s%s: disconnected from server"), + weechat_prefix ("network"), IRC_PLUGIN_NAME); } server->current_retry = 0; @@ -4427,9 +4502,9 @@ irc_server_autojoin_channels (struct t_irc_server *server) else { /* auto-join when connecting to server for first time */ - autojoin = weechat_string_eval_expression (IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_AUTOJOIN), - NULL, NULL, NULL); + autojoin = weechat_string_eval_expression ( + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_AUTOJOIN), + NULL, NULL, NULL); if (!server->disable_autojoin && autojoin && autojoin[0]) irc_command_join_server (server, autojoin, 0, 0); if (autojoin) @@ -4450,7 +4525,8 @@ irc_server_get_number_connected () int number; number = 0; - for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) + for (ptr_server = irc_servers; ptr_server; + ptr_server = ptr_server->next_server) { if (ptr_server->is_connected) number++; @@ -4587,7 +4663,8 @@ irc_server_set_away (struct t_irc_server *server, const char *nick, int is_away) "localvar_del_away", ""); } - for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) + for (ptr_channel = server->channels; ptr_channel; + ptr_channel = ptr_channel->next_channel) { /* set away flag for nick on channel */ if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL) @@ -4677,26 +4754,28 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal, { filename = weechat_infolist_string (infolist, "filename"); spaces_in_name = (strchr (filename, ' ') != NULL); - irc_server_sendf (ptr_server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "PRIVMSG %s :\01DCC SEND %s%s%s " - "%s %d %s\01", - weechat_infolist_string (infolist, "remote_nick"), - (spaces_in_name) ? "\"" : "", - filename, - (spaces_in_name) ? "\"" : "", - converted_addr, - weechat_infolist_integer (infolist, "port"), - weechat_infolist_string (infolist, "size")); + irc_server_sendf ( + ptr_server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + "PRIVMSG %s :\01DCC SEND %s%s%s " + "%s %d %s\01", + weechat_infolist_string (infolist, "remote_nick"), + (spaces_in_name) ? "\"" : "", + filename, + (spaces_in_name) ? "\"" : "", + converted_addr, + weechat_infolist_integer (infolist, "port"), + weechat_infolist_string (infolist, "size")); } else if (strcmp (type, "chat_send") == 0) { - irc_server_sendf (ptr_server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "PRIVMSG %s :\01DCC CHAT chat %s %d\01", - weechat_infolist_string (infolist, "remote_nick"), - converted_addr, - weechat_infolist_integer (infolist, "port")); + irc_server_sendf ( + ptr_server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + "PRIVMSG %s :\01DCC CHAT chat %s %d\01", + weechat_infolist_string (infolist, "remote_nick"), + converted_addr, + weechat_infolist_integer (infolist, "port")); } } } @@ -4742,15 +4821,16 @@ irc_server_xfer_resume_ready_cb (void *data, const char *signal, { filename = weechat_infolist_string (infolist, "filename"); spaces_in_name = (strchr (filename, ' ') != NULL); - irc_server_sendf (ptr_server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "PRIVMSG %s :\01DCC RESUME %s%s%s %d %s\01", - weechat_infolist_string (infolist, "remote_nick"), - (spaces_in_name) ? "\"" : "", - filename, - (spaces_in_name) ? "\"" : "", - weechat_infolist_integer (infolist, "port"), - weechat_infolist_string (infolist, "start_resume")); + irc_server_sendf ( + ptr_server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + "PRIVMSG %s :\01DCC RESUME %s%s%s %d %s\01", + weechat_infolist_string (infolist, "remote_nick"), + (spaces_in_name) ? "\"" : "", + filename, + (spaces_in_name) ? "\"" : "", + weechat_infolist_integer (infolist, "port"), + weechat_infolist_string (infolist, "start_resume")); } } } @@ -4795,15 +4875,16 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal, { filename = weechat_infolist_string (infolist, "filename"); spaces_in_name = (strchr (filename, ' ') != NULL); - irc_server_sendf (ptr_server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "PRIVMSG %s :\01DCC ACCEPT %s%s%s %d %s\01", - weechat_infolist_string (infolist, "remote_nick"), - (spaces_in_name) ? "\"" : "", - filename, - (spaces_in_name) ? "\"" : "", - weechat_infolist_integer (infolist, "port"), - weechat_infolist_string (infolist, "start_resume")); + irc_server_sendf ( + ptr_server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + "PRIVMSG %s :\01DCC ACCEPT %s%s%s %d %s\01", + weechat_infolist_string (infolist, "remote_nick"), + (spaces_in_name) ? "\"" : "", + filename, + (spaces_in_name) ? "\"" : "", + weechat_infolist_integer (infolist, "port"), + weechat_infolist_string (infolist, "start_resume")); } } } diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c index 6c807ddaf..3a0363a74 100644 --- a/src/plugins/irc/irc.c +++ b/src/plugins/irc/irc.c @@ -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 |