diff options
64 files changed, 3702 insertions, 3658 deletions
diff --git a/src/common/command.c b/src/common/command.c index 311ac3868..98ffdcc28 100644 --- a/src/common/command.c +++ b/src/common/command.c @@ -679,7 +679,7 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string strcat (unknown_command, " :"); strcat (unknown_command, ptr_args); } - irc_cmd_send_quote (server, channel, unknown_command); + irc_send_cmd_quote (server, channel, unknown_command); free (unknown_command); } } @@ -725,7 +725,7 @@ user_message_display (t_irc_server *server, t_gui_buffer *buffer, char *text) } else { - ptr_nick = nick_search (CHANNEL(buffer), server->nick); + ptr_nick = irc_nick_search (CHANNEL(buffer), server->nick); if (ptr_nick) { irc_display_nick (buffer, ptr_nick, NULL, @@ -783,7 +783,7 @@ user_message (t_irc_server *server, t_gui_buffer *buffer, char *text) next = pos; } - server_sendf_queued (server, "PRIVMSG %s :%s", CHANNEL(buffer)->name, text); + irc_server_sendf_queued (server, "PRIVMSG %s :%s", CHANNEL(buffer)->name, text); user_message_display (server, buffer, text); if (next) @@ -854,7 +854,7 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o if (pos) pos[0] = '\0'; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (is_command (ptr_cmd)) { @@ -881,9 +881,9 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o } else { - dcc_chat_sendf ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat), - "%s\r\n", - (command_with_colors) ? command_with_colors : ptr_cmd); + irc_dcc_chat_sendf ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat), + "%s\r\n", + (command_with_colors) ? command_with_colors : ptr_cmd); user_message_display (server, buffer, (command_with_colors) ? command_with_colors : ptr_cmd); @@ -1090,7 +1090,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, char *error, *pos, **argv; int argc, target_buffer, count; - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); argv = explode_string (arguments, " ", 0, &argc); @@ -1180,7 +1180,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, free_exploded_string (argv); return -1; } - server_disconnect (SERVER(buffer), 0); + irc_server_disconnect (SERVER(buffer), 0); ptr_server = SERVER(buffer); if (!buffer->all_servers) { @@ -1205,7 +1205,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, ptr_server = SERVER(buffer); ptr_channel = CHANNEL(buffer); gui_buffer_free (ptr_channel->buffer, 1); - channel_free (ptr_server, ptr_channel); + irc_channel_free (ptr_server, ptr_channel); gui_status_draw (gui_current_window->buffer, 1); gui_input_draw (gui_current_window->buffer, 1); } @@ -1221,7 +1221,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, if (pos) pos += 6; CHANNEL(buffer)->close = 1; - irc_cmd_send_part (SERVER(buffer), + irc_send_cmd_part (SERVER(buffer), CHANNEL(buffer), pos); } @@ -1231,7 +1231,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, ptr_server = SERVER(buffer); gui_buffer_free (buffer, 1); if (ptr_channel) - channel_free (ptr_server, ptr_channel); + irc_channel_free (ptr_server, ptr_channel); } } else @@ -1256,7 +1256,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, { gui_printf (NULL, " %s:%d", ptr_server->name, - server_get_default_notify_level (ptr_server)); + irc_server_get_default_notify_level (ptr_server)); count++; } } @@ -1315,8 +1315,8 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, } if (BUFFER_IS_SERVER(buffer)) { - server_set_default_notify_level (SERVER(buffer), - number); + irc_server_set_default_notify_level (SERVER(buffer), + number); irc_display_prefix (NULL, NULL, PREFIX_INFO); gui_printf (NULL, _("New default notify level for server %s%s%s: %s%d %s"), GUI_COLOR(COLOR_WIN_CHAT_SERVER), @@ -1328,9 +1328,9 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, } else { - channel_set_notify_level (SERVER(buffer), - CHANNEL(buffer), - number); + irc_channel_set_notify_level (SERVER(buffer), + CHANNEL(buffer), + number); irc_display_prefix (NULL, NULL, PREFIX_INFO); gui_printf (NULL, _("New notify level for %s%s%s: %s%d %s"), GUI_COLOR(COLOR_WIN_CHAT_CHANNEL), @@ -1418,7 +1418,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, ptr_buffer = gui_buffer_search (argv[0], argv[1]); else { - if (string_is_channel (argv[0])) + if (irc_channel_is_channel (argv[0])) ptr_buffer = gui_buffer_search (NULL, argv[0]); else ptr_buffer = gui_buffer_search (argv[0], NULL); @@ -1512,7 +1512,7 @@ weechat_cmd_clear (t_irc_server *server, t_irc_channel *channel, } else { - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); gui_buffer_clear (buffer); } @@ -1549,7 +1549,7 @@ weechat_cmd_connect_one_server (t_irc_server *server, t_gui_window *window) BUFFER_TYPE_STANDARD, 1)) return 0; } - if (server_connect (server)) + if (irc_server_connect (server)) { server->reconnect_start = 0; server->reconnect_join = (server->channels) ? 1 : 0; @@ -1573,7 +1573,7 @@ weechat_cmd_connect (t_irc_server *server, t_irc_channel *channel, t_irc_server *ptr_server; int i, connect_ok; - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); if (argc == 0) connect_ok = weechat_cmd_connect_one_server (server, window); @@ -1597,7 +1597,7 @@ weechat_cmd_connect (t_irc_server *server, t_irc_channel *channel, { for (i = 0; i < argc; i++) { - ptr_server = server_search (argv[i]); + ptr_server = irc_server_search (argv[i]); if (ptr_server) { if (!weechat_cmd_connect_one_server (ptr_server, window)) @@ -1631,7 +1631,7 @@ weechat_cmd_dcc (t_irc_server *server, t_irc_channel *channel, t_gui_buffer *buffer; char *pos_nick, *pos_file; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); /* DCC SEND file */ if (strncasecmp (arguments, "send", 4) == 0) @@ -1662,7 +1662,7 @@ weechat_cmd_dcc (t_irc_server *server, t_irc_channel *channel, while (pos_file[0] == ' ') pos_file++; - dcc_send_request (server, DCC_FILE_SEND, pos_nick, pos_file); + irc_dcc_send_request (server, DCC_FILE_SEND, pos_nick, pos_file); } /* DCC CHAT */ else if (strncasecmp (arguments, "chat", 4) == 0) @@ -1679,7 +1679,7 @@ weechat_cmd_dcc (t_irc_server *server, t_irc_channel *channel, while (pos_nick[0] == ' ') pos_nick++; - dcc_send_request (server, DCC_CHAT_SEND, pos_nick, NULL); + irc_dcc_send_request (server, DCC_CHAT_SEND, pos_nick, NULL); } /* close DCC CHAT */ else if (ascii_strcasecmp (arguments, "close") == 0) @@ -1687,8 +1687,8 @@ weechat_cmd_dcc (t_irc_server *server, t_irc_channel *channel, if (BUFFER_IS_PRIVATE(buffer) && CHANNEL(buffer)->dcc_chat) { - dcc_close ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat), DCC_ABORTED); - dcc_redraw (1); + irc_dcc_close ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat), DCC_ABORTED); + irc_dcc_redraw (1); } } /* unknown DCC action */ @@ -1781,7 +1781,7 @@ weechat_cmd_debug (t_irc_server *server, t_irc_channel *channel, for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - server_outqueue_free_all (ptr_server); + irc_server_outqueue_free_all (ptr_server); } gui_printf_nolog (NULL, "\n"); gui_printf_nolog (NULL, "DEBUG: outqueue DELETED for all servers.\n"); @@ -1822,7 +1822,7 @@ weechat_cmd_disconnect_one_server (t_irc_server *server) _("Auto-reconnection is cancelled\n")); } irc_send_quit_server (server, NULL); - server_disconnect (server, 0); + irc_server_disconnect (server, 0); gui_status_draw (server->buffer, 1); /* disconnect ok */ @@ -1841,7 +1841,7 @@ weechat_cmd_disconnect (t_irc_server *server, t_irc_channel *channel, t_irc_server *ptr_server; int i, disconnect_ok; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (argc == 0) disconnect_ok = weechat_cmd_disconnect_one_server (server); @@ -1866,7 +1866,7 @@ weechat_cmd_disconnect (t_irc_server *server, t_irc_channel *channel, { for (i = 0; i < argc; i++) { - ptr_server = server_search (argv[i]); + ptr_server = irc_server_search (argv[i]); if (ptr_server) { if (!weechat_cmd_disconnect_one_server (ptr_server)) @@ -2072,7 +2072,7 @@ weechat_cmd_history (t_irc_server *server, t_irc_channel *channel, int n_total; int n_user; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); n_user = cfg_history_display_default; @@ -2148,7 +2148,7 @@ weechat_cmd_ignore (t_irc_server *server, t_irc_channel *channel, t_irc_ignore *ptr_ignore; int i; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); ptr_ignore = NULL; switch (argc) @@ -2180,22 +2180,22 @@ weechat_cmd_ignore (t_irc_server *server, t_irc_channel *channel, return 0; break; case 1: - ptr_ignore = ignore_add (argv[0], "*", "*", - (SERVER(buffer)) ? - SERVER(buffer)->name : "*"); + ptr_ignore = irc_ignore_add (argv[0], "*", "*", + (SERVER(buffer)) ? + SERVER(buffer)->name : "*"); break; case 2: - ptr_ignore = ignore_add (argv[0], argv[1], "*", - (SERVER(buffer)) ? - SERVER(buffer)->name : "*"); + ptr_ignore = irc_ignore_add (argv[0], argv[1], "*", + (SERVER(buffer)) ? + SERVER(buffer)->name : "*"); break; case 3: - ptr_ignore = ignore_add (argv[0], argv[1], argv[2], - (SERVER(buffer)) ? - SERVER(buffer)->name : "*"); + ptr_ignore = irc_ignore_add (argv[0], argv[1], argv[2], + (SERVER(buffer)) ? + SERVER(buffer)->name : "*"); break; case 4: - ptr_ignore = ignore_add (argv[0], argv[1], argv[2], argv[3]); + ptr_ignore = irc_ignore_add (argv[0], argv[1], argv[2], argv[3]); break; } if (ptr_ignore) @@ -2253,7 +2253,7 @@ weechat_cmd_key (t_irc_server *server, t_irc_channel *channel, t_gui_key *ptr_key; void (*ptr_function)(t_gui_window *, char *); - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); if (arguments) { @@ -2756,8 +2756,8 @@ weechat_cmd_reconnect_one_server (t_irc_server *server) return 0; } irc_send_quit_server (server, NULL); - server_disconnect (server, 0); - if (server_connect (server)) + irc_server_disconnect (server, 0); + if (irc_server_connect (server)) { server->reconnect_start = 0; server->reconnect_join = (server->channels) ? 1 : 0; @@ -2780,7 +2780,7 @@ weechat_cmd_reconnect (t_irc_server *server, t_irc_channel *channel, t_irc_server *ptr_server; int i, reconnect_ok; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (argc == 0) reconnect_ok = weechat_cmd_reconnect_one_server (server); @@ -2804,7 +2804,7 @@ weechat_cmd_reconnect (t_irc_server *server, t_irc_channel *channel, { for (i = 0; i < argc; i++) { - ptr_server = server_search (argv[i]); + ptr_server = irc_server_search (argv[i]); if (ptr_server) { if (!weechat_cmd_reconnect_one_server (ptr_server)) @@ -2883,7 +2883,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, t_gui_buffer *ptr_buffer; char *server_name; - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); if ((argc == 0) || (argc == 1)) { @@ -2906,7 +2906,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, } else { - ptr_server = server_search (argv[0]); + ptr_server = irc_server_search (argv[0]); if (ptr_server) irc_display_server (ptr_server); else @@ -2937,7 +2937,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, } /* look for server by name */ - server_found = server_search (argv[1]); + server_found = irc_server_search (argv[1]); if (!server_found) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); @@ -2967,7 +2967,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, server_name = strdup (server_found->name); - server_free (server_found); + irc_server_free (server_found); irc_display_prefix (NULL, NULL, PREFIX_INFO); gui_printf (NULL, _("Server %s%s%s has been deleted\n"), @@ -2983,7 +2983,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, } /* init server struct */ - server_init (&server_tmp); + irc_server_init (&server_tmp); if (argc < 3) { @@ -2991,17 +2991,17 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing parameters for \"%s\" command\n"), WEECHAT_ERROR, "server"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } - if (server_name_already_exists (argv[0])) + if (irc_server_name_already_exists (argv[0])) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); gui_printf (NULL, _("%s server \"%s\" already exists, can't create it!\n"), WEECHAT_ERROR, argv[0]); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } @@ -3030,7 +3030,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-pwd"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } server_tmp.password = strdup (argv[++i]); @@ -3043,7 +3043,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing nick(s) for \"%s\" parameter\n"), WEECHAT_ERROR, "-nicks"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } server_tmp.nick1 = strdup (argv[++i]); @@ -3058,7 +3058,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-username"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } server_tmp.username = strdup (argv[++i]); @@ -3071,7 +3071,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-realname"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } server_tmp.realname = strdup (argv[++i]); @@ -3084,7 +3084,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing command for \"%s\" parameter\n"), WEECHAT_ERROR, "-command"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } server_tmp.command = strdup (argv[++i]); @@ -3097,7 +3097,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-autojoin"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } server_tmp.autojoin = strdup (argv[++i]); @@ -3106,16 +3106,16 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, } /* create new server */ - new_server = server_new (server_tmp.name, server_tmp.autoconnect, - server_tmp.autoreconnect, - server_tmp.autoreconnect_delay, - 0, server_tmp.address, server_tmp.port, - server_tmp.ipv6, server_tmp.ssl, - server_tmp.password, server_tmp.nick1, - server_tmp.nick2, server_tmp.nick3, - server_tmp.username, server_tmp.realname, - server_tmp.hostname, - server_tmp.command, 1, server_tmp.autojoin, 1, NULL); + new_server = irc_server_new (server_tmp.name, server_tmp.autoconnect, + server_tmp.autoreconnect, + server_tmp.autoreconnect_delay, + 0, server_tmp.address, server_tmp.port, + server_tmp.ipv6, server_tmp.ssl, + server_tmp.password, server_tmp.nick1, + server_tmp.nick2, server_tmp.nick3, + server_tmp.username, server_tmp.realname, + server_tmp.hostname, + server_tmp.command, 1, server_tmp.autojoin, 1, NULL); if (new_server) { irc_display_prefix (NULL, NULL, PREFIX_INFO); @@ -3130,7 +3130,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s unable to create server\n"), WEECHAT_ERROR); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } @@ -3138,10 +3138,10 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, { (void) gui_buffer_new (window, new_server, NULL, BUFFER_TYPE_STANDARD, 1); - server_connect (new_server); + irc_server_connect (new_server); } - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); } return 0; } @@ -3198,7 +3198,7 @@ weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *val { if (cfg_log_hide_nickserv_pwd) { - irc_hide_password (value2, 1); + irc_display_hide_password (value2, 1); if (strcmp (*((char **)value), value2) != 0) gui_printf (NULL, _("%s(password hidden) "), GUI_COLOR(COLOR_WIN_CHAT)); @@ -3294,7 +3294,7 @@ weechat_cmd_set (t_irc_server *server, t_irc_channel *channel, { /* server config option modification */ pos[0] = '\0'; - ptr_server = server_search (option); + ptr_server = irc_server_search (option); if (!ptr_server) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); @@ -3754,7 +3754,7 @@ weechat_cmd_unignore (t_irc_server *server, t_irc_channel *channel, char *error; int number, ret; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); ret = 0; switch (argc) @@ -3768,24 +3768,24 @@ weechat_cmd_unignore (t_irc_server *server, t_irc_channel *channel, error = NULL; number = strtol (argv[0], &error, 10); if ((error) && (error[0] == '\0')) - ret = ignore_search_free_by_number (number); + ret = irc_ignore_search_free_by_number (number); else - ret = ignore_search_free (argv[0], "*", "*", - (SERVER(buffer)) ? - SERVER(buffer)->name : "*"); + ret = irc_ignore_search_free (argv[0], "*", "*", + (SERVER(buffer)) ? + SERVER(buffer)->name : "*"); break; case 2: - ret = ignore_search_free (argv[0], argv[1], "*", - (SERVER(buffer)) ? - SERVER(buffer)->name : "*"); + ret = irc_ignore_search_free (argv[0], argv[1], "*", + (SERVER(buffer)) ? + SERVER(buffer)->name : "*"); break; case 3: - ret = ignore_search_free (argv[0], argv[1], argv[2], - (SERVER(buffer)) ? - SERVER(buffer)->name : "*"); + ret = irc_ignore_search_free (argv[0], argv[1], argv[2], + (SERVER(buffer)) ? + SERVER(buffer)->name : "*"); break; case 4: - ret = ignore_search_free (argv[0], argv[1], argv[2], argv[3]); + ret = irc_ignore_search_free (argv[0], argv[1], argv[2], argv[3]); break; } @@ -3934,7 +3934,7 @@ weechat_cmd_uptime (t_irc_server *server, t_irc_channel *channel, int day, hour, min, sec; char string[256]; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); running_time = time (NULL) - weechat_start_time; day = running_time / (60 * 60 * 24); @@ -3998,7 +3998,7 @@ weechat_cmd_window (t_irc_server *server, t_irc_channel *channel, char *error; long number; - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); if ((argc == 0) || ((argc == 1) && (ascii_strcasecmp (argv[0], "list") == 0))) { diff --git a/src/common/completion.c b/src/common/completion.c index 91263bbbd..9910637ed 100644 --- a/src/common/completion.c +++ b/src/common/completion.c @@ -578,7 +578,8 @@ completion_list_add_channel_nicks (t_completion *completion) for (ptr_weelist = ((t_irc_channel *)(completion->channel))->nicks_speaking; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (nick_search ((t_irc_channel *)(completion->channel), ptr_weelist->data)) + if (irc_nick_search ((t_irc_channel *)(completion->channel), + ptr_weelist->data)) completion_list_add (completion, ptr_weelist->data, 1, WEELIST_POS_BEGINNING); } @@ -1418,7 +1419,8 @@ completion_nick (t_completion *completion) for (ptr_weelist = ((t_irc_channel *)(completion->channel))->nicks_speaking; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (nick_search ((t_irc_channel *)(completion->channel), ptr_weelist->data)) + if (irc_nick_search ((t_irc_channel *)(completion->channel), + ptr_weelist->data)) weelist_add (&(completion->completion_list), &(completion->last_completion), ptr_weelist->data, @@ -1516,7 +1518,7 @@ completion_auto (t_completion *completion) } /* channel completion */ - if (string_is_channel (completion->base_word)) + if (irc_channel_is_channel (completion->base_word)) { if (!completion->completion_list) completion_list_add_server_channels (completion); diff --git a/src/common/fifo.c b/src/common/fifo.c index 1fdf6eb44..8cb097653 100644 --- a/src/common/fifo.c +++ b/src/common/fifo.c @@ -147,7 +147,7 @@ fifo_exec (char *text) pos = strchr (text, ','); if (pos) pos[0] = '\0'; - ptr_server = server_search (text); + ptr_server = irc_server_search (text); if (!ptr_server || !ptr_server->buffer) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); @@ -157,7 +157,7 @@ fifo_exec (char *text) } if (ptr_server && pos) { - ptr_channel = channel_search_any (ptr_server, pos + 1); + ptr_channel = irc_channel_search_any (ptr_server, pos + 1); if (!ptr_channel) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); diff --git a/src/common/history.c b/src/common/history.c index 8e260b7d9..ab222332f 100644 --- a/src/common/history.c +++ b/src/common/history.c @@ -62,7 +62,7 @@ history_buffer_add (void *buffer, char *string) { new_history->text = strdup (string); if (cfg_log_hide_nickserv_pwd) - irc_hide_password (new_history->text, 1); + irc_display_hide_password (new_history->text, 1); if (((t_gui_buffer *)(buffer))->history) ((t_gui_buffer *)(buffer))->history->prev_history = new_history; @@ -112,7 +112,7 @@ history_global_add (char *string) { new_history->text = strdup (string); if (cfg_log_hide_nickserv_pwd) - irc_hide_password (new_history->text, 1); + irc_display_hide_password (new_history->text, 1); if (history_global) history_global->prev_history = new_history; diff --git a/src/common/session.c b/src/common/session.c index 2bc77af43..9236c9f19 100644 --- a/src/common/session.c +++ b/src/common/session.c @@ -839,20 +839,20 @@ session_load_server (FILE *file) /* use or allocate server */ weechat_log_printf (_("session: loading server \"%s\"\n"), server_name); - session_current_server = server_search (server_name); + session_current_server = irc_server_search (server_name); if (session_current_server) weechat_log_printf (_("server found, updating values\n")); else { weechat_log_printf (_("server not found, creating new one\n")); - session_current_server = server_alloc (); + session_current_server = irc_server_alloc (); if (!session_current_server) { free (server_name); session_crash (file, _("can't create new server")); return 0; } - server_init (session_current_server); + irc_server_init (session_current_server); session_current_server->name = strdup (server_name); } free (server_name); @@ -1069,9 +1069,9 @@ session_load_channel (FILE *file) /* allocate channel */ weechat_log_printf (_("session: loading channel \"%s\"\n"), channel_name); - session_current_channel = channel_new (session_current_server, - channel_type, - channel_name); + session_current_channel = irc_channel_new (session_current_server, + channel_type, + channel_name); free (channel_name); if (!session_current_channel) { @@ -1164,8 +1164,8 @@ session_load_nick (FILE *file) } /* allocate nick */ - nick = nick_new (session_current_server, session_current_channel, - nick_name, 0, 0, 0, 0, 0, 0); + nick = irc_nick_new (session_current_server, session_current_channel, + nick_name, 0, 0, 0, 0, 0, 0); free (nick_name); if (!nick) { @@ -1222,7 +1222,7 @@ session_load_dcc (FILE *file) t_irc_channel *ptr_channel; /* allocate DCC */ - dcc = dcc_alloc (); + dcc = irc_dcc_alloc (); if (!dcc) { session_crash (file, _("can't create new DCC")); @@ -1255,7 +1255,7 @@ session_load_dcc (FILE *file) return 0; if (string && string[0]) { - ptr_server = server_search (string); + ptr_server = irc_server_search (string); if (!ptr_server) { session_crash (file, _("server not found for DCC")); @@ -1276,7 +1276,7 @@ session_load_dcc (FILE *file) return 0; if (string && string[0]) { - ptr_channel = channel_search_any (ptr_server, string); + ptr_channel = irc_channel_search_any (ptr_server, string); if (!ptr_channel) { session_crash (file, _("channel not found for DCC")); @@ -1468,7 +1468,7 @@ session_load_buffer (FILE *file) ptr_channel = NULL; if (server_name) { - ptr_server = server_search (server_name); + ptr_server = irc_server_search (server_name); if (!ptr_server) { session_crash (file, _("server not found for buffer")); @@ -1478,7 +1478,7 @@ session_load_buffer (FILE *file) if (channel_name) { - ptr_channel = channel_search_any_without_buffer (ptr_server, channel_name); + ptr_channel = irc_channel_search_any_without_buffer (ptr_server, channel_name); if (!ptr_channel) { session_crash (file, _("channel not found for buffer")); @@ -1686,7 +1686,7 @@ session_load_hotlist (FILE *file) server_name = NULL; if (!session_read_str (file, &server_name)) return 0; - ptr_server = server_search (server_name); + ptr_server = irc_server_search (server_name); free (server_name); break; case SESSION_HOTL_BUFFER_NUMBER: diff --git a/src/common/weechat.c b/src/common/weechat.c index 828c2baa0..b8e5ba7bd 100644 --- a/src/common/weechat.c +++ b/src/common/weechat.c @@ -405,7 +405,7 @@ weechat_parse_args (int argc, char *argv[]) } else if ((ascii_strncasecmp (argv[i], "irc", 3) == 0)) { - if (server_init_with_url (argv[i], &server_tmp) < 0) + if (irc_server_init_with_url (argv[i], &server_tmp) < 0) { weechat_iconv_fprintf (stderr, _("%s invalid syntax for IRC server ('%s'), ignored\n"), @@ -413,19 +413,19 @@ weechat_parse_args (int argc, char *argv[]) } else { - if (!server_new (server_tmp.name, server_tmp.autoconnect, - server_tmp.autoreconnect, - server_tmp.autoreconnect_delay, - 1, server_tmp.address, server_tmp.port, - server_tmp.ipv6, server_tmp.ssl, - server_tmp.password, server_tmp.nick1, - server_tmp.nick2, server_tmp.nick3, - NULL, NULL, NULL, NULL, 0, - server_tmp.autojoin, 1, NULL)) + if (!irc_server_new (server_tmp.name, server_tmp.autoconnect, + server_tmp.autoreconnect, + server_tmp.autoreconnect_delay, + 1, server_tmp.address, server_tmp.port, + server_tmp.ipv6, server_tmp.ssl, + server_tmp.password, server_tmp.nick1, + server_tmp.nick2, server_tmp.nick3, + NULL, NULL, NULL, NULL, 0, + server_tmp.autojoin, 1, NULL)) weechat_iconv_fprintf (stderr, _("%s unable to create server ('%s'), ignored\n"), WEECHAT_WARNING, argv[i]); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); server_cmd_line = 1; } } @@ -584,7 +584,7 @@ weechat_config_read () exit (EXIT_FAILURE); break; default: /* other error (fatal) */ - server_free_all (); + irc_server_free_all (); exit (EXIT_FAILURE); } } @@ -705,25 +705,25 @@ weechat_dump (int crash) for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { weechat_log_printf ("\n"); - server_print_log (ptr_server); + irc_server_print_log (ptr_server); for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { weechat_log_printf ("\n"); - channel_print_log (ptr_channel); + irc_channel_print_log (ptr_channel); for (ptr_nick = ptr_channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { weechat_log_printf ("\n"); - nick_print_log (ptr_nick); + irc_nick_print_log (ptr_nick); } } } - dcc_print_log (); + irc_dcc_print_log (); gui_panel_print_log (); @@ -754,7 +754,7 @@ weechat_dump (int crash) } weechat_log_printf ("\n"); - ignore_print_log (); + irc_ignore_print_log (); weechat_log_printf ("\n"); weechat_log_printf ("****** End of dump ******\n"); @@ -769,8 +769,8 @@ void weechat_sigsegv () { weechat_dump (1); - dcc_end (); - server_free_all (); + irc_dcc_end (); + irc_server_free_all (); gui_main_end (); weechat_iconv_fprintf (stderr, "\n"); @@ -837,20 +837,20 @@ main (int argc, char *argv[]) plugin_init (auto_load_plugins); /* init plugin interface(s) */ #endif - server_auto_connect (auto_connect, /* auto-connect to servers */ - server_cmd_line); + irc_server_auto_connect (auto_connect, /* auto-connect to servers */ + server_cmd_line); gui_main_loop (); /* WeeChat main loop */ #ifdef PLUGINS plugin_end (); /* end plugin interface(s) */ #endif - server_disconnect_all (); /* disconnect from all servers */ + irc_server_disconnect_all (); /* disconnect from all servers */ if (cfg_look_save_on_exit) (void) config_write (NULL); /* save config file */ command_index_free (); /* free commands index */ - dcc_end (); /* remove all DCC */ - server_free_all (); /* free all servers */ + irc_dcc_end (); /* remove all DCC */ + irc_server_free_all (); /* free all servers */ gui_main_end (); /* shut down WeeChat GUI */ weechat_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */ diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c index 2bbc98dec..99b465bc4 100644 --- a/src/common/weeconfig.c +++ b/src/common/weeconfig.c @@ -1222,7 +1222,7 @@ config_change_nicks_colors () ptr_nick = ptr_nick->next_nick) { if (ptr_nick->color != COLOR_WIN_NICK_SELF) - ptr_nick->color = nick_find_color (ptr_nick); + ptr_nick->color = irc_nick_find_color (ptr_nick); } } } @@ -1239,7 +1239,7 @@ config_change_away_check () if (cfg_irc_away_check == 0) { /* reset away flag for all nicks/chans/servers */ - server_remove_away (); + irc_server_remove_away (); } check_away = cfg_irc_away_check * 60; } @@ -1276,7 +1276,7 @@ config_change_notify_levels () { if (BUFFER_IS_CHANNEL(ptr_buffer) || BUFFER_IS_PRIVATE(ptr_buffer)) ptr_buffer->notify_level = - channel_get_notify_level (SERVER(ptr_buffer), CHANNEL(ptr_buffer)); + irc_channel_get_notify_level (SERVER(ptr_buffer), CHANNEL(ptr_buffer)); } } @@ -1688,7 +1688,7 @@ config_option_search_option_value (char *option_name, t_config_option **option, if (pos) { pos[0] = '\0'; - ptr_server = server_search (option_name); + ptr_server = irc_server_search (option_name); if (ptr_server) { for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++) @@ -1763,40 +1763,40 @@ config_allocate_server (char *filename, int line_number) || !cfg_server.username || !cfg_server.realname) { - server_free_all (); + irc_server_free_all (); gui_printf (NULL, _("%s %s, line %d: new server, but previous was incomplete\n"), WEECHAT_WARNING, filename, line_number); return 0; } - if (server_name_already_exists (cfg_server.name)) + if (irc_server_name_already_exists (cfg_server.name)) { - server_free_all (); + irc_server_free_all (); gui_printf (NULL, _("%s %s, line %d: server '%s' already exists\n"), WEECHAT_WARNING, filename, line_number, cfg_server.name); return 0; } - if (!server_new (cfg_server.name, - cfg_server.autoconnect, cfg_server.autoreconnect, - cfg_server.autoreconnect_delay, 0, cfg_server.address, - cfg_server.port, cfg_server.ipv6, cfg_server.ssl, - cfg_server.password, cfg_server.nick1, cfg_server.nick2, - cfg_server.nick3, cfg_server.username, cfg_server.realname, - cfg_server.hostname, cfg_server.command, - cfg_server.command_delay, cfg_server.autojoin, - cfg_server.autorejoin, cfg_server.notify_levels)) + if (!irc_server_new (cfg_server.name, + cfg_server.autoconnect, cfg_server.autoreconnect, + cfg_server.autoreconnect_delay, 0, cfg_server.address, + cfg_server.port, cfg_server.ipv6, cfg_server.ssl, + cfg_server.password, cfg_server.nick1, cfg_server.nick2, + cfg_server.nick3, cfg_server.username, cfg_server.realname, + cfg_server.hostname, cfg_server.command, + cfg_server.command_delay, cfg_server.autojoin, + cfg_server.autorejoin, cfg_server.notify_levels)) { - server_free_all (); + irc_server_free_all (); gui_printf (NULL, _("%s %s, line %d: unable to create server\n"), WEECHAT_WARNING, filename, line_number); return 0; } - server_destroy (&cfg_server); - server_init (&cfg_server); + irc_server_destroy (&cfg_server); + irc_server_init (&cfg_server); return 1; } @@ -1886,7 +1886,7 @@ config_read () } config_default_values (); - server_init (&cfg_server); + irc_server_init (&cfg_server); /* read config file */ section = CONFIG_SECTION_NONE; @@ -2041,7 +2041,7 @@ config_read () WEECHAT_WARNING, filename, line_number, line); else { - if (!ignore_add_from_config (pos)) + if (!irc_ignore_add_from_config (pos)) gui_printf (NULL, _("%s %s, line %d: invalid ignore options \"%s\"\n"), WEECHAT_WARNING, filename, line_number, pos); diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index 2a6bf58a7..915f92971 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -139,7 +139,7 @@ gui_main_loop () { if (ptr_server->is_connected) { - server_outqueue_send (ptr_server); + irc_server_outqueue_send (ptr_server); } } @@ -170,7 +170,7 @@ gui_main_loop () if (check_away >= (cfg_irc_away_check * 60)) { check_away = 0; - server_check_away (); + irc_server_check_away (); } } @@ -223,7 +223,7 @@ gui_main_loop () if ((!ptr_server->is_connected) && (ptr_server->reconnect_start > 0) && (new_time >= (ptr_server->reconnect_start + ptr_server->autoreconnect_delay))) - server_reconnect (ptr_server); + irc_server_reconnect (ptr_server); else { if (ptr_server->is_connected) @@ -232,7 +232,7 @@ gui_main_loop () if ((ptr_server->lag_check_time.tv_sec == 0) && (new_time >= ptr_server->lag_next_check)) { - server_sendf (ptr_server, "PING %s", ptr_server->address); + irc_server_sendf (ptr_server, "PING %s", ptr_server->address); gettimeofday (&(ptr_server->lag_check_time), NULL); } @@ -248,7 +248,7 @@ gui_main_loop () gui_printf (ptr_server->buffer, _("%s lag is high, disconnecting from server...\n"), WEECHAT_WARNING); - server_disconnect (ptr_server, 1); + irc_server_disconnect (ptr_server, 1); continue; } } @@ -282,22 +282,22 @@ gui_main_loop () if (!ptr_server->is_connected && (ptr_server->child_pid > 0)) { if (FD_ISSET (ptr_server->child_read, &read_fd)) - server_child_read (ptr_server); + irc_server_child_read (ptr_server); } else { if ((ptr_server->sock >= 0) && (FD_ISSET (ptr_server->sock, &read_fd))) - server_recv (ptr_server); + irc_server_recv (ptr_server); } } } /* manages active DCC */ - dcc_handle (); + irc_dcc_handle (); } if (send_irc_quit) - irc_cmd_send_quit (NULL, NULL, NULL); + irc_send_cmd_quit (NULL, NULL, NULL); } /* diff --git a/src/gui/curses/gui-curses-nicklist.c b/src/gui/curses/gui-curses-nicklist.c index ca2585d96..bbcfff451 100644 --- a/src/gui/curses/gui-curses-nicklist.c +++ b/src/gui/curses/gui-curses-nicklist.c @@ -54,7 +54,7 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size) { if ((ptr_win->buffer == buffer) && (buffer->num_displayed > 0)) { - max_length = nick_get_max_length (CHANNEL(buffer)); + max_length = irc_nick_get_max_length (CHANNEL(buffer)); if (calculate_size && (gui_window_calculate_pos_size (ptr_win, 0))) { diff --git a/src/gui/curses/gui-curses-status.c b/src/gui/curses/gui-curses-status.c index a6b93462b..26d3aaa9a 100644 --- a/src/gui/curses/gui-curses-status.c +++ b/src/gui/curses/gui-curses-status.c @@ -127,9 +127,9 @@ gui_status_draw (t_gui_buffer *buffer, int erase) SERVER(ptr_win->buffer)->name); if (ptr_win->buffer->all_servers) { - server_get_number_buffer (SERVER(ptr_win->buffer), - &server_pos, - &server_total); + irc_server_get_number_buffer (SERVER(ptr_win->buffer), + &server_pos, + &server_total); gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, COLOR_WIN_STATUS_DELIMITERS); wprintw (GUI_CURSES(ptr_win)->win_status, "("); diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index 5aa28fc56..67432b6ab 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -206,7 +206,7 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate) /* init chat & nicklist settings */ if (cfg_look_nicklist && BUFFER_IS_CHANNEL(window->buffer)) { - max_length = nick_get_max_length (CHANNEL(window->buffer)); + max_length = irc_nick_get_max_length (CHANNEL(window->buffer)); lines = 0; @@ -224,8 +224,8 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate) } else { - nick_count (CHANNEL(window->buffer), &num_nicks, &num_op, - &num_halfop, &num_voice, &num_normal); + irc_nick_count (CHANNEL(window->buffer), &num_nicks, &num_op, + &num_halfop, &num_voice, &num_normal); width_used = (window->win_width - add_left - add_right) - ((window->win_width - add_left - add_right) % (max_length + 2)); if (((max_length + 2) * num_nicks) % width_used == 0) diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index eb266379b..1b29f3f03 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -168,7 +168,7 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int type, new_buffer->line_complete = 1; /* notify level */ - new_buffer->notify_level = channel_get_notify_level (server, channel); + new_buffer->notify_level = irc_channel_get_notify_level (server, channel); /* create/append to log file */ new_buffer->log_filename = NULL; @@ -274,7 +274,7 @@ gui_buffer_search (char *server, char *channel) { if (server && server[0]) { - ptr_server = server_search (server); + ptr_server = irc_server_search (server); if (!ptr_server) return NULL; } @@ -283,7 +283,7 @@ gui_buffer_search (char *server, char *channel) { if (ptr_server) { - ptr_channel = channel_search_any (ptr_server, channel); + ptr_channel = irc_channel_search_any (ptr_server, channel); if (ptr_channel) ptr_buffer = ptr_channel->buffer; } @@ -368,6 +368,54 @@ gui_buffer_find_window (t_gui_buffer *buffer) } /* + * gui_buffer_find_context: find window/buffer for a server/channel + */ + +void +gui_buffer_find_context (void *server, void *channel, + t_gui_window **window, t_gui_buffer **buffer) +{ + t_gui_window *ptr_win; + + if (!buffer) + return; + + /* first find buffer */ + *buffer = NULL; + if ((t_irc_channel *)channel && ((t_irc_channel *)channel)->buffer) + *buffer = ((t_irc_channel *)channel)->buffer; + else + { + if ((t_irc_server *)server && ((t_irc_server *)server)->buffer) + *buffer = ((t_irc_server *)server)->buffer; + else + *buffer = gui_current_window->buffer; + } + + /* then find first window displaying this buffer */ + if (window) + { + *window = NULL; + if (gui_current_window->buffer == *buffer) + *window = gui_current_window; + else + { + for (ptr_win = gui_windows; ptr_win; + ptr_win = ptr_win->next_window) + { + if (ptr_win->buffer == *buffer) + { + *window = ptr_win; + break; + } + } + if (!*window) + *window = gui_current_window; + } + } +} + +/* * gui_buffer_is_scrolled: return 1 if all windows displaying buffer are scrolled * (user doesn't see end of buffer) * return 0 if at least one window is NOT scrolled diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c index f7b6cba80..60ccfcebb 100644 --- a/src/gui/gui-common.c +++ b/src/gui/gui-common.c @@ -672,7 +672,7 @@ gui_exec_action_dcc (t_gui_window *window, char *actions) && (DCC_IS_RECV(dcc_selected->status)) && (dcc_selected->status == DCC_WAITING)) { - dcc_accept (dcc_selected); + irc_dcc_accept (dcc_selected); } break; /* cancel DCC */ @@ -681,7 +681,7 @@ gui_exec_action_dcc (t_gui_window *window, char *actions) if (dcc_selected && (!DCC_ENDED(dcc_selected->status))) { - dcc_close (dcc_selected, DCC_ABORTED); + irc_dcc_close (dcc_selected, DCC_ABORTED); gui_window_redraw_buffer (window->buffer); } break; @@ -696,7 +696,7 @@ gui_exec_action_dcc (t_gui_window *window, char *actions) { ptr_dcc_next = ptr_dcc->next_dcc; if (DCC_ENDED(ptr_dcc->status)) - dcc_free (ptr_dcc); + irc_dcc_free (ptr_dcc); ptr_dcc = ptr_dcc_next; } gui_window_redraw_buffer (window->buffer); @@ -731,7 +731,7 @@ gui_exec_action_dcc (t_gui_window *window, char *actions) window->dcc_selected = dcc_selected->next_dcc; else window->dcc_selected = NULL; - dcc_free (dcc_selected); + irc_dcc_free (dcc_selected); gui_window_redraw_buffer (window->buffer); } break; diff --git a/src/gui/gui.h b/src/gui/gui.h index c3e56e08e..ef010d592 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -85,6 +85,8 @@ extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int); extern t_gui_buffer *gui_buffer_search (char *, char *); extern t_gui_buffer *gui_buffer_search_by_number (int); extern t_gui_window *gui_buffer_find_window (t_gui_buffer *); +extern void gui_buffer_find_context (void *, void *, + t_gui_window **, t_gui_buffer **); extern int gui_buffer_is_scrolled (t_gui_buffer *); extern t_gui_buffer *gui_buffer_get_dcc (t_gui_window *); extern void gui_buffer_clear (t_gui_buffer *); diff --git a/src/irc/irc-channel.c b/src/irc/irc-channel.c index 506bb3b38..4bd0e45e2 100644 --- a/src/irc/irc-channel.c +++ b/src/irc/irc-channel.c @@ -41,11 +41,12 @@ char *channel_modes = "iklmnstp"; /* - * channel_new: allocate a new channel for a server and add it to the server queue + * irc_channel_new: allocate a new channel for a server and add it to the + * server queue */ t_irc_channel * -channel_new (t_irc_server *server, int channel_type, char *channel_name) +irc_channel_new (t_irc_server *server, int channel_type, char *channel_name) { t_irc_channel *new_channel; @@ -91,11 +92,11 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name) } /* - * channel_free: free a channel and remove it from channels queue + * irc_channel_free: free a channel and remove it from channels queue */ void -channel_free (t_irc_server *server, t_irc_channel *channel) +irc_channel_free (t_irc_server *server, t_irc_channel *channel) { t_irc_channel *new_channels; @@ -108,8 +109,8 @@ channel_free (t_irc_server *server, t_irc_channel *channel) ((t_irc_dcc *)(channel->dcc_chat))->channel = NULL; if (!DCC_ENDED(((t_irc_dcc *)(channel->dcc_chat))->status)) { - dcc_close ((t_irc_dcc *)(channel->dcc_chat), DCC_ABORTED); - dcc_redraw (1); + irc_dcc_close ((t_irc_dcc *)(channel->dcc_chat), DCC_ABORTED); + irc_dcc_redraw (1); } } @@ -136,7 +137,7 @@ channel_free (t_irc_server *server, t_irc_channel *channel) free (channel->modes); if (channel->key) free (channel->key); - nick_free_all (channel); + irc_nick_free_all (channel); if (channel->away_message) free (channel->away_message); if (channel->nicks_speaking) @@ -147,24 +148,24 @@ channel_free (t_irc_server *server, t_irc_channel *channel) } /* - * channel_free_all: free all allocated channels + * irc_channel_free_all: free all allocated channels */ void -channel_free_all (t_irc_server *server) +irc_channel_free_all (t_irc_server *server) { /* remove all channels for the server */ while (server->channels) - channel_free (server, server->channels); + irc_channel_free (server, server->channels); } /* - * channel_search: returns pointer on a channel with name - * WARNING: DCC chat channels are not returned by this function + * irc_channel_search: returns pointer on a channel with name + * WARNING: DCC chat channels are not returned by this function */ t_irc_channel * -channel_search (t_irc_server *server, char *channel_name) +irc_channel_search (t_irc_server *server, char *channel_name) { t_irc_channel *ptr_channel; @@ -182,11 +183,11 @@ channel_search (t_irc_server *server, char *channel_name) } /* - * channel_search_any: returns pointer on a channel with name + * irc_channel_search_any: returns pointer on a channel with name */ t_irc_channel * -channel_search_any (t_irc_server *server, char *channel_name) +irc_channel_search_any (t_irc_server *server, char *channel_name) { t_irc_channel *ptr_channel; @@ -203,12 +204,12 @@ channel_search_any (t_irc_server *server, char *channel_name) } /* - * channel_search_any_without_buffer: returns pointer on a channel with name - * looks only for channels without buffer + * irc_channel_search_any_without_buffer: returns pointer on a channel with name + * looks only for channels without buffer */ t_irc_channel * -channel_search_any_without_buffer (t_irc_server *server, char *channel_name) +irc_channel_search_any_without_buffer (t_irc_server *server, char *channel_name) { t_irc_channel *ptr_channel; @@ -226,11 +227,11 @@ channel_search_any_without_buffer (t_irc_server *server, char *channel_name) } /* - * channel_search_dcc: returns pointer on a DCC chat channel with name + * irc_channel_search_dcc: returns pointer on a DCC chat channel with name */ t_irc_channel * -channel_search_dcc (t_irc_server *server, char *channel_name) +irc_channel_search_dcc (t_irc_server *server, char *channel_name) { t_irc_channel *ptr_channel; @@ -248,11 +249,11 @@ channel_search_dcc (t_irc_server *server, char *channel_name) } /* - * string_is_channel: returns 1 if string is channel + * irc_channel_is_channel: returns 1 if string is channel */ int -string_is_channel (char *string) +irc_channel_is_channel (char *string) { char first_char[2]; @@ -265,11 +266,11 @@ string_is_channel (char *string) } /* - * channel_remove_away: remove away for all nicks on a channel + * irc_channel_remove_away: remove away for all nicks on a channel */ void -channel_remove_away (t_irc_channel *channel) +irc_channel_remove_away (t_irc_channel *channel) { t_irc_nick *ptr_nick; @@ -284,11 +285,11 @@ channel_remove_away (t_irc_channel *channel) } /* - * channel_check_away: check for away on a channel + * irc_channel_check_away: check for away on a channel */ void -channel_check_away (t_irc_server *server, t_irc_channel *channel, int force) +irc_channel_check_away (t_irc_server *server, t_irc_channel *channel, int force) { if (channel->type == CHANNEL_TYPE_CHANNEL) { @@ -296,44 +297,44 @@ channel_check_away (t_irc_server *server, t_irc_channel *channel, int force) (channel->nicks_count <= cfg_irc_away_check_max_nicks)) { channel->checking_away++; - server_sendf (server, "WHO %s", channel->name); + irc_server_sendf (server, "WHO %s", channel->name); } else - channel_remove_away (channel); + irc_channel_remove_away (channel); } } /* - * channel_set_away: set/unset away status for a channel + * irc_channel_set_away: set/unset away status for a channel */ void -channel_set_away (t_irc_channel *channel, char *nick, int is_away) +irc_channel_set_away (t_irc_channel *channel, char *nick, int is_away) { t_irc_nick *ptr_nick; if (channel->type == CHANNEL_TYPE_CHANNEL) { - ptr_nick = nick_search (channel, nick); + ptr_nick = irc_nick_search (channel, nick); if (ptr_nick) - nick_set_away (channel, ptr_nick, is_away); + irc_nick_set_away (channel, ptr_nick, is_away); } } /* - * channel_create_dcc: create DCC CHAT channel + * irc_channel_create_dcc: create DCC CHAT channel */ int -channel_create_dcc (t_irc_dcc *ptr_dcc) +irc_channel_create_dcc (t_irc_dcc *ptr_dcc) { t_irc_channel *ptr_channel; - ptr_channel = channel_search_dcc (ptr_dcc->server, ptr_dcc->nick); + ptr_channel = irc_channel_search_dcc (ptr_dcc->server, ptr_dcc->nick); if (!ptr_channel) { - ptr_channel = channel_new (ptr_dcc->server, CHANNEL_TYPE_DCC_CHAT, - ptr_dcc->nick); + ptr_channel = irc_channel_new (ptr_dcc->server, CHANNEL_TYPE_DCC_CHAT, + ptr_dcc->nick); if (!ptr_channel) return 0; gui_buffer_new (gui_current_window, ptr_dcc->server, ptr_channel, @@ -351,11 +352,11 @@ channel_create_dcc (t_irc_dcc *ptr_dcc) } /* - * channel_get_notify_level: get channel notify level + * irc_channel_get_notify_level: get channel notify level */ int -channel_get_notify_level (t_irc_server *server, t_irc_channel *channel) +irc_channel_get_notify_level (t_irc_server *server, t_irc_channel *channel) { char *name, *pos, *pos2; int server_default_notify, notify; @@ -366,7 +367,7 @@ channel_get_notify_level (t_irc_server *server, t_irc_channel *channel) if ((!server->notify_levels) || (!server->notify_levels[0])) return NOTIFY_LEVEL_DEFAULT; - server_default_notify = server_get_default_notify_level (server); + server_default_notify = irc_server_get_default_notify_level (server); if ((channel->type != CHANNEL_TYPE_CHANNEL) && (server_default_notify == 1)) server_default_notify = 2; @@ -394,11 +395,12 @@ channel_get_notify_level (t_irc_server *server, t_irc_channel *channel) } /* - * server_set_notify_level: set channel notify level + * irc_channel_set_notify_level: set channel notify level */ void -channel_set_notify_level (t_irc_server *server, t_irc_channel *channel, int notify) +irc_channel_set_notify_level (t_irc_server *server, t_irc_channel *channel, + int notify) { char level_string[2]; @@ -411,11 +413,11 @@ channel_set_notify_level (t_irc_server *server, t_irc_channel *channel, int noti } /* - * channel_add_nick_speaking: add a nick speaking on a channel + * irc_channel_add_nick_speaking: add a nick speaking on a channel */ void -channel_add_nick_speaking (t_irc_channel *channel, char *nick) +irc_channel_add_nick_speaking (t_irc_channel *channel, char *nick) { int size, to_remove, i; @@ -436,11 +438,11 @@ channel_add_nick_speaking (t_irc_channel *channel, char *nick) } /* - * channel_print_log: print channel infos in log (usually for crash dump) + * irc_channel_print_log: print channel infos in log (usually for crash dump) */ void -channel_print_log (t_irc_channel *channel) +irc_channel_print_log (t_irc_channel *channel) { weechat_log_printf ("=> channel %s (addr:0x%X)]\n", channel->name, channel); weechat_log_printf (" type . . . . . . . . : %d\n", channel->type); diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c index 8621047e5..97e9c70e3 100644 --- a/src/irc/irc-commands.c +++ b/src/irc/irc-commands.c @@ -34,105 +34,105 @@ t_irc_command irc_commands[] = { { "admin", N_("find information about the administrator of the server"), N_("[target]"), N_("target: server"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_admin, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_admin, NULL }, { "ame", N_("send a CTCP action to all channels of all connected servers"), N_("message"), N_("message: message to send"), - "", 1, MAX_ARGS, 1, 1, NULL, irc_cmd_send_ame, NULL }, + "", 1, MAX_ARGS, 1, 1, NULL, irc_send_cmd_ame, NULL }, { "amsg", N_("send message to all channels of all connected servers"), N_("text"), N_("text: text to send"), - "", 1, MAX_ARGS, 1, 1, NULL, irc_cmd_send_amsg, NULL }, + "", 1, MAX_ARGS, 1, 1, NULL, irc_send_cmd_amsg, NULL }, { "away", N_("toggle away status"), N_("[-all] [message]"), N_(" -all: toggle away status on all connected servers\n" "message: message for away (if no message is given, away status is removed)"), - "-all", 0, MAX_ARGS, 1, 0, NULL, irc_cmd_send_away, NULL }, + "-all", 0, MAX_ARGS, 1, 0, NULL, irc_send_cmd_away, NULL }, { "ban", N_("bans nicks or hosts"), N_("[channel] [nickname [nickname ...]]"), N_(" channel: channel for ban\n" "nickname: user or host to ban"), - "%N", 0, MAX_ARGS, 0, 1, NULL, irc_cmd_send_ban, NULL }, + "%N", 0, MAX_ARGS, 0, 1, NULL, irc_send_cmd_ban, NULL }, { "ctcp", N_("send a CTCP message (Client-To-Client Protocol)"), N_("receiver type [arguments]"), N_(" receiver: nick or channel to send CTCP to\n" " type: CTCP type (examples: \"version\", \"ping\", ..)\n" "arguments: arguments for CTCP"), - "%c|%n action|ping|version", 2, MAX_ARGS, 1, 1, NULL, irc_cmd_send_ctcp, NULL }, + "%c|%n action|ping|version", 2, MAX_ARGS, 1, 1, NULL, irc_send_cmd_ctcp, NULL }, { "cycle", N_("leave and rejoin a channel"), N_("[channel[,channel]] [part_message]"), N_(" channel: channel name for cycle\n" "part_message: part message (displayed to other users)"), - "%p", 0, MAX_ARGS, 0, 1, NULL, irc_cmd_send_cycle, NULL }, + "%p", 0, MAX_ARGS, 0, 1, NULL, irc_send_cmd_cycle, NULL }, { "dehalfop", N_("removes half channel operator status from nickname(s)"), N_("[nickname [nickname]]"), "", - "", 0, MAX_ARGS, 0, 1, irc_cmd_send_dehalfop, NULL, NULL }, + "", 0, MAX_ARGS, 0, 1, irc_send_cmd_dehalfop, NULL, NULL }, { "deop", N_("removes channel operator status from nickname(s)"), N_("[nickname [nickname]]"), "", - "", 0, MAX_ARGS, 0, 1, irc_cmd_send_deop, NULL, NULL }, + "", 0, MAX_ARGS, 0, 1, irc_send_cmd_deop, NULL, NULL }, { "devoice", N_("removes voice from nickname(s)"), N_("[nickname [nickname]]"), "", - "", 0, MAX_ARGS, 0, 1, irc_cmd_send_devoice, NULL, NULL }, + "", 0, MAX_ARGS, 0, 1, irc_send_cmd_devoice, NULL, NULL }, { "die", N_("shutdown the server"), "", "", - NULL, 0, 0, 0, 1, NULL, irc_cmd_send_die, NULL }, + NULL, 0, 0, 0, 1, NULL, irc_send_cmd_die, NULL }, { "error", N_("error received from IRC server"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_error }, { "halfop", N_("gives half channel operator status to nickname(s)"), N_("[nickname [nickname]]"), "", - "", 0, MAX_ARGS, 0, 1, irc_cmd_send_halfop, NULL, NULL }, + "", 0, MAX_ARGS, 0, 1, irc_send_cmd_halfop, NULL, NULL }, { "info", N_("get information describing the server"), N_("[target]"), N_("target: server name"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_info, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_info, NULL }, { "invite", N_("invite a nick on a channel"), N_("nickname channel"), N_("nickname: nick to invite\n" " channel: channel to invite"), - "%n %c", 1, 2, 0, 1, irc_cmd_send_invite, NULL, irc_cmd_recv_invite }, + "%n %c", 1, 2, 0, 1, irc_send_cmd_invite, NULL, irc_recv_cmd_invite }, { "ison", N_("check if a nickname is currently on IRC"), N_("nickname [nickname ...]"), N_("nickname: nickname"), - "", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_ison, NULL }, + "", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_ison, NULL }, { "join", N_("join a channel"), N_("channel[,channel] [key[,key]]"), N_("channel: channel name to join\n" " key: key to join the channel"), - NULL, 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_join, irc_cmd_recv_join }, + NULL, 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_join, irc_recv_cmd_join }, { "kick", N_("forcibly remove a user from a channel"), N_("[channel] nickname [comment]"), N_(" channel: channel where user is\n" "nickname: nickname to kick\n" " comment: comment for kick"), - "%n %-", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_kick, irc_cmd_recv_kick }, + "%n %-", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_kick, irc_recv_cmd_kick }, { "kickban", N_("kicks and bans a nick from a channel"), N_("[channel] nickname [comment]"), N_(" channel: channel where user is\n" "nickname: nickname to kick and ban\n" " comment: comment for kick"), - "%n %-", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_kickban, NULL }, + "%n %-", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_kickban, NULL }, { "kill", N_("close client-server connection"), N_("nickname comment"), N_("nickname: nickname\n" " comment: comment for kill"), - "%n %-", 2, MAX_ARGS, 0, 1, NULL, irc_cmd_send_kill, irc_cmd_recv_kill }, + "%n %-", 2, MAX_ARGS, 0, 1, NULL, irc_send_cmd_kill, irc_recv_cmd_kill }, { "links", N_("list all servernames which are known by the server answering the query"), N_("[[server] server_mask]"), N_(" server: this server should answer the query\n" "server_mask: list of servers must match this mask"), - NULL, 0, 2, 0, 1, NULL, irc_cmd_send_links, NULL }, + NULL, 0, 2, 0, 1, NULL, irc_send_cmd_links, NULL }, { "list", N_("list channels and their topic"), N_("[channel[,channel] [server]]"), N_("channel: channel to list (a regexp is allowed)\nserver: server name"), - NULL, 0, MAX_ARGS, 0, 1, NULL, irc_cmd_send_list, NULL }, + NULL, 0, MAX_ARGS, 0, 1, NULL, irc_send_cmd_list, NULL }, { "lusers", N_("get statistics about the size of the IRC network"), N_("[mask [target]]"), N_(" mask: servers matching the mask only\n" "target: server for forwarding request"), - NULL, 0, 2, 0, 1, NULL, irc_cmd_send_lusers, NULL }, + NULL, 0, 2, 0, 1, NULL, irc_send_cmd_lusers, NULL }, { "me", N_("send a CTCP action to the current channel"), N_("message"), N_("message: message to send"), - "", 0, MAX_ARGS, 1, 1, NULL, irc_cmd_send_me, NULL }, + "", 0, MAX_ARGS, 1, 1, NULL, irc_send_cmd_me, NULL }, { "mode", N_("change channel or user mode"), N_("{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | " "{ nickname {[+|-]|i|w|s|o} }"), @@ -156,356 +156,356 @@ t_irc_command irc_commands[] = " s: mark a user for receive server notices\n" " w: user receives wallops\n" " o: operator flag"), - "%c|%m", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_mode, irc_cmd_recv_mode }, + "%c|%m", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_mode, irc_recv_cmd_mode }, { "motd", N_("get the \"Message Of The Day\""), N_("[target]"), N_("target: server name"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_motd, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_motd, NULL }, { "msg", N_("send message to a nick or channel"), N_("receiver[,receiver] text"), N_("receiver: nick or channel (may be mask, '*' = current channel)\n" "text: text to send"), - "", 2, MAX_ARGS, 1, 1, NULL, irc_cmd_send_msg, NULL }, + "", 2, MAX_ARGS, 1, 1, NULL, irc_send_cmd_msg, NULL }, { "names", N_("list nicknames on channels"), N_("[channel[,channel]]"), N_("channel: channel name"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_names, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_names, NULL }, { "nick", N_("change current nickname"), N_("[-all] nickname"), N_(" -all: set new nickname for all connected servers\n" "nickname: new nickname"), - "-all", 1, 2, 0, 0, irc_cmd_send_nick, NULL, irc_cmd_recv_nick }, + "-all", 1, 2, 0, 0, irc_send_cmd_nick, NULL, irc_recv_cmd_nick }, { "notice", N_("send notice message to user"), N_("nickname text"), N_("nickname: user to send notice to\n" " text: text to send"), - "%n %-", 2, MAX_ARGS, 1, 1, NULL, irc_cmd_send_notice, irc_cmd_recv_notice }, + "%n %-", 2, MAX_ARGS, 1, 1, NULL, irc_send_cmd_notice, irc_recv_cmd_notice }, { "op", N_("gives channel operator status to nickname(s)"), N_("nickname [nickname]"), "", - "", 1, MAX_ARGS, 0, 1, irc_cmd_send_op, NULL, NULL }, + "", 1, MAX_ARGS, 0, 1, irc_send_cmd_op, NULL, NULL }, { "oper", N_("get operator privileges"), N_("user password"), N_("user/password: used to get privileges on current IRC server"), - NULL, 2, 2, 0, 1, NULL, irc_cmd_send_oper, NULL }, + NULL, 2, 2, 0, 1, NULL, irc_send_cmd_oper, NULL }, { "part", N_("leave a channel"), N_("[channel[,channel]] [part_message]"), N_(" channel: channel name to leave\n" "part_message: part message (displayed to other users)"), - "%p", 0, MAX_ARGS, 0, 1, NULL, irc_cmd_send_part, irc_cmd_recv_part }, + "%p", 0, MAX_ARGS, 0, 1, NULL, irc_send_cmd_part, irc_recv_cmd_part }, { "ping", N_("ping server"), N_("server1 [server2]"), N_("server1: server to ping\nserver2: forward ping to this server"), - NULL, 1, 2, 0, 1, NULL, irc_cmd_send_ping, irc_cmd_recv_ping }, + NULL, 1, 2, 0, 1, NULL, irc_send_cmd_ping, irc_recv_cmd_ping }, { "pong", N_("answer to a ping message"), N_("daemon [daemon2]"), N_(" daemon: daemon who has responded to Ping message\n" "daemon2: forward message to this daemon"), - NULL, 1, 2, 0, 1, NULL, irc_cmd_send_pong, irc_cmd_recv_pong }, + NULL, 1, 2, 0, 1, NULL, irc_send_cmd_pong, irc_recv_cmd_pong }, { "privmsg", N_("message received"), "", "", - "", 0, 0, 1, 1, NULL, NULL, irc_cmd_recv_privmsg }, + "", 0, 0, 1, 1, NULL, NULL, irc_recv_cmd_privmsg }, { "query", N_("send a private message to a nick"), N_("nickname [text]"), N_("nickname: nickname for private conversation\n" " text: text to send"), - "%n %-", 1, MAX_ARGS, 1, 1, NULL, irc_cmd_send_query, NULL }, + "%n %-", 1, MAX_ARGS, 1, 1, NULL, irc_send_cmd_query, NULL }, { "quit", N_("close all connections and quit"), N_("[quit_message]"), N_("quit_message: quit message (displayed to other users)"), - "%q", 0, MAX_ARGS, 1, 0, NULL, irc_cmd_send_quit, irc_cmd_recv_quit }, + "%q", 0, MAX_ARGS, 1, 0, NULL, irc_send_cmd_quit, irc_recv_cmd_quit }, { "quote", N_("send raw data to server without parsing"), N_("data"), N_("data: raw data to send"), - "", 1, MAX_ARGS, 1, 1, NULL, irc_cmd_send_quote, NULL }, + "", 1, MAX_ARGS, 1, 1, NULL, irc_send_cmd_quote, NULL }, { "rehash", N_("tell the server to reload its config file"), "", "", - NULL, 0, 0, 0, 1, NULL, irc_cmd_send_rehash, NULL }, + NULL, 0, 0, 0, 1, NULL, irc_send_cmd_rehash, NULL }, { "restart", N_("tell the server to restart itself"), "", "", - NULL, 0, 0, 0, 1, NULL, irc_cmd_send_restart, NULL }, + NULL, 0, 0, 0, 1, NULL, irc_send_cmd_restart, NULL }, { "service", N_("register a new service"), N_("nickname reserved distribution type reserved info"), N_("distribution: visibility of service\n" " type: reserved for future usage"), - NULL, 6, 6, 0, 1, NULL, irc_cmd_send_service, NULL }, + NULL, 6, 6, 0, 1, NULL, irc_send_cmd_service, NULL }, { "servlist", N_("list services currently connected to the network"), N_("[mask [type]]"), N_("mask: list only services matching this mask\n" "type: list only services of this type"), - NULL, 0, 2, 0, 1, NULL, irc_cmd_send_servlist, NULL }, + NULL, 0, 2, 0, 1, NULL, irc_send_cmd_servlist, NULL }, { "squery", N_("deliver a message to a service"), N_("service text"), N_("service: name of service\ntext: text to send"), - NULL, 2, MAX_ARGS, 1, 1, NULL, irc_cmd_send_squery, NULL }, + NULL, 2, MAX_ARGS, 1, 1, NULL, irc_send_cmd_squery, NULL }, { "squit", N_("disconnect server links"), N_("server comment"), N_( "server: server name\n" "comment: comment for quit"), - NULL, 2, 2, 1, 1, NULL, irc_cmd_send_squit, NULL }, + NULL, 2, 2, 1, 1, NULL, irc_send_cmd_squit, NULL }, { "stats", N_("query statistics about server"), N_("[query [server]]"), N_(" query: c/h/i/k/l/m/o/y/u (see RFC1459)\n" "server: server name"), - NULL, 0, 2, 0, 1, NULL, irc_cmd_send_stats, NULL }, + NULL, 0, 2, 0, 1, NULL, irc_send_cmd_stats, NULL }, { "summon", N_("give users who are on a host running an IRC server a message " "asking them to please join IRC"), N_("user [target [channel]]"), N_(" user: username\ntarget: server name\n" "channel: channel name"), - NULL, 1, 3, 0, 1, NULL, irc_cmd_send_summon, NULL }, + NULL, 1, 3, 0, 1, NULL, irc_send_cmd_summon, NULL }, { "time", N_("query local time from server"), N_("[target]"), N_("target: query time from specified server"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_time, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_time, NULL }, { "topic", N_("get/set channel topic"), N_("[channel] [topic]"), N_("channel: channel name\ntopic: new topic for channel " "(if topic is \"-delete\" then topic is deleted)"), - "%t|-delete %-", 0, MAX_ARGS, 1, 1, NULL, irc_cmd_send_topic, irc_cmd_recv_topic }, + "%t|-delete %-", 0, MAX_ARGS, 1, 1, NULL, irc_send_cmd_topic, irc_recv_cmd_topic }, { "trace", N_("find the route to specific server"), N_("[target]"), N_("target: server"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_trace, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_trace, NULL }, { "unban", N_("unbans nicks or hosts"), N_("[channel] nickname [nickname ...]"), N_(" channel: channel for unban\n" "nickname: user or host to unban"), - "", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_unban, NULL }, + "", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_unban, NULL }, { "userhost", N_("return a list of information about nicknames"), N_("nickname [nickname ...]"), N_("nickname: nickname"), - "%n", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_userhost, NULL }, + "%n", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_userhost, NULL }, { "users", N_("list of users logged into the server"), N_("[target]"), N_("target: server"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_users, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_users, NULL }, { "version", N_("gives the version info of nick or server (current or specified)"), N_("[server | nickname]"), N_(" server: server name\n" "nickname: nickname"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_version, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_version, NULL }, { "voice", N_("gives voice to nickname(s)"), N_("[nickname [nickname]]"), "", - "", 0, MAX_ARGS, 0, 1, irc_cmd_send_voice, NULL, NULL }, + "", 0, MAX_ARGS, 0, 1, irc_send_cmd_voice, NULL, NULL }, { "wallops", N_("send a message to all currently connected users who have " "set the 'w' user mode for themselves"), N_("text"), N_("text to send"), - NULL, 1, MAX_ARGS, 1, 1, NULL, irc_cmd_send_wallops, irc_cmd_recv_wallops }, + NULL, 1, MAX_ARGS, 1, 1, NULL, irc_send_cmd_wallops, irc_recv_cmd_wallops }, { "who", N_("generate a query which returns a list of information"), N_("[mask [\"o\"]]"), N_("mask: only information which match this mask\n" " o: only operators are returned according to the mask supplied"), - "%C", 0, 2, 0, 1, NULL, irc_cmd_send_who, NULL }, + "%C", 0, 2, 0, 1, NULL, irc_send_cmd_who, NULL }, { "whois", N_("query information about user(s)"), N_("[server] nickname[,nickname]"), N_(" server: server name\n" "nickname: nickname (may be a mask)"), - "", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_whois, NULL }, + "", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_whois, NULL }, { "whowas", N_("ask for information about a nickname which no longer exists"), N_("nickname [,nickname [,nickname ...]] [count [target]]"), N_("nickname: nickname to search\n" " count: number of replies to return (full search if negative number)\n" " target: reply should match this mask"), - "", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_whowas, NULL }, + "", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_whowas, NULL }, { "001", N_("a server message"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_001 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_001 }, { "005", N_("a server message"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_005 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_005 }, { "221", N_("user mode string"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_221 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_221 }, { "301", N_("away message"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_301 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_301 }, { "302", N_("userhost"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_302 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_302 }, { "303", N_("ison"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_303 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_303 }, { "305", N_("unaway"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_305 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_305 }, { "306", N_("now away"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_306 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_306 }, { "307", N_("whois (registered nick)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_whois_nick_msg }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_whois_nick_msg }, { "310", N_("whois (help mode)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_310 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_310 }, { "311", N_("whois (user)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_311 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_311 }, { "312", N_("whois (server)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_312 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_312 }, { "313", N_("whois (operator)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_whois_nick_msg }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_whois_nick_msg }, { "314", N_("whowas"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_314 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_314 }, { "315", N_("end of /who list"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_315 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_315 }, { "317", N_("whois (idle)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_317 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_317 }, { "318", N_("whois (end)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_whois_nick_msg }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_whois_nick_msg }, { "319", N_("whois (channels)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_319 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_319 }, { "320", N_("whois (identified user)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_whois_nick_msg }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_whois_nick_msg }, { "321", N_("/list start"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_321 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_321 }, { "322", N_("channel (for /list)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_322 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_322 }, { "323", N_("/list end"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_323 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_323 }, { "324", N_("channel mode"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_324 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_324 }, { "326", N_("whois (has oper privs)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_whois_nick_msg }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_whois_nick_msg }, { "329", N_("channel creation date"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_329 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_329 }, { "331", N_("no topic for channel"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_331 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_331 }, { "332", N_("topic of channel"), N_("channel :topic"), N_("channel: name of channel\n" " topic: topic of the channel"), - NULL, 2, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_332 }, + NULL, 2, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_332 }, { "333", N_("infos about topic (nick and date changed)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_333 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_333 }, { "338", N_("whois (host)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_338 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_338 }, { "341", N_("inviting"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_341 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_341 }, { "344", N_("channel reop"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_344 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_344 }, { "345", N_("end of channel reop list"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_345 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_345 }, { "348", N_("channel exception list"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_348 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_348 }, { "349", N_("end of channel exception list"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_349 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_349 }, { "351", N_("server version"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_351 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_351 }, { "352", N_("who"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_352 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_352 }, { "353", N_("list of nicks on channel"), N_("channel :[[@|+]nick ...]"), N_("channel: name of channel\n" " nick: nick on the channel"), - NULL, 2, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_353 }, + NULL, 2, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_353 }, { "366", N_("end of /names list"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_366 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_366 }, { "367", N_("banlist"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_367 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_367 }, { "368", N_("end of banlist"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_368 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_368 }, { "378", N_("connecting from"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_378 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_378 }, { "401", N_("no such nick/channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "402", N_("no such server"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "403", N_("no such channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "404", N_("cannot send to channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "405", N_("too many channels"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "406", N_("was no such nick"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "407", N_("was no such nick"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "409", N_("no origin"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "410", N_("no services"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "411", N_("no recipient"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "412", N_("no text to send"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "413", N_("no toplevel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "414", N_("wilcard in toplevel domain"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "421", N_("unknown command"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "422", N_("MOTD is missing"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "423", N_("no administrative info"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "424", N_("file error"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "431", N_("no nickname given"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "432", N_("erroneous nickname"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_432 }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_432 }, { "433", N_("nickname already in use"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_433 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_433 }, { "436", N_("nickname collision"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "437", N_("resource unavailable"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "438", N_("not authorized to change nickname"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_438 }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_438 }, { "441", N_("user not in channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "442", N_("not on channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "443", N_("user already on channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "444", N_("user not logged in"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "445", N_("summon has been disabled"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "446", N_("users has been disabled"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "451", N_("you are not registered"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "461", N_("not enough parameters"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "462", N_("you may not register"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "463", N_("your host isn't among the privileged"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "464", N_("password incorrect"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "465", N_("you are banned from this server"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "467", N_("channel key already set"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "470", N_("forwarding to another channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "471", N_("channel is already full"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "472", N_("unknown mode char to me"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "473", N_("cannot join channel (invite only)"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "474", N_("cannot join channel (banned from channel)"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "475", N_("cannot join channel (bad channel key)"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "476", N_("bad channel mask"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "477", N_("channel doesn't support modes"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "481", N_("you're not an IRC operator"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "482", N_("you're not channel operator"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "483", N_("you can't kill a server!"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "484", N_("your connection is restricted!"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "485", N_("user is immune from kick/deop"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "487", N_("network split"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "491", N_("no O-lines for your host"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "501", N_("unknown mode flag"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "502", N_("can't change mode for other users"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "671", N_("whois (secure connection)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_671 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_671 }, { "973", N_("whois (secure connection)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_server_mode_reason }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_server_mode_reason }, { "974", N_("whois (secure connection)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_server_mode_reason }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_server_mode_reason }, { "975", N_("whois (secure connection)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_server_mode_reason }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_server_mode_reason }, { NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 1, NULL, NULL, NULL } }; diff --git a/src/irc/irc-dcc.c b/src/irc/irc-dcc.c index 387b84d2a..1ebece206 100644 --- a/src/irc/irc-dcc.c +++ b/src/irc/irc-dcc.c @@ -57,11 +57,11 @@ char *dcc_status_string[] = /* strings for DCC status */ /* - * dcc_redraw: redraw DCC buffer (and add to hotlist) + * irc_dcc_redraw: redraw DCC buffer (and add to hotlist) */ void -dcc_redraw (int highlight) +irc_dcc_redraw (int highlight) { t_gui_buffer *ptr_buffer; @@ -75,11 +75,11 @@ dcc_redraw (int highlight) } /* - * dcc_search: search a DCC + * irc_dcc_search: search a DCC */ t_irc_dcc * -dcc_search (t_irc_server *server, int type, int status, int port) +irc_dcc_search (t_irc_server *server, int type, int status, int port) { t_irc_dcc *ptr_dcc; @@ -97,11 +97,12 @@ dcc_search (t_irc_server *server, int type, int status, int port) } /* - * dcc_port_in_use: return 1 if a port is in used (by an active or connecting DCC) + * irc_dcc_port_in_use: return 1 if a port is in used + * (by an active or connecting DCC) */ int -dcc_port_in_use (int port) +irc_dcc_port_in_use (int port) { t_irc_dcc *ptr_dcc; @@ -117,11 +118,11 @@ dcc_port_in_use (int port) } /* - * dcc_file_is_resumable: check if a file can be used for resuming a download + * irc_dcc_file_is_resumable: check if a file can be used for resuming a download */ int -dcc_file_is_resumable (t_irc_dcc *ptr_dcc, char *filename) +irc_dcc_file_is_resumable (t_irc_dcc *ptr_dcc, char *filename) { struct stat st; @@ -147,13 +148,13 @@ dcc_file_is_resumable (t_irc_dcc *ptr_dcc, char *filename) } /* - * dcc_find_filename: find local filename for a DCC - * if type if file/recv, add a suffix (like .1) if needed - * if download is resumable, set "start_resume" to good value + * irc_dcc_find_filename: find local filename for a DCC + * if type if file/recv, add a suffix (like .1) if needed + * if download is resumable, set "start_resume" to good value */ void -dcc_find_filename (t_irc_dcc *ptr_dcc) +irc_dcc_find_filename (t_irc_dcc *ptr_dcc) { char *dir1, *dir2, *filename2; @@ -191,22 +192,22 @@ dcc_find_filename (t_irc_dcc *ptr_dcc) /* file already exists? */ if (access (ptr_dcc->local_filename, F_OK) == 0) { - if (dcc_file_is_resumable (ptr_dcc, ptr_dcc->local_filename)) + if (irc_dcc_file_is_resumable (ptr_dcc, ptr_dcc->local_filename)) return; /* if auto rename is not set, then abort DCC */ if (!cfg_dcc_auto_rename) { - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return; } filename2 = (char *) malloc (strlen (ptr_dcc->local_filename) + 16); if (!filename2) { - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return; } ptr_dcc->filename_suffix = 0; @@ -218,7 +219,7 @@ dcc_find_filename (t_irc_dcc *ptr_dcc) ptr_dcc->filename_suffix); if (access (filename2, F_OK) == 0) { - if (dcc_file_is_resumable (ptr_dcc, filename2)) + if (irc_dcc_file_is_resumable (ptr_dcc, filename2)) break; } else @@ -233,11 +234,11 @@ dcc_find_filename (t_irc_dcc *ptr_dcc) } /* - * dcc_calculate_speed: calculate DCC speed (for files only) + * irc_dcc_calculate_speed: calculate DCC speed (for files only) */ void -dcc_calculate_speed (t_irc_dcc *ptr_dcc, int ended) +irc_dcc_calculate_speed (t_irc_dcc *ptr_dcc, int ended) { time_t local_time, elapsed; unsigned long bytes_per_sec_total; @@ -277,11 +278,11 @@ dcc_calculate_speed (t_irc_dcc *ptr_dcc, int ended) } /* - * dcc_connect_to_sender: connect to sender + * irc_dcc_connect_to_sender: connect to sender */ int -dcc_connect_to_sender (t_irc_dcc *ptr_dcc) +irc_dcc_connect_to_sender (t_irc_dcc *ptr_dcc) { struct sockaddr_in addr; struct hostent *hostent; @@ -303,7 +304,8 @@ dcc_connect_to_sender (t_irc_dcc *ptr_dcc) ret = connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr)); if ((ret == -1) && (errno != EINPROGRESS)) return 0; - if (pass_proxy (ptr_dcc->sock, ip4, ptr_dcc->port, ptr_dcc->server->username) == -1) + if (irc_server_pass_proxy (ptr_dcc->sock, ip4, ptr_dcc->port, + ptr_dcc->server->username) == -1) return 0; } else @@ -320,11 +322,11 @@ dcc_connect_to_sender (t_irc_dcc *ptr_dcc) } /* - * dcc_connect: connect to another host + * irc_dcc_connect: connect to another host */ int -dcc_connect (t_irc_dcc *ptr_dcc) +irc_dcc_connect (t_irc_dcc *ptr_dcc) { if (ptr_dcc->type == DCC_CHAT_SEND) ptr_dcc->status = DCC_WAITING; @@ -354,7 +356,7 @@ dcc_connect (t_irc_dcc *ptr_dcc) { if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1) return 0; - dcc_connect_to_sender (ptr_dcc); + irc_dcc_connect_to_sender (ptr_dcc); } /* for file receiving, connection is made in child process (blocking) socket */ @@ -363,11 +365,11 @@ dcc_connect (t_irc_dcc *ptr_dcc) } /* - * dcc_free: free DCC struct and remove it from list + * irc_dcc_free: free DCC struct and remove it from list */ void -dcc_free (t_irc_dcc *ptr_dcc) +irc_dcc_free (t_irc_dcc *ptr_dcc) { t_irc_dcc *new_dcc_list; @@ -384,7 +386,7 @@ dcc_free (t_irc_dcc *ptr_dcc) { gui_buffer_free (ptr_dcc->channel->buffer, 1); if (ptr_dcc->channel) - channel_free (ptr_dcc->server, ptr_dcc->channel); + irc_channel_free (ptr_dcc->server, ptr_dcc->channel); } } @@ -414,11 +416,11 @@ dcc_free (t_irc_dcc *ptr_dcc) } /* - * dcc_file_child_kill: kill child process and close pipe + * irc_dcc_file_child_kill: kill child process and close pipe */ void -dcc_file_child_kill (t_irc_dcc *ptr_dcc) +irc_dcc_file_child_kill (t_irc_dcc *ptr_dcc) { /* kill process */ if (ptr_dcc->child_pid > 0) @@ -442,11 +444,11 @@ dcc_file_child_kill (t_irc_dcc *ptr_dcc) } /* - * dcc_close: close a DCC connection + * irc_dcc_close: close a DCC connection */ void -dcc_close (t_irc_dcc *ptr_dcc, int status) +irc_dcc_close (t_irc_dcc *ptr_dcc, int status) { t_gui_buffer *ptr_buffer; struct stat st; @@ -479,7 +481,7 @@ dcc_close (t_irc_dcc *ptr_dcc, int status) ptr_dcc->nick, GUI_COLOR(COLOR_WIN_CHAT), (status == DCC_DONE) ? _("OK") : _("FAILED")); - dcc_file_child_kill (ptr_dcc); + irc_dcc_file_child_kill (ptr_dcc); } } if (status == DCC_ABORTED) @@ -521,7 +523,7 @@ dcc_close (t_irc_dcc *ptr_dcc, int status) } if (DCC_IS_FILE(ptr_dcc->type)) - dcc_calculate_speed (ptr_dcc, 1); + irc_dcc_calculate_speed (ptr_dcc, 1); if (ptr_dcc->sock >= 0) { @@ -536,13 +538,13 @@ dcc_close (t_irc_dcc *ptr_dcc, int status) } /* - * dcc_channel_for_chat: create channel for DCC chat + * irc_dcc_channel_for_chat: create channel for DCC chat */ void -dcc_channel_for_chat (t_irc_dcc *ptr_dcc) +irc_dcc_channel_for_chat (t_irc_dcc *ptr_dcc) { - if (!channel_create_dcc (ptr_dcc)) + if (!irc_channel_create_dcc (ptr_dcc)) { irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer, PREFIX_ERROR); @@ -550,8 +552,8 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc) _("%s can't associate DCC chat with private buffer " "(maybe private buffer has already DCC CHAT?)\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return; } @@ -572,11 +574,11 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc) } /* - * dcc_chat_remove_channel: remove a buffer for DCC chat + * irc_dcc_chat_remove_channel: remove a buffer for DCC chat */ void -dcc_chat_remove_channel (t_irc_channel *channel) +irc_dcc_chat_remove_channel (t_irc_channel *channel) { t_irc_dcc *ptr_dcc; @@ -591,16 +593,16 @@ dcc_chat_remove_channel (t_irc_channel *channel) } /* - * dcc_recv_connect_init: connect to sender and init file or chat + * irc_dcc_recv_connect_init: connect to sender and init file or chat */ void -dcc_recv_connect_init (t_irc_dcc *ptr_dcc) +irc_dcc_recv_connect_init (t_irc_dcc *ptr_dcc) { - if (!dcc_connect (ptr_dcc)) + if (!irc_dcc_connect (ptr_dcc)) { - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); } else { @@ -608,63 +610,63 @@ dcc_recv_connect_init (t_irc_dcc *ptr_dcc) if (DCC_IS_FILE(ptr_dcc->type)) { ptr_dcc->status = DCC_CONNECTING; - dcc_file_recv_fork (ptr_dcc); + irc_dcc_file_recv_fork (ptr_dcc); } else { /* DCC CHAT => associate DCC with channel */ ptr_dcc->status = DCC_ACTIVE; - dcc_channel_for_chat (ptr_dcc); + irc_dcc_channel_for_chat (ptr_dcc); } } - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } /* - * dcc_accept: accepts a DCC file or chat request + * irc_dcc_accept: accepts a DCC file or chat request */ void -dcc_accept (t_irc_dcc *ptr_dcc) +irc_dcc_accept (t_irc_dcc *ptr_dcc) { if (DCC_IS_FILE(ptr_dcc->type) && (ptr_dcc->start_resume > 0)) { ptr_dcc->status = DCC_CONNECTING; - server_sendf (ptr_dcc->server, - (strchr (ptr_dcc->filename, ' ')) ? + irc_server_sendf (ptr_dcc->server, + (strchr (ptr_dcc->filename, ' ')) ? "PRIVMSG %s :\01DCC RESUME \"%s\" %d %u\01\n" : "PRIVMSG %s :\01DCC RESUME %s %d %u\01", - ptr_dcc->nick, ptr_dcc->filename, - ptr_dcc->port, ptr_dcc->start_resume); - dcc_redraw (HOTLIST_MSG); + ptr_dcc->nick, ptr_dcc->filename, + ptr_dcc->port, ptr_dcc->start_resume); + irc_dcc_redraw (HOTLIST_MSG); } else - dcc_recv_connect_init (ptr_dcc); + irc_dcc_recv_connect_init (ptr_dcc); } /* - * dcc_accept_resume: accepts a resume and inform the receiver + * irc_dcc_accept_resume: accepts a resume and inform the receiver */ void -dcc_accept_resume (t_irc_server *server, char *filename, int port, - unsigned long pos_start) +irc_dcc_accept_resume (t_irc_server *server, char *filename, int port, + unsigned long pos_start) { t_irc_dcc *ptr_dcc; - ptr_dcc = dcc_search (server, DCC_FILE_SEND, DCC_CONNECTING, port); + ptr_dcc = irc_dcc_search (server, DCC_FILE_SEND, DCC_CONNECTING, port); if (ptr_dcc) { ptr_dcc->pos = pos_start; ptr_dcc->ack = pos_start; ptr_dcc->start_resume = pos_start; ptr_dcc->last_check_pos = pos_start; - server_sendf (ptr_dcc->server, - (strchr (ptr_dcc->filename, ' ')) ? + irc_server_sendf (ptr_dcc->server, + (strchr (ptr_dcc->filename, ' ')) ? "PRIVMSG %s :\01DCC ACCEPT \"%s\" %d %u\01\n" : "PRIVMSG %s :\01DCC ACCEPT %s %d %u\01", - ptr_dcc->nick, ptr_dcc->filename, - ptr_dcc->port, ptr_dcc->start_resume); + ptr_dcc->nick, ptr_dcc->filename, + ptr_dcc->port, ptr_dcc->start_resume); irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer, PREFIX_INFO); @@ -674,7 +676,7 @@ dcc_accept_resume (t_irc_server *server, char *filename, int port, ptr_dcc->filename, GUI_COLOR(COLOR_WIN_CHAT), ptr_dcc->start_resume); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } else gui_printf (server->buffer, @@ -683,23 +685,23 @@ dcc_accept_resume (t_irc_server *server, char *filename, int port, } /* - * dcc_start_resume: called when "DCC ACCEPT" is received (resume accepted by sender) + * irc_dcc_start_resume: called when "DCC ACCEPT" is received (resume accepted by sender) */ void -dcc_start_resume (t_irc_server *server, char *filename, int port, - unsigned long pos_start) +irc_dcc_start_resume (t_irc_server *server, char *filename, int port, + unsigned long pos_start) { t_irc_dcc *ptr_dcc; - ptr_dcc = dcc_search (server, DCC_FILE_RECV, DCC_CONNECTING, port); + ptr_dcc = irc_dcc_search (server, DCC_FILE_RECV, DCC_CONNECTING, port); if (ptr_dcc) { ptr_dcc->pos = pos_start; ptr_dcc->ack = pos_start; ptr_dcc->start_resume = pos_start; ptr_dcc->last_check_pos = pos_start; - dcc_recv_connect_init (ptr_dcc); + irc_dcc_recv_connect_init (ptr_dcc); } else gui_printf (server->buffer, @@ -708,11 +710,11 @@ dcc_start_resume (t_irc_server *server, char *filename, int port, } /* - * dcc_alloc: allocate a new DCC file + * irc_dcc_alloc: allocate a new DCC file */ t_irc_dcc * -dcc_alloc () +irc_dcc_alloc () { t_irc_dcc *new_dcc; @@ -763,16 +765,16 @@ dcc_alloc () } /* - * dcc_add: add a DCC file to queue + * irc_dcc_add: add a DCC file to queue */ t_irc_dcc * -dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nick, - int sock, char *filename, char *local_filename, unsigned long size) +irc_dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nick, + int sock, char *filename, char *local_filename, unsigned long size) { t_irc_dcc *new_dcc; - new_dcc = dcc_alloc (); + new_dcc = irc_dcc_alloc (); if (!new_dcc) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -813,7 +815,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic if (local_filename) new_dcc->local_filename = strdup (local_filename); else - dcc_find_filename (new_dcc); + irc_dcc_find_filename (new_dcc); gui_current_window->dcc_first = NULL; gui_current_window->dcc_selected = NULL; @@ -840,7 +842,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic GUI_COLOR(COLOR_WIN_CHAT_CHANNEL), size, GUI_COLOR(COLOR_WIN_CHAT)); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } if (type == DCC_FILE_SEND) { @@ -860,7 +862,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic GUI_COLOR(COLOR_WIN_CHAT_CHANNEL), size, GUI_COLOR(COLOR_WIN_CHAT)); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } if (type == DCC_CHAT_RECV) { @@ -877,7 +879,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic (addr >> 8) & 0xff, addr & 0xff, GUI_COLOR(COLOR_WIN_CHAT_DARK)); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } if (type == DCC_CHAT_SEND) { @@ -886,13 +888,13 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic _("Sending DCC chat request to %s%s\n"), GUI_COLOR(COLOR_WIN_CHAT_NICK), nick); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } if (DCC_IS_FILE(type) && (!new_dcc->local_filename)) { - dcc_close (new_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (new_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return NULL; } @@ -910,36 +912,36 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic new_dcc->local_filename, GUI_COLOR(COLOR_WIN_CHAT), new_dcc->start_resume); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } /* connect if needed and redraw DCC buffer */ if (DCC_IS_SEND(type)) { - if (!dcc_connect (new_dcc)) + if (!irc_dcc_connect (new_dcc)) { - dcc_close (new_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (new_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return NULL; } } if ( ( (type == DCC_CHAT_RECV) && (cfg_dcc_auto_accept_chats) ) || ( (type == DCC_FILE_RECV) && (cfg_dcc_auto_accept_files) ) ) - dcc_accept (new_dcc); + irc_dcc_accept (new_dcc); else - dcc_redraw (HOTLIST_PRIVATE); + irc_dcc_redraw (HOTLIST_PRIVATE); gui_status_draw (gui_current_window->buffer, 0); return new_dcc; } /* - * dcc_send_request: send DCC request (file or chat) + * irc_dcc_send_request: send DCC request (file or chat) */ void -dcc_send_request (t_irc_server *server, int type, char *nick, char *filename) +irc_dcc_send_request (t_irc_server *server, int type, char *nick, char *filename) { char *dir1, *dir2, *filename2, *short_filename, *pos; int spaces, args, port_start, port_end; @@ -1069,7 +1071,7 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename) /* loop through the entire allowed port range */ while (port <= port_end) { - if (!dcc_port_in_use (port)) + if (!irc_dcc_port_in_use (port)) { /* attempt to bind to the free port */ addr.sin_port = htons (port); @@ -1138,11 +1140,11 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename) /* add DCC entry and listen to socket */ if (type == DCC_CHAT_SEND) - ptr_dcc = dcc_add (server, DCC_CHAT_SEND, local_addr, port, nick, sock, - NULL, NULL, 0); + ptr_dcc = irc_dcc_add (server, DCC_CHAT_SEND, local_addr, port, nick, sock, + NULL, NULL, 0); else - ptr_dcc = dcc_add (server, DCC_FILE_SEND, local_addr, port, nick, sock, - short_filename, filename2, st.st_size); + ptr_dcc = irc_dcc_add (server, DCC_FILE_SEND, local_addr, port, nick, sock, + short_filename, filename2, st.st_size); if (!ptr_dcc) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -1159,16 +1161,16 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename) /* send DCC request to nick */ if (type == DCC_CHAT_SEND) - server_sendf (server, - "PRIVMSG %s :\01DCC CHAT chat %lu %d\01", - nick, local_addr, port); + irc_server_sendf (server, + "PRIVMSG %s :\01DCC CHAT chat %lu %d\01", + nick, local_addr, port); else - server_sendf (server, - (spaces) ? + irc_server_sendf (server, + (spaces) ? "PRIVMSG %s :\01DCC SEND \"%s\" %lu %d %u\01\n" : "PRIVMSG %s :\01DCC SEND %s %lu %d %u\01", - nick, short_filename, local_addr, port, - (unsigned long) st.st_size); + nick, short_filename, local_addr, port, + (unsigned long) st.st_size); if (short_filename) free (short_filename); @@ -1177,11 +1179,11 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename) } /* - * dcc_chat_send: send data to remote host via DCC CHAT + * irc_dcc_chat_send: send data to remote host via DCC CHAT */ int -dcc_chat_send (t_irc_dcc *ptr_dcc, char *buffer, int size_buf) +irc_dcc_chat_send (t_irc_dcc *ptr_dcc, char *buffer, int size_buf) { if (!ptr_dcc) return -1; @@ -1190,11 +1192,11 @@ dcc_chat_send (t_irc_dcc *ptr_dcc, char *buffer, int size_buf) } /* - * dcc_chat_sendf: send formatted data to remote host via DCC CHAT + * irc_dcc_chat_sendf: send formatted data to remote host via DCC CHAT */ void -dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...) +irc_dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...) { va_list args; static char buffer[4096]; @@ -1218,23 +1220,23 @@ dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...) gui_printf (ptr_dcc->server->buffer, "[DEBUG] Sending to remote host (DCC CHAT) >>> %s\n", buffer); buffer[size_buf - 2] = '\r'; #endif - if (dcc_chat_send (ptr_dcc, buffer, strlen (buffer)) <= 0) + if (irc_dcc_chat_send (ptr_dcc, buffer, strlen (buffer)) <= 0) { irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer, PREFIX_ERROR); gui_printf (ptr_dcc->server->buffer, _("%s error sending data to \"%s\" via DCC CHAT\n"), WEECHAT_ERROR, ptr_dcc->nick); - dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_close (ptr_dcc, DCC_FAILED); } } /* - * dcc_chat_recv: receive data from DCC CHAT host + * irc_dcc_chat_recv: receive data from DCC CHAT host */ void -dcc_chat_recv (t_irc_dcc *ptr_dcc) +irc_dcc_chat_recv (t_irc_dcc *ptr_dcc) { fd_set read_fd; static struct timeval timeout; @@ -1307,7 +1309,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc) ptr_buf_color = (char *)gui_color_decode ((unsigned char *)ptr_buf, cfg_irc_colors_receive); - if (irc_is_highlight (ptr_buf, ptr_dcc->server->nick)) + if (irc_recv_is_highlight (ptr_buf, ptr_dcc->server->nick)) { irc_display_nick (ptr_dcc->channel->buffer, NULL, ptr_dcc->nick, MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT, 1, @@ -1341,18 +1343,18 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc) } else { - dcc_close (ptr_dcc, DCC_ABORTED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_ABORTED); + irc_dcc_redraw (HOTLIST_MSG); } } /* - * dcc_file_create_pipe: create pipe for communication with child process - * return 1 if ok, 0 if error + * irc_dcc_file_create_pipe: create pipe for communication with child process + * return 1 if ok, 0 if error */ int -dcc_file_create_pipe (t_irc_dcc *ptr_dcc) +irc_dcc_file_create_pipe (t_irc_dcc *ptr_dcc) { int child_pipe[2]; @@ -1363,8 +1365,8 @@ dcc_file_create_pipe (t_irc_dcc *ptr_dcc) gui_printf (ptr_dcc->server->buffer, _("%s DCC: unable to create pipe\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return 0; } @@ -1374,11 +1376,11 @@ dcc_file_create_pipe (t_irc_dcc *ptr_dcc) } /* - * dcc_file_write_pipe: write data into pipe + * irc_dcc_file_write_pipe: write data into pipe */ void -dcc_file_write_pipe (t_irc_dcc *ptr_dcc, int status, int error) +irc_dcc_file_write_pipe (t_irc_dcc *ptr_dcc, int status, int error) { char buffer[1 + 1 + 12 + 1]; /* status + error + pos + \0 */ @@ -1388,11 +1390,11 @@ dcc_file_write_pipe (t_irc_dcc *ptr_dcc, int status, int error) } /* - * dcc_file_send_child: child process for sending file + * irc_dcc_file_send_child: child process for sending file */ void -dcc_file_send_child (t_irc_dcc *ptr_dcc) +irc_dcc_file_send_child (t_irc_dcc *ptr_dcc) { int num_read, num_sent; static char buffer[DCC_MAX_BLOCKSIZE]; @@ -1412,7 +1414,7 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc) if ((num_read < 1) && ((num_read != -1) || (errno != EAGAIN))) { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_SEND_BLOCK); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_SEND_BLOCK); return; } if (num_read == 4) @@ -1424,7 +1426,7 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc) if ((ptr_dcc->pos >= ptr_dcc->size) && (ptr_dcc->ack >= ptr_dcc->size)) { - dcc_file_write_pipe (ptr_dcc, DCC_DONE, DCC_NO_ERROR); + irc_dcc_file_write_pipe (ptr_dcc, DCC_DONE, DCC_NO_ERROR); return; } } @@ -1441,7 +1443,7 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc) num_read = read (ptr_dcc->file, buffer, ptr_dcc->blocksize); if (num_read < 1) { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_READ_LOCAL); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_READ_LOCAL); return; } num_sent = send (ptr_dcc->sock, buffer, num_read, 0); @@ -1453,7 +1455,7 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc) usleep (1000); else { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_SEND_BLOCK); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_SEND_BLOCK); return; } } @@ -1464,7 +1466,7 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc) if (last_sent != new_time) { last_sent = new_time; - dcc_file_write_pipe (ptr_dcc, DCC_ACTIVE, DCC_NO_ERROR); + irc_dcc_file_write_pipe (ptr_dcc, DCC_ACTIVE, DCC_NO_ERROR); } } } @@ -1474,11 +1476,11 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc) } /* - * dcc_file_recv_child: child process for receiving file + * irc_dcc_file_recv_child: child process for receiving file */ void -dcc_file_recv_child (t_irc_dcc *ptr_dcc) +irc_dcc_file_recv_child (t_irc_dcc *ptr_dcc) { int num_read; static char buffer[DCC_MAX_BLOCKSIZE]; @@ -1486,14 +1488,14 @@ dcc_file_recv_child (t_irc_dcc *ptr_dcc) time_t last_sent, new_time; /* first connect to sender (blocking) */ - if (!dcc_connect_to_sender (ptr_dcc)) + if (!irc_dcc_connect_to_sender (ptr_dcc)) { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_CONNECT_SENDER); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_CONNECT_SENDER); return; } /* connection is ok, change DCC status (inform parent process) */ - dcc_file_write_pipe (ptr_dcc, DCC_ACTIVE, DCC_NO_ERROR); + irc_dcc_file_write_pipe (ptr_dcc, DCC_ACTIVE, DCC_NO_ERROR); last_sent = time (NULL); while (1) @@ -1506,7 +1508,7 @@ dcc_file_recv_child (t_irc_dcc *ptr_dcc) usleep (1000); else { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_RECV_BLOCK); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_RECV_BLOCK); return; } } @@ -1514,13 +1516,13 @@ dcc_file_recv_child (t_irc_dcc *ptr_dcc) { if (num_read == 0) { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_RECV_BLOCK); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_RECV_BLOCK); return; } if (write (ptr_dcc->file, buffer, num_read) == -1) { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_WRITE_LOCAL); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_WRITE_LOCAL); return; } @@ -1533,7 +1535,7 @@ dcc_file_recv_child (t_irc_dcc *ptr_dcc) /* file received ok? */ if (ptr_dcc->pos >= ptr_dcc->size) { - dcc_file_write_pipe (ptr_dcc, DCC_DONE, DCC_NO_ERROR); + irc_dcc_file_write_pipe (ptr_dcc, DCC_DONE, DCC_NO_ERROR); return; } @@ -1541,18 +1543,18 @@ dcc_file_recv_child (t_irc_dcc *ptr_dcc) if (last_sent != new_time) { last_sent = new_time; - dcc_file_write_pipe (ptr_dcc, DCC_ACTIVE, DCC_NO_ERROR); + irc_dcc_file_write_pipe (ptr_dcc, DCC_ACTIVE, DCC_NO_ERROR); } } } } /* - * dcc_file_child_read: read data from child via pipe + * irc_dcc_file_child_read: read data from child via pipe */ void -dcc_file_child_read (t_irc_dcc *ptr_dcc) +irc_dcc_file_child_read (t_irc_dcc *ptr_dcc) { fd_set read_fd; static struct timeval timeout; @@ -1579,7 +1581,7 @@ dcc_file_child_read (t_irc_dcc *ptr_dcc) error = NULL; ptr_dcc->pos = strtol (bufpipe + 2, &error, 10); ptr_dcc->last_activity = time (NULL); - dcc_calculate_speed (ptr_dcc, 0); + irc_dcc_calculate_speed (ptr_dcc, 0); /* read error code */ switch (bufpipe[1] - '0') @@ -1640,33 +1642,33 @@ dcc_file_child_read (t_irc_dcc *ptr_dcc) ptr_dcc->status = DCC_ACTIVE; ptr_dcc->start_transfer = time (NULL); ptr_dcc->last_check_time = time (NULL); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } else - dcc_redraw (HOTLIST_LOW); + irc_dcc_redraw (HOTLIST_LOW); break; case DCC_DONE: - dcc_close (ptr_dcc, DCC_DONE); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_DONE); + irc_dcc_redraw (HOTLIST_MSG); break; case DCC_FAILED: - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); break; } } } /* - * dcc_file_send_fork: fork process for sending file + * irc_dcc_file_send_fork: fork process for sending file */ void -dcc_file_send_fork (t_irc_dcc *ptr_dcc) +irc_dcc_file_send_fork (t_irc_dcc *ptr_dcc) { pid_t pid; - if (!dcc_file_create_pipe (ptr_dcc)) + if (!irc_dcc_file_create_pipe (ptr_dcc)) return; ptr_dcc->file = open (ptr_dcc->local_filename, O_RDONLY | O_NONBLOCK, 0644); @@ -1680,13 +1682,13 @@ dcc_file_send_fork (t_irc_dcc *ptr_dcc) gui_printf (ptr_dcc->server->buffer, _("%s DCC: unable to fork\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return; /* child process */ case 0: setuid (getuid ()); - dcc_file_send_child (ptr_dcc); + irc_dcc_file_send_child (ptr_dcc); _exit (EXIT_SUCCESS); } @@ -1695,15 +1697,15 @@ dcc_file_send_fork (t_irc_dcc *ptr_dcc) } /* - * dcc_file_recv_fork: fork process for receiving file + * irc_dcc_file_recv_fork: fork process for receiving file */ void -dcc_file_recv_fork (t_irc_dcc *ptr_dcc) +irc_dcc_file_recv_fork (t_irc_dcc *ptr_dcc) { pid_t pid; - if (!dcc_file_create_pipe (ptr_dcc)) + if (!irc_dcc_file_create_pipe (ptr_dcc)) return; if (ptr_dcc->start_resume > 0) @@ -1723,13 +1725,13 @@ dcc_file_recv_fork (t_irc_dcc *ptr_dcc) gui_printf (ptr_dcc->server->buffer, _("%s DCC: unable to fork\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return; /* child process */ case 0: setuid (getuid ()); - dcc_file_recv_child (ptr_dcc); + irc_dcc_file_recv_child (ptr_dcc); _exit (EXIT_SUCCESS); } @@ -1738,11 +1740,11 @@ dcc_file_recv_fork (t_irc_dcc *ptr_dcc) } /* - * dcc_handle: receive/send data for all active DCC + * irc_dcc_handle: receive/send data for all active DCC */ void -dcc_handle () +irc_dcc_handle () { t_irc_dcc *ptr_dcc; fd_set read_fd; @@ -1763,8 +1765,8 @@ dcc_handle () gui_printf (ptr_dcc->server->buffer, _("%s DCC: timeout\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); continue; } } @@ -1795,8 +1797,8 @@ dcc_handle () gui_printf (ptr_dcc->server->buffer, _("%s DCC: unable to create socket for sending file\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); continue; } ptr_dcc->sock = sock; @@ -1807,22 +1809,22 @@ dcc_handle () gui_printf (ptr_dcc->server->buffer, _("%s DCC: unable to set 'nonblock' option for socket\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); continue; } ptr_dcc->addr = ntohl (addr.sin_addr.s_addr); ptr_dcc->status = DCC_ACTIVE; ptr_dcc->start_transfer = time (NULL); - dcc_redraw (HOTLIST_MSG); - dcc_file_send_fork (ptr_dcc); + irc_dcc_redraw (HOTLIST_MSG); + irc_dcc_file_send_fork (ptr_dcc); } } } if (ptr_dcc->type == DCC_FILE_RECV) { if (ptr_dcc->child_read != -1) - dcc_file_child_read (ptr_dcc); + irc_dcc_file_child_read (ptr_dcc); } } @@ -1846,21 +1848,21 @@ dcc_handle () ptr_dcc->sock = -1; if (sock < 0) { - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); continue; } ptr_dcc->sock = sock; if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1) { - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); continue; } ptr_dcc->addr = ntohl (addr.sin_addr.s_addr); ptr_dcc->status = DCC_ACTIVE; - dcc_redraw (HOTLIST_MSG); - dcc_channel_for_chat (ptr_dcc); + irc_dcc_redraw (HOTLIST_MSG); + irc_dcc_channel_for_chat (ptr_dcc); } } } @@ -1869,19 +1871,19 @@ dcc_handle () if (ptr_dcc->status == DCC_ACTIVE) { if (DCC_IS_CHAT(ptr_dcc->type)) - dcc_chat_recv (ptr_dcc); + irc_dcc_chat_recv (ptr_dcc); else - dcc_file_child_read (ptr_dcc); + irc_dcc_file_child_read (ptr_dcc); } } } /* - * dcc_end: close all opened sockets (called when WeeChat is exiting) + * irc_dcc_end: close all opened sockets (called when WeeChat is exiting) */ void -dcc_end () +irc_dcc_end () { t_irc_dcc *ptr_dcc; @@ -1892,17 +1894,17 @@ dcc_end () if (ptr_dcc->status == DCC_ACTIVE) weechat_log_printf (_("Aborting active DCC: \"%s\" from %s\n"), ptr_dcc->filename, ptr_dcc->nick); - dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_close (ptr_dcc, DCC_FAILED); } } } /* - * dcc_print_log: print DCC infos in log (usually for crash dump) + * irc_dcc_print_log: print DCC infos in log (usually for crash dump) */ void -dcc_print_log () +irc_dcc_print_log () { t_irc_dcc *ptr_dcc; diff --git a/src/irc/irc-display.c b/src/irc/irc-display.c index bd20659e5..53f3e3ba5 100644 --- a/src/irc/irc-display.c +++ b/src/irc/irc-display.c @@ -37,49 +37,53 @@ /* - * irc_find_context: find window/buffer for a server/channel + * irc_display_hide_password: hide IRC password(s) in a string */ void -irc_find_context (t_irc_server *server, t_irc_channel *channel, - t_gui_window **window, t_gui_buffer **buffer) +irc_display_hide_password (char *string, int look_for_nickserv) { - t_gui_window *ptr_win; - - if (!buffer) - return; - - /* first find buffer */ - *buffer = NULL; - if (channel && channel->buffer) - *buffer = channel->buffer; - else - { - if (server && server->buffer) - *buffer = server->buffer; - else - *buffer = gui_current_window->buffer; - } - - /* then find first window displaying this buffer */ - if (window) + char *pos_nickserv, *pos, *pos_pwd; + + pos = string; + while (1) { - *window = NULL; - if (gui_current_window->buffer == *buffer) - *window = gui_current_window; + if (look_for_nickserv) + { + pos_nickserv = strstr (pos, "nickserv "); + if (!pos_nickserv) + return; + pos = pos_nickserv + 9; + while (pos[0] == ' ') + pos++; + if ((strncmp (pos, "identify ", 9) == 0) + || (strncmp (pos, "register ", 9) == 0)) + pos_pwd = pos + 9; + else + pos_pwd = NULL; + } else { - for (ptr_win = gui_windows; ptr_win; - ptr_win = ptr_win->next_window) + pos_pwd = strstr (pos, "identify "); + if (!pos_pwd) + pos_pwd = strstr (pos, "register "); + if (!pos_pwd) + return; + pos_pwd += 9; + } + + if (pos_pwd) + { + while (pos_pwd[0] == ' ') + pos_pwd++; + + while (pos_pwd[0] && (pos_pwd[0] != ';') && (pos_pwd[0] != ' ') + && (pos_pwd[0] != '"')) { - if (ptr_win->buffer == *buffer) - { - *window = ptr_win; - break; - } + pos_pwd[0] = '*'; + pos_pwd++; } - if (!*window) - *window = gui_current_window; + pos = pos_pwd; } } } @@ -429,7 +433,7 @@ irc_display_server (t_irc_server *server) if (string) { if (cfg_log_hide_nickserv_pwd) - irc_hide_password (string, 1); + irc_display_hide_password (string, 1); gui_printf (NULL, " server_command . . . . . . : %s\n", string); free (string); diff --git a/src/irc/irc-ignore.c b/src/irc/irc-ignore.c index 1de629786..66888d93a 100644 --- a/src/irc/irc-ignore.c +++ b/src/irc/irc-ignore.c @@ -42,12 +42,12 @@ t_irc_ignore *last_irc_ignore = NULL; /* - * ignore_check_mask: returns 1 is mask1 and mask2 are the same host - * anyone or both strings may have user and/or host after + * irc_ignore_check_mask: return 1 is mask1 and mask2 are the same host + * anyone or both strings may have user and/or host after */ int -ignore_check_mask (char *mask1, char *mask2) +irc_ignore_check_mask (char *mask1, char *mask2) { char *m1, *m2, *pos; int match; @@ -85,15 +85,16 @@ ignore_check_mask (char *mask1, char *mask2) } /* - * ignore_match: check if pointed ignore matches with arguments + * irc_ignore_match: check if pointed ignore matches with arguments */ int -ignore_match (t_irc_ignore *ptr_ignore, char *mask, char *type, char *channel_name, char *server_name) +irc_ignore_match (t_irc_ignore *ptr_ignore, char *mask, char *type, + char *channel_name, char *server_name) { /* check mask */ if ((strcmp (mask, "*") != 0) && (strcmp (ptr_ignore->mask, "*") != 0) - && (!ignore_check_mask (ptr_ignore->mask, mask))) + && (!irc_ignore_check_mask (ptr_ignore->mask, mask))) return 0; /* mask is matching, go on with type */ @@ -132,13 +133,13 @@ ignore_match (t_irc_ignore *ptr_ignore, char *mask, char *type, char *channel_na } /* - * ignore_check: check if an ignore is set for arguments - * returns 1 if at least one ignore exists (message should NOT be displayed) - * 0 if no ignore found (message will be displayed) + * irc_ignore_check: check if an ignore is set for arguments + * return 1 if at least one ignore exists (message should NOT be displayed) + * 0 if no ignore found (message will be displayed) */ int -ignore_check (char *mask, char *type, char *channel_name, char *server_name) +irc_ignore_check (char *mask, char *type, char *channel_name, char *server_name) { t_irc_ignore *ptr_ignore; @@ -148,7 +149,7 @@ ignore_check (char *mask, char *type, char *channel_name, char *server_name) for (ptr_ignore = irc_ignore; ptr_ignore; ptr_ignore = ptr_ignore->next_ignore) { - if (ignore_match (ptr_ignore, mask, type, channel_name, server_name)) + if (irc_ignore_match (ptr_ignore, mask, type, channel_name, server_name)) return 1; } @@ -157,11 +158,11 @@ ignore_check (char *mask, char *type, char *channel_name, char *server_name) } /* - * ignore_search: search for an ignore + * irc_ignore_search: search for an ignore */ t_irc_ignore * -ignore_search (char *mask, char *type, char *channel_name, char *server_name) +irc_ignore_search (char *mask, char *type, char *channel_name, char *server_name) { t_irc_ignore *ptr_ignore; @@ -180,11 +181,11 @@ ignore_search (char *mask, char *type, char *channel_name, char *server_name) } /* - * ignore_add: add an ignore in list + * irc_ignore_add: add an ignore in list */ t_irc_ignore * -ignore_add (char *mask, char *type, char *channel_name, char *server_name) +irc_ignore_add (char *mask, char *type, char *channel_name, char *server_name) { int type_index; t_irc_command *command_ptr; @@ -218,7 +219,7 @@ ignore_add (char *mask, char *type, char *channel_name, char *server_name) return NULL; } - if (ignore_search (mask, type, channel_name, server_name)) + if (irc_ignore_search (mask, type, channel_name, server_name)) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); gui_printf (NULL, @@ -258,12 +259,12 @@ ignore_add (char *mask, char *type, char *channel_name, char *server_name) } /* - * ignore_add_from_config: add an ignore to list, read from config file - * (comma serparated values) + * irc_ignore_add_from_config: add an ignore to list, read from config file + * (comma serparated values) */ t_irc_ignore * -ignore_add_from_config (char *string) +irc_ignore_add_from_config (char *string) { t_irc_ignore *new_ignore; char *string2; @@ -291,7 +292,7 @@ ignore_add_from_config (char *string) { pos_server[0] = '\0'; pos_server++; - new_ignore = ignore_add (pos_mask, pos_type, pos_channel, pos_server); + new_ignore = irc_ignore_add (pos_mask, pos_type, pos_channel, pos_server); } } } @@ -301,11 +302,11 @@ ignore_add_from_config (char *string) } /* - * ignore_free: free an ignore + * irc_ignore_free: free an ignore */ void -ignore_free (t_irc_ignore *ptr_ignore) +irc_ignore_free (t_irc_ignore *ptr_ignore) { t_irc_ignore *new_irc_ignore; @@ -338,24 +339,25 @@ ignore_free (t_irc_ignore *ptr_ignore) } /* - * ignore_free_all: free all ignores + * irc_ignore_free_all: free all ignores */ void -ignore_free_all () +irc_ignore_free_all () { while (irc_ignore) - ignore_free (irc_ignore); + irc_ignore_free (irc_ignore); } /* - * ignore_search_free: search and free ignore(s) - * return: number of ignore found and deleted - * 0 if no ignore found + * irc_ignore_search_free: search and free ignore(s) + * return: number of ignore found and deleted + * 0 if no ignore found */ int -ignore_search_free (char *mask, char *type, char *channel_name, char *server_name) +irc_ignore_search_free (char *mask, char *type, + char *channel_name, char *server_name) { int found; t_irc_ignore *ptr_ignore, *next_ignore; @@ -364,7 +366,7 @@ ignore_search_free (char *mask, char *type, char *channel_name, char *server_nam ptr_ignore = irc_ignore; while (ptr_ignore) { - if (ignore_match (ptr_ignore, mask, type, channel_name, server_name)) + if (irc_ignore_match (ptr_ignore, mask, type, channel_name, server_name)) { found++; if (found == 1) @@ -372,7 +374,7 @@ ignore_search_free (char *mask, char *type, char *channel_name, char *server_nam irc_display_prefix (NULL, NULL, PREFIX_INFO); weechat_cmd_ignore_display (_("Removing ignore:"), ptr_ignore); next_ignore = ptr_ignore->next_ignore; - ignore_free (ptr_ignore); + irc_ignore_free (ptr_ignore); ptr_ignore = next_ignore; } else @@ -383,13 +385,13 @@ ignore_search_free (char *mask, char *type, char *channel_name, char *server_nam } /* - * ignore_search_free_by_number: search and free ignore(s) by number - * return: 1 if ignore found and deleted - * 0 if ignore not found + * irc_ignore_search_free_by_number: search and free ignore(s) by number + * return: 1 if ignore found and deleted + * 0 if ignore not found */ int -ignore_search_free_by_number (int number) +irc_ignore_search_free_by_number (int number) { int i; t_irc_ignore *ptr_ignore; @@ -407,7 +409,7 @@ ignore_search_free_by_number (int number) gui_printf (NULL, "\n"); irc_display_prefix (NULL, NULL, PREFIX_INFO); weechat_cmd_ignore_display (_("Removing ignore:"), ptr_ignore); - ignore_free (ptr_ignore); + irc_ignore_free (ptr_ignore); return 1; } } @@ -417,11 +419,11 @@ ignore_search_free_by_number (int number) } /* - * ignore_print_log: print ignore list in log (usually for crash dump) + * irc_ignore_print_log: print ignore list in log (usually for crash dump) */ void -ignore_print_log () +irc_ignore_print_log () { t_irc_ignore *ptr_ignore; diff --git a/src/irc/irc-mode.c b/src/irc/irc-mode.c index 289619217..05e00460f 100644 --- a/src/irc/irc-mode.c +++ b/src/irc/irc-mode.c @@ -45,11 +45,11 @@ irc_mode_channel_set_nick (t_irc_channel *channel, char *nick, if (nick) { - ptr_nick = nick_search (channel, nick); + ptr_nick = irc_nick_search (channel, nick); if (ptr_nick) { NICK_SET_FLAG(ptr_nick, (set_flag == '+'), flag); - nick_resort (channel, ptr_nick); + irc_nick_resort (channel, ptr_nick); gui_nicklist_draw (channel->buffer, 1, 1); } } diff --git a/src/irc/irc-nick.c b/src/irc/irc-nick.c index a209157ea..5f1bfb118 100644 --- a/src/irc/irc-nick.c +++ b/src/irc/irc-nick.c @@ -37,11 +37,11 @@ /* - * nick_find_color: find a color for a nick (according to nick letters) + * irc_nick_find_color: find a color for a nick (according to nick letters) */ int -nick_find_color (t_irc_nick *nick) +irc_nick_find_color (t_irc_nick *nick) { int i, color; @@ -56,11 +56,11 @@ nick_find_color (t_irc_nick *nick) } /* - * nick_score_for_sort: return score for sorting nick, according to privileges + * irc_nick_score_for_sort: return score for sorting nick, according to privileges */ int -nick_score_for_sort (t_irc_nick *nick) +irc_nick_score_for_sort (t_irc_nick *nick) { if (nick->flags & NICK_CHANOWNER) return -64; @@ -78,20 +78,20 @@ nick_score_for_sort (t_irc_nick *nick) } /* - * nick_compare: compare two nicks - * return: -1 is nick1 < nick2 - * 0 if nick1 = nick2 - * +1 if nick1 > nick2 - * status sort: operator > voice > normal nick + * irc_nick_compare: compare two nicks + * return: -1 is nick1 < nick2 + * 0 if nick1 = nick2 + * +1 if nick1 > nick2 + * status sort: operator > voice > normal nick */ int -nick_compare (t_irc_nick *nick1, t_irc_nick *nick2) +irc_nick_compare (t_irc_nick *nick1, t_irc_nick *nick2) { int score1, score2, comp; - score1 = nick_score_for_sort (nick1); - score2 = nick_score_for_sort (nick2); + score1 = irc_nick_score_for_sort (nick1); + score2 = irc_nick_score_for_sort (nick2); comp = ascii_strcasecmp (nick1->nick, nick2->nick); if (comp > 0) @@ -110,34 +110,34 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2) } /* - * nick_find_pos: find position for a nick (for sorting nick list) + * irc_nick_find_pos: find position for a nick (for sorting nick list) */ t_irc_nick * -nick_find_pos (t_irc_channel *channel, t_irc_nick *nick) +irc_nick_find_pos (t_irc_channel *channel, t_irc_nick *nick) { t_irc_nick *ptr_nick; for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { - if (nick_compare (nick, ptr_nick) < 0) + if (irc_nick_compare (nick, ptr_nick) < 0) return ptr_nick; } return NULL; } /* - * nick_insert_sorted: insert nick into sorted list + * irc_nick_insert_sorted: insert nick into sorted list */ void -nick_insert_sorted (t_irc_channel *channel, t_irc_nick *nick) +irc_nick_insert_sorted (t_irc_channel *channel, t_irc_nick *nick) { t_irc_nick *pos_nick; if (channel->nicks) { - pos_nick = nick_find_pos (channel, nick); + pos_nick = irc_nick_find_pos (channel, nick); if (pos_nick) { @@ -169,11 +169,11 @@ nick_insert_sorted (t_irc_channel *channel, t_irc_nick *nick) } /* - * nick_resort: resort nick in the list + * irc_nick_resort: resort nick in the list */ void -nick_resort (t_irc_channel *channel, t_irc_nick *nick) +irc_nick_resort (t_irc_channel *channel, t_irc_nick *nick) { /* temporarly remove nick from list */ if (nick == channel->nicks) @@ -186,22 +186,22 @@ nick_resort (t_irc_channel *channel, t_irc_nick *nick) channel->last_nick = nick->prev_nick; /* insert again nick into sorted list */ - nick_insert_sorted (channel, nick); + irc_nick_insert_sorted (channel, nick); } /* - * nick_new: allocate a new nick for a channel and add it to the nick list + * irc_nick_new: allocate a new nick for a channel and add it to the nick list */ t_irc_nick * -nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name, - int is_chanowner, int is_chanadmin, int is_chanadmin2, int is_op, - int is_halfop, int has_voice) +irc_nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name, + int is_chanowner, int is_chanadmin, int is_chanadmin2, int is_op, + int is_halfop, int has_voice) { t_irc_nick *new_nick; /* nick already exists on this channel? */ - if ((new_nick = nick_search (channel, nick_name))) + if ((new_nick = irc_nick_search (channel, nick_name))) { /* update nick */ NICK_SET_FLAG(new_nick, is_chanowner, NICK_CHANOWNER); @@ -210,7 +210,7 @@ nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name, NICK_SET_FLAG(new_nick, is_op, NICK_OP); NICK_SET_FLAG(new_nick, is_halfop, NICK_HALFOP); NICK_SET_FLAG(new_nick, has_voice, NICK_VOICE); - nick_resort (channel, new_nick); + irc_nick_resort (channel, new_nick); return new_nick; } @@ -231,9 +231,9 @@ nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name, if (ascii_strcasecmp (new_nick->nick, server->nick) == 0) new_nick->color = COLOR_WIN_NICK_SELF; else - new_nick->color = nick_find_color (new_nick); + new_nick->color = irc_nick_find_color (new_nick); - nick_insert_sorted (channel, new_nick); + irc_nick_insert_sorted (channel, new_nick); channel->nicks_count++; @@ -244,11 +244,11 @@ nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name, } /* - * nick_change: change nickname and move it if necessary (list is sorted) + * irc_nick_change: change nickname and move it if necessary (list is sorted) */ void -nick_change (t_irc_channel *channel, t_irc_nick *nick, char *new_nick) +irc_nick_change (t_irc_channel *channel, t_irc_nick *nick, char *new_nick) { int nick_is_me; @@ -261,18 +261,18 @@ nick_change (t_irc_channel *channel, t_irc_nick *nick, char *new_nick) if (nick_is_me) nick->color = COLOR_WIN_NICK_SELF; else - nick->color = nick_find_color (nick); + nick->color = irc_nick_find_color (nick); /* insert again nick into sorted list */ - nick_resort (channel, nick); + irc_nick_resort (channel, nick); } /* - * nick_free: free a nick and remove it from nicks queue + * irc_nick_free: free a nick and remove it from nicks queue */ void -nick_free (t_irc_channel *channel, t_irc_nick *nick) +irc_nick_free (t_irc_channel *channel, t_irc_nick *nick) { t_irc_nick *new_nicks; @@ -307,29 +307,29 @@ nick_free (t_irc_channel *channel, t_irc_nick *nick) } /* - * nick_free_all: free all allocated nicks for a channel + * irc_nick_free_all: free all allocated nicks for a channel */ void -nick_free_all (t_irc_channel *channel) +irc_nick_free_all (t_irc_channel *channel) { if (!channel) return; /* remove all nicks for the channel */ while (channel->nicks) - nick_free (channel, channel->nicks); + irc_nick_free (channel, channel->nicks); /* sould be zero, but prevent any bug :D */ channel->nicks_count = 0; } /* - * nick_search: returns pointer on a nick + * irc_nick_search: returns pointer on a nick */ t_irc_nick * -nick_search (t_irc_channel *channel, char *nickname) +irc_nick_search (t_irc_channel *channel, char *nickname) { t_irc_nick *ptr_nick; @@ -346,12 +346,12 @@ nick_search (t_irc_channel *channel, char *nickname) } /* - * nick_count: returns number of nicks (total, op, halfop, voice) on a channel + * irc_nick_count: returns number of nicks (total, op, halfop, voice) on a channel */ void -nick_count (t_irc_channel *channel, int *total, int *count_op, - int *count_halfop, int *count_voice, int *count_normal) +irc_nick_count (t_irc_channel *channel, int *total, int *count_op, + int *count_halfop, int *count_voice, int *count_normal) { t_irc_nick *ptr_nick; @@ -385,11 +385,11 @@ nick_count (t_irc_channel *channel, int *total, int *count_op, } /* - * nick_get_max_length: returns longer nickname on a channel + * irc_nick_get_max_length: returns longer nickname on a channel */ int -nick_get_max_length (t_irc_channel *channel) +irc_nick_get_max_length (t_irc_channel *channel) { int length, max_length; t_irc_nick *ptr_nick; @@ -405,11 +405,11 @@ nick_get_max_length (t_irc_channel *channel) } /* - * nick_set_away: set/unset away status for a channel + * irc_nick_set_away: set/unset away status for a channel */ void -nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away) +irc_nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away) { if ((cfg_irc_away_check > 0) && ((cfg_irc_away_check_max_nicks == 0) || @@ -425,11 +425,11 @@ nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away) } /* - * nick_print_log: print nick infos in log (usually for crash dump) + * irc_nick_print_log: print nick infos in log (usually for crash dump) */ void -nick_print_log (t_irc_nick *nick) +irc_nick_print_log (t_irc_nick *nick) { weechat_log_printf ("=> nick %s (addr:0x%X)]\n", nick->nick, nick); weechat_log_printf (" host . . . . . : %s\n", nick->host); diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c index 6c564753d..be95d2236 100644 --- a/src/irc/irc-recv.c +++ b/src/irc/irc-recv.c @@ -54,11 +54,11 @@ int command_ignored, command_force_highlight; /* - * irc_is_word_char: return 1 if given character is a "word character" + * irc_recv_is_word_char: return 1 if given character is a "word character" */ int -irc_is_word_char (char c) +irc_recv_is_word_char (char c) { if (isalnum (c)) return 1; @@ -76,11 +76,11 @@ irc_is_word_char (char c) } /* - * irc_is_numeric: return 1 if given string is 100% numeric + * irc_recv_command_is_numeric: return 1 if given string is 100% numeric */ int -irc_is_numeric (char *str) +irc_recv_command_is_numeric (char *str) { while (str && str[0]) { @@ -92,12 +92,12 @@ irc_is_numeric (char *str) } /* - * irc_is_highlight: returns 1 if given message contains highlight (with given nick - * or at least one of string in "irc_higlight" setting) + * irc_recv_is_highlight: return 1 if given message contains highlight (with given nick + * or at least one of string in "irc_higlight" setting) */ int -irc_is_highlight (char *message, char *nick) +irc_recv_is_highlight (char *message, char *nick) { char *msg, *highlight, *match, *match_pre, *match_post, *msg_pos, *pos, *pos_end; int end, length, startswith, endswith, wildcard_start, wildcard_end; @@ -116,8 +116,8 @@ irc_is_highlight (char *message, char *nick) { match_pre = match - 1; match_post = match + strlen(nick); - startswith = ((match == message) || (!irc_is_word_char (match_pre[0]))); - endswith = ((!match_post[0]) || (!irc_is_word_char (match_post[0]))); + startswith = ((match == message) || (!irc_recv_is_word_char (match_pre[0]))); + endswith = ((!match_post[0]) || (!irc_recv_is_word_char (match_post[0]))); if (startswith && endswith) return 1; } @@ -190,8 +190,8 @@ irc_is_highlight (char *message, char *nick) { match_pre = match - 1; match_post = match + length; - startswith = ((match == msg) || (!irc_is_word_char (match_pre[0]))); - endswith = ((!match_post[0]) || (!irc_is_word_char (match_post[0]))); + startswith = ((match == msg) || (!irc_recv_is_word_char (match_pre[0]))); + endswith = ((!match_post[0]) || (!irc_recv_is_word_char (match_post[0]))); if ((wildcard_start && wildcard_end) || (!wildcard_start && !wildcard_end && startswith && endswith) || @@ -252,10 +252,10 @@ irc_recv_command (t_irc_server *server, char *entire_line, if (cmd_found < 0) { /* for numeric commands, we use default recv function (irc_recv_server_msg) */ - if (irc_is_numeric (command)) + if (irc_recv_command_is_numeric (command)) { cmd_name = command; - cmd_recv_func = irc_cmd_recv_server_msg; + cmd_recv_func = irc_recv_cmd_server_msg; } else return -3; @@ -272,10 +272,10 @@ irc_recv_command (t_irc_server *server, char *entire_line, dup_host = (host) ? strdup (host) : NULL; dup_arguments = (arguments) ? strdup (arguments) : NULL; - command_ignored = ignore_check (dup_host, - cmd_name, - NULL, - server->name); + command_ignored = irc_ignore_check (dup_host, + cmd_name, + NULL, + server->name); command_force_highlight = 0; #ifdef PLUGINS return_code = plugin_msg_handler_exec (server->name, @@ -320,11 +320,11 @@ irc_recv_command (t_irc_server *server, char *entire_line, } /* - * irc_cmd_recv_error: error received from server + * irc_recv_cmd_error: error received from server */ int -irc_cmd_recv_error (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_error (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; int first; @@ -353,7 +353,7 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *nick, char *argument (first) ? "" : ": ", arguments); if (strncmp (arguments, "Closing Link", 12) == 0) - server_disconnect (server, 1); + irc_server_disconnect (server, 1); arguments = NULL; } else @@ -365,7 +365,7 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *nick, char *argument { if (first) { - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) ptr_buffer = ptr_channel->buffer; irc_display_prefix (server, ptr_buffer, PREFIX_ERROR); @@ -387,11 +387,11 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *nick, char *argument } /* - * irc_cmd_recv_invite: 'invite' message received + * irc_recv_cmd_invite: 'invite' message received */ int -irc_cmd_recv_invite (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_invite (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel; @@ -405,7 +405,7 @@ irc_cmd_recv_invite (t_irc_server *server, char *host, char *nick, char *argumen if (pos_channel[0] == ':') pos_channel++; - command_ignored |= ignore_check (host, "invite", pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "invite", pos_channel, server->name); if (!command_ignored) { @@ -437,11 +437,11 @@ irc_cmd_recv_invite (t_irc_server *server, char *host, char *nick, char *argumen /* - * irc_cmd_recv_join: 'join' message received + * irc_recv_cmd_join: 'join' message received */ int -irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_join (t_irc_server *server, char *host, char *nick, char *arguments) { t_irc_channel *ptr_channel; t_irc_nick *ptr_nick; @@ -450,12 +450,12 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments if (arguments[0] == ':') arguments++; - command_ignored |= ignore_check (host, "join", arguments, server->name); + command_ignored |= irc_ignore_check (host, "join", arguments, server->name); - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (!ptr_channel) { - ptr_channel = channel_new (server, CHANNEL_TYPE_CHANNEL, arguments); + ptr_channel = irc_channel_new (server, CHANNEL_TYPE_CHANNEL, arguments); if (!ptr_channel) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -498,7 +498,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments } /* add nick in channel */ - ptr_nick = nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0, 0); + ptr_nick = irc_nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0, 0); if (ptr_nick) ptr_nick->host = strdup ((pos) ? pos + 1 : host); @@ -509,11 +509,11 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_kick: 'kick' message received + * irc_recv_cmd_kick: 'kick' message received */ int -irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_kick (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_comment; t_irc_channel *ptr_channel; @@ -538,9 +538,9 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments pos_comment++; } - command_ignored |= ignore_check (host, "kick", arguments, server->name); + command_ignored |= irc_ignore_check (host, "kick", arguments, server->name); - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (!ptr_channel) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -583,18 +583,18 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments if (strcmp (pos_nick, server->nick) == 0) { /* my nick was kicked => free all nicks, channel is not active any more */ - nick_free_all (ptr_channel); + irc_nick_free_all (ptr_channel); gui_nicklist_draw (ptr_channel->buffer, 1, 1); gui_status_draw (ptr_channel->buffer, 1); if (server->autorejoin) - irc_cmd_send_join (server, NULL, ptr_channel->name); + irc_send_cmd_join (server, NULL, ptr_channel->name); } { /* someone was kicked from channel (but not me) => remove only this nick */ - ptr_nick = nick_search (ptr_channel, pos_nick); + ptr_nick = irc_nick_search (ptr_channel, pos_nick); if (ptr_nick) { - nick_free (ptr_channel, ptr_nick); + irc_nick_free (ptr_channel, ptr_nick); gui_nicklist_draw (ptr_channel->buffer, 1, 1); gui_status_draw (ptr_channel->buffer, 1); } @@ -603,11 +603,11 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_kill: 'kill' message received + * irc_recv_cmd_kill: 'kill' message received */ int -irc_cmd_recv_kill (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_kill (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_host2, *pos_comment; t_irc_channel *ptr_channel; @@ -640,7 +640,7 @@ irc_cmd_recv_kill (t_irc_server *server, char *host, char *nick, char *arguments ptr_channel = ptr_channel->next_channel) { if (!command_ignored - && !ignore_check (host, "kill", ptr_channel->name, server->name)) + && !irc_ignore_check (host, "kill", ptr_channel->name, server->name)) { irc_display_prefix (server, ptr_channel->buffer, PREFIX_PART); gui_printf (ptr_channel->buffer, _("%s%s%s has killed %s%s%s from server"), @@ -673,11 +673,11 @@ irc_cmd_recv_kill (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_mode: 'mode' message received + * irc_recv_cmd_mode: 'mode' message received */ int -irc_cmd_recv_mode (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_mode (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_modes, *pos; t_irc_channel *ptr_channel; @@ -716,13 +716,13 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *nick, char *arguments pos--; } - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) { - command_ignored |= ignore_check (host, "mode", - ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "mode", + ptr_channel->name, server->name); if (!command_ignored) { irc_display_prefix (server, ptr_channel->buffer, PREFIX_INFO); @@ -739,7 +739,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *nick, char *arguments nick); } irc_mode_channel_set (ptr_channel, pos_modes); - server_sendf (server, "MODE %s", ptr_channel->name); + irc_server_sendf (server, "MODE %s", ptr_channel->name); } else { @@ -771,11 +771,11 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_nick: 'nick' message received + * irc_recv_cmd_nick: 'nick' message received */ int -irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_nick (t_irc_server *server, char *host, char *nick, char *arguments) { t_irc_channel *ptr_channel; t_irc_nick *ptr_nick; @@ -805,7 +805,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments if ((CHANNEL(ptr_buffer)->name) && (ascii_strcasecmp (nick, CHANNEL(ptr_buffer)->name) == 0)) { - ptr_channel = channel_search_any (server, arguments); + ptr_channel = irc_channel_search_any (server, arguments); if (!ptr_channel) { free (CHANNEL(ptr_buffer)->name); @@ -818,15 +818,15 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { - ptr_nick = nick_search (ptr_channel, nick); + ptr_nick = irc_nick_search (ptr_channel, nick); if (ptr_nick) { nick_is_me = (strcmp (ptr_nick->nick, server->nick) == 0) ? 1 : 0; if (nick_is_me) gui_add_hotlist = 0; - nick_change (ptr_channel, ptr_nick, arguments); + irc_nick_change (ptr_channel, ptr_nick, arguments); if (!command_ignored - && !ignore_check (host, "nick", ptr_channel->name, server->name)) + && !irc_ignore_check (host, "nick", ptr_channel->name, server->name)) { irc_display_prefix (server, ptr_channel->buffer, PREFIX_INFO); if (nick_is_me) @@ -867,11 +867,11 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_notice: 'notice' message received + * irc_recv_cmd_notice: 'notice' message received */ int -irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_notice (t_irc_server *server, char *host, char *nick, char *arguments) { char *host2, *pos, *pos2, *pos_usec; struct timeval tv; @@ -964,10 +964,10 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen { if (nick && nick[0] && cfg_irc_notice_as_pv) { - ptr_channel = channel_search (server, nick); + ptr_channel = irc_channel_search (server, nick); if (!ptr_channel) { - ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, nick); + ptr_channel = irc_channel_new (server, CHANNEL_TYPE_PRIVATE, nick); if (!ptr_channel) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -988,7 +988,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK, "%s<", GUI_COLOR(COLOR_WIN_CHAT_DARK)); - if (irc_is_highlight (pos, server->nick)) + if (irc_recv_is_highlight (pos, server->nick)) { gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT, @@ -1063,11 +1063,11 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen } /* - * irc_cmd_recv_part: 'part' message received + * irc_recv_cmd_part: 'part' message received */ int -irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_part (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos_args, *join_string; int join_length; @@ -1095,11 +1095,11 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments pos_args++; } - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) { - command_ignored |= ignore_check (host, "part", ptr_channel->name, server->name); - ptr_nick = nick_search (ptr_channel, nick); + command_ignored |= irc_ignore_check (host, "part", ptr_channel->name, server->name); + ptr_nick = irc_nick_search (ptr_channel, nick); if (ptr_nick) { /* display part message */ @@ -1130,7 +1130,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments /* part request was issued by local client ? */ if (strcmp (ptr_nick->nick, server->nick) == 0) { - nick_free_all (ptr_channel); + irc_nick_free_all (ptr_channel); /* cycling ? => rejoin channel immediately */ if (ptr_channel->cycle) @@ -1146,24 +1146,24 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments snprintf (join_string, join_length, "%s %s", ptr_channel->name, ptr_channel->key); - irc_cmd_send_join(server, ptr_channel, join_string); + irc_send_cmd_join(server, ptr_channel, join_string); free (join_string); } else - irc_cmd_send_join(server, ptr_channel, ptr_channel->name); + irc_send_cmd_join(server, ptr_channel, ptr_channel->name); } else - irc_cmd_send_join(server, ptr_channel, ptr_channel->name); + irc_send_cmd_join(server, ptr_channel, ptr_channel->name); } if (ptr_channel->close) { gui_buffer_free (ptr_channel->buffer, 1); - channel_free (server, ptr_channel); + irc_channel_free (server, ptr_channel); ptr_channel = NULL; } } else - nick_free (ptr_channel, ptr_nick); + irc_nick_free (ptr_channel, ptr_nick); if (ptr_channel) { @@ -1186,11 +1186,11 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_ping: 'ping' command received + * irc_recv_cmd_ping: 'ping' command received */ int -irc_cmd_recv_ping (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_ping (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; @@ -1205,17 +1205,17 @@ irc_cmd_recv_ping (t_irc_server *server, char *host, char *nick, char *arguments if (pos) pos[0] = '\0'; - server_sendf (server, "PONG :%s", arguments); + irc_server_sendf (server, "PONG :%s", arguments); return 0; } /* - * irc_cmd_recv_pong: 'pong' command received + * irc_recv_cmd_pong: 'pong' command received */ int -irc_cmd_recv_pong (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_pong (t_irc_server *server, char *host, char *nick, char *arguments) { struct timeval tv; int old_lag; @@ -1256,7 +1256,7 @@ irc_cmd_reply_version (t_irc_server *server, t_irc_channel *channel, ptr_buffer = (channel) ? channel->buffer : server->buffer; - command_ignored |= ignore_check (host, "ctcp", NULL, server->name); + command_ignored |= irc_ignore_check (host, "ctcp", NULL, server->name); if (!command_ignored) { pos = strchr (message, ' '); @@ -1273,21 +1273,21 @@ irc_cmd_reply_version (t_irc_server *server, t_irc_channel *channel, buf = (struct utsname *) malloc (sizeof (struct utsname)); if (buf && (uname (buf) >= 0)) { - server_sendf (server, - "NOTICE %s :%sVERSION %s v%s" - " compiled on %s, running " - "%s %s / %s%s", - nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__, - &buf->sysname, - &buf->release, &buf->machine, "\01"); + irc_server_sendf (server, + "NOTICE %s :%sVERSION %s v%s" + " compiled on %s, running " + "%s %s / %s%s", + nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__, + &buf->sysname, + &buf->release, &buf->machine, "\01"); free (buf); } else - server_sendf (server, - "NOTICE %s :%sVERSION %s v%s" - " compiled on %s%s", - nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__, - "\01"); + irc_server_sendf (server, + "NOTICE %s :%sVERSION %s v%s" + " compiled on %s%s", + nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__, + "\01"); irc_display_prefix (server, ptr_buffer, PREFIX_SERVER); gui_printf (ptr_buffer, _("CTCP %sVERSION%s received from %s%s"), @@ -1310,11 +1310,11 @@ irc_cmd_reply_version (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_recv_privmsg: 'privmsg' command received + * irc_recv_cmd_privmsg: 'privmsg' command received */ int -irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_privmsg (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2, *host2; char *pos_file, *pos_addr, *pos_port, *pos_size, *pos_start_resume; /* for DCC */ @@ -1339,7 +1339,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume host2 = host; /* receiver is a channel ? */ - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { pos = strchr (arguments, ' '); if (pos) @@ -1351,12 +1351,12 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume if (pos[0] == ':') pos++; - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) { if (strncmp (pos, "\01ACTION ", 8) == 0) { - command_ignored |= ignore_check (host, "action", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "action", ptr_channel->name, server->name); pos += 8; pos2 = strchr (pos, '\01'); if (pos2) @@ -1364,7 +1364,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume if (!command_ignored) { irc_display_prefix (server, ptr_channel->buffer, PREFIX_ACTION_ME); - if (irc_is_highlight (pos, server->nick)) + if (irc_recv_is_highlight (pos, server->nick)) { gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG | MSG_TYPE_HIGHLIGHT, @@ -1395,13 +1395,13 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume gui_printf (ptr_channel->buffer, " %s%s\n", GUI_COLOR(COLOR_WIN_CHAT), pos); } - channel_add_nick_speaking (ptr_channel, nick); + irc_channel_add_nick_speaking (ptr_channel, nick); } return 0; } if (strncmp (pos, "\01SOUND ", 7) == 0) { - command_ignored |= ignore_check (host, "ctcp", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "ctcp", ptr_channel->name, server->name); pos += 7; pos2 = strchr (pos, '\01'); if (pos2) @@ -1421,7 +1421,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } if (strncmp (pos, "\01PING", 5) == 0) { - command_ignored |= ignore_check (host, "ctcp", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "ctcp", ptr_channel->name, server->name); pos += 5; while (pos[0] == ' ') pos++; @@ -1433,11 +1433,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume if (pos && !pos[0]) pos = NULL; if (pos) - server_sendf (server, "NOTICE %s :\01PING %s\01", - nick, pos); + irc_server_sendf (server, "NOTICE %s :\01PING %s\01", + nick, pos); else - server_sendf (server, "NOTICE %s :\01PING\01", - nick); + irc_server_sendf (server, "NOTICE %s :\01PING\01", + nick); irc_display_prefix (server, ptr_channel->buffer, PREFIX_SERVER); gui_printf (ptr_channel->buffer, _("CTCP %sPING%s received from %s%s\n"), @@ -1457,7 +1457,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume pos2 = strchr (pos + 1, '\01'); if ((pos[0] == '\01') && pos2 && (pos2[1] == '\0')) { - command_ignored |= ignore_check (host, "ctcp", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "ctcp", ptr_channel->name, server->name); pos++; pos2[0] = '\0'; pos2 = strchr (pos, ' '); @@ -1491,11 +1491,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } /* other message */ - command_ignored |= ignore_check (host, "privmsg", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "privmsg", ptr_channel->name, server->name); if (!command_ignored) { - ptr_nick = nick_search (ptr_channel, nick); - if (irc_is_highlight (pos, server->nick)) + ptr_nick = irc_nick_search (ptr_channel, nick); + if (irc_recv_is_highlight (pos, server->nick)) { irc_display_nick (ptr_channel->buffer, ptr_nick, (ptr_nick) ? NULL : nick, @@ -1524,7 +1524,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG, "%s\n", pos); } - channel_add_nick_speaking (ptr_channel, nick); + irc_channel_add_nick_speaking (ptr_channel, nick); } } else @@ -1559,7 +1559,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume /* ping request from another user => answer */ if (strncmp (pos, "\01PING", 5) == 0) { - command_ignored |= ignore_check (host, "ctcp", NULL, server->name); + command_ignored |= irc_ignore_check (host, "ctcp", NULL, server->name); if (!command_ignored) { pos += 5; @@ -1573,11 +1573,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume if (pos && !pos[0]) pos = NULL; if (pos) - server_sendf (server, "NOTICE %s :\01PING %s\01", - nick, pos); + irc_server_sendf (server, "NOTICE %s :\01PING %s\01", + nick, pos); else - server_sendf (server, "NOTICE %s :\01PING\01", - nick); + irc_server_sendf (server, "NOTICE %s :\01PING\01", + nick); irc_display_prefix (server, server->buffer, PREFIX_SERVER); gui_printf (server->buffer, _("CTCP %sPING%s received from %s%s\n"), @@ -1609,7 +1609,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } pos2[0] = '\0'; - command_ignored |= ignore_check (host, "dcc", NULL, server->name); + command_ignored |= irc_ignore_check (host, "dcc", NULL, server->name); if (!command_ignored) { @@ -1666,9 +1666,9 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume pos2--; pos2[1] = '\0'; - dcc_add (server, DCC_FILE_RECV, strtoul (pos_addr, NULL, 10), - atoi (pos_port), nick, -1, pos_file, NULL, - strtoul (pos_size, NULL, 10)); + irc_dcc_add (server, DCC_FILE_RECV, strtoul (pos_addr, NULL, 10), + atoi (pos_port), nick, -1, pos_file, NULL, + strtoul (pos_size, NULL, 10)); #ifdef PLUGINS (void) plugin_msg_handler_exec (server->name, "weechat_dcc", @@ -1693,7 +1693,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } pos2[0] = '\0'; - command_ignored |= ignore_check (host, "dcc", NULL, server->name); + command_ignored |= irc_ignore_check (host, "dcc", NULL, server->name); if (!command_ignored) { @@ -1734,8 +1734,8 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume pos2--; pos2[1] = '\0'; - dcc_accept_resume (server, pos_file, atoi (pos_port), - strtoul (pos_start_resume, NULL, 10)); + irc_dcc_accept_resume (server, pos_file, atoi (pos_port), + strtoul (pos_start_resume, NULL, 10)); #ifdef PLUGINS (void) plugin_msg_handler_exec (server->name, "weechat_dcc", @@ -1760,7 +1760,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } pos2[0] = '\0'; - command_ignored |= ignore_check (host, "dcc", NULL, server->name); + command_ignored |= irc_ignore_check (host, "dcc", NULL, server->name); if (!command_ignored) { @@ -1801,8 +1801,8 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume pos2--; pos2[1] = '\0'; - dcc_start_resume (server, pos_file, atoi (pos_port), - strtoul (pos_start_resume, NULL, 10)); + irc_dcc_start_resume (server, pos_file, atoi (pos_port), + strtoul (pos_start_resume, NULL, 10)); #ifdef PLUGINS (void) plugin_msg_handler_exec (server->name, "weechat_dcc", @@ -1827,7 +1827,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } pos2[0] = '\0'; - command_ignored |= ignore_check (host, "dcc", NULL, server->name); + command_ignored |= irc_ignore_check (host, "dcc", NULL, server->name); if (!command_ignored) { @@ -1880,8 +1880,8 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume return -1; } - dcc_add (server, DCC_CHAT_RECV, strtoul (pos_addr, NULL, 10), - atoi (pos_port), nick, -1, NULL, NULL, 0); + irc_dcc_add (server, DCC_CHAT_RECV, strtoul (pos_addr, NULL, 10), + atoi (pos_port), nick, -1, NULL, NULL, 0); #ifdef PLUGINS (void) plugin_msg_handler_exec (server->name, "weechat_dcc", @@ -1892,18 +1892,18 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } /* private message received => display it */ - ptr_channel = channel_search (server, nick); + ptr_channel = irc_channel_search (server, nick); if (strncmp (pos, "\01ACTION ", 8) == 0) { - command_ignored |= ignore_check (host, "action", NULL, server->name); - command_ignored |= ignore_check (host, "pv", NULL, server->name); + command_ignored |= irc_ignore_check (host, "action", NULL, server->name); + command_ignored |= irc_ignore_check (host, "pv", NULL, server->name); if (!command_ignored) { if (!ptr_channel) { - ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, nick); + ptr_channel = irc_channel_new (server, CHANNEL_TYPE_PRIVATE, nick); if (!ptr_channel) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -1926,7 +1926,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume if (pos2) pos2[0] = '\0'; irc_display_prefix (server, ptr_channel->buffer, PREFIX_ACTION_ME); - if (irc_is_highlight (pos, server->nick)) + if (irc_recv_is_highlight (pos, server->nick)) { gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG | MSG_TYPE_HIGHLIGHT, @@ -1970,7 +1970,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume pos2 = strchr (pos + 1, '\01'); if ((pos[0] == '\01') && pos2 && (pos2[1] == '\0')) { - command_ignored |= ignore_check (host, "ctcp", NULL, server->name); + command_ignored |= irc_ignore_check (host, "ctcp", NULL, server->name); if (!command_ignored) { @@ -2010,13 +2010,13 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } else { - command_ignored |= ignore_check (host, "pv", NULL, server->name); + command_ignored |= irc_ignore_check (host, "pv", NULL, server->name); if (!command_ignored) { if (!ptr_channel) { - ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, nick); + ptr_channel = irc_channel_new (server, CHANNEL_TYPE_PRIVATE, nick); if (!ptr_channel) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -2034,7 +2034,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume gui_chat_draw_title (ptr_channel->buffer, 1); } - if (irc_is_highlight (pos, server->nick)) + if (irc_recv_is_highlight (pos, server->nick)) { irc_display_nick (ptr_channel->buffer, NULL, nick, MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT, 1, @@ -2083,11 +2083,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } /* - * irc_cmd_recv_quit: 'quit' command received + * irc_recv_cmd_quit: 'quit' command received */ int -irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_quit (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; t_irc_channel *ptr_channel; @@ -2113,14 +2113,14 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments || (ptr_channel->type == CHANNEL_TYPE_DCC_CHAT)) ptr_nick = NULL; else - ptr_nick = nick_search (ptr_channel, nick); + ptr_nick = irc_nick_search (ptr_channel, nick); if (ptr_nick || (strcmp (ptr_channel->name, nick) == 0)) { if (ptr_nick) - nick_free (ptr_channel, ptr_nick); + irc_nick_free (ptr_channel, ptr_nick); if (!command_ignored - && !ignore_check (host, "quit", ptr_channel->name, server->name)) + && !irc_ignore_check (host, "quit", ptr_channel->name, server->name)) { pos = strchr (host, '!'); irc_display_prefix (server, ptr_channel->buffer, PREFIX_QUIT); @@ -2149,12 +2149,12 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_server_mode_reason: command received from server (numeric), + * irc_recv_cmd_server_mode_reason: command received from server (numeric), * format: "mode :reason" */ int -irc_cmd_recv_server_mode_reason (t_irc_server *server, char *host, +irc_recv_cmd_server_mode_reason (t_irc_server *server, char *host, char *nick, char *arguments) { char *ptr_msg; @@ -2193,11 +2193,11 @@ irc_cmd_recv_server_mode_reason (t_irc_server *server, char *host, } /* - * irc_cmd_recv_server_msg: command received from server (numeric) + * irc_recv_cmd_server_msg: command received from server (numeric) */ int -irc_cmd_recv_server_msg (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_server_msg (t_irc_server *server, char *host, char *nick, char *arguments) { /* make C compiler happy */ (void) host; @@ -2227,11 +2227,11 @@ irc_cmd_recv_server_msg (t_irc_server *server, char *host, char *nick, char *arg } /* - * irc_cmd_recv_server_reply: server reply + * irc_recv_cmd_server_reply: server reply */ int -irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_server_reply (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; int first; @@ -2286,17 +2286,17 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *nick, char *a } /* - * irc_cmd_recv_topic: 'topic' command received + * irc_recv_cmd_topic: 'topic' command received */ int -irc_cmd_recv_topic (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_topic (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; t_irc_channel *ptr_channel; t_gui_buffer *buffer; - if (!string_is_channel (arguments)) + if (!irc_channel_is_channel (arguments)) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); gui_printf_nolog (server->buffer, @@ -2318,9 +2318,9 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *nick, char *argument pos = NULL; } - command_ignored |= ignore_check (host, "topic", arguments, server->name); + command_ignored |= irc_ignore_check (host, "topic", arguments, server->name); - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; if (!command_ignored) @@ -2363,13 +2363,13 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *nick, char *argument } /* - * irc_cmd_recv_wallops: 'wallops' command received + * irc_recv_cmd_wallops: 'wallops' command received */ int -irc_cmd_recv_wallops (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_wallops (t_irc_server *server, char *host, char *nick, char *arguments) { - command_ignored |= ignore_check (host, "wallops", arguments, server->name); + command_ignored |= irc_ignore_check (host, "wallops", arguments, server->name); if (!command_ignored) { @@ -2388,11 +2388,11 @@ irc_cmd_recv_wallops (t_irc_server *server, char *host, char *nick, char *argume } /* - * irc_cmd_recv_001: '001' command (connected to irc server) + * irc_recv_cmd_001: '001' command (connected to irc server) */ int -irc_cmd_recv_001 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_001 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; char **commands, **ptr, *vars_replaced; @@ -2408,7 +2408,7 @@ irc_cmd_recv_001 (t_irc_server *server, char *host, char *nick, char *arguments) server->nick = strdup (arguments); } - irc_cmd_recv_server_msg (server, host, nick, arguments); + irc_recv_cmd_server_msg (server, host, nick, arguments); /* connection to IRC server is ok! */ server->is_connected = 1; @@ -2447,11 +2447,11 @@ irc_cmd_recv_001 (t_irc_server *server, char *host, char *nick, char *arguments) if (ptr_channel->type == CHANNEL_TYPE_CHANNEL) { if (ptr_channel->key) - server_sendf (server, "JOIN %s %s", - ptr_channel->name, ptr_channel->key); + irc_server_sendf (server, "JOIN %s %s", + ptr_channel->name, ptr_channel->key); else - server_sendf (server, "JOIN %s", - ptr_channel->name); + irc_server_sendf (server, "JOIN %s", + ptr_channel->name); } } server->reconnect_join = 0; @@ -2460,7 +2460,7 @@ irc_cmd_recv_001 (t_irc_server *server, char *host, char *nick, char *arguments) { /* auto-join when connecting to server for first time */ if (server->autojoin && server->autojoin[0]) - return irc_cmd_send_join (server, NULL, server->autojoin); + return irc_send_cmd_join (server, NULL, server->autojoin); } /* set away message if user was away (before disconnection for example) */ @@ -2478,15 +2478,15 @@ irc_cmd_recv_001 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_005: '005' command (some infos from server) + * irc_recv_cmd_005: '005' command (some infos from server) */ int -irc_cmd_recv_005 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_005 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; - irc_cmd_recv_server_msg (server, host, nick, arguments); + irc_recv_cmd_server_msg (server, host, nick, arguments); pos = strstr (arguments, "PREFIX="); if (pos) @@ -2513,11 +2513,11 @@ irc_cmd_recv_005 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_221: '221' command (user mode string) + * irc_recv_cmd_221: '221' command (user mode string) */ int -irc_cmd_recv_221 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_221 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_mode; @@ -2561,11 +2561,11 @@ irc_cmd_recv_221 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_301: '301' command (away message) + * irc_recv_cmd_301: '301' command (away message) */ int -irc_cmd_recv_301 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_301 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_message; t_irc_channel *ptr_channel; @@ -2594,7 +2594,7 @@ irc_cmd_recv_301 (t_irc_server *server, char *host, char *nick, char *arguments) if (!command_ignored) { /* look for private buffer to display message */ - ptr_channel = channel_search (server, pos_nick); + ptr_channel = irc_channel_search (server, pos_nick); if (!cfg_irc_show_away_once || !ptr_channel || !(ptr_channel->away_message) || (strcmp (ptr_channel->away_message, pos_message) != 0)) @@ -2621,11 +2621,11 @@ irc_cmd_recv_301 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_302: '302' command (userhost) + * irc_recv_cmd_302: '302' command (userhost) */ int -irc_cmd_recv_302 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_302 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_host, *ptr_next; @@ -2679,11 +2679,11 @@ irc_cmd_recv_302 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_303: '303' command (ison) + * irc_recv_cmd_303: '303' command (ison) */ int -irc_cmd_recv_303 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_303 (t_irc_server *server, char *host, char *nick, char *arguments) { char *ptr_next; @@ -2727,11 +2727,11 @@ irc_cmd_recv_303 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_305: '305' command (unaway) + * irc_recv_cmd_305: '305' command (unaway) */ int -irc_cmd_recv_305 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_305 (t_irc_server *server, char *host, char *nick, char *arguments) { t_gui_window *ptr_window; @@ -2764,11 +2764,11 @@ irc_cmd_recv_305 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_306: '306' command (now away) + * irc_recv_cmd_306: '306' command (now away) */ int -irc_cmd_recv_306 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_306 (t_irc_server *server, char *host, char *nick, char *arguments) { t_gui_window *ptr_window; @@ -2804,11 +2804,11 @@ irc_cmd_recv_306 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_whois_nick_msg: a whois command with nick and message + * irc_recv_cmd_whois_nick_msg: a whois command with nick and message */ int -irc_cmd_recv_whois_nick_msg (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_whois_nick_msg (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_msg; @@ -2848,11 +2848,11 @@ irc_cmd_recv_whois_nick_msg (t_irc_server *server, char *host, char *nick, char } /* - * irc_cmd_recv_310: '310' command (whois, help mode) + * irc_recv_cmd_310: '310' command (whois, help mode) */ int -irc_cmd_recv_310 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_310 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick; @@ -2881,11 +2881,11 @@ irc_cmd_recv_310 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_311: '311' command (whois, user) + * irc_recv_cmd_311: '311' command (whois, user) */ int -irc_cmd_recv_311 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_311 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_user, *pos_host, *pos_realname; @@ -2950,11 +2950,11 @@ irc_cmd_recv_311 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_312: '312' command (whois, server) + * irc_recv_cmd_312: '312' command (whois, server) */ int -irc_cmd_recv_312 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_312 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_server, *pos_serverinfo; @@ -3007,11 +3007,11 @@ irc_cmd_recv_312 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_314: '314' command (whowas) + * irc_recv_cmd_314: '314' command (whowas) */ int -irc_cmd_recv_314 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_314 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_user, *pos_host, *pos_realname; @@ -3079,11 +3079,11 @@ irc_cmd_recv_314 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_315: '315' command (end of /who) + * irc_recv_cmd_315: '315' command (end of /who) */ int -irc_cmd_recv_315 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_315 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; t_irc_channel *ptr_channel; @@ -3105,7 +3105,7 @@ irc_cmd_recv_315 (t_irc_server *server, char *host, char *nick, char *arguments) { pos[0] = '\0'; pos++; - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel && (ptr_channel->checking_away > 0)) { ptr_channel->checking_away--; @@ -3133,11 +3133,11 @@ irc_cmd_recv_315 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_317: '317' command (whois, idle) + * irc_recv_cmd_317: '317' command (whois, idle) */ int -irc_cmd_recv_317 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_317 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_idle, *pos_signon, *pos_message; int idle_time, day, hour, min, sec; @@ -3220,11 +3220,11 @@ irc_cmd_recv_317 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_319: '319' command (whois, channels) + * irc_recv_cmd_319: '319' command (whois, channels) */ int -irc_cmd_recv_319 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_319 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_channel, *pos; @@ -3310,11 +3310,11 @@ irc_cmd_recv_319 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_321: '321' command (/list start) + * irc_recv_cmd_321: '321' command (/list start) */ int -irc_cmd_recv_321 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_321 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; @@ -3342,11 +3342,11 @@ irc_cmd_recv_321 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_322: '322' command (channel for /list) + * irc_recv_cmd_322: '322' command (channel for /list) */ int -irc_cmd_recv_322 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_322 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; @@ -3384,11 +3384,11 @@ irc_cmd_recv_322 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_323: '323' command (/list end) + * irc_recv_cmd_323: '323' command (/list end) */ int -irc_cmd_recv_323 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_323 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; @@ -3416,11 +3416,11 @@ irc_cmd_recv_323 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_324: '324' command (channel mode) + * irc_recv_cmd_324: '324' command (channel mode) */ int -irc_cmd_recv_324 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_324 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_modes, *pos; t_irc_channel *ptr_channel; @@ -3454,7 +3454,7 @@ irc_cmd_recv_324 (t_irc_server *server, char *host, char *nick, char *arguments) } /* search channel */ - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); if (ptr_channel) { if (pos_modes[0]) @@ -3483,11 +3483,11 @@ irc_cmd_recv_324 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_329: '329' command received (channel creation date) + * irc_recv_cmd_329: '329' command received (channel creation date) */ int -irc_cmd_recv_329 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_329 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_date; t_irc_channel *ptr_channel; @@ -3510,7 +3510,7 @@ irc_cmd_recv_329 (t_irc_server *server, char *host, char *nick, char *arguments) while (pos_date[0] == ' ') pos_date++; - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); if (!ptr_channel) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -3520,8 +3520,8 @@ irc_cmd_recv_329 (t_irc_server *server, char *host, char *nick, char *arguments) return -1; } - command_ignored |= ignore_check (host, "329", - pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "329", + pos_channel, server->name); if (!command_ignored && (ptr_channel->display_creation_date)) { datetime = (time_t)(atol (pos_date)); @@ -3552,11 +3552,11 @@ irc_cmd_recv_329 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_331: '331' command received (no topic for channel) + * irc_recv_cmd_331: '331' command received (no topic for channel) */ int -irc_cmd_recv_331 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_331 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos; t_irc_channel *ptr_channel; @@ -3586,10 +3586,10 @@ irc_cmd_recv_331 (t_irc_server *server, char *host, char *nick, char *arguments) return -1; } - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); if (ptr_channel) { - command_ignored |= ignore_check (host, "331", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "331", ptr_channel->name, server->name); if (!command_ignored) { irc_display_prefix (server, ptr_channel->buffer, PREFIX_INFO); @@ -3611,11 +3611,11 @@ irc_cmd_recv_331 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_332: '332' command received (topic of channel) + * irc_recv_cmd_332: '332' command received (topic of channel) */ int -irc_cmd_recv_332 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_332 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; t_irc_channel *ptr_channel; @@ -3634,7 +3634,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *nick, char *arguments) if (pos2) { pos2[0] = '\0'; - ptr_channel = channel_search (server, pos); + ptr_channel = irc_channel_search (server, pos); ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; pos2++; @@ -3649,7 +3649,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *nick, char *arguments) ptr_channel->topic = strdup (pos2); } - command_ignored |= ignore_check (host, "332", pos, server->name); + command_ignored |= irc_ignore_check (host, "332", pos, server->name); if (!command_ignored) { irc_display_prefix (server, ptr_buffer, PREFIX_INFO); @@ -3676,11 +3676,11 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_333: '333' command received (infos about topic (nick / date)) + * irc_recv_cmd_333: '333' command received (infos about topic (nick / date)) */ int -irc_cmd_recv_333 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_333 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_nick, *pos_date; t_irc_channel *ptr_channel; @@ -3711,12 +3711,12 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *nick, char *arguments) while (pos_date[0] == ' ') pos_date++; - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - command_ignored |= ignore_check (host, "333", - pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "333", + pos_channel, server->name); if (!command_ignored) { datetime = (time_t)(atol (pos_date)); @@ -3758,11 +3758,11 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_338: '338' command (whois, host) + * irc_recv_cmd_338: '338' command (whois, host) */ int -irc_cmd_recv_338 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_338 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_host, *pos_message; @@ -3814,11 +3814,11 @@ irc_cmd_recv_338 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_341: '341' command received (inviting) + * irc_recv_cmd_341: '341' command received (inviting) */ int -irc_cmd_recv_341 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_341 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_channel; @@ -3878,11 +3878,11 @@ irc_cmd_recv_341 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_344: '344' command (channel reop) + * irc_recv_cmd_344: '344' command (channel reop) */ int -irc_cmd_recv_344 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_344 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_host; @@ -3919,11 +3919,11 @@ irc_cmd_recv_344 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_345: '345' command (end of channel reop) + * irc_recv_cmd_345: '345' command (end of channel reop) */ int -irc_cmd_recv_345 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_345 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; @@ -3966,11 +3966,11 @@ irc_cmd_recv_345 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_348: '348' command received (channel exception list) + * irc_recv_cmd_348: '348' command received (channel exception list) */ int -irc_cmd_recv_348 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_348 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_exception, *pos_user, *pos_date, *pos; t_irc_channel *ptr_channel; @@ -4032,10 +4032,10 @@ irc_cmd_recv_348 (t_irc_server *server, char *host, char *nick, char *arguments) else pos_date = NULL; - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - command_ignored |= ignore_check (host, "348", pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "348", pos_channel, server->name); if (!command_ignored) { @@ -4082,11 +4082,11 @@ irc_cmd_recv_348 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_349: '349' command received (end of channel exception list) + * irc_recv_cmd_349: '349' command received (end of channel exception list) */ int -irc_cmd_recv_349 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_349 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_msg; t_irc_channel *ptr_channel; @@ -4125,10 +4125,10 @@ irc_cmd_recv_349 (t_irc_server *server, char *host, char *nick, char *arguments) if (pos_msg[0] == ':') pos_msg++; - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - command_ignored |= ignore_check (host, "349", pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "349", pos_channel, server->name); if (!command_ignored) { @@ -4145,11 +4145,11 @@ irc_cmd_recv_349 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_351: '351' command received (server version) + * irc_recv_cmd_351: '351' command received (server version) */ int -irc_cmd_recv_351 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_351 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; @@ -4186,11 +4186,11 @@ irc_cmd_recv_351 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_352: '352' command (who) + * irc_recv_cmd_352: '352' command (who) */ int -irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_352 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_user, *pos_host, *pos_server, *pos_nick; char *pos_attr, *pos_hopcount, *pos_realname; @@ -4258,12 +4258,12 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments) while (pos_realname[0] == ' ') pos_realname++; - command_ignored |= ignore_check (host, "352", pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "352", pos_channel, server->name); - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); if (ptr_channel && (ptr_channel->checking_away > 0)) { - ptr_nick = nick_search (ptr_channel, pos_nick); + ptr_nick = irc_nick_search (ptr_channel, pos_nick); if (ptr_nick) { if (ptr_nick->host) @@ -4272,8 +4272,8 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments) ptr_nick->host = (char *) malloc (length); if (ptr_nick->host) snprintf (ptr_nick->host, length, "%s@%s", pos_user, pos_host); - nick_set_away (ptr_channel, ptr_nick, - (pos_attr[0] == 'G') ? 1 : 0); + irc_nick_set_away (ptr_channel, ptr_nick, + (pos_attr[0] == 'G') ? 1 : 0); } return 0; } @@ -4312,11 +4312,11 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_353: '353' command received (list of users on a channel) + * irc_recv_cmd_353: '353' command received (list of users on a channel) */ int -irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_353 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos_nick; int is_chanowner, is_chanadmin, is_chanadmin2, is_op, is_halfop, has_voice; @@ -4348,7 +4348,7 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments) { pos[0] = '\0'; - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) ptr_buffer = ptr_channel->buffer; else @@ -4366,9 +4366,9 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments) return -1; } - command_ignored |= ignore_check (host, "353", - (ptr_channel) ? ptr_channel->name : NULL, - server->name); + command_ignored |= irc_ignore_check (host, "353", + (ptr_channel) ? ptr_channel->name : NULL, + server->name); /* channel is not joined => display users on server buffer */ if (!command_ignored && !ptr_channel) @@ -4474,8 +4474,8 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments) } if (ptr_channel) { - if (!nick_new (server, ptr_channel, pos_nick, is_chanowner, - is_chanadmin, is_chanadmin2, is_op, is_halfop, has_voice)) + if (!irc_nick_new (server, ptr_channel, pos_nick, is_chanowner, + is_chanadmin, is_chanadmin2, is_op, is_halfop, has_voice)) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); gui_printf_nolog (server->buffer, @@ -4519,11 +4519,11 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_366: '366' command received (end of /names list) + * irc_recv_cmd_366: '366' command received (end of /names list) */ int -irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_366 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; t_irc_channel *ptr_channel; @@ -4548,10 +4548,10 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments) if (pos2[0] == ':') pos2++; - ptr_channel = channel_search (server, pos); + ptr_channel = irc_channel_search (server, pos); if (ptr_channel) { - command_ignored |= ignore_check (host, "366", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "366", ptr_channel->name, server->name); if (!command_ignored) { @@ -4574,8 +4574,8 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments) GUI_COLOR(COLOR_WIN_CHAT_DARK)); /* display number of nicks, ops, halfops & voices on the channel */ - nick_count (ptr_channel, &num_nicks, &num_op, &num_halfop, &num_voice, - &num_normal); + irc_nick_count (ptr_channel, &num_nicks, &num_op, &num_halfop, &num_voice, + &num_normal); irc_display_prefix (server, ptr_channel->buffer, PREFIX_INFO); gui_printf (ptr_channel->buffer, _("Channel %s%s%s: %s%d%s %s %s(%s%d%s %s, " @@ -4606,8 +4606,8 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments) _("normal"), GUI_COLOR(COLOR_WIN_CHAT_DARK)); } - irc_cmd_send_mode (server, NULL, ptr_channel->name); - channel_check_away (server, ptr_channel, 1); + irc_send_cmd_mode (server, NULL, ptr_channel->name); + irc_channel_check_away (server, ptr_channel, 1); } else { @@ -4628,11 +4628,11 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_367: '367' command received (banlist) + * irc_recv_cmd_367: '367' command received (banlist) */ int -irc_cmd_recv_367 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_367 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_ban, *pos_user, *pos_date, *pos; t_irc_channel *ptr_channel; @@ -4693,10 +4693,10 @@ irc_cmd_recv_367 (t_irc_server *server, char *host, char *nick, char *arguments) } } - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - command_ignored |= ignore_check (host, "367", pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "367", pos_channel, server->name); if (!command_ignored) { @@ -4751,11 +4751,11 @@ irc_cmd_recv_367 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_368: '368' command received (end of banlist) + * irc_recv_cmd_368: '368' command received (end of banlist) */ int -irc_cmd_recv_368 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_368 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_msg; t_irc_channel *ptr_channel; @@ -4794,10 +4794,10 @@ irc_cmd_recv_368 (t_irc_server *server, char *host, char *nick, char *arguments) if (pos_msg[0] == ':') pos_msg++; - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - command_ignored |= ignore_check (host, "368", pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "368", pos_channel, server->name); if (!command_ignored) { @@ -4814,11 +4814,11 @@ irc_cmd_recv_368 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_378: '378' command received (connecting from) + * irc_recv_cmd_378: '378' command received (connecting from) */ int -irc_cmd_recv_378 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_378 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; @@ -4857,15 +4857,15 @@ irc_cmd_recv_378 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_432: '432' command received (erroneous nickname) + * irc_recv_cmd_432: '432' command received (erroneous nickname) */ int -irc_cmd_recv_432 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_432 (t_irc_server *server, char *host, char *nick, char *arguments) { /* Note: this IRC command can not be ignored */ - irc_cmd_recv_error (server, host, nick, arguments); + irc_recv_cmd_error (server, host, nick, arguments); if (!server->is_connected) { @@ -4899,7 +4899,7 @@ irc_cmd_recv_432 (t_irc_server *server, char *host, char *nick, char *arguments) "use or invalid, closing connection with " "server!\n"), PACKAGE_NAME); - server_disconnect (server, 1); + irc_server_disconnect (server, 1); return 0; } else @@ -4913,19 +4913,17 @@ irc_cmd_recv_432 (t_irc_server *server, char *host, char *nick, char *arguments) } } } - server_sendf (server, - "NICK %s", - server->nick); + irc_server_sendf (server, "NICK %s", server->nick); } return 0; } /* - * irc_cmd_recv_433: '433' command received (nickname already in use) + * irc_recv_cmd_433: '433' command received (nickname already in use) */ int -irc_cmd_recv_433 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_433 (t_irc_server *server, char *host, char *nick, char *arguments) { /* Note: this IRC command can not be ignored */ @@ -4962,7 +4960,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *nick, char *arguments) _("%s: all declared nicknames are already in use, " "closing connection with server!\n"), PACKAGE_NAME); - server_disconnect (server, 1); + irc_server_disconnect (server, 1); return 0; } else @@ -4977,22 +4975,20 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *nick, char *arguments) } } } - server_sendf (server, - "NICK %s", - server->nick); + irc_server_sendf (server, "NICK %s", server->nick); } else - return irc_cmd_recv_error (server, host, nick, arguments); + return irc_recv_cmd_error (server, host, nick, arguments); return 0; } /* - * irc_cmd_recv_438: '438' command received (not authorized to change nickname) + * irc_recv_cmd_438: '438' command received (not authorized to change nickname) */ int -irc_cmd_recv_438 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_438 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; @@ -5027,11 +5023,11 @@ irc_cmd_recv_438 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_671: '671' command (whois, secure connection) + * irc_recv_cmd_671: '671' command (whois, secure connection) */ int -irc_cmd_recv_671 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_671 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_message; diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c index d109f23b6..a7ceb9d79 100644 --- a/src/irc/irc-send.c +++ b/src/irc/irc-send.c @@ -45,92 +45,40 @@ /* - * irc_hide_password: hide IRC password(s) in a string + * irc_send_login: login to irc server */ void -irc_hide_password (char *string, int look_for_nickserv) -{ - char *pos_nickserv, *pos, *pos_pwd; - - pos = string; - while (1) - { - if (look_for_nickserv) - { - pos_nickserv = strstr (pos, "nickserv "); - if (!pos_nickserv) - return; - pos = pos_nickserv + 9; - while (pos[0] == ' ') - pos++; - if ((strncmp (pos, "identify ", 9) == 0) - || (strncmp (pos, "register ", 9) == 0)) - pos_pwd = pos + 9; - else - pos_pwd = NULL; - } - else - { - pos_pwd = strstr (pos, "identify "); - if (!pos_pwd) - pos_pwd = strstr (pos, "register "); - if (!pos_pwd) - return; - pos_pwd += 9; - } - - if (pos_pwd) - { - while (pos_pwd[0] == ' ') - pos_pwd++; - - while (pos_pwd[0] && (pos_pwd[0] != ';') && (pos_pwd[0] != ' ') - && (pos_pwd[0] != '"')) - { - pos_pwd[0] = '*'; - pos_pwd++; - } - pos = pos_pwd; - } - } -} - -/* - * irc_login: login to irc server - */ - -void -irc_login (t_irc_server *server) +irc_send_login (t_irc_server *server) { if ((server->password) && (server->password[0])) - server_sendf (server, "PASS %s", server->password); + irc_server_sendf (server, "PASS %s", server->password); if (!server->nick) server->nick = strdup (server->nick1); - server_sendf (server, - "NICK %s\n" - "USER %s %s %s :%s", - server->nick, server->username, server->username, - server->address, server->realname); + irc_server_sendf (server, + "NICK %s\n" + "USER %s %s %s :%s", + server->nick, server->username, server->username, + server->address, server->realname); gui_input_draw (gui_current_window->buffer, 1); } /* - * irc_cmd_send_admin: find information about the administrator of the server + * irc_send_cmd_admin: find information about the administrator of the server */ int -irc_cmd_send_admin (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_admin (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "ADMIN %s", arguments); + irc_server_sendf (server, "ADMIN %s", arguments); else - server_sendf (server, "ADMIN"); + irc_server_sendf (server, "ADMIN"); return 0; } @@ -144,9 +92,9 @@ irc_send_me (t_irc_server *server, t_irc_channel *channel, { char *string; - server_sendf (server, "PRIVMSG %s :\01ACTION %s\01", - channel->name, - (arguments && arguments[0]) ? arguments : ""); + irc_server_sendf (server, "PRIVMSG %s :\01ACTION %s\01", + channel->name, + (arguments && arguments[0]) ? arguments : ""); irc_display_prefix (NULL, channel->buffer, PREFIX_ACTION_ME); string = (arguments && arguments[0]) ? (char *)gui_color_decode ((unsigned char *)arguments, 1) : NULL; @@ -179,11 +127,11 @@ irc_send_me_all_channels (t_irc_server *server, char *arguments) } /* - * irc_cmd_send_ame: send a ctcp action to all channels of all connected servers + * irc_send_cmd_ame: send a ctcp action to all channels of all connected servers */ int -irc_cmd_send_ame (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_ame (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_irc_server *ptr_server; @@ -212,11 +160,11 @@ irc_cmd_send_ame (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_amsg: send message to all channels of all connected servers + * irc_send_cmd_amsg: send message to all channels of all connected servers */ int -irc_cmd_send_amsg (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_amsg (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_irc_server *ptr_server; @@ -241,9 +189,9 @@ irc_cmd_send_amsg (t_irc_server *server, t_irc_channel *channel, { if (ptr_channel->type == CHANNEL_TYPE_CHANNEL) { - server_sendf (ptr_server, "PRIVMSG %s :%s", - ptr_channel->name, arguments); - ptr_nick = nick_search (ptr_channel, ptr_server->nick); + irc_server_sendf (ptr_server, "PRIVMSG %s :%s", + ptr_channel->name, arguments); + ptr_nick = irc_nick_search (ptr_channel, ptr_server->nick); if (ptr_nick) { irc_display_nick (ptr_channel->buffer, ptr_nick, NULL, @@ -291,7 +239,7 @@ irc_send_away (t_irc_server *server, char *arguments) if (server->away_message) strcpy (server->away_message, arguments); server->away_time = time (NULL); - server_sendf (server, "AWAY :%s", arguments); + irc_server_sendf (server, "AWAY :%s", arguments); if (cfg_irc_display_away != CFG_IRC_DISPLAY_AWAY_OFF) { string = (char *)gui_color_decode ((unsigned char *)arguments, 1); @@ -305,7 +253,7 @@ irc_send_away (t_irc_server *server, char *arguments) if (string) free (string); } - server_set_away (server, server->nick, 1); + irc_server_set_away (server, server->nick, 1); for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window) { @@ -316,7 +264,7 @@ irc_send_away (t_irc_server *server, char *arguments) } else { - server_sendf (server, "AWAY"); + irc_server_sendf (server, "AWAY"); server->is_away = 0; if (server->away_message) { @@ -351,23 +299,23 @@ irc_send_away (t_irc_server *server, char *arguments) } } } - server_set_away (server, server->nick, 0); + irc_server_set_away (server, server->nick, 0); } } /* - * irc_cmd_send_away: toggle away status + * irc_send_cmd_away: toggle away status */ int -irc_cmd_send_away (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_away (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *pos; t_irc_server *ptr_server; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); /* make C compiler happy */ (void) channel; @@ -408,17 +356,17 @@ irc_cmd_send_away (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_ban: bans nicks or hosts + * irc_send_cmd_ban: bans nicks or hosts */ int -irc_cmd_send_ban (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_ban (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *pos_channel, *pos, *pos2; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (arguments) { @@ -428,7 +376,7 @@ irc_cmd_send_ban (t_irc_server *server, t_irc_channel *channel, { pos[0] = '\0'; - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { pos_channel = arguments; pos++; @@ -469,7 +417,7 @@ irc_cmd_send_ban (t_irc_server *server, t_irc_channel *channel, while (pos2[0] == ' ') pos2++; } - server_sendf (server, "MODE %s +b %s", pos_channel, pos); + irc_server_sendf (server, "MODE %s +b %s", pos_channel, pos); pos = pos2; } } @@ -483,18 +431,18 @@ irc_cmd_send_ban (t_irc_server *server, t_irc_channel *channel, WEECHAT_ERROR, "ban"); return -1; } - server_sendf (server, "MODE %s +b", CHANNEL(buffer)->name); + irc_server_sendf (server, "MODE %s +b", CHANNEL(buffer)->name); } return 0; } /* - * irc_cmd_send_ctcp: send a ctcp message + * irc_send_cmd_ctcp: send a ctcp message */ int -irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_ctcp (t_irc_server *server, t_irc_channel *channel, char *arguments) { char *pos_type, *pos_args, *pos; @@ -541,8 +489,8 @@ irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel, if ((ascii_strcasecmp (pos_type, "ping") == 0) && (!pos_args)) { gettimeofday (&tv, NULL); - server_sendf (server, "PRIVMSG %s :\01PING %d %d\01", - arguments, tv.tv_sec, tv.tv_usec); + irc_server_sendf (server, "PRIVMSG %s :\01PING %d %d\01", + arguments, tv.tv_sec, tv.tv_usec); gui_printf (server->buffer, " %s%d %d\n", GUI_COLOR(COLOR_WIN_CHAT), tv.tv_sec, tv.tv_usec); @@ -551,16 +499,16 @@ irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel, { if (pos_args) { - server_sendf (server, "PRIVMSG %s :\01%s %s\01", - arguments, pos_type, pos_args); + irc_server_sendf (server, "PRIVMSG %s :\01%s %s\01", + arguments, pos_type, pos_args); gui_printf (server->buffer, " %s%s\n", GUI_COLOR(COLOR_WIN_CHAT), pos_args); } else { - server_sendf (server, "PRIVMSG %s :\01%s\01", - arguments, pos_type); + irc_server_sendf (server, "PRIVMSG %s :\01%s\01", + arguments, pos_type); gui_printf (server->buffer, "\n"); } } @@ -569,11 +517,11 @@ irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_cycle: leave and rejoin a channel + * irc_send_cmd_cycle: leave and rejoin a channel */ int -irc_cmd_send_cycle (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_cycle (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; @@ -582,11 +530,11 @@ irc_cmd_send_cycle (t_irc_server *server, t_irc_channel *channel, char **channels; int i, argc; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (arguments) { - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { channel_name = arguments; pos_args = strchr (arguments, ' '); @@ -602,7 +550,7 @@ irc_cmd_send_cycle (t_irc_server *server, t_irc_channel *channel, { for (i = 0; i < argc; i++) { - ptr_channel = channel_search (server, channels[i]); + ptr_channel = irc_channel_search (server, channels[i]); /* mark channal as cycling */ if (ptr_channel && (ptr_channel->type == CHANNEL_TYPE_CHANNEL)) @@ -658,35 +606,35 @@ irc_cmd_send_cycle (t_irc_server *server, t_irc_channel *channel, if (ptr_arg) { buf = weechat_strreplace (ptr_arg, "%v", PACKAGE_VERSION); - server_sendf (server, "PART %s :%s", channel_name, - (buf) ? buf : ptr_arg); + irc_server_sendf (server, "PART %s :%s", channel_name, + (buf) ? buf : ptr_arg); if (buf) free (buf); } else - server_sendf (server, "PART %s", channel_name); + irc_server_sendf (server, "PART %s", channel_name); return 0; } /* - * irc_cmd_send_dehalfop: remove half operator privileges from nickname(s) + * irc_send_cmd_dehalfop: remove half operator privileges from nickname(s) */ int -irc_cmd_send_dehalfop (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_dehalfop (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_CHANNEL(buffer)) { if (argc == 0) - server_sendf (server, "MODE %s -h %s", - CHANNEL(buffer)->name, - server->nick); + irc_server_sendf (server, "MODE %s -h %s", + CHANNEL(buffer)->name, + server->nick); else irc_send_mode_nicks (server, CHANNEL(buffer)->name, "-", "h", argc, argv); @@ -702,23 +650,23 @@ irc_cmd_send_dehalfop (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_deop: remove operator privileges from nickname(s) + * irc_send_cmd_deop: remove operator privileges from nickname(s) */ int -irc_cmd_send_deop (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_deop (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_CHANNEL(buffer)) { if (argc == 0) - server_sendf (server, "MODE %s -o %s", - CHANNEL(buffer)->name, - server->nick); + irc_server_sendf (server, "MODE %s -o %s", + CHANNEL(buffer)->name, + server->nick); else irc_send_mode_nicks (server, CHANNEL(buffer)->name, "-", "o", argc, argv); @@ -734,23 +682,23 @@ irc_cmd_send_deop (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_devoice: remove voice from nickname(s) + * irc_send_cmd_devoice: remove voice from nickname(s) */ int -irc_cmd_send_devoice (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_devoice (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_CHANNEL(buffer)) { if (argc == 0) - server_sendf (server, "MODE %s -v %s", - CHANNEL(buffer)->name, - server->nick); + irc_server_sendf (server, "MODE %s -v %s", + CHANNEL(buffer)->name, + server->nick); else irc_send_mode_nicks (server, CHANNEL(buffer)->name, "-", "v", argc, argv); @@ -767,39 +715,39 @@ irc_cmd_send_devoice (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_die: shotdown the server + * irc_send_cmd_die: shotdown the server */ int -irc_cmd_send_die (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_die (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; (void) arguments; - server_sendf (server, "DIE"); + irc_server_sendf (server, "DIE"); return 0; } /* - * irc_cmd_send_halfop: give half operator privileges to nickname(s) + * irc_send_cmd_halfop: give half operator privileges to nickname(s) */ int -irc_cmd_send_halfop (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_halfop (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_CHANNEL(buffer)) { if (argc == 0) - server_sendf (server, "MODE %s +h %s", - CHANNEL(buffer)->name, - server->nick); + irc_server_sendf (server, "MODE %s +h %s", + CHANNEL(buffer)->name, + server->nick); else irc_send_mode_nicks (server, CHANNEL(buffer)->name, "+", "h", argc, argv); @@ -816,37 +764,37 @@ irc_cmd_send_halfop (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_info: get information describing the server + * irc_send_cmd_info: get information describing the server */ int -irc_cmd_send_info (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_info (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "INFO %s", arguments); + irc_server_sendf (server, "INFO %s", arguments); else - server_sendf (server, "INFO"); + irc_server_sendf (server, "INFO"); return 0; } /* - * irc_cmd_send_invite: invite a nick on a channel + * irc_send_cmd_invite: invite a nick on a channel */ int -irc_cmd_send_invite (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_invite (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (argc == 2) - server_sendf (server, "INVITE %s %s", argv[0], argv[1]); + irc_server_sendf (server, "INVITE %s %s", argv[0], argv[1]); else { if (!BUFFER_IS_CHANNEL(buffer)) @@ -857,59 +805,59 @@ irc_cmd_send_invite (t_irc_server *server, t_irc_channel *channel, WEECHAT_ERROR, "invite"); return -1; } - server_sendf (server, "INVITE %s %s", - argv[0], CHANNEL(buffer)->name); + irc_server_sendf (server, "INVITE %s %s", + argv[0], CHANNEL(buffer)->name); } return 0; } /* - * irc_cmd_send_ison: check if a nickname is currently on IRC + * irc_send_cmd_ison: check if a nickname is currently on IRC */ int -irc_cmd_send_ison (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_ison (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "ISON %s", arguments); + irc_server_sendf (server, "ISON %s", arguments); return 0; } /* - * irc_cmd_send_join: join a new channel + * irc_send_cmd_join: join a new channel */ int -irc_cmd_send_join (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_join (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - if (string_is_channel (arguments)) - server_sendf (server, "JOIN %s", arguments); + if (irc_channel_is_channel (arguments)) + irc_server_sendf (server, "JOIN %s", arguments); else - server_sendf (server, "JOIN #%s", arguments); + irc_server_sendf (server, "JOIN #%s", arguments); return 0; } /* - * irc_cmd_send_kick: forcibly remove a user from a channel + * irc_send_cmd_kick: forcibly remove a user from a channel */ int -irc_cmd_send_kick (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_kick (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *pos_channel, *pos_nick, *pos_comment; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { pos_channel = arguments; pos_nick = strchr (arguments, ' '); @@ -950,27 +898,27 @@ irc_cmd_send_kick (t_irc_server *server, t_irc_channel *channel, } if (pos_comment) - server_sendf (server, "KICK %s %s :%s", pos_channel, pos_nick, pos_comment); + irc_server_sendf (server, "KICK %s %s :%s", pos_channel, pos_nick, pos_comment); else - server_sendf (server, "KICK %s %s", pos_channel, pos_nick); + irc_server_sendf (server, "KICK %s %s", pos_channel, pos_nick); return 0; } /* - * irc_cmd_send_kickban: forcibly remove a user from a channel and ban it + * irc_send_cmd_kickban: forcibly remove a user from a channel and ban it */ int -irc_cmd_send_kickban (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_kickban (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *pos_channel, *pos_nick, *pos_comment; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { pos_channel = arguments; pos_nick = strchr (arguments, ' '); @@ -1010,21 +958,21 @@ irc_cmd_send_kickban (t_irc_server *server, t_irc_channel *channel, pos_comment++; } - server_sendf (server, "MODE %s +b %s", pos_channel, pos_nick); + irc_server_sendf (server, "MODE %s +b %s", pos_channel, pos_nick); if (pos_comment) - server_sendf (server, "KICK %s %s :%s", pos_channel, pos_nick, pos_comment); + irc_server_sendf (server, "KICK %s %s :%s", pos_channel, pos_nick, pos_comment); else - server_sendf (server, "KICK %s %s", pos_channel, pos_nick); + irc_server_sendf (server, "KICK %s %s", pos_channel, pos_nick); return 0; } /* - * irc_cmd_send_kill: close client-server connection + * irc_send_cmd_kill: close client-server connection */ int -irc_cmd_send_kill (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_kill (t_irc_server *server, t_irc_channel *channel, char *arguments) { char *pos; @@ -1039,38 +987,38 @@ irc_cmd_send_kill (t_irc_server *server, t_irc_channel *channel, pos++; while (pos[0] == ' ') pos++; - server_sendf (server, "KILL %s :%s", arguments, pos); + irc_server_sendf (server, "KILL %s :%s", arguments, pos); } else - server_sendf (server, "KILL %s", arguments); + irc_server_sendf (server, "KILL %s", arguments); return 0; } /* - * irc_cmd_send_links: list all servernames which are known by the server + * irc_send_cmd_links: list all servernames which are known by the server * answering the query */ int -irc_cmd_send_links (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_links (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "LINKS %s", arguments); + irc_server_sendf (server, "LINKS %s", arguments); else - server_sendf (server, "LINKS"); + irc_server_sendf (server, "LINKS"); return 0; } /* - * irc_cmd_send_list: close client-server connection + * irc_send_cmd_list: close client-server connection */ int -irc_cmd_send_list (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_list (t_irc_server *server, t_irc_channel *channel, char *arguments) { char buffer[512]; @@ -1098,7 +1046,7 @@ irc_cmd_send_list (t_irc_server *server, t_irc_channel *channel, WEECHAT_ERROR, arguments, buffer); } else - server_sendf (server, "LIST"); + irc_server_sendf (server, "LIST"); } else { @@ -1108,40 +1056,40 @@ irc_cmd_send_list (t_irc_server *server, t_irc_channel *channel, } } else - server_sendf (server, "LIST"); + irc_server_sendf (server, "LIST"); return 0; } /* - * irc_cmd_send_lusers: get statistics about ths size of the IRC network + * irc_send_cmd_lusers: get statistics about ths size of the IRC network */ int -irc_cmd_send_lusers (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_lusers (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "LUSERS %s", arguments); + irc_server_sendf (server, "LUSERS %s", arguments); else - server_sendf (server, "LUSERS"); + irc_server_sendf (server, "LUSERS"); return 0; } /* - * irc_cmd_send_me: send a ctcp action to the current channel + * irc_send_cmd_me: send a ctcp action to the current channel */ int -irc_cmd_send_me (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_me (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_SERVER(buffer)) { @@ -1156,17 +1104,17 @@ irc_cmd_send_me (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_mode: change mode for channel/nickname + * irc_send_cmd_mode: change mode for channel/nickname */ int -irc_cmd_send_mode (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_mode (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "MODE %s", arguments); + irc_server_sendf (server, "MODE %s", arguments); return 0; } @@ -1196,35 +1144,35 @@ irc_send_mode_nicks (t_irc_server *server, char *channel, strcat (command, " "); strcat (command, argv[i]); } - server_sendf (server, "%s", command); + irc_server_sendf (server, "%s", command); free (command); } } /* - * irc_cmd_send_motd: get the "Message Of The Day" + * irc_send_cmd_motd: get the "Message Of The Day" */ int -irc_cmd_send_motd (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_motd (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "MOTD %s", arguments); + irc_server_sendf (server, "MOTD %s", arguments); else - server_sendf (server, "MOTD"); + irc_server_sendf (server, "MOTD"); return 0; } /* - * irc_cmd_send_msg: send a message to a nick or channel + * irc_send_cmd_msg: send a message to a nick or channel */ int -irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_msg (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_window *window; @@ -1235,7 +1183,7 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, t_irc_nick *ptr_nick; char *string; - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); pos = strchr (arguments, ' '); if (pos) @@ -1266,7 +1214,7 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, } ptr_channel = CHANNEL(buffer); if (BUFFER_IS_CHANNEL(buffer)) - ptr_nick = nick_search (ptr_channel, server->nick); + ptr_nick = irc_nick_search (ptr_channel, server->nick); else ptr_nick = NULL; irc_display_nick (buffer, ptr_nick, @@ -1278,16 +1226,16 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, if (string) free (string); - server_sendf (server, "PRIVMSG %s :%s", ptr_channel->name, pos); + irc_server_sendf (server, "PRIVMSG %s :%s", ptr_channel->name, pos); } else { - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) { - ptr_nick = nick_search (ptr_channel, server->nick); + ptr_nick = irc_nick_search (ptr_channel, server->nick); if (ptr_nick) { irc_display_nick (ptr_channel->buffer, ptr_nick, NULL, @@ -1306,7 +1254,7 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, WEECHAT_ERROR, server->nick, "msg"); } } - server_sendf (server, "PRIVMSG %s :%s", arguments, pos); + irc_server_sendf (server, "PRIVMSG %s :%s", arguments, pos); } else { @@ -1315,7 +1263,7 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, { msg_pwd_hidden = strdup (pos); if (cfg_log_hide_nickserv_pwd) - irc_hide_password (msg_pwd_hidden, 0); + irc_display_hide_password (msg_pwd_hidden, 0); irc_display_prefix (server, server->buffer, PREFIX_SERVER); gui_printf_type (server->buffer, MSG_TYPE_NICK, "%s-%s%s%s- ", @@ -1329,13 +1277,13 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, (string) ? string : ""); if (string) free (string); - server_sendf (server, "PRIVMSG %s :%s", arguments, pos); + irc_server_sendf (server, "PRIVMSG %s :%s", arguments, pos); free (msg_pwd_hidden); return 0; } string = (char *)gui_color_decode ((unsigned char *)pos, 1); - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) { irc_display_nick (ptr_channel->buffer, NULL, server->nick, @@ -1360,7 +1308,7 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, } if (string) free (string); - server_sendf (server, "PRIVMSG %s :%s", arguments, pos); + irc_server_sendf (server, "PRIVMSG %s :%s", arguments, pos); } } arguments = pos_comma; @@ -1378,19 +1326,19 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_names: list nicknames on channels + * irc_send_cmd_names: list nicknames on channels */ int -irc_cmd_send_names (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_names (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (arguments) - server_sendf (server, "NAMES %s", arguments); + irc_server_sendf (server, "NAMES %s", arguments); else { if (!BUFFER_IS_CHANNEL(buffer)) @@ -1402,23 +1350,23 @@ irc_cmd_send_names (t_irc_server *server, t_irc_channel *channel, return -1; } else - server_sendf (server, "NAMES %s", - CHANNEL(buffer)->name); + irc_server_sendf (server, "NAMES %s", + CHANNEL(buffer)->name); } return 0; } /* - * irc_cmd_send_nick_server: change nickname on a server + * irc_send_cmd_nick_server: change nickname on a server */ void -irc_cmd_send_nick_server (t_irc_server *server, char *nickname) +irc_send_cmd_nick_server (t_irc_server *server, char *nickname) { t_irc_channel *ptr_channel; if (server->is_connected) - server_sendf (server, "NICK %s", nickname); + irc_server_sendf (server, "NICK %s", nickname); else { if (server->nick) @@ -1434,11 +1382,11 @@ irc_cmd_send_nick_server (t_irc_server *server, char *nickname) } /* - * irc_cmd_send_nick: change nickname + * irc_send_cmd_nick: change nickname */ int -irc_cmd_send_nick (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_nick (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_irc_server *ptr_server; @@ -1457,13 +1405,13 @@ irc_cmd_send_nick (t_irc_server *server, t_irc_channel *channel, for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - irc_cmd_send_nick_server (ptr_server, argv[1]); + irc_send_cmd_nick_server (ptr_server, argv[1]); } } else { if (argc == 1) - irc_cmd_send_nick_server (server, argv[0]); + irc_send_cmd_nick_server (server, argv[0]); else return -1; } @@ -1472,11 +1420,11 @@ irc_cmd_send_nick (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_notice: send notice message + * irc_send_cmd_notice: send notice message */ int -irc_cmd_send_notice (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_notice (t_irc_server *server, t_irc_channel *channel, char *arguments) { char *pos, *string; @@ -1502,7 +1450,7 @@ irc_cmd_send_notice (t_irc_server *server, t_irc_channel *channel, (string) ? string : ""); if (string) free (string); - server_sendf (server, "NOTICE %s :%s", arguments, pos); + irc_server_sendf (server, "NOTICE %s :%s", arguments, pos); } else { @@ -1516,23 +1464,23 @@ irc_cmd_send_notice (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_op: give operator privileges to nickname(s) + * irc_send_cmd_op: give operator privileges to nickname(s) */ int -irc_cmd_send_op (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_op (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_CHANNEL(buffer)) { if (argc == 0) - server_sendf (server, "MODE %s +o %s", - CHANNEL(buffer)->name, - server->nick); + irc_server_sendf (server, "MODE %s +o %s", + CHANNEL(buffer)->name, + server->nick); else irc_send_mode_nicks (server, CHANNEL(buffer)->name, "+", "o", argc, argv); @@ -1549,37 +1497,37 @@ irc_cmd_send_op (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_oper: get oper privileges + * irc_send_cmd_oper: get oper privileges */ int -irc_cmd_send_oper (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_oper (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "OPER %s", arguments); + irc_server_sendf (server, "OPER %s", arguments); return 0; } /* - * irc_cmd_send_part: leave a channel or close a private window + * irc_send_cmd_part: leave a channel or close a private window */ int -irc_cmd_send_part (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_part (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *channel_name, *pos_args, *ptr_arg, *buf; t_irc_channel *ptr_channel; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (arguments) { - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { channel_name = arguments; pos_args = strchr (arguments, ' '); @@ -1619,7 +1567,7 @@ irc_cmd_send_part (t_irc_server *server, t_irc_channel *channel, { ptr_channel = CHANNEL(buffer); gui_buffer_free (ptr_channel->buffer, 1); - channel_free (server, ptr_channel); + irc_channel_free (server, ptr_channel); gui_status_draw (buffer, 1); gui_input_draw (buffer, 1); return 0; @@ -1635,53 +1583,53 @@ irc_cmd_send_part (t_irc_server *server, t_irc_channel *channel, if (ptr_arg) { buf = weechat_strreplace (ptr_arg, "%v", PACKAGE_VERSION); - server_sendf (server, "PART %s :%s", channel_name, - (buf) ? buf : ptr_arg); + irc_server_sendf (server, "PART %s :%s", channel_name, + (buf) ? buf : ptr_arg); if (buf) free (buf); } else - server_sendf (server, "PART %s", channel_name); + irc_server_sendf (server, "PART %s", channel_name); return 0; } /* - * irc_cmd_send_ping: ping a server + * irc_send_cmd_ping: ping a server */ int -irc_cmd_send_ping (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_ping (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "PING %s", arguments); + irc_server_sendf (server, "PING %s", arguments); return 0; } /* - * irc_cmd_send_pong: send pong answer to a daemon + * irc_send_cmd_pong: send pong answer to a daemon */ int -irc_cmd_send_pong (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_pong (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "PONG %s", arguments); + irc_server_sendf (server, "PONG %s", arguments); return 0; } /* - * irc_cmd_send_query: start private conversation with a nick + * irc_send_cmd_query: start private conversation with a nick */ int -irc_cmd_send_query (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_query (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_window *window; @@ -1690,7 +1638,7 @@ irc_cmd_send_query (t_irc_server *server, t_irc_channel *channel, t_irc_channel *ptr_channel; t_gui_buffer *ptr_buffer; - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); pos = strchr (arguments, ' '); if (pos) @@ -1704,10 +1652,10 @@ irc_cmd_send_query (t_irc_server *server, t_irc_channel *channel, } /* create private window if not already opened */ - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (!ptr_channel) { - ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, arguments); + ptr_channel = irc_channel_new (server, CHANNEL_TYPE_PRIVATE, arguments); if (!ptr_channel) { irc_display_prefix (NULL, server->buffer, PREFIX_ERROR); @@ -1745,7 +1693,7 @@ irc_cmd_send_query (t_irc_server *server, t_irc_channel *channel, (string) ? string : ""); if (string) free (string); - server_sendf (server, "PRIVMSG %s :%s", arguments, pos); + irc_server_sendf (server, "PRIVMSG %s :%s", arguments, pos); } return 0; } @@ -1768,22 +1716,22 @@ irc_send_quit_server (t_irc_server *server, char *arguments) if (ptr_arg) { buf = weechat_strreplace (ptr_arg, "%v", PACKAGE_VERSION); - server_sendf (server, "QUIT :%s", - (buf) ? buf : ptr_arg); + irc_server_sendf (server, "QUIT :%s", + (buf) ? buf : ptr_arg); if (buf) free (buf); } else - server_sendf (server, "QUIT"); + irc_server_sendf (server, "QUIT"); } } /* - * irc_cmd_send_quit: disconnect from all servers and quit WeeChat + * irc_send_cmd_quit: disconnect from all servers and quit WeeChat */ int -irc_cmd_send_quit (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_quit (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_irc_server *ptr_server; @@ -1802,91 +1750,91 @@ irc_cmd_send_quit (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_quote: send raw data to server + * irc_send_cmd_quote: send raw data to server */ int -irc_cmd_send_quote (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_quote (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "%s", arguments); + irc_server_sendf (server, "%s", arguments); return 0; } /* - * irc_cmd_send_rehash: tell the server to reload its config file + * irc_send_cmd_rehash: tell the server to reload its config file */ int -irc_cmd_send_rehash (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_rehash (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; (void) arguments; - server_sendf (server, "REHASH"); + irc_server_sendf (server, "REHASH"); return 0; } /* - * irc_cmd_send_restart: tell the server to restart itself + * irc_send_cmd_restart: tell the server to restart itself */ int -irc_cmd_send_restart (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_restart (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; (void) arguments; - server_sendf (server, "RESTART"); + irc_server_sendf (server, "RESTART"); return 0; } /* - * irc_cmd_send_service: register a new service + * irc_send_cmd_service: register a new service */ int -irc_cmd_send_service (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_service (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "SERVICE %s", arguments); + irc_server_sendf (server, "SERVICE %s", arguments); return 0; } /* - * irc_cmd_send_servlist: list services currently connected to the network + * irc_send_cmd_servlist: list services currently connected to the network */ int -irc_cmd_send_servlist (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_servlist (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "SERVLIST %s", arguments); + irc_server_sendf (server, "SERVLIST %s", arguments); else - server_sendf (server, "SERVLIST"); + irc_server_sendf (server, "SERVLIST"); return 0; } /* - * irc_cmd_send_squery: deliver a message to a service + * irc_send_cmd_squery: deliver a message to a service */ int -irc_cmd_send_squery (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_squery (t_irc_server *server, t_irc_channel *channel, char *arguments) { char *pos; @@ -1903,100 +1851,100 @@ irc_cmd_send_squery (t_irc_server *server, t_irc_channel *channel, { pos++; } - server_sendf (server, "SQUERY %s :%s", arguments, pos); + irc_server_sendf (server, "SQUERY %s :%s", arguments, pos); } else - server_sendf (server, "SQUERY %s", arguments); + irc_server_sendf (server, "SQUERY %s", arguments); return 0; } /* - * irc_cmd_send_squit: disconnect server links + * irc_send_cmd_squit: disconnect server links */ int -irc_cmd_send_squit (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_squit (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "SQUIT %s", arguments); + irc_server_sendf (server, "SQUIT %s", arguments); return 0; } /* - * irc_cmd_send_stats: query statistics about server + * irc_send_cmd_stats: query statistics about server */ int -irc_cmd_send_stats (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_stats (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "STATS %s", arguments); + irc_server_sendf (server, "STATS %s", arguments); else - server_sendf (server, "STATS"); + irc_server_sendf (server, "STATS"); return 0; } /* - * irc_cmd_send_summon: give users who are on a host running an IRC server + * irc_send_cmd_summon: give users who are on a host running an IRC server * a message asking them to please join IRC */ int -irc_cmd_send_summon (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_summon (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "SUMMON %s", arguments); + irc_server_sendf (server, "SUMMON %s", arguments); return 0; } /* - * irc_cmd_send_time: query local time from server + * irc_send_cmd_time: query local time from server */ int -irc_cmd_send_time (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_time (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "TIME %s", arguments); + irc_server_sendf (server, "TIME %s", arguments); else - server_sendf (server, "TIME"); + irc_server_sendf (server, "TIME"); return 0; } /* - * irc_cmd_send_topic: get/set topic for a channel + * irc_send_cmd_topic: get/set topic for a channel */ int -irc_cmd_send_topic (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_topic (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *channel_name, *new_topic, *pos; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); channel_name = NULL; new_topic = NULL; if (arguments) { - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { channel_name = arguments; pos = strchr (arguments, ' '); @@ -2030,46 +1978,46 @@ irc_cmd_send_topic (t_irc_server *server, t_irc_channel *channel, if (new_topic) { if (strcmp (new_topic, "-delete") == 0) - server_sendf (server, "TOPIC %s :", channel_name); + irc_server_sendf (server, "TOPIC %s :", channel_name); else - server_sendf (server, "TOPIC %s :%s", channel_name, new_topic); + irc_server_sendf (server, "TOPIC %s :%s", channel_name, new_topic); } else - server_sendf (server, "TOPIC %s", channel_name); + irc_server_sendf (server, "TOPIC %s", channel_name); return 0; } /* - * irc_cmd_send_trace: find the route to specific server + * irc_send_cmd_trace: find the route to specific server */ int -irc_cmd_send_trace (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_trace (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "TRACE %s", arguments); + irc_server_sendf (server, "TRACE %s", arguments); else - server_sendf (server, "TRACE"); + irc_server_sendf (server, "TRACE"); return 0; } /* - * irc_cmd_send_unban: unbans nicks or hosts + * irc_send_cmd_unban: unbans nicks or hosts */ int -irc_cmd_send_unban (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_unban (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *pos_channel, *pos, *pos2; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (arguments) { @@ -2079,7 +2027,7 @@ irc_cmd_send_unban (t_irc_server *server, t_irc_channel *channel, { pos[0] = '\0'; - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { pos_channel = arguments; pos++; @@ -2120,7 +2068,7 @@ irc_cmd_send_unban (t_irc_server *server, t_irc_channel *channel, while (pos2[0] == ' ') pos2++; } - server_sendf (server, "MODE %s -b %s", pos_channel, pos); + irc_server_sendf (server, "MODE %s -b %s", pos_channel, pos); pos = pos2; } } @@ -2136,59 +2084,59 @@ irc_cmd_send_unban (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_userhost: return a list of information about nicknames + * irc_send_cmd_userhost: return a list of information about nicknames */ int -irc_cmd_send_userhost (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_userhost (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "USERHOST %s", arguments); + irc_server_sendf (server, "USERHOST %s", arguments); return 0; } /* - * irc_cmd_send_users: list of users logged into the server + * irc_send_cmd_users: list of users logged into the server */ int -irc_cmd_send_users (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_users (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "USERS %s", arguments); + irc_server_sendf (server, "USERS %s", arguments); else - server_sendf (server, "USERS"); + irc_server_sendf (server, "USERS"); return 0; } /* - * irc_cmd_send_version: gives the version info of nick or server (current or specified) + * irc_send_cmd_version: gives the version info of nick or server (current or specified) */ int -irc_cmd_send_version (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_version (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (arguments) { if (BUFFER_IS_CHANNEL(buffer) && - nick_search (CHANNEL(buffer), arguments)) - server_sendf (server, "PRIVMSG %s :\01VERSION\01", - arguments); + irc_nick_search (CHANNEL(buffer), arguments)) + irc_server_sendf (server, "PRIVMSG %s :\01VERSION\01", + arguments); else - server_sendf (server, "VERSION %s", - arguments); + irc_server_sendf (server, "VERSION %s", + arguments); } else { @@ -2196,29 +2144,29 @@ irc_cmd_send_version (t_irc_server *server, t_irc_channel *channel, gui_printf (server->buffer, _("%s, compiled on %s %s\n"), PACKAGE_STRING, __DATE__, __TIME__); - server_sendf (server, "VERSION"); + irc_server_sendf (server, "VERSION"); } return 0; } /* - * irc_cmd_send_voice: give voice to nickname(s) + * irc_send_cmd_voice: give voice to nickname(s) */ int -irc_cmd_send_voice (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_voice (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_CHANNEL(buffer)) { if (argc == 0) - server_sendf (server, "MODE %s +v %s", - CHANNEL(buffer)->name, - server->nick); + irc_server_sendf (server, "MODE %s +v %s", + CHANNEL(buffer)->name, + server->nick); else irc_send_mode_nicks (server, CHANNEL(buffer)->name, "+", "v", argc, argv); @@ -2235,65 +2183,65 @@ irc_cmd_send_voice (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_wallops: send a message to all currently connected users who + * irc_send_cmd_wallops: send a message to all currently connected users who * have set the 'w' user mode for themselves */ int -irc_cmd_send_wallops (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_wallops (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "WALLOPS :%s", arguments); + irc_server_sendf (server, "WALLOPS :%s", arguments); return 0; } /* - * irc_cmd_send_who: generate a query which returns a list of information + * irc_send_cmd_who: generate a query which returns a list of information */ int -irc_cmd_send_who (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_who (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "WHO %s", arguments); + irc_server_sendf (server, "WHO %s", arguments); else - server_sendf (server, "WHO"); + irc_server_sendf (server, "WHO"); return 0; } /* - * irc_cmd_send_whois: query information about user(s) + * irc_send_cmd_whois: query information about user(s) */ int -irc_cmd_send_whois (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_whois (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "WHOIS %s", arguments); + irc_server_sendf (server, "WHOIS %s", arguments); return 0; } /* - * irc_cmd_send_whowas: ask for information about a nickname which no longer exists + * irc_send_cmd_whowas: ask for information about a nickname which no longer exists */ int -irc_cmd_send_whowas (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_whowas (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "WHOWAS %s", arguments); + irc_server_sendf (server, "WHOWAS %s", arguments); return 0; } diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c index 0b6d2af30..974a8ba84 100644 --- a/src/irc/irc-server.c +++ b/src/irc/irc-server.c @@ -77,11 +77,11 @@ const int gnutls_cert_type_prio[] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 }; /* - * server_init: init server struct with default values + * irc_server_init: init server struct with default values */ void -server_init (t_irc_server *server) +irc_server_init (t_irc_server *server) { /* user choices */ server->name = NULL; @@ -138,20 +138,20 @@ server_init (t_irc_server *server) } /* - * server_init_with_url: init a server with url of this form: - * irc://nick:pass@irc.toto.org:6667 - * returns: 0 = ok - * -1 = invalid syntax + * irc_server_init_with_url: init a server with url of this form: + * irc://nick:pass@irc.toto.org:6667 + * returns: 0 = ok + * -1 = invalid syntax */ int -server_init_with_url (char *irc_url, t_irc_server *server) +irc_server_init_with_url (char *irc_url, t_irc_server *server) { char *url, *pos_server, *pos_channel, *pos, *pos2; int ipv6, ssl; struct passwd *my_passwd; - server_init (server); + irc_server_init (server); ipv6 = 0; ssl = 0; if (strncasecmp (irc_url, "irc6://", 7) == 0) @@ -233,7 +233,7 @@ server_init_with_url (char *irc_url, t_irc_server *server) server->address = strdup (pos_server); if (pos_channel && pos_channel[0]) { - if (string_is_channel (pos_channel)) + if (irc_channel_is_channel (pos_channel)) server->autojoin = strdup (pos_channel); else { @@ -262,11 +262,11 @@ server_init_with_url (char *irc_url, t_irc_server *server) } /* - * server_alloc: allocate a new server and add it to the servers queue + * irc_server_alloc: allocate a new server and add it to the servers queue */ t_irc_server * -server_alloc () +irc_server_alloc () { t_irc_server *new_server; @@ -280,7 +280,7 @@ server_alloc () } /* initialize new server */ - server_init (new_server); + irc_server_init (new_server); /* add new server to queue */ new_server->prev_server = last_irc_server; @@ -296,11 +296,12 @@ server_alloc () } /* - * server_outqueue_add: add a message in out queue + * irc_server_outqueue_add: add a message in out queue */ void -server_outqueue_add (t_irc_server *server, char *msg1, char *msg2, int modified) +irc_server_outqueue_add (t_irc_server *server, char *msg1, char *msg2, + int modified) { t_irc_outqueue *new_outqueue; @@ -322,11 +323,11 @@ server_outqueue_add (t_irc_server *server, char *msg1, char *msg2, int modified) } /* - * server_outqueue_free: free a message in out queue + * irc_server_outqueue_free: free a message in out queue */ void -server_outqueue_free (t_irc_server *server, t_irc_outqueue *outqueue) +irc_server_outqueue_free (t_irc_server *server, t_irc_outqueue *outqueue) { t_irc_outqueue *new_outqueue; @@ -353,22 +354,22 @@ server_outqueue_free (t_irc_server *server, t_irc_outqueue *outqueue) } /* - * server_outqueue_free_all: free all outqueued messages + * irc_server_outqueue_free_all: free all outqueued messages */ void -server_outqueue_free_all (t_irc_server *server) +irc_server_outqueue_free_all (t_irc_server *server) { while (server->outqueue) - server_outqueue_free (server, server->outqueue); + irc_server_outqueue_free (server, server->outqueue); } /* - * server_destroy: free server data (not struct himself) + * irc_server_destroy: free server data (not struct himself) */ void -server_destroy (t_irc_server *server) +irc_server_destroy (t_irc_server *server) { if (!server) return; @@ -409,17 +410,17 @@ server_destroy (t_irc_server *server) if (server->away_message) free (server->away_message); if (server->outqueue) - server_outqueue_free_all (server); + irc_server_outqueue_free_all (server); if (server->channels) - channel_free_all (server); + irc_channel_free_all (server); } /* - * server_free: free a server and remove it from servers queue + * irc_server_free: free a server and remove it from servers queue */ void -server_free (t_irc_server *server) +irc_server_free (t_irc_server *server) { t_irc_server *new_irc_servers; @@ -428,7 +429,7 @@ server_free (t_irc_server *server) /* close any opened channel/private */ while (server->channels) - channel_free (server, server->channels); + irc_channel_free (server, server->channels); /* remove server from queue */ if (last_irc_server == server) @@ -444,34 +445,34 @@ server_free (t_irc_server *server) if (server->next_server) (server->next_server)->prev_server = server->prev_server; - server_destroy (server); + irc_server_destroy (server); free (server); irc_servers = new_irc_servers; } /* - * server_free_all: free all allocated servers + * irc_server_free_all: free all allocated servers */ void -server_free_all () +irc_server_free_all () { /* for each server in memory, remove it */ while (irc_servers) - server_free (irc_servers); + irc_server_free (irc_servers); } /* - * server_new: creates a new server, and initialize it + * irc_server_new: creates a new server, and initialize it */ t_irc_server * -server_new (char *name, int autoconnect, int autoreconnect, - int autoreconnect_delay, int command_line, char *address, - int port, int ipv6, int ssl, char *password, - char *nick1, char *nick2, char *nick3, char *username, - char *realname, char *hostname, char *command, int command_delay, - char *autojoin, int autorejoin, char *notify_levels) +irc_server_new (char *name, int autoconnect, int autoreconnect, + int autoreconnect_delay, int command_line, char *address, + int port, int ipv6, int ssl, char *password, + char *nick1, char *nick2, char *nick3, char *username, + char *realname, char *hostname, char *command, int command_delay, + char *autojoin, int autorejoin, char *notify_levels) { t_irc_server *new_server; @@ -491,7 +492,7 @@ server_new (char *name, int autoconnect, int autoreconnect, (notify_levels) ? notify_levels : ""); #endif - if ((new_server = server_alloc ())) + if ((new_server = irc_server_alloc ())) { new_server->name = strdup (name); new_server->autoconnect = autoconnect; @@ -527,11 +528,11 @@ server_new (char *name, int autoconnect, int autoreconnect, } /* - * server_send: send data to IRC server + * irc_server_send: send data to IRC server */ int -server_send (t_irc_server *server, char *buffer, int size_buf) +irc_server_send (t_irc_server *server, char *buffer, int size_buf) { if (!server) return -1; @@ -545,11 +546,11 @@ server_send (t_irc_server *server, char *buffer, int size_buf) } /* - * server_outqueue_send: send a message from outqueue + * irc_server_outqueue_send: send a message from outqueue */ void -server_outqueue_send (t_irc_server *server) +irc_server_outqueue_send (t_irc_server *server) { time_t time_now; char *pos; @@ -579,25 +580,25 @@ server_outqueue_send (t_irc_server *server) if (pos) pos[0] = '\r'; } - if (server_send (server, server->outqueue->message_after_mod, - strlen (server->outqueue->message_after_mod)) <= 0) + if (irc_server_send (server, server->outqueue->message_after_mod, + strlen (server->outqueue->message_after_mod)) <= 0) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); gui_printf (server->buffer, _("%s error sending data to IRC server\n"), WEECHAT_ERROR); } server->last_user_message = time_now; - server_outqueue_free (server, server->outqueue); + irc_server_outqueue_free (server, server->outqueue); } } } /* - * server_send_one_msg: send one message to IRC server + * irc_server_send_one_msg: send one message to IRC server */ int -server_send_one_msg (t_irc_server *server, char *message) +irc_server_send_one_msg (t_irc_server *server, char *message) { static char buffer[4096]; char *new_msg, *ptr_msg, *pos; @@ -650,10 +651,10 @@ server_send_one_msg (t_irc_server *server, char *message) /* if queue, then only queue message and send nothing now */ if (queue) { - server_outqueue_add (server, - (new_msg && first_message) ? message : NULL, - buffer, - (new_msg) ? 1 : 0); + irc_server_outqueue_add (server, + (new_msg && first_message) ? message : NULL, + buffer, + (new_msg) ? 1 : 0); } else { @@ -661,7 +662,7 @@ server_send_one_msg (t_irc_server *server, char *message) gui_printf_raw_data (server, 1, 0, message); if (new_msg) gui_printf_raw_data (server, 1, 1, ptr_msg); - if (server_send (server, buffer, strlen (buffer)) <= 0) + if (irc_server_send (server, buffer, strlen (buffer)) <= 0) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); gui_printf (server->buffer, _("%s error sending data to IRC server\n"), @@ -694,12 +695,12 @@ server_send_one_msg (t_irc_server *server, char *message) } /* - * server_sendf: send formatted data to IRC server - * many messages may be sent, separated by '\n' + * irc_server_sendf: send formatted data to IRC server + * many messages may be sent, separated by '\n' */ void -server_sendf (t_irc_server *server, char *fmt, ...) +irc_server_sendf (t_irc_server *server, char *fmt, ...) { va_list args; static char buffer[4096]; @@ -720,7 +721,7 @@ server_sendf (t_irc_server *server, char *fmt, ...) if (pos) pos[0] = '\0'; - rc = server_send_one_msg (server, ptr_buf); + rc = irc_server_send_one_msg (server, ptr_buf); if (pos) { @@ -736,12 +737,12 @@ server_sendf (t_irc_server *server, char *fmt, ...) } /* - * server_parse_message: parse IRC message and return pointer to - * host, command and arguments (if any) + * irc_server_parse_message: parse IRC message and return pointer to + * host, command and arguments (if any) */ void -server_parse_message (char *message, char **host, char **command, char **args) +irc_server_parse_message (char *message, char **host, char **command, char **args) { char *pos, *pos2; @@ -780,11 +781,11 @@ server_parse_message (char *message, char **host, char **command, char **args) } /* - * server_msgq_add_msg: add a message to received messages queue (at the end) + * irc_server_msgq_add_msg: add a message to received messages queue (at the end) */ void -server_msgq_add_msg (t_irc_server *server, char *msg) +irc_server_msgq_add_msg (t_irc_server *server, char *msg) { t_irc_message *message; @@ -837,11 +838,11 @@ server_msgq_add_msg (t_irc_server *server, char *msg) } /* - * server_msgq_add_unterminated: add an unterminated message to queue + * irc_server_msgq_add_unterminated: add an unterminated message to queue */ void -server_msgq_add_unterminated (t_irc_server *server, char *string) +irc_server_msgq_add_unterminated (t_irc_server *server, char *string) { if (!string[0]) return; @@ -876,11 +877,11 @@ server_msgq_add_unterminated (t_irc_server *server, char *string) } /* - * server_msgq_add_buffer: explode received buffer, creating queued messages + * irc_server_msgq_add_buffer: explode received buffer, creating queued messages */ void -server_msgq_add_buffer (t_irc_server *server, char *buffer) +irc_server_msgq_add_buffer (t_irc_server *server, char *buffer) { char *pos_cr, *pos_lf; @@ -892,7 +893,7 @@ server_msgq_add_buffer (t_irc_server *server, char *buffer) if (!pos_cr && !pos_lf) { /* no CR/LF found => add to unterminated and return */ - server_msgq_add_unterminated (server, buffer); + irc_server_msgq_add_unterminated (server, buffer); return; } @@ -900,25 +901,25 @@ server_msgq_add_buffer (t_irc_server *server, char *buffer) { /* found '\r' first => ignore this char */ pos_cr[0] = '\0'; - server_msgq_add_unterminated (server, buffer); + irc_server_msgq_add_unterminated (server, buffer); buffer = pos_cr + 1; } else { /* found: '\n' first => terminate message */ pos_lf[0] = '\0'; - server_msgq_add_msg (server, buffer); + irc_server_msgq_add_msg (server, buffer); buffer = pos_lf + 1; } } } /* - * server_msgq_flush: flush message queue + * irc_server_msgq_flush: flush message queue */ void -server_msgq_flush () +irc_server_msgq_flush () { t_irc_message *next; char *ptr_data, *new_msg, *ptr_msg, *pos; @@ -970,7 +971,7 @@ server_msgq_flush () if (new_msg) gui_printf_raw_data (recv_msgq->server, 0, 1, ptr_msg); - server_parse_message (ptr_msg, &host, &command, &args); + irc_server_parse_message (ptr_msg, &host, &command, &args); switch (irc_recv_command (recv_msgq->server, ptr_msg, host, command, args)) { @@ -1027,11 +1028,11 @@ server_msgq_flush () } /* - * server_recv: receive data from an irc server + * irc_server_recv: receive data from an irc server */ void -server_recv (t_irc_server *server) +irc_server_recv (t_irc_server *server) { static char buffer[4096 + 2]; int num_read; @@ -1049,8 +1050,8 @@ server_recv (t_irc_server *server) if (num_read > 0) { buffer[num_read] = '\0'; - server_msgq_add_buffer (server, buffer); - server_msgq_flush (); + irc_server_msgq_add_buffer (server, buffer); + irc_server_msgq_flush (); } else { @@ -1058,16 +1059,16 @@ server_recv (t_irc_server *server) gui_printf (server->buffer, _("%s cannot read data from socket, disconnecting from server...\n"), WEECHAT_ERROR); - server_disconnect (server, 1); + irc_server_disconnect (server, 1); } } /* - * server_child_kill: kill child process and close pipe + * irc_server_child_kill: kill child process and close pipe */ void -server_child_kill (t_irc_server *server) +irc_server_child_kill (t_irc_server *server) { /* kill process */ if (server->child_pid > 0) @@ -1091,13 +1092,14 @@ server_child_kill (t_irc_server *server) } /* - * server_close_connection: close server connection (kill child, close socket/pipes) + * irc_server_close_connection: close server connection + * (kill child, close socket/pipes) */ void -server_close_connection (t_irc_server *server) +irc_server_close_connection (t_irc_server *server) { - server_child_kill (server); + irc_server_child_kill (server); /* close network socket */ if (server->sock != -1) @@ -1120,7 +1122,7 @@ server_close_connection (t_irc_server *server) free (server->unterminated_message); server->unterminated_message = NULL; } - server_outqueue_free_all (server); + irc_server_outqueue_free_all (server); /* server is now disconnected */ server->is_connected = 0; @@ -1128,11 +1130,11 @@ server_close_connection (t_irc_server *server) } /* - * server_reconnect_schedule: schedule reconnect for a server + * irc_server_reconnect_schedule: schedule reconnect for a server */ void -server_reconnect_schedule (t_irc_server *server) +irc_server_reconnect_schedule (t_irc_server *server) { if (server->autoreconnect) { @@ -1146,11 +1148,11 @@ server_reconnect_schedule (t_irc_server *server) } /* - * server_child_read: read connection progress from child process + * irc_server_child_read: read connection progress from child process */ void -server_child_read (t_irc_server *server) +irc_server_child_read (t_irc_server *server) { char buffer[1]; int num_read; @@ -1174,15 +1176,15 @@ server_child_read (t_irc_server *server) gui_printf (server->buffer, _("%s gnutls handshake failed\n"), WEECHAT_ERROR); - server_close_connection (server); - server_reconnect_schedule (server); + irc_server_close_connection (server); + irc_server_reconnect_schedule (server); return; } } #endif /* kill child and login to server */ - server_child_kill (server); - irc_login (server); + irc_server_child_kill (server); + irc_send_login (server); break; /* adress not found */ case '1': @@ -1195,8 +1197,8 @@ server_child_read (t_irc_server *server) gui_printf (server->buffer, _("%s address \"%s\" not found\n"), WEECHAT_ERROR, server->address); - server_close_connection (server); - server_reconnect_schedule (server); + irc_server_close_connection (server); + irc_server_reconnect_schedule (server); break; /* IP address not found */ case '2': @@ -1207,8 +1209,8 @@ server_child_read (t_irc_server *server) else gui_printf (server->buffer, _("%s IP address not found\n"), WEECHAT_ERROR); - server_close_connection (server); - server_reconnect_schedule (server); + irc_server_close_connection (server); + irc_server_reconnect_schedule (server); break; /* connection refused */ case '3': @@ -1219,8 +1221,8 @@ server_child_read (t_irc_server *server) else gui_printf (server->buffer, _("%s connection refused\n"), WEECHAT_ERROR); - server_close_connection (server); - server_reconnect_schedule (server); + irc_server_close_connection (server); + irc_server_reconnect_schedule (server); break; /* proxy fails to connect to server */ case '4': @@ -1229,8 +1231,8 @@ server_child_read (t_irc_server *server) _("%s proxy fails to establish connection to " "server (check username/password if used)\n"), WEECHAT_ERROR); - server_close_connection (server); - server_reconnect_schedule (server); + irc_server_close_connection (server); + irc_server_reconnect_schedule (server); break; /* fails to set local hostname/IP */ case '5': @@ -1238,23 +1240,22 @@ server_child_read (t_irc_server *server) gui_printf (server->buffer, _("%s unable to set local hostname/IP\n"), WEECHAT_ERROR); - server_close_connection (server); - server_reconnect_schedule (server); + irc_server_close_connection (server); + irc_server_reconnect_schedule (server); break; } } } /* - * convbase64_8x3_to_6x4 : convert 3 bytes of 8 bits in 4 bytes of 6 bits + * irc_server_convbase64_8x3_to_6x4 : convert 3 bytes of 8 bits in 4 bytes of 6 bits */ void -convbase64_8x3_to_6x4(char *from, char* to) +irc_server_convbase64_8x3_to_6x4 (char *from, char* to) { - unsigned char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - + to[0] = base64_table [ (from[0] & 0xfc) >> 2 ]; to[1] = base64_table [ ((from[0] & 0x03) << 4) + ((from[1] & 0xf0) >> 4) ]; to[2] = base64_table [ ((from[1] & 0x0f) << 2) + ((from[2] & 0xc0) >> 6) ]; @@ -1262,105 +1263,109 @@ convbase64_8x3_to_6x4(char *from, char* to) } /* - * base64encode: encode a string in base64 + * irc_server_base64encode: encode a string in base64 */ void -base64encode(char *from, char *to) +irc_server_base64encode (char *from, char *to) { - char *f, *t; int from_len; - + from_len = strlen(from); - + f = from; t = to; - - while(from_len >= 3) + + while (from_len >= 3) { - convbase64_8x3_to_6x4(f, t); - f += 3 * sizeof(*f); - t += 4 * sizeof(*t); + irc_server_convbase64_8x3_to_6x4 (f, t); + f += 3 * sizeof (*f); + t += 4 * sizeof (*t); from_len -= 3; } - + if (from_len > 0) { char rest[3] = { 0, 0, 0 }; - switch(from_len) + switch (from_len) { - case 1 : - rest[0] = f[0]; - convbase64_8x3_to_6x4(rest, t); - t[2] = t[3] = '='; - break; - case 2 : - rest[0] = f[0]; - rest[1] = f[1]; - convbase64_8x3_to_6x4(rest, t); - t[3] = '='; - break; + case 1 : + rest[0] = f[0]; + irc_server_convbase64_8x3_to_6x4 (rest, t); + t[2] = t[3] = '='; + break; + case 2 : + rest[0] = f[0]; + rest[1] = f[1]; + irc_server_convbase64_8x3_to_6x4 (rest, t); + t[3] = '='; + break; } t[4] = 0; } } /* - * pass_httpproxy: establish connection/authentification to an http proxy - * return : - * - 0 if connexion throw proxy was successful - * - 1 if connexion fails + * irc_server_pass_httpproxy: establish connection/authentification to an + * http proxy + * return : + * - 0 if connexion throw proxy was successful + * - 1 if connexion fails */ int -pass_httpproxy(int sock, char *address, int port) +irc_server_pass_httpproxy (int sock, char *address, int port) { char buffer[256]; char authbuf[128]; char authbuf_base64[196]; int n, m; - - if (strlen(cfg_proxy_username) > 0) + + if (cfg_proxy_username && cfg_proxy_username[0]) { /* authentification */ - snprintf(authbuf, sizeof(authbuf), "%s:%s", cfg_proxy_username, cfg_proxy_password); - base64encode(authbuf, authbuf_base64); - n = snprintf(buffer, sizeof(buffer), "CONNECT %s:%d HTTP/1.0\r\nProxy-Authorization: Basic %s\r\n\r\n", address, port, authbuf_base64); + snprintf (authbuf, sizeof (authbuf), "%s:%s", + cfg_proxy_username, cfg_proxy_password); + irc_server_base64encode (authbuf, authbuf_base64); + n = snprintf (buffer, sizeof (buffer), + "CONNECT %s:%d HTTP/1.0\r\nProxy-Authorization: Basic %s\r\n\r\n", + address, port, authbuf_base64); } else { /* no authentification */ - n = snprintf(buffer, sizeof(buffer), "CONNECT %s:%d HTTP/1.0\r\n\r\n", address, port); + n = snprintf (buffer, sizeof (buffer), + "CONNECT %s:%d HTTP/1.0\r\n\r\n", address, port); } - + m = send (sock, buffer, n, 0); if (n != m) return 1; - - n = recv(sock, buffer, sizeof(buffer), 0); - + + n = recv (sock, buffer, sizeof (buffer), 0); + /* success result must be like: "HTTP/1.0 200 OK" */ if (n < 12) return 1; - + if (memcmp (buffer, "HTTP/", 5) || memcmp (buffer + 9, "200", 3)) return 1; - + return 0; } /* - * resolve: resolve hostname on its IP address - * (works with ipv4 and ipv6) - * return : - * - 0 if resolution was successful - * - 1 if resolution fails + * irc_server_resolve: resolve hostname on its IP address + * (works with ipv4 and ipv6) + * return : + * - 0 if resolution was successful + * - 1 if resolution fails */ int -resolve (char *hostname, char *ip, int *version) +irc_server_resolve (char *hostname, char *ip, int *version) { char ipbuffer[NI_MAXHOST]; struct addrinfo *res; @@ -1369,7 +1374,7 @@ resolve (char *hostname, char *ip, int *version) *version = 0; res = NULL; - + if (getaddrinfo (hostname, NULL, NULL, &res) != 0) return 1; @@ -1395,21 +1400,22 @@ resolve (char *hostname, char *ip, int *version) } /* - * pass_socks4proxy: establish connection/authentification throw a socks4 proxy - * return : - * - 0 if connexion throw proxy was successful - * - 1 if connexion fails + * irc_server_pass_socks4proxy: establish connection/authentification thru a + * socks4 proxy + * return : + * - 0 if connexion thru proxy was successful + * - 1 if connexion fails */ int -pass_socks4proxy (int sock, char *address, int port, char *username) +irc_server_pass_socks4proxy (int sock, char *address, int port, char *username) { /* - * socks4 protocol is explain here: + * socks4 protocol is explained here: * http://archive.socks.permeo.com/protocol/socks4.protocol * */ - + struct s_socks4 { char version; /* 1 byte */ /* socks version : 4 or 5 */ @@ -1420,38 +1426,39 @@ pass_socks4proxy (int sock, char *address, int port, char *username) } socks4; unsigned char buffer[24]; char ip_addr[NI_MAXHOST]; - + socks4.version = 4; socks4.method = 1; socks4.port = htons (port); - resolve(address, ip_addr, NULL); + irc_server_resolve (address, ip_addr, NULL); socks4.address = inet_addr (ip_addr); - strncpy (socks4.user, username, sizeof(socks4.user) - 1); - - send (sock, (char *) &socks4, 8 + strlen(socks4.user) + 1, 0); - recv (sock, buffer, sizeof(buffer), 0); - + strncpy (socks4.user, username, sizeof (socks4.user) - 1); + + send (sock, (char *) &socks4, 8 + strlen (socks4.user) + 1, 0); + recv (sock, buffer, sizeof (buffer), 0); + if (buffer[0] == 0 && buffer[1] == 90) return 0; - + return 1; } /* - * pass_socks5proxy: establish connection/authentification throw a socks5 proxy - * return : - * - 0 if connexion throw proxy was successful - * - 1 if connexion fails + * irc_server_pass_socks5proxy: establish connection/authentification thru a + * socks5 proxy + * return : + * - 0 if connexion thru proxy was successful + * - 1 if connexion fails */ int -pass_socks5proxy(int sock, char *address, int port) +irc_server_pass_socks5proxy (int sock, char *address, int port) { /* * socks5 protocol is explained in RFC 1928 * socks5 authentication with username/pass is explained in RFC 1929 */ - + struct s_sock5 { char version; /* 1 byte */ /* socks version : 4 or 5 */ @@ -1461,23 +1468,21 @@ pass_socks5proxy(int sock, char *address, int port) unsigned char buffer[288]; int username_len, password_len, addr_len, addr_buffer_len; unsigned char *addr_buffer; - + socks5.version = 5; socks5.nmethods = 1; - - if (strlen(cfg_proxy_username) > 0) - /* with authentication */ - socks5.method = 2; + + if (cfg_proxy_username && cfg_proxy_username[0]) + socks5.method = 2; /* with authentication */ else - /* without authentication */ - socks5.method = 0; - + socks5.method = 0; /* without authentication */ + send (sock, (char *) &socks5, sizeof(socks5), 0); /* server socks5 must respond with 2 bytes */ if (recv (sock, buffer, 2, 0) != 2) return 1; - - if (strlen(cfg_proxy_username) > 0) + + if (cfg_proxy_username && cfg_proxy_username[0]) { /* with authentication */ /* -> socks server must respond with : @@ -1497,7 +1502,7 @@ pass_socks5proxy(int sock, char *address, int port) buffer[1] = (unsigned char) username_len; memcpy(buffer + 2, cfg_proxy_username, username_len); buffer[2 + username_len] = (unsigned char) password_len; - memcpy(buffer + 3 + username_len, cfg_proxy_password, password_len); + memcpy (buffer + 3 + username_len, cfg_proxy_password, password_len); send (sock, buffer, 3 + username_len + password_len, 0); @@ -1519,11 +1524,11 @@ pass_socks5proxy(int sock, char *address, int port) if (!(buffer[0] == 5 && buffer[1] == 0)) return 1; } - + /* authentication successful then giving address/port to connect */ addr_len = strlen(address); addr_buffer_len = 4 + 1 + addr_len + 2; - addr_buffer = (unsigned char *) malloc ( addr_buffer_len * sizeof(*addr_buffer)); + addr_buffer = (unsigned char *) malloc (addr_buffer_len * sizeof(*addr_buffer)); if (!addr_buffer) return 1; addr_buffer[0] = 5; /* version 5 */ @@ -1533,80 +1538,81 @@ pass_socks5proxy(int sock, char *address, int port) addr_buffer[4] = (unsigned char) addr_len; memcpy (addr_buffer + 5, address, addr_len); /* server address */ *((unsigned short *) (addr_buffer + 5 + addr_len)) = htons (port); /* server port */ - + send (sock, addr_buffer, addr_buffer_len, 0); - free(addr_buffer); - + free (addr_buffer); + /* dialog with proxy server */ if (recv (sock, buffer, 4, 0) != 4) return 1; - + if (!(buffer[0] == 5 && buffer[1] == 0)) return 1; - - switch(buffer[3]) { - /* buffer[3] = address type */ - case 1 : - /* ipv4 - * server socks return server bound address and port - * address of 4 bytes and port of 2 bytes (= 6 bytes) - */ - if (recv (sock, buffer, 6, 0) != 6) - return 1; - break; - case 3: - /* domainname - * server socks return server bound address and port - */ - /* reading address length */ - if (recv (sock, buffer, 1, 0) != 1) - return 1; - addr_len = buffer[0]; - /* reading address + port = addr_len + 2 */ - if (recv (sock, buffer, addr_len + 2, 0) != (addr_len + 2)) - return 1; - break; - case 4 : - /* ipv6 - * server socks return server bound address and port - * address of 16 bytes and port of 2 bytes (= 18 bytes) - */ - if (recv (sock, buffer, 18, 0) != 18) + + /* buffer[3] = address type */ + switch(buffer[3]) + { + case 1 : + /* ipv4 + * server socks return server bound address and port + * address of 4 bytes and port of 2 bytes (= 6 bytes) + */ + if (recv (sock, buffer, 6, 0) != 6) + return 1; + break; + case 3: + /* domainname + * server socks return server bound address and port + */ + /* reading address length */ + if (recv (sock, buffer, 1, 0) != 1) + return 1; + addr_len = buffer[0]; + /* reading address + port = addr_len + 2 */ + if (recv (sock, buffer, addr_len + 2, 0) != (addr_len + 2)) + return 1; + break; + case 4 : + /* ipv6 + * server socks return server bound address and port + * address of 16 bytes and port of 2 bytes (= 18 bytes) + */ + if (recv (sock, buffer, 18, 0) != 18) + return 1; + break; + default: return 1; - break; - default: - return 1; } - + return 0; } /* - * pass_proxy: establish connection/authentification to a proxy - * return : - * - 0 if connexion throw proxy was successful - * - 1 if connexion fails + * irc_server_pass_proxy: establish connection/authentification to a proxy + * return : + * - 0 if connexion throw proxy was successful + * - 1 if connexion fails */ int -pass_proxy (int sock, char *address, int port, char *username) +irc_server_pass_proxy (int sock, char *address, int port, char *username) { if (strcmp (cfg_proxy_type_values[cfg_proxy_type], "http") == 0) - return pass_httpproxy(sock, address, port); + return irc_server_pass_httpproxy (sock, address, port); if (strcmp (cfg_proxy_type_values[cfg_proxy_type], "socks4") == 0) - return pass_socks4proxy(sock, address, port, username); + return irc_server_pass_socks4proxy (sock, address, port, username); if (strcmp (cfg_proxy_type_values[cfg_proxy_type], "socks5") == 0) - return pass_socks5proxy(sock, address, port); - + return irc_server_pass_socks5proxy (sock, address, port); + return 1; } /* - * server_child: child process trying to connect to server + * irc_server_child: child process trying to connect to server */ int -server_child (t_irc_server *server) +irc_server_child (t_irc_server *server) { struct addrinfo hints, *res, *res_local; int rc; @@ -1651,7 +1657,7 @@ server_child (t_irc_server *server) return 0; } - if (pass_proxy(server->sock, server->address, server->port, server->username)) + if (irc_server_pass_proxy (server->sock, server->address, server->port, server->username)) { write(server->child_write, "4", 1); freeaddrinfo (res); @@ -1734,11 +1740,11 @@ server_child (t_irc_server *server) } /* - * server_connect: connect to an IRC server + * irc_server_connect: connect to an IRC server */ int -server_connect (t_irc_server *server) +irc_server_connect (t_irc_server *server) { int child_pipe[2], set; pid_t pid; @@ -1784,7 +1790,7 @@ server_connect (t_irc_server *server) } /* close any opened connection and kill child process if running */ - server_close_connection (server); + irc_server_close_connection (server); /* init SSL if asked */ server->ssl_connected = 0; @@ -1856,12 +1862,12 @@ server_connect (t_irc_server *server) { /* fork failed */ case -1: - server_close_connection (server); + irc_server_close_connection (server); return 0; /* child process */ case 0: setuid (getuid ()); - server_child (server); + irc_server_child (server); _exit (EXIT_SUCCESS); } @@ -1872,29 +1878,29 @@ server_connect (t_irc_server *server) } /* - * server_reconnect: reconnect to a server (after disconnection) + * irc_server_reconnect: reconnect to a server (after disconnection) */ void -server_reconnect (t_irc_server *server) +irc_server_reconnect (t_irc_server *server) { irc_display_prefix (server, server->buffer, PREFIX_INFO); gui_printf (server->buffer, _("%s: Reconnecting to server...\n"), PACKAGE_NAME); server->reconnect_start = 0; - if (server_connect (server)) + if (irc_server_connect (server)) server->reconnect_join = 1; else - server_reconnect_schedule (server); + irc_server_reconnect_schedule (server); } /* - * server_auto_connect: auto-connect to servers (called at startup) + * irc_server_auto_connect: auto-connect to servers (called at startup) */ void -server_auto_connect (int auto_connect, int command_line) +irc_server_auto_connect (int auto_connect, int command_line) { t_irc_server *ptr_server; @@ -1907,18 +1913,18 @@ server_auto_connect (int auto_connect, int command_line) (void) gui_buffer_new (gui_current_window, ptr_server, NULL, BUFFER_TYPE_STANDARD, 1); gui_window_redraw_buffer (gui_current_window->buffer); - if (!server_connect (ptr_server)) - server_reconnect_schedule (ptr_server); + if (!irc_server_connect (ptr_server)) + irc_server_reconnect_schedule (ptr_server); } } } /* - * server_disconnect: disconnect from an irc server + * irc_server_disconnect: disconnect from an irc server */ void -server_disconnect (t_irc_server *server, int reconnect) +irc_server_disconnect (t_irc_server *server, int reconnect) { t_irc_channel *ptr_channel; @@ -1928,7 +1934,7 @@ server_disconnect (t_irc_server *server, int reconnect) for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { - nick_free_all (ptr_channel); + irc_nick_free_all (ptr_channel); irc_display_prefix (NULL, ptr_channel->buffer, PREFIX_INFO); gui_printf (ptr_channel->buffer, _("Disconnected from server!\n")); gui_nicklist_draw (ptr_channel->buffer, 1, 1); @@ -1936,7 +1942,7 @@ server_disconnect (t_irc_server *server, int reconnect) } } - server_close_connection (server); + irc_server_close_connection (server); if (server->buffer) { @@ -1962,7 +1968,7 @@ server_disconnect (t_irc_server *server, int reconnect) server->lag_next_check = time (NULL) + cfg_irc_lag_check; if ((reconnect) && (server->autoreconnect)) - server_reconnect_schedule (server); + irc_server_reconnect_schedule (server); else server->reconnect_start = 0; @@ -1977,24 +1983,24 @@ server_disconnect (t_irc_server *server, int reconnect) } /* - * server_disconnect_all: disconnect from all irc servers + * irc_server_disconnect_all: disconnect from all irc servers */ void -server_disconnect_all () +irc_server_disconnect_all () { t_irc_server *ptr_server; for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) - server_disconnect (ptr_server, 0); + irc_server_disconnect (ptr_server, 0); } /* - * server_search: return pointer on a server with a name + * irc_server_search: return pointer on a server with a name */ t_irc_server * -server_search (char *servername) +irc_server_search (char *servername) { t_irc_server *ptr_server; @@ -2011,11 +2017,11 @@ server_search (char *servername) } /* - * server_get_number_connected: returns number of connected server + * irc_server_get_number_connected: returns number of connected server */ int -server_get_number_connected () +irc_server_get_number_connected () { t_irc_server *ptr_server; int number; @@ -2030,13 +2036,13 @@ server_get_number_connected () } /* - * server_get_number_buffer: returns position of a server and total number of - * buffers with a buffer + * irc_server_get_number_buffer: returns position of a server and total number of + * buffers with a buffer */ void -server_get_number_buffer (t_irc_server *server, - int *server_pos, int *server_total) +irc_server_get_number_buffer (t_irc_server *server, + int *server_pos, int *server_total) { t_irc_server *ptr_server; @@ -2055,12 +2061,12 @@ server_get_number_buffer (t_irc_server *server, } /* - * server_name_already_exists: return 1 if server name already exists - * otherwise return 0 + * irc_server_name_already_exists: return 1 if server name already exists + * otherwise return 0 */ int -server_name_already_exists (char *name) +irc_server_name_already_exists (char *name) { t_irc_server *ptr_server; @@ -2076,11 +2082,11 @@ server_name_already_exists (char *name) } /* - * server_remove_away: remove away for all chans/nicks (for all servers) + * irc_server_remove_away: remove away for all chans/nicks (for all servers) */ void -server_remove_away () +irc_server_remove_away () { t_irc_server *ptr_server; t_irc_channel *ptr_channel; @@ -2092,18 +2098,18 @@ server_remove_away () for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { if (ptr_channel->type == CHANNEL_TYPE_CHANNEL) - channel_remove_away (ptr_channel); + irc_channel_remove_away (ptr_channel); } } } } /* - * server_check_away: check for away on all channels (for all servers) + * irc_server_check_away: check for away on all channels (for all servers) */ void -server_check_away () +irc_server_check_away () { t_irc_server *ptr_server; t_irc_channel *ptr_channel; @@ -2115,18 +2121,18 @@ server_check_away () for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { if (ptr_channel->type == CHANNEL_TYPE_CHANNEL) - channel_check_away (ptr_server, ptr_channel, 0); + irc_channel_check_away (ptr_server, ptr_channel, 0); } } } } /* - * server_set_away: set/unset away status for a server (all channels) + * irc_server_set_away: set/unset away status for a server (all channels) */ void -server_set_away (t_irc_server *server, char *nick, int is_away) +irc_server_set_away (t_irc_server *server, char *nick, int is_away) { t_irc_channel *ptr_channel; @@ -2135,17 +2141,17 @@ server_set_away (t_irc_server *server, char *nick, int is_away) if (server->is_connected) { if (ptr_channel->type == CHANNEL_TYPE_CHANNEL) - channel_set_away (ptr_channel, nick, is_away); + irc_channel_set_away (ptr_channel, nick, is_away); } } } /* - * server_get_default_notify_level: get default notify level for server + * irc_server_get_default_notify_level: get default notify level for server */ int -server_get_default_notify_level (t_irc_server *server) +irc_server_get_default_notify_level (t_irc_server *server) { int notify, value; char *pos; @@ -2171,11 +2177,11 @@ server_get_default_notify_level (t_irc_server *server) } /* - * server_set_default_notify_level: set default notify level for server + * irc_server_set_default_notify_level: set default notify level for server */ void -server_set_default_notify_level (t_irc_server *server, int notify) +irc_server_set_default_notify_level (t_irc_server *server, int notify) { char level_string[2]; @@ -2188,11 +2194,11 @@ server_set_default_notify_level (t_irc_server *server, int notify) } /* - * server_print_log: print server infos in log (usually for crash dump) + * irc_server_print_log: print server infos in log (usually for crash dump) */ void -server_print_log (t_irc_server *server) +irc_server_print_log (t_irc_server *server) { weechat_log_printf ("[server %s (addr:0x%X)]\n", server->name, server); weechat_log_printf (" autoconnect . . . . : %d\n", server->autoconnect); diff --git a/src/irc/irc.h b/src/irc/irc.h index 47a565142..1ce76e8ab 100644 --- a/src/irc/irc.h +++ b/src/irc/irc.h @@ -70,11 +70,11 @@ else \ nick->flags &= 0xFFFF - flag; -#define server_sendf_queued(server, fmt, argz...) \ +#define irc_server_sendf_queued(server, fmt, argz...) \ if (server) \ { \ server->queue_msg = 1; \ - server_sendf(server, fmt, ##argz); \ + irc_server_sendf (server, fmt, ##argz); \ server->queue_msg = 0; \ } @@ -363,86 +363,81 @@ extern t_irc_ignore *irc_last_ignore; /* server functions (irc-server.c) */ -extern void server_init (t_irc_server *); -extern int server_init_with_url (char *, t_irc_server *); -extern t_irc_server *server_alloc (); -extern void server_outqueue_free_all (t_irc_server *); -extern void server_destroy (t_irc_server *); -extern void server_free (t_irc_server *); -extern void server_free_all (); -extern t_irc_server *server_new (char *, int, int, int, int, char *, int, int, int, - char *, char *, char *, char *, char *, char *, - char *, char *, int, char *, int, char *); -extern char *server_get_charset_decode_iso (t_irc_server *); -extern char *server_get_charset_decode_utf (t_irc_server *); -extern char *server_get_charset_encode (t_irc_server *); -extern int server_send (t_irc_server *, char *, int); -extern void server_outqueue_send (t_irc_server *); -extern void server_sendf (t_irc_server *, char *, ...); -extern void server_parse_message (char *, char **, char **, char **); -extern void server_recv (t_irc_server *); -extern void server_child_read (t_irc_server *); -extern int server_connect (t_irc_server *); -extern void server_reconnect (t_irc_server *); -extern void server_auto_connect (int, int); -extern void server_disconnect (t_irc_server *, int); -extern void server_disconnect_all (); -extern t_irc_server *server_search (char *); -extern int server_get_number_connected (); -extern void server_get_number_buffer (t_irc_server *, int *, int *); -extern int server_name_already_exists (char *); -extern void server_remove_away (); -extern void server_check_away (); -extern void server_set_away (t_irc_server *, char *, int); -extern int server_get_default_notify_level (t_irc_server *); -extern void server_set_default_notify_level (t_irc_server *, int); -extern void server_print_log (t_irc_server *); - -/* proxy functions (irc-server.c) */ -extern void convbase64_8x3_to_6x4(char *from, char* to); -extern void base64encode(char *from, char *to); -extern int pass_httpproxy(int, char*, int); -extern int resolve(char *hostname, char *ip, int *version); -extern int pass_socks4proxy(int, char*, int, char*); -extern int pass_socks5proxy(int, char*, int); -extern int pass_proxy(int, char*, int, char*); +extern void irc_server_init (t_irc_server *); +extern int irc_server_init_with_url (char *, t_irc_server *); +extern t_irc_server *irc_server_alloc (); +extern void irc_server_outqueue_free_all (t_irc_server *); +extern void irc_server_destroy (t_irc_server *); +extern void irc_server_free (t_irc_server *); +extern void irc_server_free_all (); +extern t_irc_server *irc_server_new (char *, int, int, int, int, char *, int, int, int, + char *, char *, char *, char *, char *, char *, + char *, char *, int, char *, int, char *); +extern char *irc_server_get_charset_decode_iso (t_irc_server *); +extern char *irc_server_get_charset_decode_utf (t_irc_server *); +extern char *irc_server_get_charset_encode (t_irc_server *); +extern int irc_server_send (t_irc_server *, char *, int); +extern void irc_server_outqueue_send (t_irc_server *); +extern void irc_server_sendf (t_irc_server *, char *, ...); +extern void irc_server_parse_message (char *, char **, char **, char **); +extern void irc_server_recv (t_irc_server *); +extern void irc_server_child_read (t_irc_server *); +extern void irc_server_convbase64_8x3_to_6x4 (char *, char*); +extern void irc_server_base64encode (char *, char *); +extern int irc_server_pass_httpproxy (int, char*, int); +extern int irc_server_resolve (char *, char *, int *); +extern int irc_server_pass_socks4proxy (int, char*, int, char*); +extern int irc_server_pass_socks5proxy (int, char*, int); +extern int irc_server_pass_proxy (int, char*, int, char*); +extern int irc_server_connect (t_irc_server *); +extern void irc_server_reconnect (t_irc_server *); +extern void irc_server_auto_connect (int, int); +extern void irc_server_disconnect (t_irc_server *, int); +extern void irc_server_disconnect_all (); +extern t_irc_server *irc_server_search (char *); +extern int irc_server_get_number_connected (); +extern void irc_server_get_number_buffer (t_irc_server *, int *, int *); +extern int irc_server_name_already_exists (char *); +extern void irc_server_remove_away (); +extern void irc_server_check_away (); +extern void irc_server_set_away (t_irc_server *, char *, int); +extern int irc_server_get_default_notify_level (t_irc_server *); +extern void irc_server_set_default_notify_level (t_irc_server *, int); +extern void irc_server_print_log (t_irc_server *); /* channel functions (irc-channel.c) */ -extern t_irc_channel *channel_new (t_irc_server *, int, char *); -extern void channel_free (t_irc_server *, t_irc_channel *); -extern void channel_free_all (t_irc_server *); -extern t_irc_channel *channel_search (t_irc_server *, char *); -extern t_irc_channel *channel_search_any (t_irc_server *, char *); -extern t_irc_channel *channel_search_any_without_buffer (t_irc_server *, char *); -extern t_irc_channel *channel_search_dcc (t_irc_server *, char *); -extern int string_is_channel (char *); -extern char *channel_get_charset_decode_iso (t_irc_server *, t_irc_channel *); -extern char *channel_get_charset_decode_utf (t_irc_server *, t_irc_channel *); -extern char *channel_get_charset_encode (t_irc_server *, t_irc_channel *); -extern void channel_remove_away (t_irc_channel *); -extern void channel_check_away (t_irc_server *, t_irc_channel *, int); -extern void channel_set_away (t_irc_channel *, char *, int); -extern int channel_create_dcc (t_irc_dcc *); -extern int channel_get_notify_level (t_irc_server *, t_irc_channel *); -extern void channel_set_notify_level (t_irc_server *, t_irc_channel *, int); -extern void channel_add_nick_speaking (t_irc_channel *, char *); -extern void channel_print_log (t_irc_channel *); +extern t_irc_channel *irc_channel_new (t_irc_server *, int, char *); +extern void irc_channel_free (t_irc_server *, t_irc_channel *); +extern void irc_channel_free_all (t_irc_server *); +extern t_irc_channel *irc_channel_search (t_irc_server *, char *); +extern t_irc_channel *irc_channel_search_any (t_irc_server *, char *); +extern t_irc_channel *irc_channel_search_any_without_buffer (t_irc_server *, char *); +extern t_irc_channel *irc_channel_search_dcc (t_irc_server *, char *); +extern int irc_channel_is_channel (char *); +extern void irc_channel_remove_away (t_irc_channel *); +extern void irc_channel_check_away (t_irc_server *, t_irc_channel *, int); +extern void irc_channel_set_away (t_irc_channel *, char *, int); +extern int irc_channel_create_dcc (t_irc_dcc *); +extern int irc_channel_get_notify_level (t_irc_server *, t_irc_channel *); +extern void irc_channel_set_notify_level (t_irc_server *, t_irc_channel *, int); +extern void irc_channel_add_nick_speaking (t_irc_channel *, char *); +extern void irc_channel_print_log (t_irc_channel *); /* nick functions (irc-nick.c) */ -extern int nick_find_color (t_irc_nick *); -extern t_irc_nick *nick_new (t_irc_server *, t_irc_channel *, char *, - int, int, int, int, int, int); -extern void nick_resort (t_irc_channel *, t_irc_nick *); -extern void nick_change (t_irc_channel *, t_irc_nick *, char *); -extern void nick_free (t_irc_channel *, t_irc_nick *); -extern void nick_free_all (t_irc_channel *); -extern t_irc_nick *nick_search (t_irc_channel *, char *); -extern void nick_count (t_irc_channel *, int *, int *, int *, int *, int *); -extern int nick_get_max_length (t_irc_channel *); -extern void nick_set_away (t_irc_channel *, t_irc_nick *, int); -extern void nick_print_log (t_irc_nick *); +extern int irc_nick_find_color (t_irc_nick *); +extern t_irc_nick *irc_nick_new (t_irc_server *, t_irc_channel *, char *, + int, int, int, int, int, int); +extern void irc_nick_resort (t_irc_channel *, t_irc_nick *); +extern void irc_nick_change (t_irc_channel *, t_irc_nick *, char *); +extern void irc_nick_free (t_irc_channel *, t_irc_nick *); +extern void irc_nick_free_all (t_irc_channel *); +extern t_irc_nick *irc_nick_search (t_irc_channel *, char *); +extern void irc_nick_count (t_irc_channel *, int *, int *, int *, int *, int *); +extern int irc_nick_get_max_length (t_irc_channel *); +extern void irc_nick_set_away (t_irc_channel *, t_irc_nick *, int); +extern void irc_nick_print_log (t_irc_nick *); /* mode functions (irc-mode.c) */ @@ -452,28 +447,27 @@ extern int irc_mode_nick_prefix_allowed (t_irc_server *, char); /* DCC functions (irc-dcc.c) */ -extern void dcc_redraw (int); -extern void dcc_free (t_irc_dcc *); -extern void dcc_close (t_irc_dcc *, int); -extern void dcc_chat_remove_channel (t_irc_channel *); -extern void dcc_accept (t_irc_dcc *); -extern void dcc_accept_resume (t_irc_server *, char *, int, unsigned long); -extern void dcc_start_resume (t_irc_server *, char *, int, unsigned long); -extern t_irc_dcc *dcc_alloc (); -extern t_irc_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, int, - char *, char *, unsigned long); -extern void dcc_send_request (t_irc_server *, int, char *, char *); -extern void dcc_chat_sendf (t_irc_dcc *, char *, ...); -extern void dcc_file_send_fork (t_irc_dcc *); -extern void dcc_file_recv_fork (t_irc_dcc *); -extern void dcc_handle (); -extern void dcc_end (); -extern void dcc_print_log (); +extern void irc_dcc_redraw (int); +extern void irc_dcc_free (t_irc_dcc *); +extern void irc_dcc_close (t_irc_dcc *, int); +extern void irc_dcc_chat_remove_channel (t_irc_channel *); +extern void irc_dcc_accept (t_irc_dcc *); +extern void irc_dcc_accept_resume (t_irc_server *, char *, int, unsigned long); +extern void irc_dcc_start_resume (t_irc_server *, char *, int, unsigned long); +extern t_irc_dcc *irc_dcc_alloc (); +extern t_irc_dcc *irc_dcc_add (t_irc_server *, int, unsigned long, int, char *, int, + char *, char *, unsigned long); +extern void irc_dcc_send_request (t_irc_server *, int, char *, char *); +extern void irc_dcc_chat_sendf (t_irc_dcc *, char *, ...); +extern void irc_dcc_file_send_fork (t_irc_dcc *); +extern void irc_dcc_file_recv_fork (t_irc_dcc *); +extern void irc_dcc_handle (); +extern void irc_dcc_end (); +extern void irc_dcc_print_log (); /* IRC display (irc-diplay.c) */ -extern void irc_find_context (t_irc_server *, t_irc_channel *, - t_gui_window **, t_gui_buffer **); +extern void irc_display_hide_password (char *, int); extern void irc_display_prefix (t_irc_server *, t_gui_buffer *, char *); extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, char *, int, int, int, int); @@ -484,142 +478,141 @@ extern void irc_display_server (t_irc_server *ptr_server); /* IRC commands issued by user (irc-send.c) */ -extern void irc_login (t_irc_server *); -extern void irc_hide_password (char *, int); -extern int irc_cmd_send_admin (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_ame (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_amsg (t_irc_server *, t_irc_channel *, char *); +extern void irc_send_login (t_irc_server *); +extern int irc_send_cmd_admin (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_ame (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_amsg (t_irc_server *, t_irc_channel *, char *); extern void irc_send_away (t_irc_server *, char *); -extern int irc_cmd_send_away (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_ban (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_ctcp (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_cycle (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_dehalfop (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_deop (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_devoice (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_die (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_halfop (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_info (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_invite (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_ison (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_join (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_kick (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_kickban (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_kill (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_links (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_list (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_lusers (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_me (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_mode (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_away (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_ban (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_ctcp (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_cycle (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_dehalfop (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_deop (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_devoice (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_die (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_halfop (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_info (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_invite (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_ison (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_join (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_kick (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_kickban (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_kill (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_links (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_list (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_lusers (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_me (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_mode (t_irc_server *, t_irc_channel *, char *); extern void irc_send_mode_nicks (t_irc_server *, char *, char *, char *, int, char **); -extern int irc_cmd_send_motd (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_msg (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_names (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_nick (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_notice (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_op (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_oper (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_part (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_ping (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_pong (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_query (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_motd (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_msg (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_names (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_nick (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_notice (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_op (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_oper (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_part (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_ping (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_pong (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_query (t_irc_server *, t_irc_channel *, char *); extern void irc_send_quit_server (t_irc_server *, char *); -extern int irc_cmd_send_quit (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_quote (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_rehash (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_restart (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_service (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_servlist (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_squery (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_squit (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_stats (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_summon (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_time (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_topic (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_trace (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_unban (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_userhost (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_users (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_version (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_voice (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_wallops (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_who (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_whois (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_whowas (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_quit (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_quote (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_rehash (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_restart (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_service (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_servlist (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_squery (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_squit (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_stats (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_summon (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_time (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_topic (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_trace (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_unban (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_userhost (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_users (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_version (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_voice (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_wallops (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_who (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_whois (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_whowas (t_irc_server *, t_irc_channel *, char *); /* IRC commands executed when received from server (irc-recv.c) */ -extern int irc_is_highlight (char *, char *); +extern int irc_recv_is_highlight (char *, char *); extern int irc_recv_command (t_irc_server *, char *, char *, char *, char *); -extern int irc_cmd_recv_error (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_invite (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_join (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_kick (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_kill (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_mode (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_nick (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_notice (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_part (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_ping (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_pong (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_privmsg (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_quit (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_server_mode_reason (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_server_msg (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_server_reply (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_topic (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_wallops (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_001 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_005 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_221 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_301 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_302 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_303 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_305 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_306 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_whois_nick_msg (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_310 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_311 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_312 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_314 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_315 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_317 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_319 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_321 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_322 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_323 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_324 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_329 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_331 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_332 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_333 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_338 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_341 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_344 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_345 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_348 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_349 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_351 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_352 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_353 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_365 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_366 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_367 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_368 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_378 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_432 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_433 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_438 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_671 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_error (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_invite (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_join (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_kick (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_kill (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_mode (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_nick (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_notice (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_part (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_ping (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_pong (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_privmsg (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_quit (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_server_mode_reason (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_server_msg (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_server_reply (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_topic (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_wallops (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_001 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_005 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_221 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_301 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_302 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_303 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_305 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_306 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_whois_nick_msg (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_310 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_311 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_312 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_314 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_315 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_317 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_319 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_321 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_322 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_323 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_324 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_329 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_331 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_332 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_333 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_338 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_341 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_344 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_345 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_348 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_349 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_351 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_352 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_353 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_365 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_366 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_367 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_368 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_378 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_432 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_433 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_438 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_671 (t_irc_server *, char *, char *, char *); /* ignore functions (irc-ignore.c) */ -extern int ignore_check (char *, char *, char *, char *); -extern t_irc_ignore *ignore_add (char *, char *, char *, char *); -extern t_irc_ignore *ignore_add_from_config (char *); -extern void ignore_free_all (); -extern int ignore_search_free (char *, char *, char *, char *); -extern int ignore_search_free_by_number (int); -extern void ignore_print_log (); +extern int irc_ignore_check (char *, char *, char *, char *); +extern t_irc_ignore *irc_ignore_add (char *, char *, char *, char *); +extern t_irc_ignore *irc_ignore_add_from_config (char *); +extern void irc_ignore_free_all (); +extern int irc_ignore_search_free (char *, char *, char *, char *); +extern int irc_ignore_search_free_by_number (int); +extern void irc_ignore_print_log (); #endif /* irc.h */ diff --git a/src/plugins/plugins-interface.c b/src/plugins/plugins-interface.c index c54caac70..b1bb6414c 100644 --- a/src/plugins/plugins-interface.c +++ b/src/plugins/plugins-interface.c @@ -833,7 +833,7 @@ weechat_plugin_set_config (t_weechat_plugin *plugin, char *option, char *value) { strncpy (server_name, option, pos - option); server_name[pos - option] = '\0'; - ptr_server = server_search (server_name); + ptr_server = irc_server_search (server_name); free (server_name); if (ptr_server) return (config_set_server_value (ptr_server, pos + 1, value) == 0); @@ -899,8 +899,8 @@ weechat_plugin_set_plugin_config (t_weechat_plugin *plugin, char *option, char * /* * weechat_plugin_get_server_info: get list of server info - * WARNING: caller has to free structure returned - * by this function after use + * WARNING: caller has to free structure returned + * by this function after use */ t_plugin_server_info * @@ -945,6 +945,7 @@ weechat_plugin_get_server_info (t_weechat_plugin *plugin) new_server_info->ssl_connected = ptr_server->ssl_connected; new_server_info->nick = (ptr_server->nick) ? strdup (ptr_server->nick) : strdup (""); new_server_info->nick_modes = (ptr_server->nick_modes) ? strdup (ptr_server->nick_modes) : strdup (""); + new_server_info->prefix = (ptr_server->prefix) ? strdup (ptr_server->prefix) : strdup (""); new_server_info->is_away = ptr_server->is_away; new_server_info->away_time = ptr_server->away_time; new_server_info->lag = ptr_server->lag; @@ -1005,6 +1006,8 @@ weechat_plugin_free_server_info (t_weechat_plugin *plugin, t_plugin_server_info free (server_info->nick); if (server_info->nick_modes) free (server_info->nick_modes); + if (server_info->prefix) + free (server_info->prefix); new_server_info = server_info->next_server; free (server_info); server_info = new_server_info; @@ -1027,7 +1030,7 @@ weechat_plugin_get_channel_info (t_weechat_plugin *plugin, char *server) if (!plugin || !server || !server[0]) return NULL; - ptr_server = server_search (server); + ptr_server = irc_server_search (server); if (!ptr_server) return NULL; @@ -1111,11 +1114,11 @@ weechat_plugin_get_nick_info (t_weechat_plugin *plugin, char *server, char *chan if (!plugin || !server || !server[0] || !channel || !channel[0]) return NULL; - ptr_server = server_search (server); + ptr_server = irc_server_search (server); if (!ptr_server) return NULL; - ptr_channel = channel_search (ptr_server, channel); + ptr_channel = irc_channel_search (ptr_server, channel); if (!ptr_channel) return NULL; diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c index 5650b6d10..2013965a9 100644 --- a/src/plugins/plugins.c +++ b/src/plugins/plugins.c @@ -90,7 +90,7 @@ plugin_find_server_channel (char *server, char *channel, { if (server && server[0]) { - (*ptr_server) = server_search (server); + (*ptr_server) = irc_server_search (server); if (!(*ptr_server)) return -1; } @@ -104,7 +104,7 @@ plugin_find_server_channel (char *server, char *channel, if (channel && channel[0]) { if ((*ptr_server)) - (*ptr_channel) = channel_search ((*ptr_server), channel); + (*ptr_channel) = irc_channel_search ((*ptr_server), channel); if (!(*ptr_channel)) return -1; } diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c index 6526507ec..01d28a898 100644 --- a/src/plugins/scripts/lua/weechat-lua.c +++ b/src/plugins/scripts/lua/weechat-lua.c @@ -1731,6 +1731,10 @@ weechat_lua_get_server_info (lua_State *L) lua_pushstring (lua_current_interpreter, "nick_modes"); lua_pushstring (lua_current_interpreter, ptr_server->nick_modes); lua_rawset (lua_current_interpreter, -3); + + lua_pushstring (lua_current_interpreter, "prefix"); + lua_pushstring (lua_current_interpreter, ptr_server->prefix); + lua_rawset (lua_current_interpreter, -3); lua_pushstring (lua_current_interpreter, "away_time"); lua_pushstring (lua_current_interpreter, timebuffer); diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index 66418273f..3015de34f 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -1483,6 +1483,7 @@ static XS (XS_weechat_get_server_info) hv_store (server_hash_member, "ssl_connected", 13, newSViv (ptr_server->ssl_connected), 0); hv_store (server_hash_member, "nick", 4, newSVpv (ptr_server->nick, 0), 0); hv_store (server_hash_member, "nick_modes", 10, newSVpv (ptr_server->nick_modes, 0), 0); + hv_store (server_hash_member, "prefix", 6, newSVpv (ptr_server->prefix, 0), 0); hv_store (server_hash_member, "away_time", 9, newSVpv (timebuffer, 0), 0); hv_store (server_hash_member, "lag", 3, newSViv (ptr_server->lag), 0); diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index ca73eafb4..ff0e69485 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -1612,6 +1612,12 @@ weechat_python_get_server_info (PyObject *self, PyObject *args) PyDict_SetItem(server_hash_member, key, value); Py_DECREF (key); Py_DECREF (value); + + key = Py_BuildValue("s", "prefix"); + value = Py_BuildValue("s", ptr_server->prefix); + PyDict_SetItem(server_hash_member, key, value); + Py_DECREF (key); + Py_DECREF (value); key = Py_BuildValue("s", "away_time"); value = Py_BuildValue("s", timebuffer); diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c index acd35fc3e..233ac0091 100644 --- a/src/plugins/scripts/ruby/weechat-ruby.c +++ b/src/plugins/scripts/ruby/weechat-ruby.c @@ -1707,6 +1707,8 @@ weechat_ruby_get_server_info (VALUE class) rb_str_new2(ptr_server->nick)); rb_hash_aset (server_hash_member, rb_str_new2("nick_modes"), rb_str_new2(ptr_server->nick_modes)); + rb_hash_aset (server_hash_member, rb_str_new2("prefix"), + rb_str_new2(ptr_server->prefix)); rb_hash_aset (server_hash_member, rb_str_new2("away_time"), rb_str_new2(timebuffer)); rb_hash_aset (server_hash_member, rb_str_new2("lag"), diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 12bae1ed1..827ca5890 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -107,6 +107,7 @@ struct t_plugin_server_info int ssl_connected; /* = 1 if connected with SSL */ char *nick; /* current nickname */ char *nick_modes; /* nick modes */ + char *prefix; /* nick prefix allowed */ int is_away; /* 1 is user is marker as away */ time_t away_time; /* time() when user marking as away */ int lag; /* lag (in milliseconds) */ diff --git a/weechat/src/common/command.c b/weechat/src/common/command.c index 311ac3868..98ffdcc28 100644 --- a/weechat/src/common/command.c +++ b/weechat/src/common/command.c @@ -679,7 +679,7 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string strcat (unknown_command, " :"); strcat (unknown_command, ptr_args); } - irc_cmd_send_quote (server, channel, unknown_command); + irc_send_cmd_quote (server, channel, unknown_command); free (unknown_command); } } @@ -725,7 +725,7 @@ user_message_display (t_irc_server *server, t_gui_buffer *buffer, char *text) } else { - ptr_nick = nick_search (CHANNEL(buffer), server->nick); + ptr_nick = irc_nick_search (CHANNEL(buffer), server->nick); if (ptr_nick) { irc_display_nick (buffer, ptr_nick, NULL, @@ -783,7 +783,7 @@ user_message (t_irc_server *server, t_gui_buffer *buffer, char *text) next = pos; } - server_sendf_queued (server, "PRIVMSG %s :%s", CHANNEL(buffer)->name, text); + irc_server_sendf_queued (server, "PRIVMSG %s :%s", CHANNEL(buffer)->name, text); user_message_display (server, buffer, text); if (next) @@ -854,7 +854,7 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o if (pos) pos[0] = '\0'; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (is_command (ptr_cmd)) { @@ -881,9 +881,9 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o } else { - dcc_chat_sendf ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat), - "%s\r\n", - (command_with_colors) ? command_with_colors : ptr_cmd); + irc_dcc_chat_sendf ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat), + "%s\r\n", + (command_with_colors) ? command_with_colors : ptr_cmd); user_message_display (server, buffer, (command_with_colors) ? command_with_colors : ptr_cmd); @@ -1090,7 +1090,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, char *error, *pos, **argv; int argc, target_buffer, count; - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); argv = explode_string (arguments, " ", 0, &argc); @@ -1180,7 +1180,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, free_exploded_string (argv); return -1; } - server_disconnect (SERVER(buffer), 0); + irc_server_disconnect (SERVER(buffer), 0); ptr_server = SERVER(buffer); if (!buffer->all_servers) { @@ -1205,7 +1205,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, ptr_server = SERVER(buffer); ptr_channel = CHANNEL(buffer); gui_buffer_free (ptr_channel->buffer, 1); - channel_free (ptr_server, ptr_channel); + irc_channel_free (ptr_server, ptr_channel); gui_status_draw (gui_current_window->buffer, 1); gui_input_draw (gui_current_window->buffer, 1); } @@ -1221,7 +1221,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, if (pos) pos += 6; CHANNEL(buffer)->close = 1; - irc_cmd_send_part (SERVER(buffer), + irc_send_cmd_part (SERVER(buffer), CHANNEL(buffer), pos); } @@ -1231,7 +1231,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, ptr_server = SERVER(buffer); gui_buffer_free (buffer, 1); if (ptr_channel) - channel_free (ptr_server, ptr_channel); + irc_channel_free (ptr_server, ptr_channel); } } else @@ -1256,7 +1256,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, { gui_printf (NULL, " %s:%d", ptr_server->name, - server_get_default_notify_level (ptr_server)); + irc_server_get_default_notify_level (ptr_server)); count++; } } @@ -1315,8 +1315,8 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, } if (BUFFER_IS_SERVER(buffer)) { - server_set_default_notify_level (SERVER(buffer), - number); + irc_server_set_default_notify_level (SERVER(buffer), + number); irc_display_prefix (NULL, NULL, PREFIX_INFO); gui_printf (NULL, _("New default notify level for server %s%s%s: %s%d %s"), GUI_COLOR(COLOR_WIN_CHAT_SERVER), @@ -1328,9 +1328,9 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, } else { - channel_set_notify_level (SERVER(buffer), - CHANNEL(buffer), - number); + irc_channel_set_notify_level (SERVER(buffer), + CHANNEL(buffer), + number); irc_display_prefix (NULL, NULL, PREFIX_INFO); gui_printf (NULL, _("New notify level for %s%s%s: %s%d %s"), GUI_COLOR(COLOR_WIN_CHAT_CHANNEL), @@ -1418,7 +1418,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel, ptr_buffer = gui_buffer_search (argv[0], argv[1]); else { - if (string_is_channel (argv[0])) + if (irc_channel_is_channel (argv[0])) ptr_buffer = gui_buffer_search (NULL, argv[0]); else ptr_buffer = gui_buffer_search (argv[0], NULL); @@ -1512,7 +1512,7 @@ weechat_cmd_clear (t_irc_server *server, t_irc_channel *channel, } else { - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); gui_buffer_clear (buffer); } @@ -1549,7 +1549,7 @@ weechat_cmd_connect_one_server (t_irc_server *server, t_gui_window *window) BUFFER_TYPE_STANDARD, 1)) return 0; } - if (server_connect (server)) + if (irc_server_connect (server)) { server->reconnect_start = 0; server->reconnect_join = (server->channels) ? 1 : 0; @@ -1573,7 +1573,7 @@ weechat_cmd_connect (t_irc_server *server, t_irc_channel *channel, t_irc_server *ptr_server; int i, connect_ok; - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); if (argc == 0) connect_ok = weechat_cmd_connect_one_server (server, window); @@ -1597,7 +1597,7 @@ weechat_cmd_connect (t_irc_server *server, t_irc_channel *channel, { for (i = 0; i < argc; i++) { - ptr_server = server_search (argv[i]); + ptr_server = irc_server_search (argv[i]); if (ptr_server) { if (!weechat_cmd_connect_one_server (ptr_server, window)) @@ -1631,7 +1631,7 @@ weechat_cmd_dcc (t_irc_server *server, t_irc_channel *channel, t_gui_buffer *buffer; char *pos_nick, *pos_file; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); /* DCC SEND file */ if (strncasecmp (arguments, "send", 4) == 0) @@ -1662,7 +1662,7 @@ weechat_cmd_dcc (t_irc_server *server, t_irc_channel *channel, while (pos_file[0] == ' ') pos_file++; - dcc_send_request (server, DCC_FILE_SEND, pos_nick, pos_file); + irc_dcc_send_request (server, DCC_FILE_SEND, pos_nick, pos_file); } /* DCC CHAT */ else if (strncasecmp (arguments, "chat", 4) == 0) @@ -1679,7 +1679,7 @@ weechat_cmd_dcc (t_irc_server *server, t_irc_channel *channel, while (pos_nick[0] == ' ') pos_nick++; - dcc_send_request (server, DCC_CHAT_SEND, pos_nick, NULL); + irc_dcc_send_request (server, DCC_CHAT_SEND, pos_nick, NULL); } /* close DCC CHAT */ else if (ascii_strcasecmp (arguments, "close") == 0) @@ -1687,8 +1687,8 @@ weechat_cmd_dcc (t_irc_server *server, t_irc_channel *channel, if (BUFFER_IS_PRIVATE(buffer) && CHANNEL(buffer)->dcc_chat) { - dcc_close ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat), DCC_ABORTED); - dcc_redraw (1); + irc_dcc_close ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat), DCC_ABORTED); + irc_dcc_redraw (1); } } /* unknown DCC action */ @@ -1781,7 +1781,7 @@ weechat_cmd_debug (t_irc_server *server, t_irc_channel *channel, for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - server_outqueue_free_all (ptr_server); + irc_server_outqueue_free_all (ptr_server); } gui_printf_nolog (NULL, "\n"); gui_printf_nolog (NULL, "DEBUG: outqueue DELETED for all servers.\n"); @@ -1822,7 +1822,7 @@ weechat_cmd_disconnect_one_server (t_irc_server *server) _("Auto-reconnection is cancelled\n")); } irc_send_quit_server (server, NULL); - server_disconnect (server, 0); + irc_server_disconnect (server, 0); gui_status_draw (server->buffer, 1); /* disconnect ok */ @@ -1841,7 +1841,7 @@ weechat_cmd_disconnect (t_irc_server *server, t_irc_channel *channel, t_irc_server *ptr_server; int i, disconnect_ok; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (argc == 0) disconnect_ok = weechat_cmd_disconnect_one_server (server); @@ -1866,7 +1866,7 @@ weechat_cmd_disconnect (t_irc_server *server, t_irc_channel *channel, { for (i = 0; i < argc; i++) { - ptr_server = server_search (argv[i]); + ptr_server = irc_server_search (argv[i]); if (ptr_server) { if (!weechat_cmd_disconnect_one_server (ptr_server)) @@ -2072,7 +2072,7 @@ weechat_cmd_history (t_irc_server *server, t_irc_channel *channel, int n_total; int n_user; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); n_user = cfg_history_display_default; @@ -2148,7 +2148,7 @@ weechat_cmd_ignore (t_irc_server *server, t_irc_channel *channel, t_irc_ignore *ptr_ignore; int i; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); ptr_ignore = NULL; switch (argc) @@ -2180,22 +2180,22 @@ weechat_cmd_ignore (t_irc_server *server, t_irc_channel *channel, return 0; break; case 1: - ptr_ignore = ignore_add (argv[0], "*", "*", - (SERVER(buffer)) ? - SERVER(buffer)->name : "*"); + ptr_ignore = irc_ignore_add (argv[0], "*", "*", + (SERVER(buffer)) ? + SERVER(buffer)->name : "*"); break; case 2: - ptr_ignore = ignore_add (argv[0], argv[1], "*", - (SERVER(buffer)) ? - SERVER(buffer)->name : "*"); + ptr_ignore = irc_ignore_add (argv[0], argv[1], "*", + (SERVER(buffer)) ? + SERVER(buffer)->name : "*"); break; case 3: - ptr_ignore = ignore_add (argv[0], argv[1], argv[2], - (SERVER(buffer)) ? - SERVER(buffer)->name : "*"); + ptr_ignore = irc_ignore_add (argv[0], argv[1], argv[2], + (SERVER(buffer)) ? + SERVER(buffer)->name : "*"); break; case 4: - ptr_ignore = ignore_add (argv[0], argv[1], argv[2], argv[3]); + ptr_ignore = irc_ignore_add (argv[0], argv[1], argv[2], argv[3]); break; } if (ptr_ignore) @@ -2253,7 +2253,7 @@ weechat_cmd_key (t_irc_server *server, t_irc_channel *channel, t_gui_key *ptr_key; void (*ptr_function)(t_gui_window *, char *); - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); if (arguments) { @@ -2756,8 +2756,8 @@ weechat_cmd_reconnect_one_server (t_irc_server *server) return 0; } irc_send_quit_server (server, NULL); - server_disconnect (server, 0); - if (server_connect (server)) + irc_server_disconnect (server, 0); + if (irc_server_connect (server)) { server->reconnect_start = 0; server->reconnect_join = (server->channels) ? 1 : 0; @@ -2780,7 +2780,7 @@ weechat_cmd_reconnect (t_irc_server *server, t_irc_channel *channel, t_irc_server *ptr_server; int i, reconnect_ok; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (argc == 0) reconnect_ok = weechat_cmd_reconnect_one_server (server); @@ -2804,7 +2804,7 @@ weechat_cmd_reconnect (t_irc_server *server, t_irc_channel *channel, { for (i = 0; i < argc; i++) { - ptr_server = server_search (argv[i]); + ptr_server = irc_server_search (argv[i]); if (ptr_server) { if (!weechat_cmd_reconnect_one_server (ptr_server)) @@ -2883,7 +2883,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, t_gui_buffer *ptr_buffer; char *server_name; - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); if ((argc == 0) || (argc == 1)) { @@ -2906,7 +2906,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, } else { - ptr_server = server_search (argv[0]); + ptr_server = irc_server_search (argv[0]); if (ptr_server) irc_display_server (ptr_server); else @@ -2937,7 +2937,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, } /* look for server by name */ - server_found = server_search (argv[1]); + server_found = irc_server_search (argv[1]); if (!server_found) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); @@ -2967,7 +2967,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, server_name = strdup (server_found->name); - server_free (server_found); + irc_server_free (server_found); irc_display_prefix (NULL, NULL, PREFIX_INFO); gui_printf (NULL, _("Server %s%s%s has been deleted\n"), @@ -2983,7 +2983,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, } /* init server struct */ - server_init (&server_tmp); + irc_server_init (&server_tmp); if (argc < 3) { @@ -2991,17 +2991,17 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing parameters for \"%s\" command\n"), WEECHAT_ERROR, "server"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } - if (server_name_already_exists (argv[0])) + if (irc_server_name_already_exists (argv[0])) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); gui_printf (NULL, _("%s server \"%s\" already exists, can't create it!\n"), WEECHAT_ERROR, argv[0]); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } @@ -3030,7 +3030,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-pwd"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } server_tmp.password = strdup (argv[++i]); @@ -3043,7 +3043,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing nick(s) for \"%s\" parameter\n"), WEECHAT_ERROR, "-nicks"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } server_tmp.nick1 = strdup (argv[++i]); @@ -3058,7 +3058,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-username"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } server_tmp.username = strdup (argv[++i]); @@ -3071,7 +3071,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-realname"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } server_tmp.realname = strdup (argv[++i]); @@ -3084,7 +3084,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing command for \"%s\" parameter\n"), WEECHAT_ERROR, "-command"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } server_tmp.command = strdup (argv[++i]); @@ -3097,7 +3097,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-autojoin"); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } server_tmp.autojoin = strdup (argv[++i]); @@ -3106,16 +3106,16 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, } /* create new server */ - new_server = server_new (server_tmp.name, server_tmp.autoconnect, - server_tmp.autoreconnect, - server_tmp.autoreconnect_delay, - 0, server_tmp.address, server_tmp.port, - server_tmp.ipv6, server_tmp.ssl, - server_tmp.password, server_tmp.nick1, - server_tmp.nick2, server_tmp.nick3, - server_tmp.username, server_tmp.realname, - server_tmp.hostname, - server_tmp.command, 1, server_tmp.autojoin, 1, NULL); + new_server = irc_server_new (server_tmp.name, server_tmp.autoconnect, + server_tmp.autoreconnect, + server_tmp.autoreconnect_delay, + 0, server_tmp.address, server_tmp.port, + server_tmp.ipv6, server_tmp.ssl, + server_tmp.password, server_tmp.nick1, + server_tmp.nick2, server_tmp.nick3, + server_tmp.username, server_tmp.realname, + server_tmp.hostname, + server_tmp.command, 1, server_tmp.autojoin, 1, NULL); if (new_server) { irc_display_prefix (NULL, NULL, PREFIX_INFO); @@ -3130,7 +3130,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, gui_printf (NULL, _("%s unable to create server\n"), WEECHAT_ERROR); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); return -1; } @@ -3138,10 +3138,10 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel, { (void) gui_buffer_new (window, new_server, NULL, BUFFER_TYPE_STANDARD, 1); - server_connect (new_server); + irc_server_connect (new_server); } - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); } return 0; } @@ -3198,7 +3198,7 @@ weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *val { if (cfg_log_hide_nickserv_pwd) { - irc_hide_password (value2, 1); + irc_display_hide_password (value2, 1); if (strcmp (*((char **)value), value2) != 0) gui_printf (NULL, _("%s(password hidden) "), GUI_COLOR(COLOR_WIN_CHAT)); @@ -3294,7 +3294,7 @@ weechat_cmd_set (t_irc_server *server, t_irc_channel *channel, { /* server config option modification */ pos[0] = '\0'; - ptr_server = server_search (option); + ptr_server = irc_server_search (option); if (!ptr_server) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); @@ -3754,7 +3754,7 @@ weechat_cmd_unignore (t_irc_server *server, t_irc_channel *channel, char *error; int number, ret; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); ret = 0; switch (argc) @@ -3768,24 +3768,24 @@ weechat_cmd_unignore (t_irc_server *server, t_irc_channel *channel, error = NULL; number = strtol (argv[0], &error, 10); if ((error) && (error[0] == '\0')) - ret = ignore_search_free_by_number (number); + ret = irc_ignore_search_free_by_number (number); else - ret = ignore_search_free (argv[0], "*", "*", - (SERVER(buffer)) ? - SERVER(buffer)->name : "*"); + ret = irc_ignore_search_free (argv[0], "*", "*", + (SERVER(buffer)) ? + SERVER(buffer)->name : "*"); break; case 2: - ret = ignore_search_free (argv[0], argv[1], "*", - (SERVER(buffer)) ? - SERVER(buffer)->name : "*"); + ret = irc_ignore_search_free (argv[0], argv[1], "*", + (SERVER(buffer)) ? + SERVER(buffer)->name : "*"); break; case 3: - ret = ignore_search_free (argv[0], argv[1], argv[2], - (SERVER(buffer)) ? - SERVER(buffer)->name : "*"); + ret = irc_ignore_search_free (argv[0], argv[1], argv[2], + (SERVER(buffer)) ? + SERVER(buffer)->name : "*"); break; case 4: - ret = ignore_search_free (argv[0], argv[1], argv[2], argv[3]); + ret = irc_ignore_search_free (argv[0], argv[1], argv[2], argv[3]); break; } @@ -3934,7 +3934,7 @@ weechat_cmd_uptime (t_irc_server *server, t_irc_channel *channel, int day, hour, min, sec; char string[256]; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); running_time = time (NULL) - weechat_start_time; day = running_time / (60 * 60 * 24); @@ -3998,7 +3998,7 @@ weechat_cmd_window (t_irc_server *server, t_irc_channel *channel, char *error; long number; - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); if ((argc == 0) || ((argc == 1) && (ascii_strcasecmp (argv[0], "list") == 0))) { diff --git a/weechat/src/common/completion.c b/weechat/src/common/completion.c index 91263bbbd..9910637ed 100644 --- a/weechat/src/common/completion.c +++ b/weechat/src/common/completion.c @@ -578,7 +578,8 @@ completion_list_add_channel_nicks (t_completion *completion) for (ptr_weelist = ((t_irc_channel *)(completion->channel))->nicks_speaking; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (nick_search ((t_irc_channel *)(completion->channel), ptr_weelist->data)) + if (irc_nick_search ((t_irc_channel *)(completion->channel), + ptr_weelist->data)) completion_list_add (completion, ptr_weelist->data, 1, WEELIST_POS_BEGINNING); } @@ -1418,7 +1419,8 @@ completion_nick (t_completion *completion) for (ptr_weelist = ((t_irc_channel *)(completion->channel))->nicks_speaking; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (nick_search ((t_irc_channel *)(completion->channel), ptr_weelist->data)) + if (irc_nick_search ((t_irc_channel *)(completion->channel), + ptr_weelist->data)) weelist_add (&(completion->completion_list), &(completion->last_completion), ptr_weelist->data, @@ -1516,7 +1518,7 @@ completion_auto (t_completion *completion) } /* channel completion */ - if (string_is_channel (completion->base_word)) + if (irc_channel_is_channel (completion->base_word)) { if (!completion->completion_list) completion_list_add_server_channels (completion); diff --git a/weechat/src/common/fifo.c b/weechat/src/common/fifo.c index 1fdf6eb44..8cb097653 100644 --- a/weechat/src/common/fifo.c +++ b/weechat/src/common/fifo.c @@ -147,7 +147,7 @@ fifo_exec (char *text) pos = strchr (text, ','); if (pos) pos[0] = '\0'; - ptr_server = server_search (text); + ptr_server = irc_server_search (text); if (!ptr_server || !ptr_server->buffer) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); @@ -157,7 +157,7 @@ fifo_exec (char *text) } if (ptr_server && pos) { - ptr_channel = channel_search_any (ptr_server, pos + 1); + ptr_channel = irc_channel_search_any (ptr_server, pos + 1); if (!ptr_channel) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); diff --git a/weechat/src/common/history.c b/weechat/src/common/history.c index 8e260b7d9..ab222332f 100644 --- a/weechat/src/common/history.c +++ b/weechat/src/common/history.c @@ -62,7 +62,7 @@ history_buffer_add (void *buffer, char *string) { new_history->text = strdup (string); if (cfg_log_hide_nickserv_pwd) - irc_hide_password (new_history->text, 1); + irc_display_hide_password (new_history->text, 1); if (((t_gui_buffer *)(buffer))->history) ((t_gui_buffer *)(buffer))->history->prev_history = new_history; @@ -112,7 +112,7 @@ history_global_add (char *string) { new_history->text = strdup (string); if (cfg_log_hide_nickserv_pwd) - irc_hide_password (new_history->text, 1); + irc_display_hide_password (new_history->text, 1); if (history_global) history_global->prev_history = new_history; diff --git a/weechat/src/common/session.c b/weechat/src/common/session.c index 2bc77af43..9236c9f19 100644 --- a/weechat/src/common/session.c +++ b/weechat/src/common/session.c @@ -839,20 +839,20 @@ session_load_server (FILE *file) /* use or allocate server */ weechat_log_printf (_("session: loading server \"%s\"\n"), server_name); - session_current_server = server_search (server_name); + session_current_server = irc_server_search (server_name); if (session_current_server) weechat_log_printf (_("server found, updating values\n")); else { weechat_log_printf (_("server not found, creating new one\n")); - session_current_server = server_alloc (); + session_current_server = irc_server_alloc (); if (!session_current_server) { free (server_name); session_crash (file, _("can't create new server")); return 0; } - server_init (session_current_server); + irc_server_init (session_current_server); session_current_server->name = strdup (server_name); } free (server_name); @@ -1069,9 +1069,9 @@ session_load_channel (FILE *file) /* allocate channel */ weechat_log_printf (_("session: loading channel \"%s\"\n"), channel_name); - session_current_channel = channel_new (session_current_server, - channel_type, - channel_name); + session_current_channel = irc_channel_new (session_current_server, + channel_type, + channel_name); free (channel_name); if (!session_current_channel) { @@ -1164,8 +1164,8 @@ session_load_nick (FILE *file) } /* allocate nick */ - nick = nick_new (session_current_server, session_current_channel, - nick_name, 0, 0, 0, 0, 0, 0); + nick = irc_nick_new (session_current_server, session_current_channel, + nick_name, 0, 0, 0, 0, 0, 0); free (nick_name); if (!nick) { @@ -1222,7 +1222,7 @@ session_load_dcc (FILE *file) t_irc_channel *ptr_channel; /* allocate DCC */ - dcc = dcc_alloc (); + dcc = irc_dcc_alloc (); if (!dcc) { session_crash (file, _("can't create new DCC")); @@ -1255,7 +1255,7 @@ session_load_dcc (FILE *file) return 0; if (string && string[0]) { - ptr_server = server_search (string); + ptr_server = irc_server_search (string); if (!ptr_server) { session_crash (file, _("server not found for DCC")); @@ -1276,7 +1276,7 @@ session_load_dcc (FILE *file) return 0; if (string && string[0]) { - ptr_channel = channel_search_any (ptr_server, string); + ptr_channel = irc_channel_search_any (ptr_server, string); if (!ptr_channel) { session_crash (file, _("channel not found for DCC")); @@ -1468,7 +1468,7 @@ session_load_buffer (FILE *file) ptr_channel = NULL; if (server_name) { - ptr_server = server_search (server_name); + ptr_server = irc_server_search (server_name); if (!ptr_server) { session_crash (file, _("server not found for buffer")); @@ -1478,7 +1478,7 @@ session_load_buffer (FILE *file) if (channel_name) { - ptr_channel = channel_search_any_without_buffer (ptr_server, channel_name); + ptr_channel = irc_channel_search_any_without_buffer (ptr_server, channel_name); if (!ptr_channel) { session_crash (file, _("channel not found for buffer")); @@ -1686,7 +1686,7 @@ session_load_hotlist (FILE *file) server_name = NULL; if (!session_read_str (file, &server_name)) return 0; - ptr_server = server_search (server_name); + ptr_server = irc_server_search (server_name); free (server_name); break; case SESSION_HOTL_BUFFER_NUMBER: diff --git a/weechat/src/common/weechat.c b/weechat/src/common/weechat.c index 828c2baa0..b8e5ba7bd 100644 --- a/weechat/src/common/weechat.c +++ b/weechat/src/common/weechat.c @@ -405,7 +405,7 @@ weechat_parse_args (int argc, char *argv[]) } else if ((ascii_strncasecmp (argv[i], "irc", 3) == 0)) { - if (server_init_with_url (argv[i], &server_tmp) < 0) + if (irc_server_init_with_url (argv[i], &server_tmp) < 0) { weechat_iconv_fprintf (stderr, _("%s invalid syntax for IRC server ('%s'), ignored\n"), @@ -413,19 +413,19 @@ weechat_parse_args (int argc, char *argv[]) } else { - if (!server_new (server_tmp.name, server_tmp.autoconnect, - server_tmp.autoreconnect, - server_tmp.autoreconnect_delay, - 1, server_tmp.address, server_tmp.port, - server_tmp.ipv6, server_tmp.ssl, - server_tmp.password, server_tmp.nick1, - server_tmp.nick2, server_tmp.nick3, - NULL, NULL, NULL, NULL, 0, - server_tmp.autojoin, 1, NULL)) + if (!irc_server_new (server_tmp.name, server_tmp.autoconnect, + server_tmp.autoreconnect, + server_tmp.autoreconnect_delay, + 1, server_tmp.address, server_tmp.port, + server_tmp.ipv6, server_tmp.ssl, + server_tmp.password, server_tmp.nick1, + server_tmp.nick2, server_tmp.nick3, + NULL, NULL, NULL, NULL, 0, + server_tmp.autojoin, 1, NULL)) weechat_iconv_fprintf (stderr, _("%s unable to create server ('%s'), ignored\n"), WEECHAT_WARNING, argv[i]); - server_destroy (&server_tmp); + irc_server_destroy (&server_tmp); server_cmd_line = 1; } } @@ -584,7 +584,7 @@ weechat_config_read () exit (EXIT_FAILURE); break; default: /* other error (fatal) */ - server_free_all (); + irc_server_free_all (); exit (EXIT_FAILURE); } } @@ -705,25 +705,25 @@ weechat_dump (int crash) for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { weechat_log_printf ("\n"); - server_print_log (ptr_server); + irc_server_print_log (ptr_server); for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { weechat_log_printf ("\n"); - channel_print_log (ptr_channel); + irc_channel_print_log (ptr_channel); for (ptr_nick = ptr_channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { weechat_log_printf ("\n"); - nick_print_log (ptr_nick); + irc_nick_print_log (ptr_nick); } } } - dcc_print_log (); + irc_dcc_print_log (); gui_panel_print_log (); @@ -754,7 +754,7 @@ weechat_dump (int crash) } weechat_log_printf ("\n"); - ignore_print_log (); + irc_ignore_print_log (); weechat_log_printf ("\n"); weechat_log_printf ("****** End of dump ******\n"); @@ -769,8 +769,8 @@ void weechat_sigsegv () { weechat_dump (1); - dcc_end (); - server_free_all (); + irc_dcc_end (); + irc_server_free_all (); gui_main_end (); weechat_iconv_fprintf (stderr, "\n"); @@ -837,20 +837,20 @@ main (int argc, char *argv[]) plugin_init (auto_load_plugins); /* init plugin interface(s) */ #endif - server_auto_connect (auto_connect, /* auto-connect to servers */ - server_cmd_line); + irc_server_auto_connect (auto_connect, /* auto-connect to servers */ + server_cmd_line); gui_main_loop (); /* WeeChat main loop */ #ifdef PLUGINS plugin_end (); /* end plugin interface(s) */ #endif - server_disconnect_all (); /* disconnect from all servers */ + irc_server_disconnect_all (); /* disconnect from all servers */ if (cfg_look_save_on_exit) (void) config_write (NULL); /* save config file */ command_index_free (); /* free commands index */ - dcc_end (); /* remove all DCC */ - server_free_all (); /* free all servers */ + irc_dcc_end (); /* remove all DCC */ + irc_server_free_all (); /* free all servers */ gui_main_end (); /* shut down WeeChat GUI */ weechat_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */ diff --git a/weechat/src/common/weeconfig.c b/weechat/src/common/weeconfig.c index 2bbc98dec..99b465bc4 100644 --- a/weechat/src/common/weeconfig.c +++ b/weechat/src/common/weeconfig.c @@ -1222,7 +1222,7 @@ config_change_nicks_colors () ptr_nick = ptr_nick->next_nick) { if (ptr_nick->color != COLOR_WIN_NICK_SELF) - ptr_nick->color = nick_find_color (ptr_nick); + ptr_nick->color = irc_nick_find_color (ptr_nick); } } } @@ -1239,7 +1239,7 @@ config_change_away_check () if (cfg_irc_away_check == 0) { /* reset away flag for all nicks/chans/servers */ - server_remove_away (); + irc_server_remove_away (); } check_away = cfg_irc_away_check * 60; } @@ -1276,7 +1276,7 @@ config_change_notify_levels () { if (BUFFER_IS_CHANNEL(ptr_buffer) || BUFFER_IS_PRIVATE(ptr_buffer)) ptr_buffer->notify_level = - channel_get_notify_level (SERVER(ptr_buffer), CHANNEL(ptr_buffer)); + irc_channel_get_notify_level (SERVER(ptr_buffer), CHANNEL(ptr_buffer)); } } @@ -1688,7 +1688,7 @@ config_option_search_option_value (char *option_name, t_config_option **option, if (pos) { pos[0] = '\0'; - ptr_server = server_search (option_name); + ptr_server = irc_server_search (option_name); if (ptr_server) { for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++) @@ -1763,40 +1763,40 @@ config_allocate_server (char *filename, int line_number) || !cfg_server.username || !cfg_server.realname) { - server_free_all (); + irc_server_free_all (); gui_printf (NULL, _("%s %s, line %d: new server, but previous was incomplete\n"), WEECHAT_WARNING, filename, line_number); return 0; } - if (server_name_already_exists (cfg_server.name)) + if (irc_server_name_already_exists (cfg_server.name)) { - server_free_all (); + irc_server_free_all (); gui_printf (NULL, _("%s %s, line %d: server '%s' already exists\n"), WEECHAT_WARNING, filename, line_number, cfg_server.name); return 0; } - if (!server_new (cfg_server.name, - cfg_server.autoconnect, cfg_server.autoreconnect, - cfg_server.autoreconnect_delay, 0, cfg_server.address, - cfg_server.port, cfg_server.ipv6, cfg_server.ssl, - cfg_server.password, cfg_server.nick1, cfg_server.nick2, - cfg_server.nick3, cfg_server.username, cfg_server.realname, - cfg_server.hostname, cfg_server.command, - cfg_server.command_delay, cfg_server.autojoin, - cfg_server.autorejoin, cfg_server.notify_levels)) + if (!irc_server_new (cfg_server.name, + cfg_server.autoconnect, cfg_server.autoreconnect, + cfg_server.autoreconnect_delay, 0, cfg_server.address, + cfg_server.port, cfg_server.ipv6, cfg_server.ssl, + cfg_server.password, cfg_server.nick1, cfg_server.nick2, + cfg_server.nick3, cfg_server.username, cfg_server.realname, + cfg_server.hostname, cfg_server.command, + cfg_server.command_delay, cfg_server.autojoin, + cfg_server.autorejoin, cfg_server.notify_levels)) { - server_free_all (); + irc_server_free_all (); gui_printf (NULL, _("%s %s, line %d: unable to create server\n"), WEECHAT_WARNING, filename, line_number); return 0; } - server_destroy (&cfg_server); - server_init (&cfg_server); + irc_server_destroy (&cfg_server); + irc_server_init (&cfg_server); return 1; } @@ -1886,7 +1886,7 @@ config_read () } config_default_values (); - server_init (&cfg_server); + irc_server_init (&cfg_server); /* read config file */ section = CONFIG_SECTION_NONE; @@ -2041,7 +2041,7 @@ config_read () WEECHAT_WARNING, filename, line_number, line); else { - if (!ignore_add_from_config (pos)) + if (!irc_ignore_add_from_config (pos)) gui_printf (NULL, _("%s %s, line %d: invalid ignore options \"%s\"\n"), WEECHAT_WARNING, filename, line_number, pos); diff --git a/weechat/src/gui/curses/gui-curses-main.c b/weechat/src/gui/curses/gui-curses-main.c index 2a6bf58a7..915f92971 100644 --- a/weechat/src/gui/curses/gui-curses-main.c +++ b/weechat/src/gui/curses/gui-curses-main.c @@ -139,7 +139,7 @@ gui_main_loop () { if (ptr_server->is_connected) { - server_outqueue_send (ptr_server); + irc_server_outqueue_send (ptr_server); } } @@ -170,7 +170,7 @@ gui_main_loop () if (check_away >= (cfg_irc_away_check * 60)) { check_away = 0; - server_check_away (); + irc_server_check_away (); } } @@ -223,7 +223,7 @@ gui_main_loop () if ((!ptr_server->is_connected) && (ptr_server->reconnect_start > 0) && (new_time >= (ptr_server->reconnect_start + ptr_server->autoreconnect_delay))) - server_reconnect (ptr_server); + irc_server_reconnect (ptr_server); else { if (ptr_server->is_connected) @@ -232,7 +232,7 @@ gui_main_loop () if ((ptr_server->lag_check_time.tv_sec == 0) && (new_time >= ptr_server->lag_next_check)) { - server_sendf (ptr_server, "PING %s", ptr_server->address); + irc_server_sendf (ptr_server, "PING %s", ptr_server->address); gettimeofday (&(ptr_server->lag_check_time), NULL); } @@ -248,7 +248,7 @@ gui_main_loop () gui_printf (ptr_server->buffer, _("%s lag is high, disconnecting from server...\n"), WEECHAT_WARNING); - server_disconnect (ptr_server, 1); + irc_server_disconnect (ptr_server, 1); continue; } } @@ -282,22 +282,22 @@ gui_main_loop () if (!ptr_server->is_connected && (ptr_server->child_pid > 0)) { if (FD_ISSET (ptr_server->child_read, &read_fd)) - server_child_read (ptr_server); + irc_server_child_read (ptr_server); } else { if ((ptr_server->sock >= 0) && (FD_ISSET (ptr_server->sock, &read_fd))) - server_recv (ptr_server); + irc_server_recv (ptr_server); } } } /* manages active DCC */ - dcc_handle (); + irc_dcc_handle (); } if (send_irc_quit) - irc_cmd_send_quit (NULL, NULL, NULL); + irc_send_cmd_quit (NULL, NULL, NULL); } /* diff --git a/weechat/src/gui/curses/gui-curses-nicklist.c b/weechat/src/gui/curses/gui-curses-nicklist.c index ca2585d96..bbcfff451 100644 --- a/weechat/src/gui/curses/gui-curses-nicklist.c +++ b/weechat/src/gui/curses/gui-curses-nicklist.c @@ -54,7 +54,7 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size) { if ((ptr_win->buffer == buffer) && (buffer->num_displayed > 0)) { - max_length = nick_get_max_length (CHANNEL(buffer)); + max_length = irc_nick_get_max_length (CHANNEL(buffer)); if (calculate_size && (gui_window_calculate_pos_size (ptr_win, 0))) { diff --git a/weechat/src/gui/curses/gui-curses-status.c b/weechat/src/gui/curses/gui-curses-status.c index a6b93462b..26d3aaa9a 100644 --- a/weechat/src/gui/curses/gui-curses-status.c +++ b/weechat/src/gui/curses/gui-curses-status.c @@ -127,9 +127,9 @@ gui_status_draw (t_gui_buffer *buffer, int erase) SERVER(ptr_win->buffer)->name); if (ptr_win->buffer->all_servers) { - server_get_number_buffer (SERVER(ptr_win->buffer), - &server_pos, - &server_total); + irc_server_get_number_buffer (SERVER(ptr_win->buffer), + &server_pos, + &server_total); gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, COLOR_WIN_STATUS_DELIMITERS); wprintw (GUI_CURSES(ptr_win)->win_status, "("); diff --git a/weechat/src/gui/curses/gui-curses-window.c b/weechat/src/gui/curses/gui-curses-window.c index 5aa28fc56..67432b6ab 100644 --- a/weechat/src/gui/curses/gui-curses-window.c +++ b/weechat/src/gui/curses/gui-curses-window.c @@ -206,7 +206,7 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate) /* init chat & nicklist settings */ if (cfg_look_nicklist && BUFFER_IS_CHANNEL(window->buffer)) { - max_length = nick_get_max_length (CHANNEL(window->buffer)); + max_length = irc_nick_get_max_length (CHANNEL(window->buffer)); lines = 0; @@ -224,8 +224,8 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate) } else { - nick_count (CHANNEL(window->buffer), &num_nicks, &num_op, - &num_halfop, &num_voice, &num_normal); + irc_nick_count (CHANNEL(window->buffer), &num_nicks, &num_op, + &num_halfop, &num_voice, &num_normal); width_used = (window->win_width - add_left - add_right) - ((window->win_width - add_left - add_right) % (max_length + 2)); if (((max_length + 2) * num_nicks) % width_used == 0) diff --git a/weechat/src/gui/gui-buffer.c b/weechat/src/gui/gui-buffer.c index eb266379b..1b29f3f03 100644 --- a/weechat/src/gui/gui-buffer.c +++ b/weechat/src/gui/gui-buffer.c @@ -168,7 +168,7 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int type, new_buffer->line_complete = 1; /* notify level */ - new_buffer->notify_level = channel_get_notify_level (server, channel); + new_buffer->notify_level = irc_channel_get_notify_level (server, channel); /* create/append to log file */ new_buffer->log_filename = NULL; @@ -274,7 +274,7 @@ gui_buffer_search (char *server, char *channel) { if (server && server[0]) { - ptr_server = server_search (server); + ptr_server = irc_server_search (server); if (!ptr_server) return NULL; } @@ -283,7 +283,7 @@ gui_buffer_search (char *server, char *channel) { if (ptr_server) { - ptr_channel = channel_search_any (ptr_server, channel); + ptr_channel = irc_channel_search_any (ptr_server, channel); if (ptr_channel) ptr_buffer = ptr_channel->buffer; } @@ -368,6 +368,54 @@ gui_buffer_find_window (t_gui_buffer *buffer) } /* + * gui_buffer_find_context: find window/buffer for a server/channel + */ + +void +gui_buffer_find_context (void *server, void *channel, + t_gui_window **window, t_gui_buffer **buffer) +{ + t_gui_window *ptr_win; + + if (!buffer) + return; + + /* first find buffer */ + *buffer = NULL; + if ((t_irc_channel *)channel && ((t_irc_channel *)channel)->buffer) + *buffer = ((t_irc_channel *)channel)->buffer; + else + { + if ((t_irc_server *)server && ((t_irc_server *)server)->buffer) + *buffer = ((t_irc_server *)server)->buffer; + else + *buffer = gui_current_window->buffer; + } + + /* then find first window displaying this buffer */ + if (window) + { + *window = NULL; + if (gui_current_window->buffer == *buffer) + *window = gui_current_window; + else + { + for (ptr_win = gui_windows; ptr_win; + ptr_win = ptr_win->next_window) + { + if (ptr_win->buffer == *buffer) + { + *window = ptr_win; + break; + } + } + if (!*window) + *window = gui_current_window; + } + } +} + +/* * gui_buffer_is_scrolled: return 1 if all windows displaying buffer are scrolled * (user doesn't see end of buffer) * return 0 if at least one window is NOT scrolled diff --git a/weechat/src/gui/gui-common.c b/weechat/src/gui/gui-common.c index f7b6cba80..60ccfcebb 100644 --- a/weechat/src/gui/gui-common.c +++ b/weechat/src/gui/gui-common.c @@ -672,7 +672,7 @@ gui_exec_action_dcc (t_gui_window *window, char *actions) && (DCC_IS_RECV(dcc_selected->status)) && (dcc_selected->status == DCC_WAITING)) { - dcc_accept (dcc_selected); + irc_dcc_accept (dcc_selected); } break; /* cancel DCC */ @@ -681,7 +681,7 @@ gui_exec_action_dcc (t_gui_window *window, char *actions) if (dcc_selected && (!DCC_ENDED(dcc_selected->status))) { - dcc_close (dcc_selected, DCC_ABORTED); + irc_dcc_close (dcc_selected, DCC_ABORTED); gui_window_redraw_buffer (window->buffer); } break; @@ -696,7 +696,7 @@ gui_exec_action_dcc (t_gui_window *window, char *actions) { ptr_dcc_next = ptr_dcc->next_dcc; if (DCC_ENDED(ptr_dcc->status)) - dcc_free (ptr_dcc); + irc_dcc_free (ptr_dcc); ptr_dcc = ptr_dcc_next; } gui_window_redraw_buffer (window->buffer); @@ -731,7 +731,7 @@ gui_exec_action_dcc (t_gui_window *window, char *actions) window->dcc_selected = dcc_selected->next_dcc; else window->dcc_selected = NULL; - dcc_free (dcc_selected); + irc_dcc_free (dcc_selected); gui_window_redraw_buffer (window->buffer); } break; diff --git a/weechat/src/gui/gui.h b/weechat/src/gui/gui.h index c3e56e08e..ef010d592 100644 --- a/weechat/src/gui/gui.h +++ b/weechat/src/gui/gui.h @@ -85,6 +85,8 @@ extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int); extern t_gui_buffer *gui_buffer_search (char *, char *); extern t_gui_buffer *gui_buffer_search_by_number (int); extern t_gui_window *gui_buffer_find_window (t_gui_buffer *); +extern void gui_buffer_find_context (void *, void *, + t_gui_window **, t_gui_buffer **); extern int gui_buffer_is_scrolled (t_gui_buffer *); extern t_gui_buffer *gui_buffer_get_dcc (t_gui_window *); extern void gui_buffer_clear (t_gui_buffer *); diff --git a/weechat/src/irc/irc-channel.c b/weechat/src/irc/irc-channel.c index 506bb3b38..4bd0e45e2 100644 --- a/weechat/src/irc/irc-channel.c +++ b/weechat/src/irc/irc-channel.c @@ -41,11 +41,12 @@ char *channel_modes = "iklmnstp"; /* - * channel_new: allocate a new channel for a server and add it to the server queue + * irc_channel_new: allocate a new channel for a server and add it to the + * server queue */ t_irc_channel * -channel_new (t_irc_server *server, int channel_type, char *channel_name) +irc_channel_new (t_irc_server *server, int channel_type, char *channel_name) { t_irc_channel *new_channel; @@ -91,11 +92,11 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name) } /* - * channel_free: free a channel and remove it from channels queue + * irc_channel_free: free a channel and remove it from channels queue */ void -channel_free (t_irc_server *server, t_irc_channel *channel) +irc_channel_free (t_irc_server *server, t_irc_channel *channel) { t_irc_channel *new_channels; @@ -108,8 +109,8 @@ channel_free (t_irc_server *server, t_irc_channel *channel) ((t_irc_dcc *)(channel->dcc_chat))->channel = NULL; if (!DCC_ENDED(((t_irc_dcc *)(channel->dcc_chat))->status)) { - dcc_close ((t_irc_dcc *)(channel->dcc_chat), DCC_ABORTED); - dcc_redraw (1); + irc_dcc_close ((t_irc_dcc *)(channel->dcc_chat), DCC_ABORTED); + irc_dcc_redraw (1); } } @@ -136,7 +137,7 @@ channel_free (t_irc_server *server, t_irc_channel *channel) free (channel->modes); if (channel->key) free (channel->key); - nick_free_all (channel); + irc_nick_free_all (channel); if (channel->away_message) free (channel->away_message); if (channel->nicks_speaking) @@ -147,24 +148,24 @@ channel_free (t_irc_server *server, t_irc_channel *channel) } /* - * channel_free_all: free all allocated channels + * irc_channel_free_all: free all allocated channels */ void -channel_free_all (t_irc_server *server) +irc_channel_free_all (t_irc_server *server) { /* remove all channels for the server */ while (server->channels) - channel_free (server, server->channels); + irc_channel_free (server, server->channels); } /* - * channel_search: returns pointer on a channel with name - * WARNING: DCC chat channels are not returned by this function + * irc_channel_search: returns pointer on a channel with name + * WARNING: DCC chat channels are not returned by this function */ t_irc_channel * -channel_search (t_irc_server *server, char *channel_name) +irc_channel_search (t_irc_server *server, char *channel_name) { t_irc_channel *ptr_channel; @@ -182,11 +183,11 @@ channel_search (t_irc_server *server, char *channel_name) } /* - * channel_search_any: returns pointer on a channel with name + * irc_channel_search_any: returns pointer on a channel with name */ t_irc_channel * -channel_search_any (t_irc_server *server, char *channel_name) +irc_channel_search_any (t_irc_server *server, char *channel_name) { t_irc_channel *ptr_channel; @@ -203,12 +204,12 @@ channel_search_any (t_irc_server *server, char *channel_name) } /* - * channel_search_any_without_buffer: returns pointer on a channel with name - * looks only for channels without buffer + * irc_channel_search_any_without_buffer: returns pointer on a channel with name + * looks only for channels without buffer */ t_irc_channel * -channel_search_any_without_buffer (t_irc_server *server, char *channel_name) +irc_channel_search_any_without_buffer (t_irc_server *server, char *channel_name) { t_irc_channel *ptr_channel; @@ -226,11 +227,11 @@ channel_search_any_without_buffer (t_irc_server *server, char *channel_name) } /* - * channel_search_dcc: returns pointer on a DCC chat channel with name + * irc_channel_search_dcc: returns pointer on a DCC chat channel with name */ t_irc_channel * -channel_search_dcc (t_irc_server *server, char *channel_name) +irc_channel_search_dcc (t_irc_server *server, char *channel_name) { t_irc_channel *ptr_channel; @@ -248,11 +249,11 @@ channel_search_dcc (t_irc_server *server, char *channel_name) } /* - * string_is_channel: returns 1 if string is channel + * irc_channel_is_channel: returns 1 if string is channel */ int -string_is_channel (char *string) +irc_channel_is_channel (char *string) { char first_char[2]; @@ -265,11 +266,11 @@ string_is_channel (char *string) } /* - * channel_remove_away: remove away for all nicks on a channel + * irc_channel_remove_away: remove away for all nicks on a channel */ void -channel_remove_away (t_irc_channel *channel) +irc_channel_remove_away (t_irc_channel *channel) { t_irc_nick *ptr_nick; @@ -284,11 +285,11 @@ channel_remove_away (t_irc_channel *channel) } /* - * channel_check_away: check for away on a channel + * irc_channel_check_away: check for away on a channel */ void -channel_check_away (t_irc_server *server, t_irc_channel *channel, int force) +irc_channel_check_away (t_irc_server *server, t_irc_channel *channel, int force) { if (channel->type == CHANNEL_TYPE_CHANNEL) { @@ -296,44 +297,44 @@ channel_check_away (t_irc_server *server, t_irc_channel *channel, int force) (channel->nicks_count <= cfg_irc_away_check_max_nicks)) { channel->checking_away++; - server_sendf (server, "WHO %s", channel->name); + irc_server_sendf (server, "WHO %s", channel->name); } else - channel_remove_away (channel); + irc_channel_remove_away (channel); } } /* - * channel_set_away: set/unset away status for a channel + * irc_channel_set_away: set/unset away status for a channel */ void -channel_set_away (t_irc_channel *channel, char *nick, int is_away) +irc_channel_set_away (t_irc_channel *channel, char *nick, int is_away) { t_irc_nick *ptr_nick; if (channel->type == CHANNEL_TYPE_CHANNEL) { - ptr_nick = nick_search (channel, nick); + ptr_nick = irc_nick_search (channel, nick); if (ptr_nick) - nick_set_away (channel, ptr_nick, is_away); + irc_nick_set_away (channel, ptr_nick, is_away); } } /* - * channel_create_dcc: create DCC CHAT channel + * irc_channel_create_dcc: create DCC CHAT channel */ int -channel_create_dcc (t_irc_dcc *ptr_dcc) +irc_channel_create_dcc (t_irc_dcc *ptr_dcc) { t_irc_channel *ptr_channel; - ptr_channel = channel_search_dcc (ptr_dcc->server, ptr_dcc->nick); + ptr_channel = irc_channel_search_dcc (ptr_dcc->server, ptr_dcc->nick); if (!ptr_channel) { - ptr_channel = channel_new (ptr_dcc->server, CHANNEL_TYPE_DCC_CHAT, - ptr_dcc->nick); + ptr_channel = irc_channel_new (ptr_dcc->server, CHANNEL_TYPE_DCC_CHAT, + ptr_dcc->nick); if (!ptr_channel) return 0; gui_buffer_new (gui_current_window, ptr_dcc->server, ptr_channel, @@ -351,11 +352,11 @@ channel_create_dcc (t_irc_dcc *ptr_dcc) } /* - * channel_get_notify_level: get channel notify level + * irc_channel_get_notify_level: get channel notify level */ int -channel_get_notify_level (t_irc_server *server, t_irc_channel *channel) +irc_channel_get_notify_level (t_irc_server *server, t_irc_channel *channel) { char *name, *pos, *pos2; int server_default_notify, notify; @@ -366,7 +367,7 @@ channel_get_notify_level (t_irc_server *server, t_irc_channel *channel) if ((!server->notify_levels) || (!server->notify_levels[0])) return NOTIFY_LEVEL_DEFAULT; - server_default_notify = server_get_default_notify_level (server); + server_default_notify = irc_server_get_default_notify_level (server); if ((channel->type != CHANNEL_TYPE_CHANNEL) && (server_default_notify == 1)) server_default_notify = 2; @@ -394,11 +395,12 @@ channel_get_notify_level (t_irc_server *server, t_irc_channel *channel) } /* - * server_set_notify_level: set channel notify level + * irc_channel_set_notify_level: set channel notify level */ void -channel_set_notify_level (t_irc_server *server, t_irc_channel *channel, int notify) +irc_channel_set_notify_level (t_irc_server *server, t_irc_channel *channel, + int notify) { char level_string[2]; @@ -411,11 +413,11 @@ channel_set_notify_level (t_irc_server *server, t_irc_channel *channel, int noti } /* - * channel_add_nick_speaking: add a nick speaking on a channel + * irc_channel_add_nick_speaking: add a nick speaking on a channel */ void -channel_add_nick_speaking (t_irc_channel *channel, char *nick) +irc_channel_add_nick_speaking (t_irc_channel *channel, char *nick) { int size, to_remove, i; @@ -436,11 +438,11 @@ channel_add_nick_speaking (t_irc_channel *channel, char *nick) } /* - * channel_print_log: print channel infos in log (usually for crash dump) + * irc_channel_print_log: print channel infos in log (usually for crash dump) */ void -channel_print_log (t_irc_channel *channel) +irc_channel_print_log (t_irc_channel *channel) { weechat_log_printf ("=> channel %s (addr:0x%X)]\n", channel->name, channel); weechat_log_printf (" type . . . . . . . . : %d\n", channel->type); diff --git a/weechat/src/irc/irc-commands.c b/weechat/src/irc/irc-commands.c index 8621047e5..97e9c70e3 100644 --- a/weechat/src/irc/irc-commands.c +++ b/weechat/src/irc/irc-commands.c @@ -34,105 +34,105 @@ t_irc_command irc_commands[] = { { "admin", N_("find information about the administrator of the server"), N_("[target]"), N_("target: server"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_admin, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_admin, NULL }, { "ame", N_("send a CTCP action to all channels of all connected servers"), N_("message"), N_("message: message to send"), - "", 1, MAX_ARGS, 1, 1, NULL, irc_cmd_send_ame, NULL }, + "", 1, MAX_ARGS, 1, 1, NULL, irc_send_cmd_ame, NULL }, { "amsg", N_("send message to all channels of all connected servers"), N_("text"), N_("text: text to send"), - "", 1, MAX_ARGS, 1, 1, NULL, irc_cmd_send_amsg, NULL }, + "", 1, MAX_ARGS, 1, 1, NULL, irc_send_cmd_amsg, NULL }, { "away", N_("toggle away status"), N_("[-all] [message]"), N_(" -all: toggle away status on all connected servers\n" "message: message for away (if no message is given, away status is removed)"), - "-all", 0, MAX_ARGS, 1, 0, NULL, irc_cmd_send_away, NULL }, + "-all", 0, MAX_ARGS, 1, 0, NULL, irc_send_cmd_away, NULL }, { "ban", N_("bans nicks or hosts"), N_("[channel] [nickname [nickname ...]]"), N_(" channel: channel for ban\n" "nickname: user or host to ban"), - "%N", 0, MAX_ARGS, 0, 1, NULL, irc_cmd_send_ban, NULL }, + "%N", 0, MAX_ARGS, 0, 1, NULL, irc_send_cmd_ban, NULL }, { "ctcp", N_("send a CTCP message (Client-To-Client Protocol)"), N_("receiver type [arguments]"), N_(" receiver: nick or channel to send CTCP to\n" " type: CTCP type (examples: \"version\", \"ping\", ..)\n" "arguments: arguments for CTCP"), - "%c|%n action|ping|version", 2, MAX_ARGS, 1, 1, NULL, irc_cmd_send_ctcp, NULL }, + "%c|%n action|ping|version", 2, MAX_ARGS, 1, 1, NULL, irc_send_cmd_ctcp, NULL }, { "cycle", N_("leave and rejoin a channel"), N_("[channel[,channel]] [part_message]"), N_(" channel: channel name for cycle\n" "part_message: part message (displayed to other users)"), - "%p", 0, MAX_ARGS, 0, 1, NULL, irc_cmd_send_cycle, NULL }, + "%p", 0, MAX_ARGS, 0, 1, NULL, irc_send_cmd_cycle, NULL }, { "dehalfop", N_("removes half channel operator status from nickname(s)"), N_("[nickname [nickname]]"), "", - "", 0, MAX_ARGS, 0, 1, irc_cmd_send_dehalfop, NULL, NULL }, + "", 0, MAX_ARGS, 0, 1, irc_send_cmd_dehalfop, NULL, NULL }, { "deop", N_("removes channel operator status from nickname(s)"), N_("[nickname [nickname]]"), "", - "", 0, MAX_ARGS, 0, 1, irc_cmd_send_deop, NULL, NULL }, + "", 0, MAX_ARGS, 0, 1, irc_send_cmd_deop, NULL, NULL }, { "devoice", N_("removes voice from nickname(s)"), N_("[nickname [nickname]]"), "", - "", 0, MAX_ARGS, 0, 1, irc_cmd_send_devoice, NULL, NULL }, + "", 0, MAX_ARGS, 0, 1, irc_send_cmd_devoice, NULL, NULL }, { "die", N_("shutdown the server"), "", "", - NULL, 0, 0, 0, 1, NULL, irc_cmd_send_die, NULL }, + NULL, 0, 0, 0, 1, NULL, irc_send_cmd_die, NULL }, { "error", N_("error received from IRC server"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_error }, { "halfop", N_("gives half channel operator status to nickname(s)"), N_("[nickname [nickname]]"), "", - "", 0, MAX_ARGS, 0, 1, irc_cmd_send_halfop, NULL, NULL }, + "", 0, MAX_ARGS, 0, 1, irc_send_cmd_halfop, NULL, NULL }, { "info", N_("get information describing the server"), N_("[target]"), N_("target: server name"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_info, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_info, NULL }, { "invite", N_("invite a nick on a channel"), N_("nickname channel"), N_("nickname: nick to invite\n" " channel: channel to invite"), - "%n %c", 1, 2, 0, 1, irc_cmd_send_invite, NULL, irc_cmd_recv_invite }, + "%n %c", 1, 2, 0, 1, irc_send_cmd_invite, NULL, irc_recv_cmd_invite }, { "ison", N_("check if a nickname is currently on IRC"), N_("nickname [nickname ...]"), N_("nickname: nickname"), - "", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_ison, NULL }, + "", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_ison, NULL }, { "join", N_("join a channel"), N_("channel[,channel] [key[,key]]"), N_("channel: channel name to join\n" " key: key to join the channel"), - NULL, 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_join, irc_cmd_recv_join }, + NULL, 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_join, irc_recv_cmd_join }, { "kick", N_("forcibly remove a user from a channel"), N_("[channel] nickname [comment]"), N_(" channel: channel where user is\n" "nickname: nickname to kick\n" " comment: comment for kick"), - "%n %-", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_kick, irc_cmd_recv_kick }, + "%n %-", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_kick, irc_recv_cmd_kick }, { "kickban", N_("kicks and bans a nick from a channel"), N_("[channel] nickname [comment]"), N_(" channel: channel where user is\n" "nickname: nickname to kick and ban\n" " comment: comment for kick"), - "%n %-", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_kickban, NULL }, + "%n %-", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_kickban, NULL }, { "kill", N_("close client-server connection"), N_("nickname comment"), N_("nickname: nickname\n" " comment: comment for kill"), - "%n %-", 2, MAX_ARGS, 0, 1, NULL, irc_cmd_send_kill, irc_cmd_recv_kill }, + "%n %-", 2, MAX_ARGS, 0, 1, NULL, irc_send_cmd_kill, irc_recv_cmd_kill }, { "links", N_("list all servernames which are known by the server answering the query"), N_("[[server] server_mask]"), N_(" server: this server should answer the query\n" "server_mask: list of servers must match this mask"), - NULL, 0, 2, 0, 1, NULL, irc_cmd_send_links, NULL }, + NULL, 0, 2, 0, 1, NULL, irc_send_cmd_links, NULL }, { "list", N_("list channels and their topic"), N_("[channel[,channel] [server]]"), N_("channel: channel to list (a regexp is allowed)\nserver: server name"), - NULL, 0, MAX_ARGS, 0, 1, NULL, irc_cmd_send_list, NULL }, + NULL, 0, MAX_ARGS, 0, 1, NULL, irc_send_cmd_list, NULL }, { "lusers", N_("get statistics about the size of the IRC network"), N_("[mask [target]]"), N_(" mask: servers matching the mask only\n" "target: server for forwarding request"), - NULL, 0, 2, 0, 1, NULL, irc_cmd_send_lusers, NULL }, + NULL, 0, 2, 0, 1, NULL, irc_send_cmd_lusers, NULL }, { "me", N_("send a CTCP action to the current channel"), N_("message"), N_("message: message to send"), - "", 0, MAX_ARGS, 1, 1, NULL, irc_cmd_send_me, NULL }, + "", 0, MAX_ARGS, 1, 1, NULL, irc_send_cmd_me, NULL }, { "mode", N_("change channel or user mode"), N_("{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | " "{ nickname {[+|-]|i|w|s|o} }"), @@ -156,356 +156,356 @@ t_irc_command irc_commands[] = " s: mark a user for receive server notices\n" " w: user receives wallops\n" " o: operator flag"), - "%c|%m", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_mode, irc_cmd_recv_mode }, + "%c|%m", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_mode, irc_recv_cmd_mode }, { "motd", N_("get the \"Message Of The Day\""), N_("[target]"), N_("target: server name"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_motd, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_motd, NULL }, { "msg", N_("send message to a nick or channel"), N_("receiver[,receiver] text"), N_("receiver: nick or channel (may be mask, '*' = current channel)\n" "text: text to send"), - "", 2, MAX_ARGS, 1, 1, NULL, irc_cmd_send_msg, NULL }, + "", 2, MAX_ARGS, 1, 1, NULL, irc_send_cmd_msg, NULL }, { "names", N_("list nicknames on channels"), N_("[channel[,channel]]"), N_("channel: channel name"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_names, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_names, NULL }, { "nick", N_("change current nickname"), N_("[-all] nickname"), N_(" -all: set new nickname for all connected servers\n" "nickname: new nickname"), - "-all", 1, 2, 0, 0, irc_cmd_send_nick, NULL, irc_cmd_recv_nick }, + "-all", 1, 2, 0, 0, irc_send_cmd_nick, NULL, irc_recv_cmd_nick }, { "notice", N_("send notice message to user"), N_("nickname text"), N_("nickname: user to send notice to\n" " text: text to send"), - "%n %-", 2, MAX_ARGS, 1, 1, NULL, irc_cmd_send_notice, irc_cmd_recv_notice }, + "%n %-", 2, MAX_ARGS, 1, 1, NULL, irc_send_cmd_notice, irc_recv_cmd_notice }, { "op", N_("gives channel operator status to nickname(s)"), N_("nickname [nickname]"), "", - "", 1, MAX_ARGS, 0, 1, irc_cmd_send_op, NULL, NULL }, + "", 1, MAX_ARGS, 0, 1, irc_send_cmd_op, NULL, NULL }, { "oper", N_("get operator privileges"), N_("user password"), N_("user/password: used to get privileges on current IRC server"), - NULL, 2, 2, 0, 1, NULL, irc_cmd_send_oper, NULL }, + NULL, 2, 2, 0, 1, NULL, irc_send_cmd_oper, NULL }, { "part", N_("leave a channel"), N_("[channel[,channel]] [part_message]"), N_(" channel: channel name to leave\n" "part_message: part message (displayed to other users)"), - "%p", 0, MAX_ARGS, 0, 1, NULL, irc_cmd_send_part, irc_cmd_recv_part }, + "%p", 0, MAX_ARGS, 0, 1, NULL, irc_send_cmd_part, irc_recv_cmd_part }, { "ping", N_("ping server"), N_("server1 [server2]"), N_("server1: server to ping\nserver2: forward ping to this server"), - NULL, 1, 2, 0, 1, NULL, irc_cmd_send_ping, irc_cmd_recv_ping }, + NULL, 1, 2, 0, 1, NULL, irc_send_cmd_ping, irc_recv_cmd_ping }, { "pong", N_("answer to a ping message"), N_("daemon [daemon2]"), N_(" daemon: daemon who has responded to Ping message\n" "daemon2: forward message to this daemon"), - NULL, 1, 2, 0, 1, NULL, irc_cmd_send_pong, irc_cmd_recv_pong }, + NULL, 1, 2, 0, 1, NULL, irc_send_cmd_pong, irc_recv_cmd_pong }, { "privmsg", N_("message received"), "", "", - "", 0, 0, 1, 1, NULL, NULL, irc_cmd_recv_privmsg }, + "", 0, 0, 1, 1, NULL, NULL, irc_recv_cmd_privmsg }, { "query", N_("send a private message to a nick"), N_("nickname [text]"), N_("nickname: nickname for private conversation\n" " text: text to send"), - "%n %-", 1, MAX_ARGS, 1, 1, NULL, irc_cmd_send_query, NULL }, + "%n %-", 1, MAX_ARGS, 1, 1, NULL, irc_send_cmd_query, NULL }, { "quit", N_("close all connections and quit"), N_("[quit_message]"), N_("quit_message: quit message (displayed to other users)"), - "%q", 0, MAX_ARGS, 1, 0, NULL, irc_cmd_send_quit, irc_cmd_recv_quit }, + "%q", 0, MAX_ARGS, 1, 0, NULL, irc_send_cmd_quit, irc_recv_cmd_quit }, { "quote", N_("send raw data to server without parsing"), N_("data"), N_("data: raw data to send"), - "", 1, MAX_ARGS, 1, 1, NULL, irc_cmd_send_quote, NULL }, + "", 1, MAX_ARGS, 1, 1, NULL, irc_send_cmd_quote, NULL }, { "rehash", N_("tell the server to reload its config file"), "", "", - NULL, 0, 0, 0, 1, NULL, irc_cmd_send_rehash, NULL }, + NULL, 0, 0, 0, 1, NULL, irc_send_cmd_rehash, NULL }, { "restart", N_("tell the server to restart itself"), "", "", - NULL, 0, 0, 0, 1, NULL, irc_cmd_send_restart, NULL }, + NULL, 0, 0, 0, 1, NULL, irc_send_cmd_restart, NULL }, { "service", N_("register a new service"), N_("nickname reserved distribution type reserved info"), N_("distribution: visibility of service\n" " type: reserved for future usage"), - NULL, 6, 6, 0, 1, NULL, irc_cmd_send_service, NULL }, + NULL, 6, 6, 0, 1, NULL, irc_send_cmd_service, NULL }, { "servlist", N_("list services currently connected to the network"), N_("[mask [type]]"), N_("mask: list only services matching this mask\n" "type: list only services of this type"), - NULL, 0, 2, 0, 1, NULL, irc_cmd_send_servlist, NULL }, + NULL, 0, 2, 0, 1, NULL, irc_send_cmd_servlist, NULL }, { "squery", N_("deliver a message to a service"), N_("service text"), N_("service: name of service\ntext: text to send"), - NULL, 2, MAX_ARGS, 1, 1, NULL, irc_cmd_send_squery, NULL }, + NULL, 2, MAX_ARGS, 1, 1, NULL, irc_send_cmd_squery, NULL }, { "squit", N_("disconnect server links"), N_("server comment"), N_( "server: server name\n" "comment: comment for quit"), - NULL, 2, 2, 1, 1, NULL, irc_cmd_send_squit, NULL }, + NULL, 2, 2, 1, 1, NULL, irc_send_cmd_squit, NULL }, { "stats", N_("query statistics about server"), N_("[query [server]]"), N_(" query: c/h/i/k/l/m/o/y/u (see RFC1459)\n" "server: server name"), - NULL, 0, 2, 0, 1, NULL, irc_cmd_send_stats, NULL }, + NULL, 0, 2, 0, 1, NULL, irc_send_cmd_stats, NULL }, { "summon", N_("give users who are on a host running an IRC server a message " "asking them to please join IRC"), N_("user [target [channel]]"), N_(" user: username\ntarget: server name\n" "channel: channel name"), - NULL, 1, 3, 0, 1, NULL, irc_cmd_send_summon, NULL }, + NULL, 1, 3, 0, 1, NULL, irc_send_cmd_summon, NULL }, { "time", N_("query local time from server"), N_("[target]"), N_("target: query time from specified server"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_time, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_time, NULL }, { "topic", N_("get/set channel topic"), N_("[channel] [topic]"), N_("channel: channel name\ntopic: new topic for channel " "(if topic is \"-delete\" then topic is deleted)"), - "%t|-delete %-", 0, MAX_ARGS, 1, 1, NULL, irc_cmd_send_topic, irc_cmd_recv_topic }, + "%t|-delete %-", 0, MAX_ARGS, 1, 1, NULL, irc_send_cmd_topic, irc_recv_cmd_topic }, { "trace", N_("find the route to specific server"), N_("[target]"), N_("target: server"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_trace, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_trace, NULL }, { "unban", N_("unbans nicks or hosts"), N_("[channel] nickname [nickname ...]"), N_(" channel: channel for unban\n" "nickname: user or host to unban"), - "", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_unban, NULL }, + "", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_unban, NULL }, { "userhost", N_("return a list of information about nicknames"), N_("nickname [nickname ...]"), N_("nickname: nickname"), - "%n", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_userhost, NULL }, + "%n", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_userhost, NULL }, { "users", N_("list of users logged into the server"), N_("[target]"), N_("target: server"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_users, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_users, NULL }, { "version", N_("gives the version info of nick or server (current or specified)"), N_("[server | nickname]"), N_(" server: server name\n" "nickname: nickname"), - NULL, 0, 1, 0, 1, NULL, irc_cmd_send_version, NULL }, + NULL, 0, 1, 0, 1, NULL, irc_send_cmd_version, NULL }, { "voice", N_("gives voice to nickname(s)"), N_("[nickname [nickname]]"), "", - "", 0, MAX_ARGS, 0, 1, irc_cmd_send_voice, NULL, NULL }, + "", 0, MAX_ARGS, 0, 1, irc_send_cmd_voice, NULL, NULL }, { "wallops", N_("send a message to all currently connected users who have " "set the 'w' user mode for themselves"), N_("text"), N_("text to send"), - NULL, 1, MAX_ARGS, 1, 1, NULL, irc_cmd_send_wallops, irc_cmd_recv_wallops }, + NULL, 1, MAX_ARGS, 1, 1, NULL, irc_send_cmd_wallops, irc_recv_cmd_wallops }, { "who", N_("generate a query which returns a list of information"), N_("[mask [\"o\"]]"), N_("mask: only information which match this mask\n" " o: only operators are returned according to the mask supplied"), - "%C", 0, 2, 0, 1, NULL, irc_cmd_send_who, NULL }, + "%C", 0, 2, 0, 1, NULL, irc_send_cmd_who, NULL }, { "whois", N_("query information about user(s)"), N_("[server] nickname[,nickname]"), N_(" server: server name\n" "nickname: nickname (may be a mask)"), - "", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_whois, NULL }, + "", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_whois, NULL }, { "whowas", N_("ask for information about a nickname which no longer exists"), N_("nickname [,nickname [,nickname ...]] [count [target]]"), N_("nickname: nickname to search\n" " count: number of replies to return (full search if negative number)\n" " target: reply should match this mask"), - "", 1, MAX_ARGS, 0, 1, NULL, irc_cmd_send_whowas, NULL }, + "", 1, MAX_ARGS, 0, 1, NULL, irc_send_cmd_whowas, NULL }, { "001", N_("a server message"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_001 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_001 }, { "005", N_("a server message"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_005 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_005 }, { "221", N_("user mode string"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_221 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_221 }, { "301", N_("away message"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_301 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_301 }, { "302", N_("userhost"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_302 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_302 }, { "303", N_("ison"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_303 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_303 }, { "305", N_("unaway"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_305 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_305 }, { "306", N_("now away"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_306 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_306 }, { "307", N_("whois (registered nick)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_whois_nick_msg }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_whois_nick_msg }, { "310", N_("whois (help mode)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_310 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_310 }, { "311", N_("whois (user)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_311 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_311 }, { "312", N_("whois (server)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_312 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_312 }, { "313", N_("whois (operator)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_whois_nick_msg }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_whois_nick_msg }, { "314", N_("whowas"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_314 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_314 }, { "315", N_("end of /who list"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_315 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_315 }, { "317", N_("whois (idle)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_317 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_317 }, { "318", N_("whois (end)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_whois_nick_msg }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_whois_nick_msg }, { "319", N_("whois (channels)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_319 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_319 }, { "320", N_("whois (identified user)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_whois_nick_msg }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_whois_nick_msg }, { "321", N_("/list start"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_321 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_321 }, { "322", N_("channel (for /list)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_322 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_322 }, { "323", N_("/list end"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_323 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_323 }, { "324", N_("channel mode"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_324 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_324 }, { "326", N_("whois (has oper privs)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_whois_nick_msg }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_whois_nick_msg }, { "329", N_("channel creation date"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_329 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_329 }, { "331", N_("no topic for channel"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_331 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_331 }, { "332", N_("topic of channel"), N_("channel :topic"), N_("channel: name of channel\n" " topic: topic of the channel"), - NULL, 2, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_332 }, + NULL, 2, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_332 }, { "333", N_("infos about topic (nick and date changed)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_333 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_333 }, { "338", N_("whois (host)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_338 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_338 }, { "341", N_("inviting"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_341 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_341 }, { "344", N_("channel reop"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_344 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_344 }, { "345", N_("end of channel reop list"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_345 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_345 }, { "348", N_("channel exception list"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_348 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_348 }, { "349", N_("end of channel exception list"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_349 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_349 }, { "351", N_("server version"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_351 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_351 }, { "352", N_("who"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_352 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_352 }, { "353", N_("list of nicks on channel"), N_("channel :[[@|+]nick ...]"), N_("channel: name of channel\n" " nick: nick on the channel"), - NULL, 2, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_353 }, + NULL, 2, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_353 }, { "366", N_("end of /names list"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_366 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_366 }, { "367", N_("banlist"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_367 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_367 }, { "368", N_("end of banlist"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_368 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_368 }, { "378", N_("connecting from"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_378 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_378 }, { "401", N_("no such nick/channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "402", N_("no such server"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "403", N_("no such channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "404", N_("cannot send to channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "405", N_("too many channels"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "406", N_("was no such nick"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "407", N_("was no such nick"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "409", N_("no origin"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "410", N_("no services"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "411", N_("no recipient"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "412", N_("no text to send"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "413", N_("no toplevel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "414", N_("wilcard in toplevel domain"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "421", N_("unknown command"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "422", N_("MOTD is missing"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "423", N_("no administrative info"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "424", N_("file error"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "431", N_("no nickname given"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "432", N_("erroneous nickname"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_432 }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_432 }, { "433", N_("nickname already in use"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_433 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_433 }, { "436", N_("nickname collision"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "437", N_("resource unavailable"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "438", N_("not authorized to change nickname"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_438 }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_438 }, { "441", N_("user not in channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "442", N_("not on channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "443", N_("user already on channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "444", N_("user not logged in"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "445", N_("summon has been disabled"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "446", N_("users has been disabled"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "451", N_("you are not registered"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "461", N_("not enough parameters"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "462", N_("you may not register"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "463", N_("your host isn't among the privileged"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "464", N_("password incorrect"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "465", N_("you are banned from this server"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "467", N_("channel key already set"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "470", N_("forwarding to another channel"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "471", N_("channel is already full"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "472", N_("unknown mode char to me"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "473", N_("cannot join channel (invite only)"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "474", N_("cannot join channel (banned from channel)"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "475", N_("cannot join channel (bad channel key)"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "476", N_("bad channel mask"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "477", N_("channel doesn't support modes"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "481", N_("you're not an IRC operator"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "482", N_("you're not channel operator"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "483", N_("you can't kill a server!"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "484", N_("your connection is restricted!"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "485", N_("user is immune from kick/deop"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "487", N_("network split"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "491", N_("no O-lines for your host"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "501", N_("unknown mode flag"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "502", N_("can't change mode for other users"), "", "", - NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, + NULL, 0, 0, MAX_ARGS, 1, NULL, NULL, irc_recv_cmd_error }, { "671", N_("whois (secure connection)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_671 }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_671 }, { "973", N_("whois (secure connection)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_server_mode_reason }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_server_mode_reason }, { "974", N_("whois (secure connection)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_server_mode_reason }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_server_mode_reason }, { "975", N_("whois (secure connection)"), "", "", - NULL, 0, 0, 0, 1, NULL, NULL, irc_cmd_recv_server_mode_reason }, + NULL, 0, 0, 0, 1, NULL, NULL, irc_recv_cmd_server_mode_reason }, { NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 1, NULL, NULL, NULL } }; diff --git a/weechat/src/irc/irc-dcc.c b/weechat/src/irc/irc-dcc.c index 387b84d2a..1ebece206 100644 --- a/weechat/src/irc/irc-dcc.c +++ b/weechat/src/irc/irc-dcc.c @@ -57,11 +57,11 @@ char *dcc_status_string[] = /* strings for DCC status */ /* - * dcc_redraw: redraw DCC buffer (and add to hotlist) + * irc_dcc_redraw: redraw DCC buffer (and add to hotlist) */ void -dcc_redraw (int highlight) +irc_dcc_redraw (int highlight) { t_gui_buffer *ptr_buffer; @@ -75,11 +75,11 @@ dcc_redraw (int highlight) } /* - * dcc_search: search a DCC + * irc_dcc_search: search a DCC */ t_irc_dcc * -dcc_search (t_irc_server *server, int type, int status, int port) +irc_dcc_search (t_irc_server *server, int type, int status, int port) { t_irc_dcc *ptr_dcc; @@ -97,11 +97,12 @@ dcc_search (t_irc_server *server, int type, int status, int port) } /* - * dcc_port_in_use: return 1 if a port is in used (by an active or connecting DCC) + * irc_dcc_port_in_use: return 1 if a port is in used + * (by an active or connecting DCC) */ int -dcc_port_in_use (int port) +irc_dcc_port_in_use (int port) { t_irc_dcc *ptr_dcc; @@ -117,11 +118,11 @@ dcc_port_in_use (int port) } /* - * dcc_file_is_resumable: check if a file can be used for resuming a download + * irc_dcc_file_is_resumable: check if a file can be used for resuming a download */ int -dcc_file_is_resumable (t_irc_dcc *ptr_dcc, char *filename) +irc_dcc_file_is_resumable (t_irc_dcc *ptr_dcc, char *filename) { struct stat st; @@ -147,13 +148,13 @@ dcc_file_is_resumable (t_irc_dcc *ptr_dcc, char *filename) } /* - * dcc_find_filename: find local filename for a DCC - * if type if file/recv, add a suffix (like .1) if needed - * if download is resumable, set "start_resume" to good value + * irc_dcc_find_filename: find local filename for a DCC + * if type if file/recv, add a suffix (like .1) if needed + * if download is resumable, set "start_resume" to good value */ void -dcc_find_filename (t_irc_dcc *ptr_dcc) +irc_dcc_find_filename (t_irc_dcc *ptr_dcc) { char *dir1, *dir2, *filename2; @@ -191,22 +192,22 @@ dcc_find_filename (t_irc_dcc *ptr_dcc) /* file already exists? */ if (access (ptr_dcc->local_filename, F_OK) == 0) { - if (dcc_file_is_resumable (ptr_dcc, ptr_dcc->local_filename)) + if (irc_dcc_file_is_resumable (ptr_dcc, ptr_dcc->local_filename)) return; /* if auto rename is not set, then abort DCC */ if (!cfg_dcc_auto_rename) { - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return; } filename2 = (char *) malloc (strlen (ptr_dcc->local_filename) + 16); if (!filename2) { - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return; } ptr_dcc->filename_suffix = 0; @@ -218,7 +219,7 @@ dcc_find_filename (t_irc_dcc *ptr_dcc) ptr_dcc->filename_suffix); if (access (filename2, F_OK) == 0) { - if (dcc_file_is_resumable (ptr_dcc, filename2)) + if (irc_dcc_file_is_resumable (ptr_dcc, filename2)) break; } else @@ -233,11 +234,11 @@ dcc_find_filename (t_irc_dcc *ptr_dcc) } /* - * dcc_calculate_speed: calculate DCC speed (for files only) + * irc_dcc_calculate_speed: calculate DCC speed (for files only) */ void -dcc_calculate_speed (t_irc_dcc *ptr_dcc, int ended) +irc_dcc_calculate_speed (t_irc_dcc *ptr_dcc, int ended) { time_t local_time, elapsed; unsigned long bytes_per_sec_total; @@ -277,11 +278,11 @@ dcc_calculate_speed (t_irc_dcc *ptr_dcc, int ended) } /* - * dcc_connect_to_sender: connect to sender + * irc_dcc_connect_to_sender: connect to sender */ int -dcc_connect_to_sender (t_irc_dcc *ptr_dcc) +irc_dcc_connect_to_sender (t_irc_dcc *ptr_dcc) { struct sockaddr_in addr; struct hostent *hostent; @@ -303,7 +304,8 @@ dcc_connect_to_sender (t_irc_dcc *ptr_dcc) ret = connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr)); if ((ret == -1) && (errno != EINPROGRESS)) return 0; - if (pass_proxy (ptr_dcc->sock, ip4, ptr_dcc->port, ptr_dcc->server->username) == -1) + if (irc_server_pass_proxy (ptr_dcc->sock, ip4, ptr_dcc->port, + ptr_dcc->server->username) == -1) return 0; } else @@ -320,11 +322,11 @@ dcc_connect_to_sender (t_irc_dcc *ptr_dcc) } /* - * dcc_connect: connect to another host + * irc_dcc_connect: connect to another host */ int -dcc_connect (t_irc_dcc *ptr_dcc) +irc_dcc_connect (t_irc_dcc *ptr_dcc) { if (ptr_dcc->type == DCC_CHAT_SEND) ptr_dcc->status = DCC_WAITING; @@ -354,7 +356,7 @@ dcc_connect (t_irc_dcc *ptr_dcc) { if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1) return 0; - dcc_connect_to_sender (ptr_dcc); + irc_dcc_connect_to_sender (ptr_dcc); } /* for file receiving, connection is made in child process (blocking) socket */ @@ -363,11 +365,11 @@ dcc_connect (t_irc_dcc *ptr_dcc) } /* - * dcc_free: free DCC struct and remove it from list + * irc_dcc_free: free DCC struct and remove it from list */ void -dcc_free (t_irc_dcc *ptr_dcc) +irc_dcc_free (t_irc_dcc *ptr_dcc) { t_irc_dcc *new_dcc_list; @@ -384,7 +386,7 @@ dcc_free (t_irc_dcc *ptr_dcc) { gui_buffer_free (ptr_dcc->channel->buffer, 1); if (ptr_dcc->channel) - channel_free (ptr_dcc->server, ptr_dcc->channel); + irc_channel_free (ptr_dcc->server, ptr_dcc->channel); } } @@ -414,11 +416,11 @@ dcc_free (t_irc_dcc *ptr_dcc) } /* - * dcc_file_child_kill: kill child process and close pipe + * irc_dcc_file_child_kill: kill child process and close pipe */ void -dcc_file_child_kill (t_irc_dcc *ptr_dcc) +irc_dcc_file_child_kill (t_irc_dcc *ptr_dcc) { /* kill process */ if (ptr_dcc->child_pid > 0) @@ -442,11 +444,11 @@ dcc_file_child_kill (t_irc_dcc *ptr_dcc) } /* - * dcc_close: close a DCC connection + * irc_dcc_close: close a DCC connection */ void -dcc_close (t_irc_dcc *ptr_dcc, int status) +irc_dcc_close (t_irc_dcc *ptr_dcc, int status) { t_gui_buffer *ptr_buffer; struct stat st; @@ -479,7 +481,7 @@ dcc_close (t_irc_dcc *ptr_dcc, int status) ptr_dcc->nick, GUI_COLOR(COLOR_WIN_CHAT), (status == DCC_DONE) ? _("OK") : _("FAILED")); - dcc_file_child_kill (ptr_dcc); + irc_dcc_file_child_kill (ptr_dcc); } } if (status == DCC_ABORTED) @@ -521,7 +523,7 @@ dcc_close (t_irc_dcc *ptr_dcc, int status) } if (DCC_IS_FILE(ptr_dcc->type)) - dcc_calculate_speed (ptr_dcc, 1); + irc_dcc_calculate_speed (ptr_dcc, 1); if (ptr_dcc->sock >= 0) { @@ -536,13 +538,13 @@ dcc_close (t_irc_dcc *ptr_dcc, int status) } /* - * dcc_channel_for_chat: create channel for DCC chat + * irc_dcc_channel_for_chat: create channel for DCC chat */ void -dcc_channel_for_chat (t_irc_dcc *ptr_dcc) +irc_dcc_channel_for_chat (t_irc_dcc *ptr_dcc) { - if (!channel_create_dcc (ptr_dcc)) + if (!irc_channel_create_dcc (ptr_dcc)) { irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer, PREFIX_ERROR); @@ -550,8 +552,8 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc) _("%s can't associate DCC chat with private buffer " "(maybe private buffer has already DCC CHAT?)\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return; } @@ -572,11 +574,11 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc) } /* - * dcc_chat_remove_channel: remove a buffer for DCC chat + * irc_dcc_chat_remove_channel: remove a buffer for DCC chat */ void -dcc_chat_remove_channel (t_irc_channel *channel) +irc_dcc_chat_remove_channel (t_irc_channel *channel) { t_irc_dcc *ptr_dcc; @@ -591,16 +593,16 @@ dcc_chat_remove_channel (t_irc_channel *channel) } /* - * dcc_recv_connect_init: connect to sender and init file or chat + * irc_dcc_recv_connect_init: connect to sender and init file or chat */ void -dcc_recv_connect_init (t_irc_dcc *ptr_dcc) +irc_dcc_recv_connect_init (t_irc_dcc *ptr_dcc) { - if (!dcc_connect (ptr_dcc)) + if (!irc_dcc_connect (ptr_dcc)) { - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); } else { @@ -608,63 +610,63 @@ dcc_recv_connect_init (t_irc_dcc *ptr_dcc) if (DCC_IS_FILE(ptr_dcc->type)) { ptr_dcc->status = DCC_CONNECTING; - dcc_file_recv_fork (ptr_dcc); + irc_dcc_file_recv_fork (ptr_dcc); } else { /* DCC CHAT => associate DCC with channel */ ptr_dcc->status = DCC_ACTIVE; - dcc_channel_for_chat (ptr_dcc); + irc_dcc_channel_for_chat (ptr_dcc); } } - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } /* - * dcc_accept: accepts a DCC file or chat request + * irc_dcc_accept: accepts a DCC file or chat request */ void -dcc_accept (t_irc_dcc *ptr_dcc) +irc_dcc_accept (t_irc_dcc *ptr_dcc) { if (DCC_IS_FILE(ptr_dcc->type) && (ptr_dcc->start_resume > 0)) { ptr_dcc->status = DCC_CONNECTING; - server_sendf (ptr_dcc->server, - (strchr (ptr_dcc->filename, ' ')) ? + irc_server_sendf (ptr_dcc->server, + (strchr (ptr_dcc->filename, ' ')) ? "PRIVMSG %s :\01DCC RESUME \"%s\" %d %u\01\n" : "PRIVMSG %s :\01DCC RESUME %s %d %u\01", - ptr_dcc->nick, ptr_dcc->filename, - ptr_dcc->port, ptr_dcc->start_resume); - dcc_redraw (HOTLIST_MSG); + ptr_dcc->nick, ptr_dcc->filename, + ptr_dcc->port, ptr_dcc->start_resume); + irc_dcc_redraw (HOTLIST_MSG); } else - dcc_recv_connect_init (ptr_dcc); + irc_dcc_recv_connect_init (ptr_dcc); } /* - * dcc_accept_resume: accepts a resume and inform the receiver + * irc_dcc_accept_resume: accepts a resume and inform the receiver */ void -dcc_accept_resume (t_irc_server *server, char *filename, int port, - unsigned long pos_start) +irc_dcc_accept_resume (t_irc_server *server, char *filename, int port, + unsigned long pos_start) { t_irc_dcc *ptr_dcc; - ptr_dcc = dcc_search (server, DCC_FILE_SEND, DCC_CONNECTING, port); + ptr_dcc = irc_dcc_search (server, DCC_FILE_SEND, DCC_CONNECTING, port); if (ptr_dcc) { ptr_dcc->pos = pos_start; ptr_dcc->ack = pos_start; ptr_dcc->start_resume = pos_start; ptr_dcc->last_check_pos = pos_start; - server_sendf (ptr_dcc->server, - (strchr (ptr_dcc->filename, ' ')) ? + irc_server_sendf (ptr_dcc->server, + (strchr (ptr_dcc->filename, ' ')) ? "PRIVMSG %s :\01DCC ACCEPT \"%s\" %d %u\01\n" : "PRIVMSG %s :\01DCC ACCEPT %s %d %u\01", - ptr_dcc->nick, ptr_dcc->filename, - ptr_dcc->port, ptr_dcc->start_resume); + ptr_dcc->nick, ptr_dcc->filename, + ptr_dcc->port, ptr_dcc->start_resume); irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer, PREFIX_INFO); @@ -674,7 +676,7 @@ dcc_accept_resume (t_irc_server *server, char *filename, int port, ptr_dcc->filename, GUI_COLOR(COLOR_WIN_CHAT), ptr_dcc->start_resume); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } else gui_printf (server->buffer, @@ -683,23 +685,23 @@ dcc_accept_resume (t_irc_server *server, char *filename, int port, } /* - * dcc_start_resume: called when "DCC ACCEPT" is received (resume accepted by sender) + * irc_dcc_start_resume: called when "DCC ACCEPT" is received (resume accepted by sender) */ void -dcc_start_resume (t_irc_server *server, char *filename, int port, - unsigned long pos_start) +irc_dcc_start_resume (t_irc_server *server, char *filename, int port, + unsigned long pos_start) { t_irc_dcc *ptr_dcc; - ptr_dcc = dcc_search (server, DCC_FILE_RECV, DCC_CONNECTING, port); + ptr_dcc = irc_dcc_search (server, DCC_FILE_RECV, DCC_CONNECTING, port); if (ptr_dcc) { ptr_dcc->pos = pos_start; ptr_dcc->ack = pos_start; ptr_dcc->start_resume = pos_start; ptr_dcc->last_check_pos = pos_start; - dcc_recv_connect_init (ptr_dcc); + irc_dcc_recv_connect_init (ptr_dcc); } else gui_printf (server->buffer, @@ -708,11 +710,11 @@ dcc_start_resume (t_irc_server *server, char *filename, int port, } /* - * dcc_alloc: allocate a new DCC file + * irc_dcc_alloc: allocate a new DCC file */ t_irc_dcc * -dcc_alloc () +irc_dcc_alloc () { t_irc_dcc *new_dcc; @@ -763,16 +765,16 @@ dcc_alloc () } /* - * dcc_add: add a DCC file to queue + * irc_dcc_add: add a DCC file to queue */ t_irc_dcc * -dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nick, - int sock, char *filename, char *local_filename, unsigned long size) +irc_dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nick, + int sock, char *filename, char *local_filename, unsigned long size) { t_irc_dcc *new_dcc; - new_dcc = dcc_alloc (); + new_dcc = irc_dcc_alloc (); if (!new_dcc) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -813,7 +815,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic if (local_filename) new_dcc->local_filename = strdup (local_filename); else - dcc_find_filename (new_dcc); + irc_dcc_find_filename (new_dcc); gui_current_window->dcc_first = NULL; gui_current_window->dcc_selected = NULL; @@ -840,7 +842,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic GUI_COLOR(COLOR_WIN_CHAT_CHANNEL), size, GUI_COLOR(COLOR_WIN_CHAT)); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } if (type == DCC_FILE_SEND) { @@ -860,7 +862,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic GUI_COLOR(COLOR_WIN_CHAT_CHANNEL), size, GUI_COLOR(COLOR_WIN_CHAT)); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } if (type == DCC_CHAT_RECV) { @@ -877,7 +879,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic (addr >> 8) & 0xff, addr & 0xff, GUI_COLOR(COLOR_WIN_CHAT_DARK)); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } if (type == DCC_CHAT_SEND) { @@ -886,13 +888,13 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic _("Sending DCC chat request to %s%s\n"), GUI_COLOR(COLOR_WIN_CHAT_NICK), nick); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } if (DCC_IS_FILE(type) && (!new_dcc->local_filename)) { - dcc_close (new_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (new_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return NULL; } @@ -910,36 +912,36 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic new_dcc->local_filename, GUI_COLOR(COLOR_WIN_CHAT), new_dcc->start_resume); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } /* connect if needed and redraw DCC buffer */ if (DCC_IS_SEND(type)) { - if (!dcc_connect (new_dcc)) + if (!irc_dcc_connect (new_dcc)) { - dcc_close (new_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (new_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return NULL; } } if ( ( (type == DCC_CHAT_RECV) && (cfg_dcc_auto_accept_chats) ) || ( (type == DCC_FILE_RECV) && (cfg_dcc_auto_accept_files) ) ) - dcc_accept (new_dcc); + irc_dcc_accept (new_dcc); else - dcc_redraw (HOTLIST_PRIVATE); + irc_dcc_redraw (HOTLIST_PRIVATE); gui_status_draw (gui_current_window->buffer, 0); return new_dcc; } /* - * dcc_send_request: send DCC request (file or chat) + * irc_dcc_send_request: send DCC request (file or chat) */ void -dcc_send_request (t_irc_server *server, int type, char *nick, char *filename) +irc_dcc_send_request (t_irc_server *server, int type, char *nick, char *filename) { char *dir1, *dir2, *filename2, *short_filename, *pos; int spaces, args, port_start, port_end; @@ -1069,7 +1071,7 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename) /* loop through the entire allowed port range */ while (port <= port_end) { - if (!dcc_port_in_use (port)) + if (!irc_dcc_port_in_use (port)) { /* attempt to bind to the free port */ addr.sin_port = htons (port); @@ -1138,11 +1140,11 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename) /* add DCC entry and listen to socket */ if (type == DCC_CHAT_SEND) - ptr_dcc = dcc_add (server, DCC_CHAT_SEND, local_addr, port, nick, sock, - NULL, NULL, 0); + ptr_dcc = irc_dcc_add (server, DCC_CHAT_SEND, local_addr, port, nick, sock, + NULL, NULL, 0); else - ptr_dcc = dcc_add (server, DCC_FILE_SEND, local_addr, port, nick, sock, - short_filename, filename2, st.st_size); + ptr_dcc = irc_dcc_add (server, DCC_FILE_SEND, local_addr, port, nick, sock, + short_filename, filename2, st.st_size); if (!ptr_dcc) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -1159,16 +1161,16 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename) /* send DCC request to nick */ if (type == DCC_CHAT_SEND) - server_sendf (server, - "PRIVMSG %s :\01DCC CHAT chat %lu %d\01", - nick, local_addr, port); + irc_server_sendf (server, + "PRIVMSG %s :\01DCC CHAT chat %lu %d\01", + nick, local_addr, port); else - server_sendf (server, - (spaces) ? + irc_server_sendf (server, + (spaces) ? "PRIVMSG %s :\01DCC SEND \"%s\" %lu %d %u\01\n" : "PRIVMSG %s :\01DCC SEND %s %lu %d %u\01", - nick, short_filename, local_addr, port, - (unsigned long) st.st_size); + nick, short_filename, local_addr, port, + (unsigned long) st.st_size); if (short_filename) free (short_filename); @@ -1177,11 +1179,11 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename) } /* - * dcc_chat_send: send data to remote host via DCC CHAT + * irc_dcc_chat_send: send data to remote host via DCC CHAT */ int -dcc_chat_send (t_irc_dcc *ptr_dcc, char *buffer, int size_buf) +irc_dcc_chat_send (t_irc_dcc *ptr_dcc, char *buffer, int size_buf) { if (!ptr_dcc) return -1; @@ -1190,11 +1192,11 @@ dcc_chat_send (t_irc_dcc *ptr_dcc, char *buffer, int size_buf) } /* - * dcc_chat_sendf: send formatted data to remote host via DCC CHAT + * irc_dcc_chat_sendf: send formatted data to remote host via DCC CHAT */ void -dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...) +irc_dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...) { va_list args; static char buffer[4096]; @@ -1218,23 +1220,23 @@ dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...) gui_printf (ptr_dcc->server->buffer, "[DEBUG] Sending to remote host (DCC CHAT) >>> %s\n", buffer); buffer[size_buf - 2] = '\r'; #endif - if (dcc_chat_send (ptr_dcc, buffer, strlen (buffer)) <= 0) + if (irc_dcc_chat_send (ptr_dcc, buffer, strlen (buffer)) <= 0) { irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer, PREFIX_ERROR); gui_printf (ptr_dcc->server->buffer, _("%s error sending data to \"%s\" via DCC CHAT\n"), WEECHAT_ERROR, ptr_dcc->nick); - dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_close (ptr_dcc, DCC_FAILED); } } /* - * dcc_chat_recv: receive data from DCC CHAT host + * irc_dcc_chat_recv: receive data from DCC CHAT host */ void -dcc_chat_recv (t_irc_dcc *ptr_dcc) +irc_dcc_chat_recv (t_irc_dcc *ptr_dcc) { fd_set read_fd; static struct timeval timeout; @@ -1307,7 +1309,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc) ptr_buf_color = (char *)gui_color_decode ((unsigned char *)ptr_buf, cfg_irc_colors_receive); - if (irc_is_highlight (ptr_buf, ptr_dcc->server->nick)) + if (irc_recv_is_highlight (ptr_buf, ptr_dcc->server->nick)) { irc_display_nick (ptr_dcc->channel->buffer, NULL, ptr_dcc->nick, MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT, 1, @@ -1341,18 +1343,18 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc) } else { - dcc_close (ptr_dcc, DCC_ABORTED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_ABORTED); + irc_dcc_redraw (HOTLIST_MSG); } } /* - * dcc_file_create_pipe: create pipe for communication with child process - * return 1 if ok, 0 if error + * irc_dcc_file_create_pipe: create pipe for communication with child process + * return 1 if ok, 0 if error */ int -dcc_file_create_pipe (t_irc_dcc *ptr_dcc) +irc_dcc_file_create_pipe (t_irc_dcc *ptr_dcc) { int child_pipe[2]; @@ -1363,8 +1365,8 @@ dcc_file_create_pipe (t_irc_dcc *ptr_dcc) gui_printf (ptr_dcc->server->buffer, _("%s DCC: unable to create pipe\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return 0; } @@ -1374,11 +1376,11 @@ dcc_file_create_pipe (t_irc_dcc *ptr_dcc) } /* - * dcc_file_write_pipe: write data into pipe + * irc_dcc_file_write_pipe: write data into pipe */ void -dcc_file_write_pipe (t_irc_dcc *ptr_dcc, int status, int error) +irc_dcc_file_write_pipe (t_irc_dcc *ptr_dcc, int status, int error) { char buffer[1 + 1 + 12 + 1]; /* status + error + pos + \0 */ @@ -1388,11 +1390,11 @@ dcc_file_write_pipe (t_irc_dcc *ptr_dcc, int status, int error) } /* - * dcc_file_send_child: child process for sending file + * irc_dcc_file_send_child: child process for sending file */ void -dcc_file_send_child (t_irc_dcc *ptr_dcc) +irc_dcc_file_send_child (t_irc_dcc *ptr_dcc) { int num_read, num_sent; static char buffer[DCC_MAX_BLOCKSIZE]; @@ -1412,7 +1414,7 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc) if ((num_read < 1) && ((num_read != -1) || (errno != EAGAIN))) { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_SEND_BLOCK); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_SEND_BLOCK); return; } if (num_read == 4) @@ -1424,7 +1426,7 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc) if ((ptr_dcc->pos >= ptr_dcc->size) && (ptr_dcc->ack >= ptr_dcc->size)) { - dcc_file_write_pipe (ptr_dcc, DCC_DONE, DCC_NO_ERROR); + irc_dcc_file_write_pipe (ptr_dcc, DCC_DONE, DCC_NO_ERROR); return; } } @@ -1441,7 +1443,7 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc) num_read = read (ptr_dcc->file, buffer, ptr_dcc->blocksize); if (num_read < 1) { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_READ_LOCAL); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_READ_LOCAL); return; } num_sent = send (ptr_dcc->sock, buffer, num_read, 0); @@ -1453,7 +1455,7 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc) usleep (1000); else { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_SEND_BLOCK); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_SEND_BLOCK); return; } } @@ -1464,7 +1466,7 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc) if (last_sent != new_time) { last_sent = new_time; - dcc_file_write_pipe (ptr_dcc, DCC_ACTIVE, DCC_NO_ERROR); + irc_dcc_file_write_pipe (ptr_dcc, DCC_ACTIVE, DCC_NO_ERROR); } } } @@ -1474,11 +1476,11 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc) } /* - * dcc_file_recv_child: child process for receiving file + * irc_dcc_file_recv_child: child process for receiving file */ void -dcc_file_recv_child (t_irc_dcc *ptr_dcc) +irc_dcc_file_recv_child (t_irc_dcc *ptr_dcc) { int num_read; static char buffer[DCC_MAX_BLOCKSIZE]; @@ -1486,14 +1488,14 @@ dcc_file_recv_child (t_irc_dcc *ptr_dcc) time_t last_sent, new_time; /* first connect to sender (blocking) */ - if (!dcc_connect_to_sender (ptr_dcc)) + if (!irc_dcc_connect_to_sender (ptr_dcc)) { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_CONNECT_SENDER); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_CONNECT_SENDER); return; } /* connection is ok, change DCC status (inform parent process) */ - dcc_file_write_pipe (ptr_dcc, DCC_ACTIVE, DCC_NO_ERROR); + irc_dcc_file_write_pipe (ptr_dcc, DCC_ACTIVE, DCC_NO_ERROR); last_sent = time (NULL); while (1) @@ -1506,7 +1508,7 @@ dcc_file_recv_child (t_irc_dcc *ptr_dcc) usleep (1000); else { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_RECV_BLOCK); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_RECV_BLOCK); return; } } @@ -1514,13 +1516,13 @@ dcc_file_recv_child (t_irc_dcc *ptr_dcc) { if (num_read == 0) { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_RECV_BLOCK); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_RECV_BLOCK); return; } if (write (ptr_dcc->file, buffer, num_read) == -1) { - dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_WRITE_LOCAL); + irc_dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_WRITE_LOCAL); return; } @@ -1533,7 +1535,7 @@ dcc_file_recv_child (t_irc_dcc *ptr_dcc) /* file received ok? */ if (ptr_dcc->pos >= ptr_dcc->size) { - dcc_file_write_pipe (ptr_dcc, DCC_DONE, DCC_NO_ERROR); + irc_dcc_file_write_pipe (ptr_dcc, DCC_DONE, DCC_NO_ERROR); return; } @@ -1541,18 +1543,18 @@ dcc_file_recv_child (t_irc_dcc *ptr_dcc) if (last_sent != new_time) { last_sent = new_time; - dcc_file_write_pipe (ptr_dcc, DCC_ACTIVE, DCC_NO_ERROR); + irc_dcc_file_write_pipe (ptr_dcc, DCC_ACTIVE, DCC_NO_ERROR); } } } } /* - * dcc_file_child_read: read data from child via pipe + * irc_dcc_file_child_read: read data from child via pipe */ void -dcc_file_child_read (t_irc_dcc *ptr_dcc) +irc_dcc_file_child_read (t_irc_dcc *ptr_dcc) { fd_set read_fd; static struct timeval timeout; @@ -1579,7 +1581,7 @@ dcc_file_child_read (t_irc_dcc *ptr_dcc) error = NULL; ptr_dcc->pos = strtol (bufpipe + 2, &error, 10); ptr_dcc->last_activity = time (NULL); - dcc_calculate_speed (ptr_dcc, 0); + irc_dcc_calculate_speed (ptr_dcc, 0); /* read error code */ switch (bufpipe[1] - '0') @@ -1640,33 +1642,33 @@ dcc_file_child_read (t_irc_dcc *ptr_dcc) ptr_dcc->status = DCC_ACTIVE; ptr_dcc->start_transfer = time (NULL); ptr_dcc->last_check_time = time (NULL); - dcc_redraw (HOTLIST_MSG); + irc_dcc_redraw (HOTLIST_MSG); } else - dcc_redraw (HOTLIST_LOW); + irc_dcc_redraw (HOTLIST_LOW); break; case DCC_DONE: - dcc_close (ptr_dcc, DCC_DONE); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_DONE); + irc_dcc_redraw (HOTLIST_MSG); break; case DCC_FAILED: - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); break; } } } /* - * dcc_file_send_fork: fork process for sending file + * irc_dcc_file_send_fork: fork process for sending file */ void -dcc_file_send_fork (t_irc_dcc *ptr_dcc) +irc_dcc_file_send_fork (t_irc_dcc *ptr_dcc) { pid_t pid; - if (!dcc_file_create_pipe (ptr_dcc)) + if (!irc_dcc_file_create_pipe (ptr_dcc)) return; ptr_dcc->file = open (ptr_dcc->local_filename, O_RDONLY | O_NONBLOCK, 0644); @@ -1680,13 +1682,13 @@ dcc_file_send_fork (t_irc_dcc *ptr_dcc) gui_printf (ptr_dcc->server->buffer, _("%s DCC: unable to fork\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return; /* child process */ case 0: setuid (getuid ()); - dcc_file_send_child (ptr_dcc); + irc_dcc_file_send_child (ptr_dcc); _exit (EXIT_SUCCESS); } @@ -1695,15 +1697,15 @@ dcc_file_send_fork (t_irc_dcc *ptr_dcc) } /* - * dcc_file_recv_fork: fork process for receiving file + * irc_dcc_file_recv_fork: fork process for receiving file */ void -dcc_file_recv_fork (t_irc_dcc *ptr_dcc) +irc_dcc_file_recv_fork (t_irc_dcc *ptr_dcc) { pid_t pid; - if (!dcc_file_create_pipe (ptr_dcc)) + if (!irc_dcc_file_create_pipe (ptr_dcc)) return; if (ptr_dcc->start_resume > 0) @@ -1723,13 +1725,13 @@ dcc_file_recv_fork (t_irc_dcc *ptr_dcc) gui_printf (ptr_dcc->server->buffer, _("%s DCC: unable to fork\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); return; /* child process */ case 0: setuid (getuid ()); - dcc_file_recv_child (ptr_dcc); + irc_dcc_file_recv_child (ptr_dcc); _exit (EXIT_SUCCESS); } @@ -1738,11 +1740,11 @@ dcc_file_recv_fork (t_irc_dcc *ptr_dcc) } /* - * dcc_handle: receive/send data for all active DCC + * irc_dcc_handle: receive/send data for all active DCC */ void -dcc_handle () +irc_dcc_handle () { t_irc_dcc *ptr_dcc; fd_set read_fd; @@ -1763,8 +1765,8 @@ dcc_handle () gui_printf (ptr_dcc->server->buffer, _("%s DCC: timeout\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); continue; } } @@ -1795,8 +1797,8 @@ dcc_handle () gui_printf (ptr_dcc->server->buffer, _("%s DCC: unable to create socket for sending file\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); continue; } ptr_dcc->sock = sock; @@ -1807,22 +1809,22 @@ dcc_handle () gui_printf (ptr_dcc->server->buffer, _("%s DCC: unable to set 'nonblock' option for socket\n"), WEECHAT_ERROR); - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); continue; } ptr_dcc->addr = ntohl (addr.sin_addr.s_addr); ptr_dcc->status = DCC_ACTIVE; ptr_dcc->start_transfer = time (NULL); - dcc_redraw (HOTLIST_MSG); - dcc_file_send_fork (ptr_dcc); + irc_dcc_redraw (HOTLIST_MSG); + irc_dcc_file_send_fork (ptr_dcc); } } } if (ptr_dcc->type == DCC_FILE_RECV) { if (ptr_dcc->child_read != -1) - dcc_file_child_read (ptr_dcc); + irc_dcc_file_child_read (ptr_dcc); } } @@ -1846,21 +1848,21 @@ dcc_handle () ptr_dcc->sock = -1; if (sock < 0) { - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); continue; } ptr_dcc->sock = sock; if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1) { - dcc_close (ptr_dcc, DCC_FAILED); - dcc_redraw (HOTLIST_MSG); + irc_dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_redraw (HOTLIST_MSG); continue; } ptr_dcc->addr = ntohl (addr.sin_addr.s_addr); ptr_dcc->status = DCC_ACTIVE; - dcc_redraw (HOTLIST_MSG); - dcc_channel_for_chat (ptr_dcc); + irc_dcc_redraw (HOTLIST_MSG); + irc_dcc_channel_for_chat (ptr_dcc); } } } @@ -1869,19 +1871,19 @@ dcc_handle () if (ptr_dcc->status == DCC_ACTIVE) { if (DCC_IS_CHAT(ptr_dcc->type)) - dcc_chat_recv (ptr_dcc); + irc_dcc_chat_recv (ptr_dcc); else - dcc_file_child_read (ptr_dcc); + irc_dcc_file_child_read (ptr_dcc); } } } /* - * dcc_end: close all opened sockets (called when WeeChat is exiting) + * irc_dcc_end: close all opened sockets (called when WeeChat is exiting) */ void -dcc_end () +irc_dcc_end () { t_irc_dcc *ptr_dcc; @@ -1892,17 +1894,17 @@ dcc_end () if (ptr_dcc->status == DCC_ACTIVE) weechat_log_printf (_("Aborting active DCC: \"%s\" from %s\n"), ptr_dcc->filename, ptr_dcc->nick); - dcc_close (ptr_dcc, DCC_FAILED); + irc_dcc_close (ptr_dcc, DCC_FAILED); } } } /* - * dcc_print_log: print DCC infos in log (usually for crash dump) + * irc_dcc_print_log: print DCC infos in log (usually for crash dump) */ void -dcc_print_log () +irc_dcc_print_log () { t_irc_dcc *ptr_dcc; diff --git a/weechat/src/irc/irc-display.c b/weechat/src/irc/irc-display.c index bd20659e5..53f3e3ba5 100644 --- a/weechat/src/irc/irc-display.c +++ b/weechat/src/irc/irc-display.c @@ -37,49 +37,53 @@ /* - * irc_find_context: find window/buffer for a server/channel + * irc_display_hide_password: hide IRC password(s) in a string */ void -irc_find_context (t_irc_server *server, t_irc_channel *channel, - t_gui_window **window, t_gui_buffer **buffer) +irc_display_hide_password (char *string, int look_for_nickserv) { - t_gui_window *ptr_win; - - if (!buffer) - return; - - /* first find buffer */ - *buffer = NULL; - if (channel && channel->buffer) - *buffer = channel->buffer; - else - { - if (server && server->buffer) - *buffer = server->buffer; - else - *buffer = gui_current_window->buffer; - } - - /* then find first window displaying this buffer */ - if (window) + char *pos_nickserv, *pos, *pos_pwd; + + pos = string; + while (1) { - *window = NULL; - if (gui_current_window->buffer == *buffer) - *window = gui_current_window; + if (look_for_nickserv) + { + pos_nickserv = strstr (pos, "nickserv "); + if (!pos_nickserv) + return; + pos = pos_nickserv + 9; + while (pos[0] == ' ') + pos++; + if ((strncmp (pos, "identify ", 9) == 0) + || (strncmp (pos, "register ", 9) == 0)) + pos_pwd = pos + 9; + else + pos_pwd = NULL; + } else { - for (ptr_win = gui_windows; ptr_win; - ptr_win = ptr_win->next_window) + pos_pwd = strstr (pos, "identify "); + if (!pos_pwd) + pos_pwd = strstr (pos, "register "); + if (!pos_pwd) + return; + pos_pwd += 9; + } + + if (pos_pwd) + { + while (pos_pwd[0] == ' ') + pos_pwd++; + + while (pos_pwd[0] && (pos_pwd[0] != ';') && (pos_pwd[0] != ' ') + && (pos_pwd[0] != '"')) { - if (ptr_win->buffer == *buffer) - { - *window = ptr_win; - break; - } + pos_pwd[0] = '*'; + pos_pwd++; } - if (!*window) - *window = gui_current_window; + pos = pos_pwd; } } } @@ -429,7 +433,7 @@ irc_display_server (t_irc_server *server) if (string) { if (cfg_log_hide_nickserv_pwd) - irc_hide_password (string, 1); + irc_display_hide_password (string, 1); gui_printf (NULL, " server_command . . . . . . : %s\n", string); free (string); diff --git a/weechat/src/irc/irc-ignore.c b/weechat/src/irc/irc-ignore.c index 1de629786..66888d93a 100644 --- a/weechat/src/irc/irc-ignore.c +++ b/weechat/src/irc/irc-ignore.c @@ -42,12 +42,12 @@ t_irc_ignore *last_irc_ignore = NULL; /* - * ignore_check_mask: returns 1 is mask1 and mask2 are the same host - * anyone or both strings may have user and/or host after + * irc_ignore_check_mask: return 1 is mask1 and mask2 are the same host + * anyone or both strings may have user and/or host after */ int -ignore_check_mask (char *mask1, char *mask2) +irc_ignore_check_mask (char *mask1, char *mask2) { char *m1, *m2, *pos; int match; @@ -85,15 +85,16 @@ ignore_check_mask (char *mask1, char *mask2) } /* - * ignore_match: check if pointed ignore matches with arguments + * irc_ignore_match: check if pointed ignore matches with arguments */ int -ignore_match (t_irc_ignore *ptr_ignore, char *mask, char *type, char *channel_name, char *server_name) +irc_ignore_match (t_irc_ignore *ptr_ignore, char *mask, char *type, + char *channel_name, char *server_name) { /* check mask */ if ((strcmp (mask, "*") != 0) && (strcmp (ptr_ignore->mask, "*") != 0) - && (!ignore_check_mask (ptr_ignore->mask, mask))) + && (!irc_ignore_check_mask (ptr_ignore->mask, mask))) return 0; /* mask is matching, go on with type */ @@ -132,13 +133,13 @@ ignore_match (t_irc_ignore *ptr_ignore, char *mask, char *type, char *channel_na } /* - * ignore_check: check if an ignore is set for arguments - * returns 1 if at least one ignore exists (message should NOT be displayed) - * 0 if no ignore found (message will be displayed) + * irc_ignore_check: check if an ignore is set for arguments + * return 1 if at least one ignore exists (message should NOT be displayed) + * 0 if no ignore found (message will be displayed) */ int -ignore_check (char *mask, char *type, char *channel_name, char *server_name) +irc_ignore_check (char *mask, char *type, char *channel_name, char *server_name) { t_irc_ignore *ptr_ignore; @@ -148,7 +149,7 @@ ignore_check (char *mask, char *type, char *channel_name, char *server_name) for (ptr_ignore = irc_ignore; ptr_ignore; ptr_ignore = ptr_ignore->next_ignore) { - if (ignore_match (ptr_ignore, mask, type, channel_name, server_name)) + if (irc_ignore_match (ptr_ignore, mask, type, channel_name, server_name)) return 1; } @@ -157,11 +158,11 @@ ignore_check (char *mask, char *type, char *channel_name, char *server_name) } /* - * ignore_search: search for an ignore + * irc_ignore_search: search for an ignore */ t_irc_ignore * -ignore_search (char *mask, char *type, char *channel_name, char *server_name) +irc_ignore_search (char *mask, char *type, char *channel_name, char *server_name) { t_irc_ignore *ptr_ignore; @@ -180,11 +181,11 @@ ignore_search (char *mask, char *type, char *channel_name, char *server_name) } /* - * ignore_add: add an ignore in list + * irc_ignore_add: add an ignore in list */ t_irc_ignore * -ignore_add (char *mask, char *type, char *channel_name, char *server_name) +irc_ignore_add (char *mask, char *type, char *channel_name, char *server_name) { int type_index; t_irc_command *command_ptr; @@ -218,7 +219,7 @@ ignore_add (char *mask, char *type, char *channel_name, char *server_name) return NULL; } - if (ignore_search (mask, type, channel_name, server_name)) + if (irc_ignore_search (mask, type, channel_name, server_name)) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); gui_printf (NULL, @@ -258,12 +259,12 @@ ignore_add (char *mask, char *type, char *channel_name, char *server_name) } /* - * ignore_add_from_config: add an ignore to list, read from config file - * (comma serparated values) + * irc_ignore_add_from_config: add an ignore to list, read from config file + * (comma serparated values) */ t_irc_ignore * -ignore_add_from_config (char *string) +irc_ignore_add_from_config (char *string) { t_irc_ignore *new_ignore; char *string2; @@ -291,7 +292,7 @@ ignore_add_from_config (char *string) { pos_server[0] = '\0'; pos_server++; - new_ignore = ignore_add (pos_mask, pos_type, pos_channel, pos_server); + new_ignore = irc_ignore_add (pos_mask, pos_type, pos_channel, pos_server); } } } @@ -301,11 +302,11 @@ ignore_add_from_config (char *string) } /* - * ignore_free: free an ignore + * irc_ignore_free: free an ignore */ void -ignore_free (t_irc_ignore *ptr_ignore) +irc_ignore_free (t_irc_ignore *ptr_ignore) { t_irc_ignore *new_irc_ignore; @@ -338,24 +339,25 @@ ignore_free (t_irc_ignore *ptr_ignore) } /* - * ignore_free_all: free all ignores + * irc_ignore_free_all: free all ignores */ void -ignore_free_all () +irc_ignore_free_all () { while (irc_ignore) - ignore_free (irc_ignore); + irc_ignore_free (irc_ignore); } /* - * ignore_search_free: search and free ignore(s) - * return: number of ignore found and deleted - * 0 if no ignore found + * irc_ignore_search_free: search and free ignore(s) + * return: number of ignore found and deleted + * 0 if no ignore found */ int -ignore_search_free (char *mask, char *type, char *channel_name, char *server_name) +irc_ignore_search_free (char *mask, char *type, + char *channel_name, char *server_name) { int found; t_irc_ignore *ptr_ignore, *next_ignore; @@ -364,7 +366,7 @@ ignore_search_free (char *mask, char *type, char *channel_name, char *server_nam ptr_ignore = irc_ignore; while (ptr_ignore) { - if (ignore_match (ptr_ignore, mask, type, channel_name, server_name)) + if (irc_ignore_match (ptr_ignore, mask, type, channel_name, server_name)) { found++; if (found == 1) @@ -372,7 +374,7 @@ ignore_search_free (char *mask, char *type, char *channel_name, char *server_nam irc_display_prefix (NULL, NULL, PREFIX_INFO); weechat_cmd_ignore_display (_("Removing ignore:"), ptr_ignore); next_ignore = ptr_ignore->next_ignore; - ignore_free (ptr_ignore); + irc_ignore_free (ptr_ignore); ptr_ignore = next_ignore; } else @@ -383,13 +385,13 @@ ignore_search_free (char *mask, char *type, char *channel_name, char *server_nam } /* - * ignore_search_free_by_number: search and free ignore(s) by number - * return: 1 if ignore found and deleted - * 0 if ignore not found + * irc_ignore_search_free_by_number: search and free ignore(s) by number + * return: 1 if ignore found and deleted + * 0 if ignore not found */ int -ignore_search_free_by_number (int number) +irc_ignore_search_free_by_number (int number) { int i; t_irc_ignore *ptr_ignore; @@ -407,7 +409,7 @@ ignore_search_free_by_number (int number) gui_printf (NULL, "\n"); irc_display_prefix (NULL, NULL, PREFIX_INFO); weechat_cmd_ignore_display (_("Removing ignore:"), ptr_ignore); - ignore_free (ptr_ignore); + irc_ignore_free (ptr_ignore); return 1; } } @@ -417,11 +419,11 @@ ignore_search_free_by_number (int number) } /* - * ignore_print_log: print ignore list in log (usually for crash dump) + * irc_ignore_print_log: print ignore list in log (usually for crash dump) */ void -ignore_print_log () +irc_ignore_print_log () { t_irc_ignore *ptr_ignore; diff --git a/weechat/src/irc/irc-mode.c b/weechat/src/irc/irc-mode.c index 289619217..05e00460f 100644 --- a/weechat/src/irc/irc-mode.c +++ b/weechat/src/irc/irc-mode.c @@ -45,11 +45,11 @@ irc_mode_channel_set_nick (t_irc_channel *channel, char *nick, if (nick) { - ptr_nick = nick_search (channel, nick); + ptr_nick = irc_nick_search (channel, nick); if (ptr_nick) { NICK_SET_FLAG(ptr_nick, (set_flag == '+'), flag); - nick_resort (channel, ptr_nick); + irc_nick_resort (channel, ptr_nick); gui_nicklist_draw (channel->buffer, 1, 1); } } diff --git a/weechat/src/irc/irc-nick.c b/weechat/src/irc/irc-nick.c index a209157ea..5f1bfb118 100644 --- a/weechat/src/irc/irc-nick.c +++ b/weechat/src/irc/irc-nick.c @@ -37,11 +37,11 @@ /* - * nick_find_color: find a color for a nick (according to nick letters) + * irc_nick_find_color: find a color for a nick (according to nick letters) */ int -nick_find_color (t_irc_nick *nick) +irc_nick_find_color (t_irc_nick *nick) { int i, color; @@ -56,11 +56,11 @@ nick_find_color (t_irc_nick *nick) } /* - * nick_score_for_sort: return score for sorting nick, according to privileges + * irc_nick_score_for_sort: return score for sorting nick, according to privileges */ int -nick_score_for_sort (t_irc_nick *nick) +irc_nick_score_for_sort (t_irc_nick *nick) { if (nick->flags & NICK_CHANOWNER) return -64; @@ -78,20 +78,20 @@ nick_score_for_sort (t_irc_nick *nick) } /* - * nick_compare: compare two nicks - * return: -1 is nick1 < nick2 - * 0 if nick1 = nick2 - * +1 if nick1 > nick2 - * status sort: operator > voice > normal nick + * irc_nick_compare: compare two nicks + * return: -1 is nick1 < nick2 + * 0 if nick1 = nick2 + * +1 if nick1 > nick2 + * status sort: operator > voice > normal nick */ int -nick_compare (t_irc_nick *nick1, t_irc_nick *nick2) +irc_nick_compare (t_irc_nick *nick1, t_irc_nick *nick2) { int score1, score2, comp; - score1 = nick_score_for_sort (nick1); - score2 = nick_score_for_sort (nick2); + score1 = irc_nick_score_for_sort (nick1); + score2 = irc_nick_score_for_sort (nick2); comp = ascii_strcasecmp (nick1->nick, nick2->nick); if (comp > 0) @@ -110,34 +110,34 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2) } /* - * nick_find_pos: find position for a nick (for sorting nick list) + * irc_nick_find_pos: find position for a nick (for sorting nick list) */ t_irc_nick * -nick_find_pos (t_irc_channel *channel, t_irc_nick *nick) +irc_nick_find_pos (t_irc_channel *channel, t_irc_nick *nick) { t_irc_nick *ptr_nick; for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { - if (nick_compare (nick, ptr_nick) < 0) + if (irc_nick_compare (nick, ptr_nick) < 0) return ptr_nick; } return NULL; } /* - * nick_insert_sorted: insert nick into sorted list + * irc_nick_insert_sorted: insert nick into sorted list */ void -nick_insert_sorted (t_irc_channel *channel, t_irc_nick *nick) +irc_nick_insert_sorted (t_irc_channel *channel, t_irc_nick *nick) { t_irc_nick *pos_nick; if (channel->nicks) { - pos_nick = nick_find_pos (channel, nick); + pos_nick = irc_nick_find_pos (channel, nick); if (pos_nick) { @@ -169,11 +169,11 @@ nick_insert_sorted (t_irc_channel *channel, t_irc_nick *nick) } /* - * nick_resort: resort nick in the list + * irc_nick_resort: resort nick in the list */ void -nick_resort (t_irc_channel *channel, t_irc_nick *nick) +irc_nick_resort (t_irc_channel *channel, t_irc_nick *nick) { /* temporarly remove nick from list */ if (nick == channel->nicks) @@ -186,22 +186,22 @@ nick_resort (t_irc_channel *channel, t_irc_nick *nick) channel->last_nick = nick->prev_nick; /* insert again nick into sorted list */ - nick_insert_sorted (channel, nick); + irc_nick_insert_sorted (channel, nick); } /* - * nick_new: allocate a new nick for a channel and add it to the nick list + * irc_nick_new: allocate a new nick for a channel and add it to the nick list */ t_irc_nick * -nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name, - int is_chanowner, int is_chanadmin, int is_chanadmin2, int is_op, - int is_halfop, int has_voice) +irc_nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name, + int is_chanowner, int is_chanadmin, int is_chanadmin2, int is_op, + int is_halfop, int has_voice) { t_irc_nick *new_nick; /* nick already exists on this channel? */ - if ((new_nick = nick_search (channel, nick_name))) + if ((new_nick = irc_nick_search (channel, nick_name))) { /* update nick */ NICK_SET_FLAG(new_nick, is_chanowner, NICK_CHANOWNER); @@ -210,7 +210,7 @@ nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name, NICK_SET_FLAG(new_nick, is_op, NICK_OP); NICK_SET_FLAG(new_nick, is_halfop, NICK_HALFOP); NICK_SET_FLAG(new_nick, has_voice, NICK_VOICE); - nick_resort (channel, new_nick); + irc_nick_resort (channel, new_nick); return new_nick; } @@ -231,9 +231,9 @@ nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name, if (ascii_strcasecmp (new_nick->nick, server->nick) == 0) new_nick->color = COLOR_WIN_NICK_SELF; else - new_nick->color = nick_find_color (new_nick); + new_nick->color = irc_nick_find_color (new_nick); - nick_insert_sorted (channel, new_nick); + irc_nick_insert_sorted (channel, new_nick); channel->nicks_count++; @@ -244,11 +244,11 @@ nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name, } /* - * nick_change: change nickname and move it if necessary (list is sorted) + * irc_nick_change: change nickname and move it if necessary (list is sorted) */ void -nick_change (t_irc_channel *channel, t_irc_nick *nick, char *new_nick) +irc_nick_change (t_irc_channel *channel, t_irc_nick *nick, char *new_nick) { int nick_is_me; @@ -261,18 +261,18 @@ nick_change (t_irc_channel *channel, t_irc_nick *nick, char *new_nick) if (nick_is_me) nick->color = COLOR_WIN_NICK_SELF; else - nick->color = nick_find_color (nick); + nick->color = irc_nick_find_color (nick); /* insert again nick into sorted list */ - nick_resort (channel, nick); + irc_nick_resort (channel, nick); } /* - * nick_free: free a nick and remove it from nicks queue + * irc_nick_free: free a nick and remove it from nicks queue */ void -nick_free (t_irc_channel *channel, t_irc_nick *nick) +irc_nick_free (t_irc_channel *channel, t_irc_nick *nick) { t_irc_nick *new_nicks; @@ -307,29 +307,29 @@ nick_free (t_irc_channel *channel, t_irc_nick *nick) } /* - * nick_free_all: free all allocated nicks for a channel + * irc_nick_free_all: free all allocated nicks for a channel */ void -nick_free_all (t_irc_channel *channel) +irc_nick_free_all (t_irc_channel *channel) { if (!channel) return; /* remove all nicks for the channel */ while (channel->nicks) - nick_free (channel, channel->nicks); + irc_nick_free (channel, channel->nicks); /* sould be zero, but prevent any bug :D */ channel->nicks_count = 0; } /* - * nick_search: returns pointer on a nick + * irc_nick_search: returns pointer on a nick */ t_irc_nick * -nick_search (t_irc_channel *channel, char *nickname) +irc_nick_search (t_irc_channel *channel, char *nickname) { t_irc_nick *ptr_nick; @@ -346,12 +346,12 @@ nick_search (t_irc_channel *channel, char *nickname) } /* - * nick_count: returns number of nicks (total, op, halfop, voice) on a channel + * irc_nick_count: returns number of nicks (total, op, halfop, voice) on a channel */ void -nick_count (t_irc_channel *channel, int *total, int *count_op, - int *count_halfop, int *count_voice, int *count_normal) +irc_nick_count (t_irc_channel *channel, int *total, int *count_op, + int *count_halfop, int *count_voice, int *count_normal) { t_irc_nick *ptr_nick; @@ -385,11 +385,11 @@ nick_count (t_irc_channel *channel, int *total, int *count_op, } /* - * nick_get_max_length: returns longer nickname on a channel + * irc_nick_get_max_length: returns longer nickname on a channel */ int -nick_get_max_length (t_irc_channel *channel) +irc_nick_get_max_length (t_irc_channel *channel) { int length, max_length; t_irc_nick *ptr_nick; @@ -405,11 +405,11 @@ nick_get_max_length (t_irc_channel *channel) } /* - * nick_set_away: set/unset away status for a channel + * irc_nick_set_away: set/unset away status for a channel */ void -nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away) +irc_nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away) { if ((cfg_irc_away_check > 0) && ((cfg_irc_away_check_max_nicks == 0) || @@ -425,11 +425,11 @@ nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away) } /* - * nick_print_log: print nick infos in log (usually for crash dump) + * irc_nick_print_log: print nick infos in log (usually for crash dump) */ void -nick_print_log (t_irc_nick *nick) +irc_nick_print_log (t_irc_nick *nick) { weechat_log_printf ("=> nick %s (addr:0x%X)]\n", nick->nick, nick); weechat_log_printf (" host . . . . . : %s\n", nick->host); diff --git a/weechat/src/irc/irc-recv.c b/weechat/src/irc/irc-recv.c index 6c564753d..be95d2236 100644 --- a/weechat/src/irc/irc-recv.c +++ b/weechat/src/irc/irc-recv.c @@ -54,11 +54,11 @@ int command_ignored, command_force_highlight; /* - * irc_is_word_char: return 1 if given character is a "word character" + * irc_recv_is_word_char: return 1 if given character is a "word character" */ int -irc_is_word_char (char c) +irc_recv_is_word_char (char c) { if (isalnum (c)) return 1; @@ -76,11 +76,11 @@ irc_is_word_char (char c) } /* - * irc_is_numeric: return 1 if given string is 100% numeric + * irc_recv_command_is_numeric: return 1 if given string is 100% numeric */ int -irc_is_numeric (char *str) +irc_recv_command_is_numeric (char *str) { while (str && str[0]) { @@ -92,12 +92,12 @@ irc_is_numeric (char *str) } /* - * irc_is_highlight: returns 1 if given message contains highlight (with given nick - * or at least one of string in "irc_higlight" setting) + * irc_recv_is_highlight: return 1 if given message contains highlight (with given nick + * or at least one of string in "irc_higlight" setting) */ int -irc_is_highlight (char *message, char *nick) +irc_recv_is_highlight (char *message, char *nick) { char *msg, *highlight, *match, *match_pre, *match_post, *msg_pos, *pos, *pos_end; int end, length, startswith, endswith, wildcard_start, wildcard_end; @@ -116,8 +116,8 @@ irc_is_highlight (char *message, char *nick) { match_pre = match - 1; match_post = match + strlen(nick); - startswith = ((match == message) || (!irc_is_word_char (match_pre[0]))); - endswith = ((!match_post[0]) || (!irc_is_word_char (match_post[0]))); + startswith = ((match == message) || (!irc_recv_is_word_char (match_pre[0]))); + endswith = ((!match_post[0]) || (!irc_recv_is_word_char (match_post[0]))); if (startswith && endswith) return 1; } @@ -190,8 +190,8 @@ irc_is_highlight (char *message, char *nick) { match_pre = match - 1; match_post = match + length; - startswith = ((match == msg) || (!irc_is_word_char (match_pre[0]))); - endswith = ((!match_post[0]) || (!irc_is_word_char (match_post[0]))); + startswith = ((match == msg) || (!irc_recv_is_word_char (match_pre[0]))); + endswith = ((!match_post[0]) || (!irc_recv_is_word_char (match_post[0]))); if ((wildcard_start && wildcard_end) || (!wildcard_start && !wildcard_end && startswith && endswith) || @@ -252,10 +252,10 @@ irc_recv_command (t_irc_server *server, char *entire_line, if (cmd_found < 0) { /* for numeric commands, we use default recv function (irc_recv_server_msg) */ - if (irc_is_numeric (command)) + if (irc_recv_command_is_numeric (command)) { cmd_name = command; - cmd_recv_func = irc_cmd_recv_server_msg; + cmd_recv_func = irc_recv_cmd_server_msg; } else return -3; @@ -272,10 +272,10 @@ irc_recv_command (t_irc_server *server, char *entire_line, dup_host = (host) ? strdup (host) : NULL; dup_arguments = (arguments) ? strdup (arguments) : NULL; - command_ignored = ignore_check (dup_host, - cmd_name, - NULL, - server->name); + command_ignored = irc_ignore_check (dup_host, + cmd_name, + NULL, + server->name); command_force_highlight = 0; #ifdef PLUGINS return_code = plugin_msg_handler_exec (server->name, @@ -320,11 +320,11 @@ irc_recv_command (t_irc_server *server, char *entire_line, } /* - * irc_cmd_recv_error: error received from server + * irc_recv_cmd_error: error received from server */ int -irc_cmd_recv_error (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_error (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; int first; @@ -353,7 +353,7 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *nick, char *argument (first) ? "" : ": ", arguments); if (strncmp (arguments, "Closing Link", 12) == 0) - server_disconnect (server, 1); + irc_server_disconnect (server, 1); arguments = NULL; } else @@ -365,7 +365,7 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *nick, char *argument { if (first) { - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) ptr_buffer = ptr_channel->buffer; irc_display_prefix (server, ptr_buffer, PREFIX_ERROR); @@ -387,11 +387,11 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *nick, char *argument } /* - * irc_cmd_recv_invite: 'invite' message received + * irc_recv_cmd_invite: 'invite' message received */ int -irc_cmd_recv_invite (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_invite (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel; @@ -405,7 +405,7 @@ irc_cmd_recv_invite (t_irc_server *server, char *host, char *nick, char *argumen if (pos_channel[0] == ':') pos_channel++; - command_ignored |= ignore_check (host, "invite", pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "invite", pos_channel, server->name); if (!command_ignored) { @@ -437,11 +437,11 @@ irc_cmd_recv_invite (t_irc_server *server, char *host, char *nick, char *argumen /* - * irc_cmd_recv_join: 'join' message received + * irc_recv_cmd_join: 'join' message received */ int -irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_join (t_irc_server *server, char *host, char *nick, char *arguments) { t_irc_channel *ptr_channel; t_irc_nick *ptr_nick; @@ -450,12 +450,12 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments if (arguments[0] == ':') arguments++; - command_ignored |= ignore_check (host, "join", arguments, server->name); + command_ignored |= irc_ignore_check (host, "join", arguments, server->name); - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (!ptr_channel) { - ptr_channel = channel_new (server, CHANNEL_TYPE_CHANNEL, arguments); + ptr_channel = irc_channel_new (server, CHANNEL_TYPE_CHANNEL, arguments); if (!ptr_channel) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -498,7 +498,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments } /* add nick in channel */ - ptr_nick = nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0, 0); + ptr_nick = irc_nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0, 0); if (ptr_nick) ptr_nick->host = strdup ((pos) ? pos + 1 : host); @@ -509,11 +509,11 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_kick: 'kick' message received + * irc_recv_cmd_kick: 'kick' message received */ int -irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_kick (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_comment; t_irc_channel *ptr_channel; @@ -538,9 +538,9 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments pos_comment++; } - command_ignored |= ignore_check (host, "kick", arguments, server->name); + command_ignored |= irc_ignore_check (host, "kick", arguments, server->name); - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (!ptr_channel) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -583,18 +583,18 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments if (strcmp (pos_nick, server->nick) == 0) { /* my nick was kicked => free all nicks, channel is not active any more */ - nick_free_all (ptr_channel); + irc_nick_free_all (ptr_channel); gui_nicklist_draw (ptr_channel->buffer, 1, 1); gui_status_draw (ptr_channel->buffer, 1); if (server->autorejoin) - irc_cmd_send_join (server, NULL, ptr_channel->name); + irc_send_cmd_join (server, NULL, ptr_channel->name); } { /* someone was kicked from channel (but not me) => remove only this nick */ - ptr_nick = nick_search (ptr_channel, pos_nick); + ptr_nick = irc_nick_search (ptr_channel, pos_nick); if (ptr_nick) { - nick_free (ptr_channel, ptr_nick); + irc_nick_free (ptr_channel, ptr_nick); gui_nicklist_draw (ptr_channel->buffer, 1, 1); gui_status_draw (ptr_channel->buffer, 1); } @@ -603,11 +603,11 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_kill: 'kill' message received + * irc_recv_cmd_kill: 'kill' message received */ int -irc_cmd_recv_kill (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_kill (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_host2, *pos_comment; t_irc_channel *ptr_channel; @@ -640,7 +640,7 @@ irc_cmd_recv_kill (t_irc_server *server, char *host, char *nick, char *arguments ptr_channel = ptr_channel->next_channel) { if (!command_ignored - && !ignore_check (host, "kill", ptr_channel->name, server->name)) + && !irc_ignore_check (host, "kill", ptr_channel->name, server->name)) { irc_display_prefix (server, ptr_channel->buffer, PREFIX_PART); gui_printf (ptr_channel->buffer, _("%s%s%s has killed %s%s%s from server"), @@ -673,11 +673,11 @@ irc_cmd_recv_kill (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_mode: 'mode' message received + * irc_recv_cmd_mode: 'mode' message received */ int -irc_cmd_recv_mode (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_mode (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_modes, *pos; t_irc_channel *ptr_channel; @@ -716,13 +716,13 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *nick, char *arguments pos--; } - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) { - command_ignored |= ignore_check (host, "mode", - ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "mode", + ptr_channel->name, server->name); if (!command_ignored) { irc_display_prefix (server, ptr_channel->buffer, PREFIX_INFO); @@ -739,7 +739,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *nick, char *arguments nick); } irc_mode_channel_set (ptr_channel, pos_modes); - server_sendf (server, "MODE %s", ptr_channel->name); + irc_server_sendf (server, "MODE %s", ptr_channel->name); } else { @@ -771,11 +771,11 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_nick: 'nick' message received + * irc_recv_cmd_nick: 'nick' message received */ int -irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_nick (t_irc_server *server, char *host, char *nick, char *arguments) { t_irc_channel *ptr_channel; t_irc_nick *ptr_nick; @@ -805,7 +805,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments if ((CHANNEL(ptr_buffer)->name) && (ascii_strcasecmp (nick, CHANNEL(ptr_buffer)->name) == 0)) { - ptr_channel = channel_search_any (server, arguments); + ptr_channel = irc_channel_search_any (server, arguments); if (!ptr_channel) { free (CHANNEL(ptr_buffer)->name); @@ -818,15 +818,15 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { - ptr_nick = nick_search (ptr_channel, nick); + ptr_nick = irc_nick_search (ptr_channel, nick); if (ptr_nick) { nick_is_me = (strcmp (ptr_nick->nick, server->nick) == 0) ? 1 : 0; if (nick_is_me) gui_add_hotlist = 0; - nick_change (ptr_channel, ptr_nick, arguments); + irc_nick_change (ptr_channel, ptr_nick, arguments); if (!command_ignored - && !ignore_check (host, "nick", ptr_channel->name, server->name)) + && !irc_ignore_check (host, "nick", ptr_channel->name, server->name)) { irc_display_prefix (server, ptr_channel->buffer, PREFIX_INFO); if (nick_is_me) @@ -867,11 +867,11 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_notice: 'notice' message received + * irc_recv_cmd_notice: 'notice' message received */ int -irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_notice (t_irc_server *server, char *host, char *nick, char *arguments) { char *host2, *pos, *pos2, *pos_usec; struct timeval tv; @@ -964,10 +964,10 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen { if (nick && nick[0] && cfg_irc_notice_as_pv) { - ptr_channel = channel_search (server, nick); + ptr_channel = irc_channel_search (server, nick); if (!ptr_channel) { - ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, nick); + ptr_channel = irc_channel_new (server, CHANNEL_TYPE_PRIVATE, nick); if (!ptr_channel) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -988,7 +988,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK, "%s<", GUI_COLOR(COLOR_WIN_CHAT_DARK)); - if (irc_is_highlight (pos, server->nick)) + if (irc_recv_is_highlight (pos, server->nick)) { gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT, @@ -1063,11 +1063,11 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen } /* - * irc_cmd_recv_part: 'part' message received + * irc_recv_cmd_part: 'part' message received */ int -irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_part (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos_args, *join_string; int join_length; @@ -1095,11 +1095,11 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments pos_args++; } - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) { - command_ignored |= ignore_check (host, "part", ptr_channel->name, server->name); - ptr_nick = nick_search (ptr_channel, nick); + command_ignored |= irc_ignore_check (host, "part", ptr_channel->name, server->name); + ptr_nick = irc_nick_search (ptr_channel, nick); if (ptr_nick) { /* display part message */ @@ -1130,7 +1130,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments /* part request was issued by local client ? */ if (strcmp (ptr_nick->nick, server->nick) == 0) { - nick_free_all (ptr_channel); + irc_nick_free_all (ptr_channel); /* cycling ? => rejoin channel immediately */ if (ptr_channel->cycle) @@ -1146,24 +1146,24 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments snprintf (join_string, join_length, "%s %s", ptr_channel->name, ptr_channel->key); - irc_cmd_send_join(server, ptr_channel, join_string); + irc_send_cmd_join(server, ptr_channel, join_string); free (join_string); } else - irc_cmd_send_join(server, ptr_channel, ptr_channel->name); + irc_send_cmd_join(server, ptr_channel, ptr_channel->name); } else - irc_cmd_send_join(server, ptr_channel, ptr_channel->name); + irc_send_cmd_join(server, ptr_channel, ptr_channel->name); } if (ptr_channel->close) { gui_buffer_free (ptr_channel->buffer, 1); - channel_free (server, ptr_channel); + irc_channel_free (server, ptr_channel); ptr_channel = NULL; } } else - nick_free (ptr_channel, ptr_nick); + irc_nick_free (ptr_channel, ptr_nick); if (ptr_channel) { @@ -1186,11 +1186,11 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_ping: 'ping' command received + * irc_recv_cmd_ping: 'ping' command received */ int -irc_cmd_recv_ping (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_ping (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; @@ -1205,17 +1205,17 @@ irc_cmd_recv_ping (t_irc_server *server, char *host, char *nick, char *arguments if (pos) pos[0] = '\0'; - server_sendf (server, "PONG :%s", arguments); + irc_server_sendf (server, "PONG :%s", arguments); return 0; } /* - * irc_cmd_recv_pong: 'pong' command received + * irc_recv_cmd_pong: 'pong' command received */ int -irc_cmd_recv_pong (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_pong (t_irc_server *server, char *host, char *nick, char *arguments) { struct timeval tv; int old_lag; @@ -1256,7 +1256,7 @@ irc_cmd_reply_version (t_irc_server *server, t_irc_channel *channel, ptr_buffer = (channel) ? channel->buffer : server->buffer; - command_ignored |= ignore_check (host, "ctcp", NULL, server->name); + command_ignored |= irc_ignore_check (host, "ctcp", NULL, server->name); if (!command_ignored) { pos = strchr (message, ' '); @@ -1273,21 +1273,21 @@ irc_cmd_reply_version (t_irc_server *server, t_irc_channel *channel, buf = (struct utsname *) malloc (sizeof (struct utsname)); if (buf && (uname (buf) >= 0)) { - server_sendf (server, - "NOTICE %s :%sVERSION %s v%s" - " compiled on %s, running " - "%s %s / %s%s", - nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__, - &buf->sysname, - &buf->release, &buf->machine, "\01"); + irc_server_sendf (server, + "NOTICE %s :%sVERSION %s v%s" + " compiled on %s, running " + "%s %s / %s%s", + nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__, + &buf->sysname, + &buf->release, &buf->machine, "\01"); free (buf); } else - server_sendf (server, - "NOTICE %s :%sVERSION %s v%s" - " compiled on %s%s", - nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__, - "\01"); + irc_server_sendf (server, + "NOTICE %s :%sVERSION %s v%s" + " compiled on %s%s", + nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__, + "\01"); irc_display_prefix (server, ptr_buffer, PREFIX_SERVER); gui_printf (ptr_buffer, _("CTCP %sVERSION%s received from %s%s"), @@ -1310,11 +1310,11 @@ irc_cmd_reply_version (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_recv_privmsg: 'privmsg' command received + * irc_recv_cmd_privmsg: 'privmsg' command received */ int -irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_privmsg (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2, *host2; char *pos_file, *pos_addr, *pos_port, *pos_size, *pos_start_resume; /* for DCC */ @@ -1339,7 +1339,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume host2 = host; /* receiver is a channel ? */ - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { pos = strchr (arguments, ' '); if (pos) @@ -1351,12 +1351,12 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume if (pos[0] == ':') pos++; - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) { if (strncmp (pos, "\01ACTION ", 8) == 0) { - command_ignored |= ignore_check (host, "action", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "action", ptr_channel->name, server->name); pos += 8; pos2 = strchr (pos, '\01'); if (pos2) @@ -1364,7 +1364,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume if (!command_ignored) { irc_display_prefix (server, ptr_channel->buffer, PREFIX_ACTION_ME); - if (irc_is_highlight (pos, server->nick)) + if (irc_recv_is_highlight (pos, server->nick)) { gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG | MSG_TYPE_HIGHLIGHT, @@ -1395,13 +1395,13 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume gui_printf (ptr_channel->buffer, " %s%s\n", GUI_COLOR(COLOR_WIN_CHAT), pos); } - channel_add_nick_speaking (ptr_channel, nick); + irc_channel_add_nick_speaking (ptr_channel, nick); } return 0; } if (strncmp (pos, "\01SOUND ", 7) == 0) { - command_ignored |= ignore_check (host, "ctcp", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "ctcp", ptr_channel->name, server->name); pos += 7; pos2 = strchr (pos, '\01'); if (pos2) @@ -1421,7 +1421,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } if (strncmp (pos, "\01PING", 5) == 0) { - command_ignored |= ignore_check (host, "ctcp", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "ctcp", ptr_channel->name, server->name); pos += 5; while (pos[0] == ' ') pos++; @@ -1433,11 +1433,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume if (pos && !pos[0]) pos = NULL; if (pos) - server_sendf (server, "NOTICE %s :\01PING %s\01", - nick, pos); + irc_server_sendf (server, "NOTICE %s :\01PING %s\01", + nick, pos); else - server_sendf (server, "NOTICE %s :\01PING\01", - nick); + irc_server_sendf (server, "NOTICE %s :\01PING\01", + nick); irc_display_prefix (server, ptr_channel->buffer, PREFIX_SERVER); gui_printf (ptr_channel->buffer, _("CTCP %sPING%s received from %s%s\n"), @@ -1457,7 +1457,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume pos2 = strchr (pos + 1, '\01'); if ((pos[0] == '\01') && pos2 && (pos2[1] == '\0')) { - command_ignored |= ignore_check (host, "ctcp", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "ctcp", ptr_channel->name, server->name); pos++; pos2[0] = '\0'; pos2 = strchr (pos, ' '); @@ -1491,11 +1491,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } /* other message */ - command_ignored |= ignore_check (host, "privmsg", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "privmsg", ptr_channel->name, server->name); if (!command_ignored) { - ptr_nick = nick_search (ptr_channel, nick); - if (irc_is_highlight (pos, server->nick)) + ptr_nick = irc_nick_search (ptr_channel, nick); + if (irc_recv_is_highlight (pos, server->nick)) { irc_display_nick (ptr_channel->buffer, ptr_nick, (ptr_nick) ? NULL : nick, @@ -1524,7 +1524,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG, "%s\n", pos); } - channel_add_nick_speaking (ptr_channel, nick); + irc_channel_add_nick_speaking (ptr_channel, nick); } } else @@ -1559,7 +1559,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume /* ping request from another user => answer */ if (strncmp (pos, "\01PING", 5) == 0) { - command_ignored |= ignore_check (host, "ctcp", NULL, server->name); + command_ignored |= irc_ignore_check (host, "ctcp", NULL, server->name); if (!command_ignored) { pos += 5; @@ -1573,11 +1573,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume if (pos && !pos[0]) pos = NULL; if (pos) - server_sendf (server, "NOTICE %s :\01PING %s\01", - nick, pos); + irc_server_sendf (server, "NOTICE %s :\01PING %s\01", + nick, pos); else - server_sendf (server, "NOTICE %s :\01PING\01", - nick); + irc_server_sendf (server, "NOTICE %s :\01PING\01", + nick); irc_display_prefix (server, server->buffer, PREFIX_SERVER); gui_printf (server->buffer, _("CTCP %sPING%s received from %s%s\n"), @@ -1609,7 +1609,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } pos2[0] = '\0'; - command_ignored |= ignore_check (host, "dcc", NULL, server->name); + command_ignored |= irc_ignore_check (host, "dcc", NULL, server->name); if (!command_ignored) { @@ -1666,9 +1666,9 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume pos2--; pos2[1] = '\0'; - dcc_add (server, DCC_FILE_RECV, strtoul (pos_addr, NULL, 10), - atoi (pos_port), nick, -1, pos_file, NULL, - strtoul (pos_size, NULL, 10)); + irc_dcc_add (server, DCC_FILE_RECV, strtoul (pos_addr, NULL, 10), + atoi (pos_port), nick, -1, pos_file, NULL, + strtoul (pos_size, NULL, 10)); #ifdef PLUGINS (void) plugin_msg_handler_exec (server->name, "weechat_dcc", @@ -1693,7 +1693,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } pos2[0] = '\0'; - command_ignored |= ignore_check (host, "dcc", NULL, server->name); + command_ignored |= irc_ignore_check (host, "dcc", NULL, server->name); if (!command_ignored) { @@ -1734,8 +1734,8 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume pos2--; pos2[1] = '\0'; - dcc_accept_resume (server, pos_file, atoi (pos_port), - strtoul (pos_start_resume, NULL, 10)); + irc_dcc_accept_resume (server, pos_file, atoi (pos_port), + strtoul (pos_start_resume, NULL, 10)); #ifdef PLUGINS (void) plugin_msg_handler_exec (server->name, "weechat_dcc", @@ -1760,7 +1760,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } pos2[0] = '\0'; - command_ignored |= ignore_check (host, "dcc", NULL, server->name); + command_ignored |= irc_ignore_check (host, "dcc", NULL, server->name); if (!command_ignored) { @@ -1801,8 +1801,8 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume pos2--; pos2[1] = '\0'; - dcc_start_resume (server, pos_file, atoi (pos_port), - strtoul (pos_start_resume, NULL, 10)); + irc_dcc_start_resume (server, pos_file, atoi (pos_port), + strtoul (pos_start_resume, NULL, 10)); #ifdef PLUGINS (void) plugin_msg_handler_exec (server->name, "weechat_dcc", @@ -1827,7 +1827,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } pos2[0] = '\0'; - command_ignored |= ignore_check (host, "dcc", NULL, server->name); + command_ignored |= irc_ignore_check (host, "dcc", NULL, server->name); if (!command_ignored) { @@ -1880,8 +1880,8 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume return -1; } - dcc_add (server, DCC_CHAT_RECV, strtoul (pos_addr, NULL, 10), - atoi (pos_port), nick, -1, NULL, NULL, 0); + irc_dcc_add (server, DCC_CHAT_RECV, strtoul (pos_addr, NULL, 10), + atoi (pos_port), nick, -1, NULL, NULL, 0); #ifdef PLUGINS (void) plugin_msg_handler_exec (server->name, "weechat_dcc", @@ -1892,18 +1892,18 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } /* private message received => display it */ - ptr_channel = channel_search (server, nick); + ptr_channel = irc_channel_search (server, nick); if (strncmp (pos, "\01ACTION ", 8) == 0) { - command_ignored |= ignore_check (host, "action", NULL, server->name); - command_ignored |= ignore_check (host, "pv", NULL, server->name); + command_ignored |= irc_ignore_check (host, "action", NULL, server->name); + command_ignored |= irc_ignore_check (host, "pv", NULL, server->name); if (!command_ignored) { if (!ptr_channel) { - ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, nick); + ptr_channel = irc_channel_new (server, CHANNEL_TYPE_PRIVATE, nick); if (!ptr_channel) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -1926,7 +1926,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume if (pos2) pos2[0] = '\0'; irc_display_prefix (server, ptr_channel->buffer, PREFIX_ACTION_ME); - if (irc_is_highlight (pos, server->nick)) + if (irc_recv_is_highlight (pos, server->nick)) { gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG | MSG_TYPE_HIGHLIGHT, @@ -1970,7 +1970,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume pos2 = strchr (pos + 1, '\01'); if ((pos[0] == '\01') && pos2 && (pos2[1] == '\0')) { - command_ignored |= ignore_check (host, "ctcp", NULL, server->name); + command_ignored |= irc_ignore_check (host, "ctcp", NULL, server->name); if (!command_ignored) { @@ -2010,13 +2010,13 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } else { - command_ignored |= ignore_check (host, "pv", NULL, server->name); + command_ignored |= irc_ignore_check (host, "pv", NULL, server->name); if (!command_ignored) { if (!ptr_channel) { - ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, nick); + ptr_channel = irc_channel_new (server, CHANNEL_TYPE_PRIVATE, nick); if (!ptr_channel) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -2034,7 +2034,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume gui_chat_draw_title (ptr_channel->buffer, 1); } - if (irc_is_highlight (pos, server->nick)) + if (irc_recv_is_highlight (pos, server->nick)) { irc_display_nick (ptr_channel->buffer, NULL, nick, MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT, 1, @@ -2083,11 +2083,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume } /* - * irc_cmd_recv_quit: 'quit' command received + * irc_recv_cmd_quit: 'quit' command received */ int -irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_quit (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; t_irc_channel *ptr_channel; @@ -2113,14 +2113,14 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments || (ptr_channel->type == CHANNEL_TYPE_DCC_CHAT)) ptr_nick = NULL; else - ptr_nick = nick_search (ptr_channel, nick); + ptr_nick = irc_nick_search (ptr_channel, nick); if (ptr_nick || (strcmp (ptr_channel->name, nick) == 0)) { if (ptr_nick) - nick_free (ptr_channel, ptr_nick); + irc_nick_free (ptr_channel, ptr_nick); if (!command_ignored - && !ignore_check (host, "quit", ptr_channel->name, server->name)) + && !irc_ignore_check (host, "quit", ptr_channel->name, server->name)) { pos = strchr (host, '!'); irc_display_prefix (server, ptr_channel->buffer, PREFIX_QUIT); @@ -2149,12 +2149,12 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments } /* - * irc_cmd_recv_server_mode_reason: command received from server (numeric), + * irc_recv_cmd_server_mode_reason: command received from server (numeric), * format: "mode :reason" */ int -irc_cmd_recv_server_mode_reason (t_irc_server *server, char *host, +irc_recv_cmd_server_mode_reason (t_irc_server *server, char *host, char *nick, char *arguments) { char *ptr_msg; @@ -2193,11 +2193,11 @@ irc_cmd_recv_server_mode_reason (t_irc_server *server, char *host, } /* - * irc_cmd_recv_server_msg: command received from server (numeric) + * irc_recv_cmd_server_msg: command received from server (numeric) */ int -irc_cmd_recv_server_msg (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_server_msg (t_irc_server *server, char *host, char *nick, char *arguments) { /* make C compiler happy */ (void) host; @@ -2227,11 +2227,11 @@ irc_cmd_recv_server_msg (t_irc_server *server, char *host, char *nick, char *arg } /* - * irc_cmd_recv_server_reply: server reply + * irc_recv_cmd_server_reply: server reply */ int -irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_server_reply (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; int first; @@ -2286,17 +2286,17 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *nick, char *a } /* - * irc_cmd_recv_topic: 'topic' command received + * irc_recv_cmd_topic: 'topic' command received */ int -irc_cmd_recv_topic (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_topic (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; t_irc_channel *ptr_channel; t_gui_buffer *buffer; - if (!string_is_channel (arguments)) + if (!irc_channel_is_channel (arguments)) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); gui_printf_nolog (server->buffer, @@ -2318,9 +2318,9 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *nick, char *argument pos = NULL; } - command_ignored |= ignore_check (host, "topic", arguments, server->name); + command_ignored |= irc_ignore_check (host, "topic", arguments, server->name); - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; if (!command_ignored) @@ -2363,13 +2363,13 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *nick, char *argument } /* - * irc_cmd_recv_wallops: 'wallops' command received + * irc_recv_cmd_wallops: 'wallops' command received */ int -irc_cmd_recv_wallops (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_wallops (t_irc_server *server, char *host, char *nick, char *arguments) { - command_ignored |= ignore_check (host, "wallops", arguments, server->name); + command_ignored |= irc_ignore_check (host, "wallops", arguments, server->name); if (!command_ignored) { @@ -2388,11 +2388,11 @@ irc_cmd_recv_wallops (t_irc_server *server, char *host, char *nick, char *argume } /* - * irc_cmd_recv_001: '001' command (connected to irc server) + * irc_recv_cmd_001: '001' command (connected to irc server) */ int -irc_cmd_recv_001 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_001 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; char **commands, **ptr, *vars_replaced; @@ -2408,7 +2408,7 @@ irc_cmd_recv_001 (t_irc_server *server, char *host, char *nick, char *arguments) server->nick = strdup (arguments); } - irc_cmd_recv_server_msg (server, host, nick, arguments); + irc_recv_cmd_server_msg (server, host, nick, arguments); /* connection to IRC server is ok! */ server->is_connected = 1; @@ -2447,11 +2447,11 @@ irc_cmd_recv_001 (t_irc_server *server, char *host, char *nick, char *arguments) if (ptr_channel->type == CHANNEL_TYPE_CHANNEL) { if (ptr_channel->key) - server_sendf (server, "JOIN %s %s", - ptr_channel->name, ptr_channel->key); + irc_server_sendf (server, "JOIN %s %s", + ptr_channel->name, ptr_channel->key); else - server_sendf (server, "JOIN %s", - ptr_channel->name); + irc_server_sendf (server, "JOIN %s", + ptr_channel->name); } } server->reconnect_join = 0; @@ -2460,7 +2460,7 @@ irc_cmd_recv_001 (t_irc_server *server, char *host, char *nick, char *arguments) { /* auto-join when connecting to server for first time */ if (server->autojoin && server->autojoin[0]) - return irc_cmd_send_join (server, NULL, server->autojoin); + return irc_send_cmd_join (server, NULL, server->autojoin); } /* set away message if user was away (before disconnection for example) */ @@ -2478,15 +2478,15 @@ irc_cmd_recv_001 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_005: '005' command (some infos from server) + * irc_recv_cmd_005: '005' command (some infos from server) */ int -irc_cmd_recv_005 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_005 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; - irc_cmd_recv_server_msg (server, host, nick, arguments); + irc_recv_cmd_server_msg (server, host, nick, arguments); pos = strstr (arguments, "PREFIX="); if (pos) @@ -2513,11 +2513,11 @@ irc_cmd_recv_005 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_221: '221' command (user mode string) + * irc_recv_cmd_221: '221' command (user mode string) */ int -irc_cmd_recv_221 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_221 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_mode; @@ -2561,11 +2561,11 @@ irc_cmd_recv_221 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_301: '301' command (away message) + * irc_recv_cmd_301: '301' command (away message) */ int -irc_cmd_recv_301 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_301 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_message; t_irc_channel *ptr_channel; @@ -2594,7 +2594,7 @@ irc_cmd_recv_301 (t_irc_server *server, char *host, char *nick, char *arguments) if (!command_ignored) { /* look for private buffer to display message */ - ptr_channel = channel_search (server, pos_nick); + ptr_channel = irc_channel_search (server, pos_nick); if (!cfg_irc_show_away_once || !ptr_channel || !(ptr_channel->away_message) || (strcmp (ptr_channel->away_message, pos_message) != 0)) @@ -2621,11 +2621,11 @@ irc_cmd_recv_301 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_302: '302' command (userhost) + * irc_recv_cmd_302: '302' command (userhost) */ int -irc_cmd_recv_302 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_302 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_host, *ptr_next; @@ -2679,11 +2679,11 @@ irc_cmd_recv_302 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_303: '303' command (ison) + * irc_recv_cmd_303: '303' command (ison) */ int -irc_cmd_recv_303 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_303 (t_irc_server *server, char *host, char *nick, char *arguments) { char *ptr_next; @@ -2727,11 +2727,11 @@ irc_cmd_recv_303 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_305: '305' command (unaway) + * irc_recv_cmd_305: '305' command (unaway) */ int -irc_cmd_recv_305 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_305 (t_irc_server *server, char *host, char *nick, char *arguments) { t_gui_window *ptr_window; @@ -2764,11 +2764,11 @@ irc_cmd_recv_305 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_306: '306' command (now away) + * irc_recv_cmd_306: '306' command (now away) */ int -irc_cmd_recv_306 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_306 (t_irc_server *server, char *host, char *nick, char *arguments) { t_gui_window *ptr_window; @@ -2804,11 +2804,11 @@ irc_cmd_recv_306 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_whois_nick_msg: a whois command with nick and message + * irc_recv_cmd_whois_nick_msg: a whois command with nick and message */ int -irc_cmd_recv_whois_nick_msg (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_whois_nick_msg (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_msg; @@ -2848,11 +2848,11 @@ irc_cmd_recv_whois_nick_msg (t_irc_server *server, char *host, char *nick, char } /* - * irc_cmd_recv_310: '310' command (whois, help mode) + * irc_recv_cmd_310: '310' command (whois, help mode) */ int -irc_cmd_recv_310 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_310 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick; @@ -2881,11 +2881,11 @@ irc_cmd_recv_310 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_311: '311' command (whois, user) + * irc_recv_cmd_311: '311' command (whois, user) */ int -irc_cmd_recv_311 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_311 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_user, *pos_host, *pos_realname; @@ -2950,11 +2950,11 @@ irc_cmd_recv_311 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_312: '312' command (whois, server) + * irc_recv_cmd_312: '312' command (whois, server) */ int -irc_cmd_recv_312 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_312 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_server, *pos_serverinfo; @@ -3007,11 +3007,11 @@ irc_cmd_recv_312 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_314: '314' command (whowas) + * irc_recv_cmd_314: '314' command (whowas) */ int -irc_cmd_recv_314 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_314 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_user, *pos_host, *pos_realname; @@ -3079,11 +3079,11 @@ irc_cmd_recv_314 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_315: '315' command (end of /who) + * irc_recv_cmd_315: '315' command (end of /who) */ int -irc_cmd_recv_315 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_315 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; t_irc_channel *ptr_channel; @@ -3105,7 +3105,7 @@ irc_cmd_recv_315 (t_irc_server *server, char *host, char *nick, char *arguments) { pos[0] = '\0'; pos++; - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel && (ptr_channel->checking_away > 0)) { ptr_channel->checking_away--; @@ -3133,11 +3133,11 @@ irc_cmd_recv_315 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_317: '317' command (whois, idle) + * irc_recv_cmd_317: '317' command (whois, idle) */ int -irc_cmd_recv_317 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_317 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_idle, *pos_signon, *pos_message; int idle_time, day, hour, min, sec; @@ -3220,11 +3220,11 @@ irc_cmd_recv_317 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_319: '319' command (whois, channels) + * irc_recv_cmd_319: '319' command (whois, channels) */ int -irc_cmd_recv_319 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_319 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_channel, *pos; @@ -3310,11 +3310,11 @@ irc_cmd_recv_319 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_321: '321' command (/list start) + * irc_recv_cmd_321: '321' command (/list start) */ int -irc_cmd_recv_321 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_321 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; @@ -3342,11 +3342,11 @@ irc_cmd_recv_321 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_322: '322' command (channel for /list) + * irc_recv_cmd_322: '322' command (channel for /list) */ int -irc_cmd_recv_322 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_322 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; @@ -3384,11 +3384,11 @@ irc_cmd_recv_322 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_323: '323' command (/list end) + * irc_recv_cmd_323: '323' command (/list end) */ int -irc_cmd_recv_323 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_323 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; @@ -3416,11 +3416,11 @@ irc_cmd_recv_323 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_324: '324' command (channel mode) + * irc_recv_cmd_324: '324' command (channel mode) */ int -irc_cmd_recv_324 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_324 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_modes, *pos; t_irc_channel *ptr_channel; @@ -3454,7 +3454,7 @@ irc_cmd_recv_324 (t_irc_server *server, char *host, char *nick, char *arguments) } /* search channel */ - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); if (ptr_channel) { if (pos_modes[0]) @@ -3483,11 +3483,11 @@ irc_cmd_recv_324 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_329: '329' command received (channel creation date) + * irc_recv_cmd_329: '329' command received (channel creation date) */ int -irc_cmd_recv_329 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_329 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_date; t_irc_channel *ptr_channel; @@ -3510,7 +3510,7 @@ irc_cmd_recv_329 (t_irc_server *server, char *host, char *nick, char *arguments) while (pos_date[0] == ' ') pos_date++; - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); if (!ptr_channel) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); @@ -3520,8 +3520,8 @@ irc_cmd_recv_329 (t_irc_server *server, char *host, char *nick, char *arguments) return -1; } - command_ignored |= ignore_check (host, "329", - pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "329", + pos_channel, server->name); if (!command_ignored && (ptr_channel->display_creation_date)) { datetime = (time_t)(atol (pos_date)); @@ -3552,11 +3552,11 @@ irc_cmd_recv_329 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_331: '331' command received (no topic for channel) + * irc_recv_cmd_331: '331' command received (no topic for channel) */ int -irc_cmd_recv_331 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_331 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos; t_irc_channel *ptr_channel; @@ -3586,10 +3586,10 @@ irc_cmd_recv_331 (t_irc_server *server, char *host, char *nick, char *arguments) return -1; } - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); if (ptr_channel) { - command_ignored |= ignore_check (host, "331", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "331", ptr_channel->name, server->name); if (!command_ignored) { irc_display_prefix (server, ptr_channel->buffer, PREFIX_INFO); @@ -3611,11 +3611,11 @@ irc_cmd_recv_331 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_332: '332' command received (topic of channel) + * irc_recv_cmd_332: '332' command received (topic of channel) */ int -irc_cmd_recv_332 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_332 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; t_irc_channel *ptr_channel; @@ -3634,7 +3634,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *nick, char *arguments) if (pos2) { pos2[0] = '\0'; - ptr_channel = channel_search (server, pos); + ptr_channel = irc_channel_search (server, pos); ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; pos2++; @@ -3649,7 +3649,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *nick, char *arguments) ptr_channel->topic = strdup (pos2); } - command_ignored |= ignore_check (host, "332", pos, server->name); + command_ignored |= irc_ignore_check (host, "332", pos, server->name); if (!command_ignored) { irc_display_prefix (server, ptr_buffer, PREFIX_INFO); @@ -3676,11 +3676,11 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_333: '333' command received (infos about topic (nick / date)) + * irc_recv_cmd_333: '333' command received (infos about topic (nick / date)) */ int -irc_cmd_recv_333 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_333 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_nick, *pos_date; t_irc_channel *ptr_channel; @@ -3711,12 +3711,12 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *nick, char *arguments) while (pos_date[0] == ' ') pos_date++; - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - command_ignored |= ignore_check (host, "333", - pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "333", + pos_channel, server->name); if (!command_ignored) { datetime = (time_t)(atol (pos_date)); @@ -3758,11 +3758,11 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_338: '338' command (whois, host) + * irc_recv_cmd_338: '338' command (whois, host) */ int -irc_cmd_recv_338 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_338 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_host, *pos_message; @@ -3814,11 +3814,11 @@ irc_cmd_recv_338 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_341: '341' command received (inviting) + * irc_recv_cmd_341: '341' command received (inviting) */ int -irc_cmd_recv_341 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_341 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_channel; @@ -3878,11 +3878,11 @@ irc_cmd_recv_341 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_344: '344' command (channel reop) + * irc_recv_cmd_344: '344' command (channel reop) */ int -irc_cmd_recv_344 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_344 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_host; @@ -3919,11 +3919,11 @@ irc_cmd_recv_344 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_345: '345' command (end of channel reop) + * irc_recv_cmd_345: '345' command (end of channel reop) */ int -irc_cmd_recv_345 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_345 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos; @@ -3966,11 +3966,11 @@ irc_cmd_recv_345 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_348: '348' command received (channel exception list) + * irc_recv_cmd_348: '348' command received (channel exception list) */ int -irc_cmd_recv_348 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_348 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_exception, *pos_user, *pos_date, *pos; t_irc_channel *ptr_channel; @@ -4032,10 +4032,10 @@ irc_cmd_recv_348 (t_irc_server *server, char *host, char *nick, char *arguments) else pos_date = NULL; - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - command_ignored |= ignore_check (host, "348", pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "348", pos_channel, server->name); if (!command_ignored) { @@ -4082,11 +4082,11 @@ irc_cmd_recv_348 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_349: '349' command received (end of channel exception list) + * irc_recv_cmd_349: '349' command received (end of channel exception list) */ int -irc_cmd_recv_349 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_349 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_msg; t_irc_channel *ptr_channel; @@ -4125,10 +4125,10 @@ irc_cmd_recv_349 (t_irc_server *server, char *host, char *nick, char *arguments) if (pos_msg[0] == ':') pos_msg++; - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - command_ignored |= ignore_check (host, "349", pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "349", pos_channel, server->name); if (!command_ignored) { @@ -4145,11 +4145,11 @@ irc_cmd_recv_349 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_351: '351' command received (server version) + * irc_recv_cmd_351: '351' command received (server version) */ int -irc_cmd_recv_351 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_351 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; @@ -4186,11 +4186,11 @@ irc_cmd_recv_351 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_352: '352' command (who) + * irc_recv_cmd_352: '352' command (who) */ int -irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_352 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_user, *pos_host, *pos_server, *pos_nick; char *pos_attr, *pos_hopcount, *pos_realname; @@ -4258,12 +4258,12 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments) while (pos_realname[0] == ' ') pos_realname++; - command_ignored |= ignore_check (host, "352", pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "352", pos_channel, server->name); - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); if (ptr_channel && (ptr_channel->checking_away > 0)) { - ptr_nick = nick_search (ptr_channel, pos_nick); + ptr_nick = irc_nick_search (ptr_channel, pos_nick); if (ptr_nick) { if (ptr_nick->host) @@ -4272,8 +4272,8 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments) ptr_nick->host = (char *) malloc (length); if (ptr_nick->host) snprintf (ptr_nick->host, length, "%s@%s", pos_user, pos_host); - nick_set_away (ptr_channel, ptr_nick, - (pos_attr[0] == 'G') ? 1 : 0); + irc_nick_set_away (ptr_channel, ptr_nick, + (pos_attr[0] == 'G') ? 1 : 0); } return 0; } @@ -4312,11 +4312,11 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_353: '353' command received (list of users on a channel) + * irc_recv_cmd_353: '353' command received (list of users on a channel) */ int -irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_353 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos_nick; int is_chanowner, is_chanadmin, is_chanadmin2, is_op, is_halfop, has_voice; @@ -4348,7 +4348,7 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments) { pos[0] = '\0'; - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) ptr_buffer = ptr_channel->buffer; else @@ -4366,9 +4366,9 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments) return -1; } - command_ignored |= ignore_check (host, "353", - (ptr_channel) ? ptr_channel->name : NULL, - server->name); + command_ignored |= irc_ignore_check (host, "353", + (ptr_channel) ? ptr_channel->name : NULL, + server->name); /* channel is not joined => display users on server buffer */ if (!command_ignored && !ptr_channel) @@ -4474,8 +4474,8 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments) } if (ptr_channel) { - if (!nick_new (server, ptr_channel, pos_nick, is_chanowner, - is_chanadmin, is_chanadmin2, is_op, is_halfop, has_voice)) + if (!irc_nick_new (server, ptr_channel, pos_nick, is_chanowner, + is_chanadmin, is_chanadmin2, is_op, is_halfop, has_voice)) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); gui_printf_nolog (server->buffer, @@ -4519,11 +4519,11 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_366: '366' command received (end of /names list) + * irc_recv_cmd_366: '366' command received (end of /names list) */ int -irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_366 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; t_irc_channel *ptr_channel; @@ -4548,10 +4548,10 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments) if (pos2[0] == ':') pos2++; - ptr_channel = channel_search (server, pos); + ptr_channel = irc_channel_search (server, pos); if (ptr_channel) { - command_ignored |= ignore_check (host, "366", ptr_channel->name, server->name); + command_ignored |= irc_ignore_check (host, "366", ptr_channel->name, server->name); if (!command_ignored) { @@ -4574,8 +4574,8 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments) GUI_COLOR(COLOR_WIN_CHAT_DARK)); /* display number of nicks, ops, halfops & voices on the channel */ - nick_count (ptr_channel, &num_nicks, &num_op, &num_halfop, &num_voice, - &num_normal); + irc_nick_count (ptr_channel, &num_nicks, &num_op, &num_halfop, &num_voice, + &num_normal); irc_display_prefix (server, ptr_channel->buffer, PREFIX_INFO); gui_printf (ptr_channel->buffer, _("Channel %s%s%s: %s%d%s %s %s(%s%d%s %s, " @@ -4606,8 +4606,8 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments) _("normal"), GUI_COLOR(COLOR_WIN_CHAT_DARK)); } - irc_cmd_send_mode (server, NULL, ptr_channel->name); - channel_check_away (server, ptr_channel, 1); + irc_send_cmd_mode (server, NULL, ptr_channel->name); + irc_channel_check_away (server, ptr_channel, 1); } else { @@ -4628,11 +4628,11 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_367: '367' command received (banlist) + * irc_recv_cmd_367: '367' command received (banlist) */ int -irc_cmd_recv_367 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_367 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_ban, *pos_user, *pos_date, *pos; t_irc_channel *ptr_channel; @@ -4693,10 +4693,10 @@ irc_cmd_recv_367 (t_irc_server *server, char *host, char *nick, char *arguments) } } - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - command_ignored |= ignore_check (host, "367", pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "367", pos_channel, server->name); if (!command_ignored) { @@ -4751,11 +4751,11 @@ irc_cmd_recv_367 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_368: '368' command received (end of banlist) + * irc_recv_cmd_368: '368' command received (end of banlist) */ int -irc_cmd_recv_368 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_368 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_channel, *pos_msg; t_irc_channel *ptr_channel; @@ -4794,10 +4794,10 @@ irc_cmd_recv_368 (t_irc_server *server, char *host, char *nick, char *arguments) if (pos_msg[0] == ':') pos_msg++; - ptr_channel = channel_search (server, pos_channel); + ptr_channel = irc_channel_search (server, pos_channel); buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - command_ignored |= ignore_check (host, "368", pos_channel, server->name); + command_ignored |= irc_ignore_check (host, "368", pos_channel, server->name); if (!command_ignored) { @@ -4814,11 +4814,11 @@ irc_cmd_recv_368 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_378: '378' command received (connecting from) + * irc_recv_cmd_378: '378' command received (connecting from) */ int -irc_cmd_recv_378 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_378 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; @@ -4857,15 +4857,15 @@ irc_cmd_recv_378 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_432: '432' command received (erroneous nickname) + * irc_recv_cmd_432: '432' command received (erroneous nickname) */ int -irc_cmd_recv_432 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_432 (t_irc_server *server, char *host, char *nick, char *arguments) { /* Note: this IRC command can not be ignored */ - irc_cmd_recv_error (server, host, nick, arguments); + irc_recv_cmd_error (server, host, nick, arguments); if (!server->is_connected) { @@ -4899,7 +4899,7 @@ irc_cmd_recv_432 (t_irc_server *server, char *host, char *nick, char *arguments) "use or invalid, closing connection with " "server!\n"), PACKAGE_NAME); - server_disconnect (server, 1); + irc_server_disconnect (server, 1); return 0; } else @@ -4913,19 +4913,17 @@ irc_cmd_recv_432 (t_irc_server *server, char *host, char *nick, char *arguments) } } } - server_sendf (server, - "NICK %s", - server->nick); + irc_server_sendf (server, "NICK %s", server->nick); } return 0; } /* - * irc_cmd_recv_433: '433' command received (nickname already in use) + * irc_recv_cmd_433: '433' command received (nickname already in use) */ int -irc_cmd_recv_433 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_433 (t_irc_server *server, char *host, char *nick, char *arguments) { /* Note: this IRC command can not be ignored */ @@ -4962,7 +4960,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *nick, char *arguments) _("%s: all declared nicknames are already in use, " "closing connection with server!\n"), PACKAGE_NAME); - server_disconnect (server, 1); + irc_server_disconnect (server, 1); return 0; } else @@ -4977,22 +4975,20 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *nick, char *arguments) } } } - server_sendf (server, - "NICK %s", - server->nick); + irc_server_sendf (server, "NICK %s", server->nick); } else - return irc_cmd_recv_error (server, host, nick, arguments); + return irc_recv_cmd_error (server, host, nick, arguments); return 0; } /* - * irc_cmd_recv_438: '438' command received (not authorized to change nickname) + * irc_recv_cmd_438: '438' command received (not authorized to change nickname) */ int -irc_cmd_recv_438 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_438 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos, *pos2; @@ -5027,11 +5023,11 @@ irc_cmd_recv_438 (t_irc_server *server, char *host, char *nick, char *arguments) } /* - * irc_cmd_recv_671: '671' command (whois, secure connection) + * irc_recv_cmd_671: '671' command (whois, secure connection) */ int -irc_cmd_recv_671 (t_irc_server *server, char *host, char *nick, char *arguments) +irc_recv_cmd_671 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_message; diff --git a/weechat/src/irc/irc-send.c b/weechat/src/irc/irc-send.c index d109f23b6..a7ceb9d79 100644 --- a/weechat/src/irc/irc-send.c +++ b/weechat/src/irc/irc-send.c @@ -45,92 +45,40 @@ /* - * irc_hide_password: hide IRC password(s) in a string + * irc_send_login: login to irc server */ void -irc_hide_password (char *string, int look_for_nickserv) -{ - char *pos_nickserv, *pos, *pos_pwd; - - pos = string; - while (1) - { - if (look_for_nickserv) - { - pos_nickserv = strstr (pos, "nickserv "); - if (!pos_nickserv) - return; - pos = pos_nickserv + 9; - while (pos[0] == ' ') - pos++; - if ((strncmp (pos, "identify ", 9) == 0) - || (strncmp (pos, "register ", 9) == 0)) - pos_pwd = pos + 9; - else - pos_pwd = NULL; - } - else - { - pos_pwd = strstr (pos, "identify "); - if (!pos_pwd) - pos_pwd = strstr (pos, "register "); - if (!pos_pwd) - return; - pos_pwd += 9; - } - - if (pos_pwd) - { - while (pos_pwd[0] == ' ') - pos_pwd++; - - while (pos_pwd[0] && (pos_pwd[0] != ';') && (pos_pwd[0] != ' ') - && (pos_pwd[0] != '"')) - { - pos_pwd[0] = '*'; - pos_pwd++; - } - pos = pos_pwd; - } - } -} - -/* - * irc_login: login to irc server - */ - -void -irc_login (t_irc_server *server) +irc_send_login (t_irc_server *server) { if ((server->password) && (server->password[0])) - server_sendf (server, "PASS %s", server->password); + irc_server_sendf (server, "PASS %s", server->password); if (!server->nick) server->nick = strdup (server->nick1); - server_sendf (server, - "NICK %s\n" - "USER %s %s %s :%s", - server->nick, server->username, server->username, - server->address, server->realname); + irc_server_sendf (server, + "NICK %s\n" + "USER %s %s %s :%s", + server->nick, server->username, server->username, + server->address, server->realname); gui_input_draw (gui_current_window->buffer, 1); } /* - * irc_cmd_send_admin: find information about the administrator of the server + * irc_send_cmd_admin: find information about the administrator of the server */ int -irc_cmd_send_admin (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_admin (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "ADMIN %s", arguments); + irc_server_sendf (server, "ADMIN %s", arguments); else - server_sendf (server, "ADMIN"); + irc_server_sendf (server, "ADMIN"); return 0; } @@ -144,9 +92,9 @@ irc_send_me (t_irc_server *server, t_irc_channel *channel, { char *string; - server_sendf (server, "PRIVMSG %s :\01ACTION %s\01", - channel->name, - (arguments && arguments[0]) ? arguments : ""); + irc_server_sendf (server, "PRIVMSG %s :\01ACTION %s\01", + channel->name, + (arguments && arguments[0]) ? arguments : ""); irc_display_prefix (NULL, channel->buffer, PREFIX_ACTION_ME); string = (arguments && arguments[0]) ? (char *)gui_color_decode ((unsigned char *)arguments, 1) : NULL; @@ -179,11 +127,11 @@ irc_send_me_all_channels (t_irc_server *server, char *arguments) } /* - * irc_cmd_send_ame: send a ctcp action to all channels of all connected servers + * irc_send_cmd_ame: send a ctcp action to all channels of all connected servers */ int -irc_cmd_send_ame (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_ame (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_irc_server *ptr_server; @@ -212,11 +160,11 @@ irc_cmd_send_ame (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_amsg: send message to all channels of all connected servers + * irc_send_cmd_amsg: send message to all channels of all connected servers */ int -irc_cmd_send_amsg (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_amsg (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_irc_server *ptr_server; @@ -241,9 +189,9 @@ irc_cmd_send_amsg (t_irc_server *server, t_irc_channel *channel, { if (ptr_channel->type == CHANNEL_TYPE_CHANNEL) { - server_sendf (ptr_server, "PRIVMSG %s :%s", - ptr_channel->name, arguments); - ptr_nick = nick_search (ptr_channel, ptr_server->nick); + irc_server_sendf (ptr_server, "PRIVMSG %s :%s", + ptr_channel->name, arguments); + ptr_nick = irc_nick_search (ptr_channel, ptr_server->nick); if (ptr_nick) { irc_display_nick (ptr_channel->buffer, ptr_nick, NULL, @@ -291,7 +239,7 @@ irc_send_away (t_irc_server *server, char *arguments) if (server->away_message) strcpy (server->away_message, arguments); server->away_time = time (NULL); - server_sendf (server, "AWAY :%s", arguments); + irc_server_sendf (server, "AWAY :%s", arguments); if (cfg_irc_display_away != CFG_IRC_DISPLAY_AWAY_OFF) { string = (char *)gui_color_decode ((unsigned char *)arguments, 1); @@ -305,7 +253,7 @@ irc_send_away (t_irc_server *server, char *arguments) if (string) free (string); } - server_set_away (server, server->nick, 1); + irc_server_set_away (server, server->nick, 1); for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window) { @@ -316,7 +264,7 @@ irc_send_away (t_irc_server *server, char *arguments) } else { - server_sendf (server, "AWAY"); + irc_server_sendf (server, "AWAY"); server->is_away = 0; if (server->away_message) { @@ -351,23 +299,23 @@ irc_send_away (t_irc_server *server, char *arguments) } } } - server_set_away (server, server->nick, 0); + irc_server_set_away (server, server->nick, 0); } } /* - * irc_cmd_send_away: toggle away status + * irc_send_cmd_away: toggle away status */ int -irc_cmd_send_away (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_away (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *pos; t_irc_server *ptr_server; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); /* make C compiler happy */ (void) channel; @@ -408,17 +356,17 @@ irc_cmd_send_away (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_ban: bans nicks or hosts + * irc_send_cmd_ban: bans nicks or hosts */ int -irc_cmd_send_ban (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_ban (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *pos_channel, *pos, *pos2; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (arguments) { @@ -428,7 +376,7 @@ irc_cmd_send_ban (t_irc_server *server, t_irc_channel *channel, { pos[0] = '\0'; - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { pos_channel = arguments; pos++; @@ -469,7 +417,7 @@ irc_cmd_send_ban (t_irc_server *server, t_irc_channel *channel, while (pos2[0] == ' ') pos2++; } - server_sendf (server, "MODE %s +b %s", pos_channel, pos); + irc_server_sendf (server, "MODE %s +b %s", pos_channel, pos); pos = pos2; } } @@ -483,18 +431,18 @@ irc_cmd_send_ban (t_irc_server *server, t_irc_channel *channel, WEECHAT_ERROR, "ban"); return -1; } - server_sendf (server, "MODE %s +b", CHANNEL(buffer)->name); + irc_server_sendf (server, "MODE %s +b", CHANNEL(buffer)->name); } return 0; } /* - * irc_cmd_send_ctcp: send a ctcp message + * irc_send_cmd_ctcp: send a ctcp message */ int -irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_ctcp (t_irc_server *server, t_irc_channel *channel, char *arguments) { char *pos_type, *pos_args, *pos; @@ -541,8 +489,8 @@ irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel, if ((ascii_strcasecmp (pos_type, "ping") == 0) && (!pos_args)) { gettimeofday (&tv, NULL); - server_sendf (server, "PRIVMSG %s :\01PING %d %d\01", - arguments, tv.tv_sec, tv.tv_usec); + irc_server_sendf (server, "PRIVMSG %s :\01PING %d %d\01", + arguments, tv.tv_sec, tv.tv_usec); gui_printf (server->buffer, " %s%d %d\n", GUI_COLOR(COLOR_WIN_CHAT), tv.tv_sec, tv.tv_usec); @@ -551,16 +499,16 @@ irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel, { if (pos_args) { - server_sendf (server, "PRIVMSG %s :\01%s %s\01", - arguments, pos_type, pos_args); + irc_server_sendf (server, "PRIVMSG %s :\01%s %s\01", + arguments, pos_type, pos_args); gui_printf (server->buffer, " %s%s\n", GUI_COLOR(COLOR_WIN_CHAT), pos_args); } else { - server_sendf (server, "PRIVMSG %s :\01%s\01", - arguments, pos_type); + irc_server_sendf (server, "PRIVMSG %s :\01%s\01", + arguments, pos_type); gui_printf (server->buffer, "\n"); } } @@ -569,11 +517,11 @@ irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_cycle: leave and rejoin a channel + * irc_send_cmd_cycle: leave and rejoin a channel */ int -irc_cmd_send_cycle (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_cycle (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; @@ -582,11 +530,11 @@ irc_cmd_send_cycle (t_irc_server *server, t_irc_channel *channel, char **channels; int i, argc; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (arguments) { - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { channel_name = arguments; pos_args = strchr (arguments, ' '); @@ -602,7 +550,7 @@ irc_cmd_send_cycle (t_irc_server *server, t_irc_channel *channel, { for (i = 0; i < argc; i++) { - ptr_channel = channel_search (server, channels[i]); + ptr_channel = irc_channel_search (server, channels[i]); /* mark channal as cycling */ if (ptr_channel && (ptr_channel->type == CHANNEL_TYPE_CHANNEL)) @@ -658,35 +606,35 @@ irc_cmd_send_cycle (t_irc_server *server, t_irc_channel *channel, if (ptr_arg) { buf = weechat_strreplace (ptr_arg, "%v", PACKAGE_VERSION); - server_sendf (server, "PART %s :%s", channel_name, - (buf) ? buf : ptr_arg); + irc_server_sendf (server, "PART %s :%s", channel_name, + (buf) ? buf : ptr_arg); if (buf) free (buf); } else - server_sendf (server, "PART %s", channel_name); + irc_server_sendf (server, "PART %s", channel_name); return 0; } /* - * irc_cmd_send_dehalfop: remove half operator privileges from nickname(s) + * irc_send_cmd_dehalfop: remove half operator privileges from nickname(s) */ int -irc_cmd_send_dehalfop (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_dehalfop (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_CHANNEL(buffer)) { if (argc == 0) - server_sendf (server, "MODE %s -h %s", - CHANNEL(buffer)->name, - server->nick); + irc_server_sendf (server, "MODE %s -h %s", + CHANNEL(buffer)->name, + server->nick); else irc_send_mode_nicks (server, CHANNEL(buffer)->name, "-", "h", argc, argv); @@ -702,23 +650,23 @@ irc_cmd_send_dehalfop (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_deop: remove operator privileges from nickname(s) + * irc_send_cmd_deop: remove operator privileges from nickname(s) */ int -irc_cmd_send_deop (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_deop (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_CHANNEL(buffer)) { if (argc == 0) - server_sendf (server, "MODE %s -o %s", - CHANNEL(buffer)->name, - server->nick); + irc_server_sendf (server, "MODE %s -o %s", + CHANNEL(buffer)->name, + server->nick); else irc_send_mode_nicks (server, CHANNEL(buffer)->name, "-", "o", argc, argv); @@ -734,23 +682,23 @@ irc_cmd_send_deop (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_devoice: remove voice from nickname(s) + * irc_send_cmd_devoice: remove voice from nickname(s) */ int -irc_cmd_send_devoice (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_devoice (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_CHANNEL(buffer)) { if (argc == 0) - server_sendf (server, "MODE %s -v %s", - CHANNEL(buffer)->name, - server->nick); + irc_server_sendf (server, "MODE %s -v %s", + CHANNEL(buffer)->name, + server->nick); else irc_send_mode_nicks (server, CHANNEL(buffer)->name, "-", "v", argc, argv); @@ -767,39 +715,39 @@ irc_cmd_send_devoice (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_die: shotdown the server + * irc_send_cmd_die: shotdown the server */ int -irc_cmd_send_die (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_die (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; (void) arguments; - server_sendf (server, "DIE"); + irc_server_sendf (server, "DIE"); return 0; } /* - * irc_cmd_send_halfop: give half operator privileges to nickname(s) + * irc_send_cmd_halfop: give half operator privileges to nickname(s) */ int -irc_cmd_send_halfop (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_halfop (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_CHANNEL(buffer)) { if (argc == 0) - server_sendf (server, "MODE %s +h %s", - CHANNEL(buffer)->name, - server->nick); + irc_server_sendf (server, "MODE %s +h %s", + CHANNEL(buffer)->name, + server->nick); else irc_send_mode_nicks (server, CHANNEL(buffer)->name, "+", "h", argc, argv); @@ -816,37 +764,37 @@ irc_cmd_send_halfop (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_info: get information describing the server + * irc_send_cmd_info: get information describing the server */ int -irc_cmd_send_info (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_info (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "INFO %s", arguments); + irc_server_sendf (server, "INFO %s", arguments); else - server_sendf (server, "INFO"); + irc_server_sendf (server, "INFO"); return 0; } /* - * irc_cmd_send_invite: invite a nick on a channel + * irc_send_cmd_invite: invite a nick on a channel */ int -irc_cmd_send_invite (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_invite (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (argc == 2) - server_sendf (server, "INVITE %s %s", argv[0], argv[1]); + irc_server_sendf (server, "INVITE %s %s", argv[0], argv[1]); else { if (!BUFFER_IS_CHANNEL(buffer)) @@ -857,59 +805,59 @@ irc_cmd_send_invite (t_irc_server *server, t_irc_channel *channel, WEECHAT_ERROR, "invite"); return -1; } - server_sendf (server, "INVITE %s %s", - argv[0], CHANNEL(buffer)->name); + irc_server_sendf (server, "INVITE %s %s", + argv[0], CHANNEL(buffer)->name); } return 0; } /* - * irc_cmd_send_ison: check if a nickname is currently on IRC + * irc_send_cmd_ison: check if a nickname is currently on IRC */ int -irc_cmd_send_ison (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_ison (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "ISON %s", arguments); + irc_server_sendf (server, "ISON %s", arguments); return 0; } /* - * irc_cmd_send_join: join a new channel + * irc_send_cmd_join: join a new channel */ int -irc_cmd_send_join (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_join (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - if (string_is_channel (arguments)) - server_sendf (server, "JOIN %s", arguments); + if (irc_channel_is_channel (arguments)) + irc_server_sendf (server, "JOIN %s", arguments); else - server_sendf (server, "JOIN #%s", arguments); + irc_server_sendf (server, "JOIN #%s", arguments); return 0; } /* - * irc_cmd_send_kick: forcibly remove a user from a channel + * irc_send_cmd_kick: forcibly remove a user from a channel */ int -irc_cmd_send_kick (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_kick (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *pos_channel, *pos_nick, *pos_comment; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { pos_channel = arguments; pos_nick = strchr (arguments, ' '); @@ -950,27 +898,27 @@ irc_cmd_send_kick (t_irc_server *server, t_irc_channel *channel, } if (pos_comment) - server_sendf (server, "KICK %s %s :%s", pos_channel, pos_nick, pos_comment); + irc_server_sendf (server, "KICK %s %s :%s", pos_channel, pos_nick, pos_comment); else - server_sendf (server, "KICK %s %s", pos_channel, pos_nick); + irc_server_sendf (server, "KICK %s %s", pos_channel, pos_nick); return 0; } /* - * irc_cmd_send_kickban: forcibly remove a user from a channel and ban it + * irc_send_cmd_kickban: forcibly remove a user from a channel and ban it */ int -irc_cmd_send_kickban (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_kickban (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *pos_channel, *pos_nick, *pos_comment; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { pos_channel = arguments; pos_nick = strchr (arguments, ' '); @@ -1010,21 +958,21 @@ irc_cmd_send_kickban (t_irc_server *server, t_irc_channel *channel, pos_comment++; } - server_sendf (server, "MODE %s +b %s", pos_channel, pos_nick); + irc_server_sendf (server, "MODE %s +b %s", pos_channel, pos_nick); if (pos_comment) - server_sendf (server, "KICK %s %s :%s", pos_channel, pos_nick, pos_comment); + irc_server_sendf (server, "KICK %s %s :%s", pos_channel, pos_nick, pos_comment); else - server_sendf (server, "KICK %s %s", pos_channel, pos_nick); + irc_server_sendf (server, "KICK %s %s", pos_channel, pos_nick); return 0; } /* - * irc_cmd_send_kill: close client-server connection + * irc_send_cmd_kill: close client-server connection */ int -irc_cmd_send_kill (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_kill (t_irc_server *server, t_irc_channel *channel, char *arguments) { char *pos; @@ -1039,38 +987,38 @@ irc_cmd_send_kill (t_irc_server *server, t_irc_channel *channel, pos++; while (pos[0] == ' ') pos++; - server_sendf (server, "KILL %s :%s", arguments, pos); + irc_server_sendf (server, "KILL %s :%s", arguments, pos); } else - server_sendf (server, "KILL %s", arguments); + irc_server_sendf (server, "KILL %s", arguments); return 0; } /* - * irc_cmd_send_links: list all servernames which are known by the server + * irc_send_cmd_links: list all servernames which are known by the server * answering the query */ int -irc_cmd_send_links (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_links (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "LINKS %s", arguments); + irc_server_sendf (server, "LINKS %s", arguments); else - server_sendf (server, "LINKS"); + irc_server_sendf (server, "LINKS"); return 0; } /* - * irc_cmd_send_list: close client-server connection + * irc_send_cmd_list: close client-server connection */ int -irc_cmd_send_list (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_list (t_irc_server *server, t_irc_channel *channel, char *arguments) { char buffer[512]; @@ -1098,7 +1046,7 @@ irc_cmd_send_list (t_irc_server *server, t_irc_channel *channel, WEECHAT_ERROR, arguments, buffer); } else - server_sendf (server, "LIST"); + irc_server_sendf (server, "LIST"); } else { @@ -1108,40 +1056,40 @@ irc_cmd_send_list (t_irc_server *server, t_irc_channel *channel, } } else - server_sendf (server, "LIST"); + irc_server_sendf (server, "LIST"); return 0; } /* - * irc_cmd_send_lusers: get statistics about ths size of the IRC network + * irc_send_cmd_lusers: get statistics about ths size of the IRC network */ int -irc_cmd_send_lusers (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_lusers (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "LUSERS %s", arguments); + irc_server_sendf (server, "LUSERS %s", arguments); else - server_sendf (server, "LUSERS"); + irc_server_sendf (server, "LUSERS"); return 0; } /* - * irc_cmd_send_me: send a ctcp action to the current channel + * irc_send_cmd_me: send a ctcp action to the current channel */ int -irc_cmd_send_me (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_me (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_SERVER(buffer)) { @@ -1156,17 +1104,17 @@ irc_cmd_send_me (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_mode: change mode for channel/nickname + * irc_send_cmd_mode: change mode for channel/nickname */ int -irc_cmd_send_mode (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_mode (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "MODE %s", arguments); + irc_server_sendf (server, "MODE %s", arguments); return 0; } @@ -1196,35 +1144,35 @@ irc_send_mode_nicks (t_irc_server *server, char *channel, strcat (command, " "); strcat (command, argv[i]); } - server_sendf (server, "%s", command); + irc_server_sendf (server, "%s", command); free (command); } } /* - * irc_cmd_send_motd: get the "Message Of The Day" + * irc_send_cmd_motd: get the "Message Of The Day" */ int -irc_cmd_send_motd (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_motd (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "MOTD %s", arguments); + irc_server_sendf (server, "MOTD %s", arguments); else - server_sendf (server, "MOTD"); + irc_server_sendf (server, "MOTD"); return 0; } /* - * irc_cmd_send_msg: send a message to a nick or channel + * irc_send_cmd_msg: send a message to a nick or channel */ int -irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_msg (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_window *window; @@ -1235,7 +1183,7 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, t_irc_nick *ptr_nick; char *string; - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); pos = strchr (arguments, ' '); if (pos) @@ -1266,7 +1214,7 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, } ptr_channel = CHANNEL(buffer); if (BUFFER_IS_CHANNEL(buffer)) - ptr_nick = nick_search (ptr_channel, server->nick); + ptr_nick = irc_nick_search (ptr_channel, server->nick); else ptr_nick = NULL; irc_display_nick (buffer, ptr_nick, @@ -1278,16 +1226,16 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, if (string) free (string); - server_sendf (server, "PRIVMSG %s :%s", ptr_channel->name, pos); + irc_server_sendf (server, "PRIVMSG %s :%s", ptr_channel->name, pos); } else { - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) { - ptr_nick = nick_search (ptr_channel, server->nick); + ptr_nick = irc_nick_search (ptr_channel, server->nick); if (ptr_nick) { irc_display_nick (ptr_channel->buffer, ptr_nick, NULL, @@ -1306,7 +1254,7 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, WEECHAT_ERROR, server->nick, "msg"); } } - server_sendf (server, "PRIVMSG %s :%s", arguments, pos); + irc_server_sendf (server, "PRIVMSG %s :%s", arguments, pos); } else { @@ -1315,7 +1263,7 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, { msg_pwd_hidden = strdup (pos); if (cfg_log_hide_nickserv_pwd) - irc_hide_password (msg_pwd_hidden, 0); + irc_display_hide_password (msg_pwd_hidden, 0); irc_display_prefix (server, server->buffer, PREFIX_SERVER); gui_printf_type (server->buffer, MSG_TYPE_NICK, "%s-%s%s%s- ", @@ -1329,13 +1277,13 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, (string) ? string : ""); if (string) free (string); - server_sendf (server, "PRIVMSG %s :%s", arguments, pos); + irc_server_sendf (server, "PRIVMSG %s :%s", arguments, pos); free (msg_pwd_hidden); return 0; } string = (char *)gui_color_decode ((unsigned char *)pos, 1); - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (ptr_channel) { irc_display_nick (ptr_channel->buffer, NULL, server->nick, @@ -1360,7 +1308,7 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, } if (string) free (string); - server_sendf (server, "PRIVMSG %s :%s", arguments, pos); + irc_server_sendf (server, "PRIVMSG %s :%s", arguments, pos); } } arguments = pos_comma; @@ -1378,19 +1326,19 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_names: list nicknames on channels + * irc_send_cmd_names: list nicknames on channels */ int -irc_cmd_send_names (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_names (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (arguments) - server_sendf (server, "NAMES %s", arguments); + irc_server_sendf (server, "NAMES %s", arguments); else { if (!BUFFER_IS_CHANNEL(buffer)) @@ -1402,23 +1350,23 @@ irc_cmd_send_names (t_irc_server *server, t_irc_channel *channel, return -1; } else - server_sendf (server, "NAMES %s", - CHANNEL(buffer)->name); + irc_server_sendf (server, "NAMES %s", + CHANNEL(buffer)->name); } return 0; } /* - * irc_cmd_send_nick_server: change nickname on a server + * irc_send_cmd_nick_server: change nickname on a server */ void -irc_cmd_send_nick_server (t_irc_server *server, char *nickname) +irc_send_cmd_nick_server (t_irc_server *server, char *nickname) { t_irc_channel *ptr_channel; if (server->is_connected) - server_sendf (server, "NICK %s", nickname); + irc_server_sendf (server, "NICK %s", nickname); else { if (server->nick) @@ -1434,11 +1382,11 @@ irc_cmd_send_nick_server (t_irc_server *server, char *nickname) } /* - * irc_cmd_send_nick: change nickname + * irc_send_cmd_nick: change nickname */ int -irc_cmd_send_nick (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_nick (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_irc_server *ptr_server; @@ -1457,13 +1405,13 @@ irc_cmd_send_nick (t_irc_server *server, t_irc_channel *channel, for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - irc_cmd_send_nick_server (ptr_server, argv[1]); + irc_send_cmd_nick_server (ptr_server, argv[1]); } } else { if (argc == 1) - irc_cmd_send_nick_server (server, argv[0]); + irc_send_cmd_nick_server (server, argv[0]); else return -1; } @@ -1472,11 +1420,11 @@ irc_cmd_send_nick (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_notice: send notice message + * irc_send_cmd_notice: send notice message */ int -irc_cmd_send_notice (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_notice (t_irc_server *server, t_irc_channel *channel, char *arguments) { char *pos, *string; @@ -1502,7 +1450,7 @@ irc_cmd_send_notice (t_irc_server *server, t_irc_channel *channel, (string) ? string : ""); if (string) free (string); - server_sendf (server, "NOTICE %s :%s", arguments, pos); + irc_server_sendf (server, "NOTICE %s :%s", arguments, pos); } else { @@ -1516,23 +1464,23 @@ irc_cmd_send_notice (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_op: give operator privileges to nickname(s) + * irc_send_cmd_op: give operator privileges to nickname(s) */ int -irc_cmd_send_op (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_op (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_CHANNEL(buffer)) { if (argc == 0) - server_sendf (server, "MODE %s +o %s", - CHANNEL(buffer)->name, - server->nick); + irc_server_sendf (server, "MODE %s +o %s", + CHANNEL(buffer)->name, + server->nick); else irc_send_mode_nicks (server, CHANNEL(buffer)->name, "+", "o", argc, argv); @@ -1549,37 +1497,37 @@ irc_cmd_send_op (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_oper: get oper privileges + * irc_send_cmd_oper: get oper privileges */ int -irc_cmd_send_oper (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_oper (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "OPER %s", arguments); + irc_server_sendf (server, "OPER %s", arguments); return 0; } /* - * irc_cmd_send_part: leave a channel or close a private window + * irc_send_cmd_part: leave a channel or close a private window */ int -irc_cmd_send_part (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_part (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *channel_name, *pos_args, *ptr_arg, *buf; t_irc_channel *ptr_channel; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (arguments) { - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { channel_name = arguments; pos_args = strchr (arguments, ' '); @@ -1619,7 +1567,7 @@ irc_cmd_send_part (t_irc_server *server, t_irc_channel *channel, { ptr_channel = CHANNEL(buffer); gui_buffer_free (ptr_channel->buffer, 1); - channel_free (server, ptr_channel); + irc_channel_free (server, ptr_channel); gui_status_draw (buffer, 1); gui_input_draw (buffer, 1); return 0; @@ -1635,53 +1583,53 @@ irc_cmd_send_part (t_irc_server *server, t_irc_channel *channel, if (ptr_arg) { buf = weechat_strreplace (ptr_arg, "%v", PACKAGE_VERSION); - server_sendf (server, "PART %s :%s", channel_name, - (buf) ? buf : ptr_arg); + irc_server_sendf (server, "PART %s :%s", channel_name, + (buf) ? buf : ptr_arg); if (buf) free (buf); } else - server_sendf (server, "PART %s", channel_name); + irc_server_sendf (server, "PART %s", channel_name); return 0; } /* - * irc_cmd_send_ping: ping a server + * irc_send_cmd_ping: ping a server */ int -irc_cmd_send_ping (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_ping (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "PING %s", arguments); + irc_server_sendf (server, "PING %s", arguments); return 0; } /* - * irc_cmd_send_pong: send pong answer to a daemon + * irc_send_cmd_pong: send pong answer to a daemon */ int -irc_cmd_send_pong (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_pong (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "PONG %s", arguments); + irc_server_sendf (server, "PONG %s", arguments); return 0; } /* - * irc_cmd_send_query: start private conversation with a nick + * irc_send_cmd_query: start private conversation with a nick */ int -irc_cmd_send_query (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_query (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_window *window; @@ -1690,7 +1638,7 @@ irc_cmd_send_query (t_irc_server *server, t_irc_channel *channel, t_irc_channel *ptr_channel; t_gui_buffer *ptr_buffer; - irc_find_context (server, channel, &window, &buffer); + gui_buffer_find_context (server, channel, &window, &buffer); pos = strchr (arguments, ' '); if (pos) @@ -1704,10 +1652,10 @@ irc_cmd_send_query (t_irc_server *server, t_irc_channel *channel, } /* create private window if not already opened */ - ptr_channel = channel_search (server, arguments); + ptr_channel = irc_channel_search (server, arguments); if (!ptr_channel) { - ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, arguments); + ptr_channel = irc_channel_new (server, CHANNEL_TYPE_PRIVATE, arguments); if (!ptr_channel) { irc_display_prefix (NULL, server->buffer, PREFIX_ERROR); @@ -1745,7 +1693,7 @@ irc_cmd_send_query (t_irc_server *server, t_irc_channel *channel, (string) ? string : ""); if (string) free (string); - server_sendf (server, "PRIVMSG %s :%s", arguments, pos); + irc_server_sendf (server, "PRIVMSG %s :%s", arguments, pos); } return 0; } @@ -1768,22 +1716,22 @@ irc_send_quit_server (t_irc_server *server, char *arguments) if (ptr_arg) { buf = weechat_strreplace (ptr_arg, "%v", PACKAGE_VERSION); - server_sendf (server, "QUIT :%s", - (buf) ? buf : ptr_arg); + irc_server_sendf (server, "QUIT :%s", + (buf) ? buf : ptr_arg); if (buf) free (buf); } else - server_sendf (server, "QUIT"); + irc_server_sendf (server, "QUIT"); } } /* - * irc_cmd_send_quit: disconnect from all servers and quit WeeChat + * irc_send_cmd_quit: disconnect from all servers and quit WeeChat */ int -irc_cmd_send_quit (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_quit (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_irc_server *ptr_server; @@ -1802,91 +1750,91 @@ irc_cmd_send_quit (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_quote: send raw data to server + * irc_send_cmd_quote: send raw data to server */ int -irc_cmd_send_quote (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_quote (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "%s", arguments); + irc_server_sendf (server, "%s", arguments); return 0; } /* - * irc_cmd_send_rehash: tell the server to reload its config file + * irc_send_cmd_rehash: tell the server to reload its config file */ int -irc_cmd_send_rehash (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_rehash (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; (void) arguments; - server_sendf (server, "REHASH"); + irc_server_sendf (server, "REHASH"); return 0; } /* - * irc_cmd_send_restart: tell the server to restart itself + * irc_send_cmd_restart: tell the server to restart itself */ int -irc_cmd_send_restart (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_restart (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; (void) arguments; - server_sendf (server, "RESTART"); + irc_server_sendf (server, "RESTART"); return 0; } /* - * irc_cmd_send_service: register a new service + * irc_send_cmd_service: register a new service */ int -irc_cmd_send_service (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_service (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "SERVICE %s", arguments); + irc_server_sendf (server, "SERVICE %s", arguments); return 0; } /* - * irc_cmd_send_servlist: list services currently connected to the network + * irc_send_cmd_servlist: list services currently connected to the network */ int -irc_cmd_send_servlist (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_servlist (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "SERVLIST %s", arguments); + irc_server_sendf (server, "SERVLIST %s", arguments); else - server_sendf (server, "SERVLIST"); + irc_server_sendf (server, "SERVLIST"); return 0; } /* - * irc_cmd_send_squery: deliver a message to a service + * irc_send_cmd_squery: deliver a message to a service */ int -irc_cmd_send_squery (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_squery (t_irc_server *server, t_irc_channel *channel, char *arguments) { char *pos; @@ -1903,100 +1851,100 @@ irc_cmd_send_squery (t_irc_server *server, t_irc_channel *channel, { pos++; } - server_sendf (server, "SQUERY %s :%s", arguments, pos); + irc_server_sendf (server, "SQUERY %s :%s", arguments, pos); } else - server_sendf (server, "SQUERY %s", arguments); + irc_server_sendf (server, "SQUERY %s", arguments); return 0; } /* - * irc_cmd_send_squit: disconnect server links + * irc_send_cmd_squit: disconnect server links */ int -irc_cmd_send_squit (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_squit (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "SQUIT %s", arguments); + irc_server_sendf (server, "SQUIT %s", arguments); return 0; } /* - * irc_cmd_send_stats: query statistics about server + * irc_send_cmd_stats: query statistics about server */ int -irc_cmd_send_stats (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_stats (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "STATS %s", arguments); + irc_server_sendf (server, "STATS %s", arguments); else - server_sendf (server, "STATS"); + irc_server_sendf (server, "STATS"); return 0; } /* - * irc_cmd_send_summon: give users who are on a host running an IRC server + * irc_send_cmd_summon: give users who are on a host running an IRC server * a message asking them to please join IRC */ int -irc_cmd_send_summon (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_summon (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "SUMMON %s", arguments); + irc_server_sendf (server, "SUMMON %s", arguments); return 0; } /* - * irc_cmd_send_time: query local time from server + * irc_send_cmd_time: query local time from server */ int -irc_cmd_send_time (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_time (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "TIME %s", arguments); + irc_server_sendf (server, "TIME %s", arguments); else - server_sendf (server, "TIME"); + irc_server_sendf (server, "TIME"); return 0; } /* - * irc_cmd_send_topic: get/set topic for a channel + * irc_send_cmd_topic: get/set topic for a channel */ int -irc_cmd_send_topic (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_topic (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *channel_name, *new_topic, *pos; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); channel_name = NULL; new_topic = NULL; if (arguments) { - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { channel_name = arguments; pos = strchr (arguments, ' '); @@ -2030,46 +1978,46 @@ irc_cmd_send_topic (t_irc_server *server, t_irc_channel *channel, if (new_topic) { if (strcmp (new_topic, "-delete") == 0) - server_sendf (server, "TOPIC %s :", channel_name); + irc_server_sendf (server, "TOPIC %s :", channel_name); else - server_sendf (server, "TOPIC %s :%s", channel_name, new_topic); + irc_server_sendf (server, "TOPIC %s :%s", channel_name, new_topic); } else - server_sendf (server, "TOPIC %s", channel_name); + irc_server_sendf (server, "TOPIC %s", channel_name); return 0; } /* - * irc_cmd_send_trace: find the route to specific server + * irc_send_cmd_trace: find the route to specific server */ int -irc_cmd_send_trace (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_trace (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "TRACE %s", arguments); + irc_server_sendf (server, "TRACE %s", arguments); else - server_sendf (server, "TRACE"); + irc_server_sendf (server, "TRACE"); return 0; } /* - * irc_cmd_send_unban: unbans nicks or hosts + * irc_send_cmd_unban: unbans nicks or hosts */ int -irc_cmd_send_unban (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_unban (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; char *pos_channel, *pos, *pos2; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (arguments) { @@ -2079,7 +2027,7 @@ irc_cmd_send_unban (t_irc_server *server, t_irc_channel *channel, { pos[0] = '\0'; - if (string_is_channel (arguments)) + if (irc_channel_is_channel (arguments)) { pos_channel = arguments; pos++; @@ -2120,7 +2068,7 @@ irc_cmd_send_unban (t_irc_server *server, t_irc_channel *channel, while (pos2[0] == ' ') pos2++; } - server_sendf (server, "MODE %s -b %s", pos_channel, pos); + irc_server_sendf (server, "MODE %s -b %s", pos_channel, pos); pos = pos2; } } @@ -2136,59 +2084,59 @@ irc_cmd_send_unban (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_userhost: return a list of information about nicknames + * irc_send_cmd_userhost: return a list of information about nicknames */ int -irc_cmd_send_userhost (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_userhost (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "USERHOST %s", arguments); + irc_server_sendf (server, "USERHOST %s", arguments); return 0; } /* - * irc_cmd_send_users: list of users logged into the server + * irc_send_cmd_users: list of users logged into the server */ int -irc_cmd_send_users (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_users (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "USERS %s", arguments); + irc_server_sendf (server, "USERS %s", arguments); else - server_sendf (server, "USERS"); + irc_server_sendf (server, "USERS"); return 0; } /* - * irc_cmd_send_version: gives the version info of nick or server (current or specified) + * irc_send_cmd_version: gives the version info of nick or server (current or specified) */ int -irc_cmd_send_version (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_version (t_irc_server *server, t_irc_channel *channel, char *arguments) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (arguments) { if (BUFFER_IS_CHANNEL(buffer) && - nick_search (CHANNEL(buffer), arguments)) - server_sendf (server, "PRIVMSG %s :\01VERSION\01", - arguments); + irc_nick_search (CHANNEL(buffer), arguments)) + irc_server_sendf (server, "PRIVMSG %s :\01VERSION\01", + arguments); else - server_sendf (server, "VERSION %s", - arguments); + irc_server_sendf (server, "VERSION %s", + arguments); } else { @@ -2196,29 +2144,29 @@ irc_cmd_send_version (t_irc_server *server, t_irc_channel *channel, gui_printf (server->buffer, _("%s, compiled on %s %s\n"), PACKAGE_STRING, __DATE__, __TIME__); - server_sendf (server, "VERSION"); + irc_server_sendf (server, "VERSION"); } return 0; } /* - * irc_cmd_send_voice: give voice to nickname(s) + * irc_send_cmd_voice: give voice to nickname(s) */ int -irc_cmd_send_voice (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_voice (t_irc_server *server, t_irc_channel *channel, int argc, char **argv) { t_gui_buffer *buffer; - irc_find_context (server, channel, NULL, &buffer); + gui_buffer_find_context (server, channel, NULL, &buffer); if (BUFFER_IS_CHANNEL(buffer)) { if (argc == 0) - server_sendf (server, "MODE %s +v %s", - CHANNEL(buffer)->name, - server->nick); + irc_server_sendf (server, "MODE %s +v %s", + CHANNEL(buffer)->name, + server->nick); else irc_send_mode_nicks (server, CHANNEL(buffer)->name, "+", "v", argc, argv); @@ -2235,65 +2183,65 @@ irc_cmd_send_voice (t_irc_server *server, t_irc_channel *channel, } /* - * irc_cmd_send_wallops: send a message to all currently connected users who + * irc_send_cmd_wallops: send a message to all currently connected users who * have set the 'w' user mode for themselves */ int -irc_cmd_send_wallops (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_wallops (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "WALLOPS :%s", arguments); + irc_server_sendf (server, "WALLOPS :%s", arguments); return 0; } /* - * irc_cmd_send_who: generate a query which returns a list of information + * irc_send_cmd_who: generate a query which returns a list of information */ int -irc_cmd_send_who (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_who (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; if (arguments) - server_sendf (server, "WHO %s", arguments); + irc_server_sendf (server, "WHO %s", arguments); else - server_sendf (server, "WHO"); + irc_server_sendf (server, "WHO"); return 0; } /* - * irc_cmd_send_whois: query information about user(s) + * irc_send_cmd_whois: query information about user(s) */ int -irc_cmd_send_whois (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_whois (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "WHOIS %s", arguments); + irc_server_sendf (server, "WHOIS %s", arguments); return 0; } /* - * irc_cmd_send_whowas: ask for information about a nickname which no longer exists + * irc_send_cmd_whowas: ask for information about a nickname which no longer exists */ int -irc_cmd_send_whowas (t_irc_server *server, t_irc_channel *channel, +irc_send_cmd_whowas (t_irc_server *server, t_irc_channel *channel, char *arguments) { /* make C compiler happy */ (void) channel; - server_sendf (server, "WHOWAS %s", arguments); + irc_server_sendf (server, "WHOWAS %s", arguments); return 0; } diff --git a/weechat/src/irc/irc-server.c b/weechat/src/irc/irc-server.c index 0b6d2af30..974a8ba84 100644 --- a/weechat/src/irc/irc-server.c +++ b/weechat/src/irc/irc-server.c @@ -77,11 +77,11 @@ const int gnutls_cert_type_prio[] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 }; /* - * server_init: init server struct with default values + * irc_server_init: init server struct with default values */ void -server_init (t_irc_server *server) +irc_server_init (t_irc_server *server) { /* user choices */ server->name = NULL; @@ -138,20 +138,20 @@ server_init (t_irc_server *server) } /* - * server_init_with_url: init a server with url of this form: - * irc://nick:pass@irc.toto.org:6667 - * returns: 0 = ok - * -1 = invalid syntax + * irc_server_init_with_url: init a server with url of this form: + * irc://nick:pass@irc.toto.org:6667 + * returns: 0 = ok + * -1 = invalid syntax */ int -server_init_with_url (char *irc_url, t_irc_server *server) +irc_server_init_with_url (char *irc_url, t_irc_server *server) { char *url, *pos_server, *pos_channel, *pos, *pos2; int ipv6, ssl; struct passwd *my_passwd; - server_init (server); + irc_server_init (server); ipv6 = 0; ssl = 0; if (strncasecmp (irc_url, "irc6://", 7) == 0) @@ -233,7 +233,7 @@ server_init_with_url (char *irc_url, t_irc_server *server) server->address = strdup (pos_server); if (pos_channel && pos_channel[0]) { - if (string_is_channel (pos_channel)) + if (irc_channel_is_channel (pos_channel)) server->autojoin = strdup (pos_channel); else { @@ -262,11 +262,11 @@ server_init_with_url (char *irc_url, t_irc_server *server) } /* - * server_alloc: allocate a new server and add it to the servers queue + * irc_server_alloc: allocate a new server and add it to the servers queue */ t_irc_server * -server_alloc () +irc_server_alloc () { t_irc_server *new_server; @@ -280,7 +280,7 @@ server_alloc () } /* initialize new server */ - server_init (new_server); + irc_server_init (new_server); /* add new server to queue */ new_server->prev_server = last_irc_server; @@ -296,11 +296,12 @@ server_alloc () } /* - * server_outqueue_add: add a message in out queue + * irc_server_outqueue_add: add a message in out queue */ void -server_outqueue_add (t_irc_server *server, char *msg1, char *msg2, int modified) +irc_server_outqueue_add (t_irc_server *server, char *msg1, char *msg2, + int modified) { t_irc_outqueue *new_outqueue; @@ -322,11 +323,11 @@ server_outqueue_add (t_irc_server *server, char *msg1, char *msg2, int modified) } /* - * server_outqueue_free: free a message in out queue + * irc_server_outqueue_free: free a message in out queue */ void -server_outqueue_free (t_irc_server *server, t_irc_outqueue *outqueue) +irc_server_outqueue_free (t_irc_server *server, t_irc_outqueue *outqueue) { t_irc_outqueue *new_outqueue; @@ -353,22 +354,22 @@ server_outqueue_free (t_irc_server *server, t_irc_outqueue *outqueue) } /* - * server_outqueue_free_all: free all outqueued messages + * irc_server_outqueue_free_all: free all outqueued messages */ void -server_outqueue_free_all (t_irc_server *server) +irc_server_outqueue_free_all (t_irc_server *server) { while (server->outqueue) - server_outqueue_free (server, server->outqueue); + irc_server_outqueue_free (server, server->outqueue); } /* - * server_destroy: free server data (not struct himself) + * irc_server_destroy: free server data (not struct himself) */ void -server_destroy (t_irc_server *server) +irc_server_destroy (t_irc_server *server) { if (!server) return; @@ -409,17 +410,17 @@ server_destroy (t_irc_server *server) if (server->away_message) free (server->away_message); if (server->outqueue) - server_outqueue_free_all (server); + irc_server_outqueue_free_all (server); if (server->channels) - channel_free_all (server); + irc_channel_free_all (server); } /* - * server_free: free a server and remove it from servers queue + * irc_server_free: free a server and remove it from servers queue */ void -server_free (t_irc_server *server) +irc_server_free (t_irc_server *server) { t_irc_server *new_irc_servers; @@ -428,7 +429,7 @@ server_free (t_irc_server *server) /* close any opened channel/private */ while (server->channels) - channel_free (server, server->channels); + irc_channel_free (server, server->channels); /* remove server from queue */ if (last_irc_server == server) @@ -444,34 +445,34 @@ server_free (t_irc_server *server) if (server->next_server) (server->next_server)->prev_server = server->prev_server; - server_destroy (server); + irc_server_destroy (server); free (server); irc_servers = new_irc_servers; } /* - * server_free_all: free all allocated servers + * irc_server_free_all: free all allocated servers */ void -server_free_all () +irc_server_free_all () { /* for each server in memory, remove it */ while (irc_servers) - server_free (irc_servers); + irc_server_free (irc_servers); } /* - * server_new: creates a new server, and initialize it + * irc_server_new: creates a new server, and initialize it */ t_irc_server * -server_new (char *name, int autoconnect, int autoreconnect, - int autoreconnect_delay, int command_line, char *address, - int port, int ipv6, int ssl, char *password, - char *nick1, char *nick2, char *nick3, char *username, - char *realname, char *hostname, char *command, int command_delay, - char *autojoin, int autorejoin, char *notify_levels) +irc_server_new (char *name, int autoconnect, int autoreconnect, + int autoreconnect_delay, int command_line, char *address, + int port, int ipv6, int ssl, char *password, + char *nick1, char *nick2, char *nick3, char *username, + char *realname, char *hostname, char *command, int command_delay, + char *autojoin, int autorejoin, char *notify_levels) { t_irc_server *new_server; @@ -491,7 +492,7 @@ server_new (char *name, int autoconnect, int autoreconnect, (notify_levels) ? notify_levels : ""); #endif - if ((new_server = server_alloc ())) + if ((new_server = irc_server_alloc ())) { new_server->name = strdup (name); new_server->autoconnect = autoconnect; @@ -527,11 +528,11 @@ server_new (char *name, int autoconnect, int autoreconnect, } /* - * server_send: send data to IRC server + * irc_server_send: send data to IRC server */ int -server_send (t_irc_server *server, char *buffer, int size_buf) +irc_server_send (t_irc_server *server, char *buffer, int size_buf) { if (!server) return -1; @@ -545,11 +546,11 @@ server_send (t_irc_server *server, char *buffer, int size_buf) } /* - * server_outqueue_send: send a message from outqueue + * irc_server_outqueue_send: send a message from outqueue */ void -server_outqueue_send (t_irc_server *server) +irc_server_outqueue_send (t_irc_server *server) { time_t time_now; char *pos; @@ -579,25 +580,25 @@ server_outqueue_send (t_irc_server *server) if (pos) pos[0] = '\r'; } - if (server_send (server, server->outqueue->message_after_mod, - strlen (server->outqueue->message_after_mod)) <= 0) + if (irc_server_send (server, server->outqueue->message_after_mod, + strlen (server->outqueue->message_after_mod)) <= 0) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); gui_printf (server->buffer, _("%s error sending data to IRC server\n"), WEECHAT_ERROR); } server->last_user_message = time_now; - server_outqueue_free (server, server->outqueue); + irc_server_outqueue_free (server, server->outqueue); } } } /* - * server_send_one_msg: send one message to IRC server + * irc_server_send_one_msg: send one message to IRC server */ int -server_send_one_msg (t_irc_server *server, char *message) +irc_server_send_one_msg (t_irc_server *server, char *message) { static char buffer[4096]; char *new_msg, *ptr_msg, *pos; @@ -650,10 +651,10 @@ server_send_one_msg (t_irc_server *server, char *message) /* if queue, then only queue message and send nothing now */ if (queue) { - server_outqueue_add (server, - (new_msg && first_message) ? message : NULL, - buffer, - (new_msg) ? 1 : 0); + irc_server_outqueue_add (server, + (new_msg && first_message) ? message : NULL, + buffer, + (new_msg) ? 1 : 0); } else { @@ -661,7 +662,7 @@ server_send_one_msg (t_irc_server *server, char *message) gui_printf_raw_data (server, 1, 0, message); if (new_msg) gui_printf_raw_data (server, 1, 1, ptr_msg); - if (server_send (server, buffer, strlen (buffer)) <= 0) + if (irc_server_send (server, buffer, strlen (buffer)) <= 0) { irc_display_prefix (server, server->buffer, PREFIX_ERROR); gui_printf (server->buffer, _("%s error sending data to IRC server\n"), @@ -694,12 +695,12 @@ server_send_one_msg (t_irc_server *server, char *message) } /* - * server_sendf: send formatted data to IRC server - * many messages may be sent, separated by '\n' + * irc_server_sendf: send formatted data to IRC server + * many messages may be sent, separated by '\n' */ void -server_sendf (t_irc_server *server, char *fmt, ...) +irc_server_sendf (t_irc_server *server, char *fmt, ...) { va_list args; static char buffer[4096]; @@ -720,7 +721,7 @@ server_sendf (t_irc_server *server, char *fmt, ...) if (pos) pos[0] = '\0'; - rc = server_send_one_msg (server, ptr_buf); + rc = irc_server_send_one_msg (server, ptr_buf); if (pos) { @@ -736,12 +737,12 @@ server_sendf (t_irc_server *server, char *fmt, ...) } /* - * server_parse_message: parse IRC message and return pointer to - * host, command and arguments (if any) + * irc_server_parse_message: parse IRC message and return pointer to + * host, command and arguments (if any) */ void -server_parse_message (char *message, char **host, char **command, char **args) +irc_server_parse_message (char *message, char **host, char **command, char **args) { char *pos, *pos2; @@ -780,11 +781,11 @@ server_parse_message (char *message, char **host, char **command, char **args) } /* - * server_msgq_add_msg: add a message to received messages queue (at the end) + * irc_server_msgq_add_msg: add a message to received messages queue (at the end) */ void -server_msgq_add_msg (t_irc_server *server, char *msg) +irc_server_msgq_add_msg (t_irc_server *server, char *msg) { t_irc_message *message; @@ -837,11 +838,11 @@ server_msgq_add_msg (t_irc_server *server, char *msg) } /* - * server_msgq_add_unterminated: add an unterminated message to queue + * irc_server_msgq_add_unterminated: add an unterminated message to queue */ void -server_msgq_add_unterminated (t_irc_server *server, char *string) +irc_server_msgq_add_unterminated (t_irc_server *server, char *string) { if (!string[0]) return; @@ -876,11 +877,11 @@ server_msgq_add_unterminated (t_irc_server *server, char *string) } /* - * server_msgq_add_buffer: explode received buffer, creating queued messages + * irc_server_msgq_add_buffer: explode received buffer, creating queued messages */ void -server_msgq_add_buffer (t_irc_server *server, char *buffer) +irc_server_msgq_add_buffer (t_irc_server *server, char *buffer) { char *pos_cr, *pos_lf; @@ -892,7 +893,7 @@ server_msgq_add_buffer (t_irc_server *server, char *buffer) if (!pos_cr && !pos_lf) { /* no CR/LF found => add to unterminated and return */ - server_msgq_add_unterminated (server, buffer); + irc_server_msgq_add_unterminated (server, buffer); return; } @@ -900,25 +901,25 @@ server_msgq_add_buffer (t_irc_server *server, char *buffer) { /* found '\r' first => ignore this char */ pos_cr[0] = '\0'; - server_msgq_add_unterminated (server, buffer); + irc_server_msgq_add_unterminated (server, buffer); buffer = pos_cr + 1; } else { /* found: '\n' first => terminate message */ pos_lf[0] = '\0'; - server_msgq_add_msg (server, buffer); + irc_server_msgq_add_msg (server, buffer); buffer = pos_lf + 1; } } } /* - * server_msgq_flush: flush message queue + * irc_server_msgq_flush: flush message queue */ void -server_msgq_flush () +irc_server_msgq_flush () { t_irc_message *next; char *ptr_data, *new_msg, *ptr_msg, *pos; @@ -970,7 +971,7 @@ server_msgq_flush () if (new_msg) gui_printf_raw_data (recv_msgq->server, 0, 1, ptr_msg); - server_parse_message (ptr_msg, &host, &command, &args); + irc_server_parse_message (ptr_msg, &host, &command, &args); switch (irc_recv_command (recv_msgq->server, ptr_msg, host, command, args)) { @@ -1027,11 +1028,11 @@ server_msgq_flush () } /* - * server_recv: receive data from an irc server + * irc_server_recv: receive data from an irc server */ void -server_recv (t_irc_server *server) +irc_server_recv (t_irc_server *server) { static char buffer[4096 + 2]; int num_read; @@ -1049,8 +1050,8 @@ server_recv (t_irc_server *server) if (num_read > 0) { buffer[num_read] = '\0'; - server_msgq_add_buffer (server, buffer); - server_msgq_flush (); + irc_server_msgq_add_buffer (server, buffer); + irc_server_msgq_flush (); } else { @@ -1058,16 +1059,16 @@ server_recv (t_irc_server *server) gui_printf (server->buffer, _("%s cannot read data from socket, disconnecting from server...\n"), WEECHAT_ERROR); - server_disconnect (server, 1); + irc_server_disconnect (server, 1); } } /* - * server_child_kill: kill child process and close pipe + * irc_server_child_kill: kill child process and close pipe */ void -server_child_kill (t_irc_server *server) +irc_server_child_kill (t_irc_server *server) { /* kill process */ if (server->child_pid > 0) @@ -1091,13 +1092,14 @@ server_child_kill (t_irc_server *server) } /* - * server_close_connection: close server connection (kill child, close socket/pipes) + * irc_server_close_connection: close server connection + * (kill child, close socket/pipes) */ void -server_close_connection (t_irc_server *server) +irc_server_close_connection (t_irc_server *server) { - server_child_kill (server); + irc_server_child_kill (server); /* close network socket */ if (server->sock != -1) @@ -1120,7 +1122,7 @@ server_close_connection (t_irc_server *server) free (server->unterminated_message); server->unterminated_message = NULL; } - server_outqueue_free_all (server); + irc_server_outqueue_free_all (server); /* server is now disconnected */ server->is_connected = 0; @@ -1128,11 +1130,11 @@ server_close_connection (t_irc_server *server) } /* - * server_reconnect_schedule: schedule reconnect for a server + * irc_server_reconnect_schedule: schedule reconnect for a server */ void -server_reconnect_schedule (t_irc_server *server) +irc_server_reconnect_schedule (t_irc_server *server) { if (server->autoreconnect) { @@ -1146,11 +1148,11 @@ server_reconnect_schedule (t_irc_server *server) } /* - * server_child_read: read connection progress from child process + * irc_server_child_read: read connection progress from child process */ void -server_child_read (t_irc_server *server) +irc_server_child_read (t_irc_server *server) { char buffer[1]; int num_read; @@ -1174,15 +1176,15 @@ server_child_read (t_irc_server *server) gui_printf (server->buffer, _("%s gnutls handshake failed\n"), WEECHAT_ERROR); - server_close_connection (server); - server_reconnect_schedule (server); + irc_server_close_connection (server); + irc_server_reconnect_schedule (server); return; } } #endif /* kill child and login to server */ - server_child_kill (server); - irc_login (server); + irc_server_child_kill (server); + irc_send_login (server); break; /* adress not found */ case '1': @@ -1195,8 +1197,8 @@ server_child_read (t_irc_server *server) gui_printf (server->buffer, _("%s address \"%s\" not found\n"), WEECHAT_ERROR, server->address); - server_close_connection (server); - server_reconnect_schedule (server); + irc_server_close_connection (server); + irc_server_reconnect_schedule (server); break; /* IP address not found */ case '2': @@ -1207,8 +1209,8 @@ server_child_read (t_irc_server *server) else gui_printf (server->buffer, _("%s IP address not found\n"), WEECHAT_ERROR); - server_close_connection (server); - server_reconnect_schedule (server); + irc_server_close_connection (server); + irc_server_reconnect_schedule (server); break; /* connection refused */ case '3': @@ -1219,8 +1221,8 @@ server_child_read (t_irc_server *server) else gui_printf (server->buffer, _("%s connection refused\n"), WEECHAT_ERROR); - server_close_connection (server); - server_reconnect_schedule (server); + irc_server_close_connection (server); + irc_server_reconnect_schedule (server); break; /* proxy fails to connect to server */ case '4': @@ -1229,8 +1231,8 @@ server_child_read (t_irc_server *server) _("%s proxy fails to establish connection to " "server (check username/password if used)\n"), WEECHAT_ERROR); - server_close_connection (server); - server_reconnect_schedule (server); + irc_server_close_connection (server); + irc_server_reconnect_schedule (server); break; /* fails to set local hostname/IP */ case '5': @@ -1238,23 +1240,22 @@ server_child_read (t_irc_server *server) gui_printf (server->buffer, _("%s unable to set local hostname/IP\n"), WEECHAT_ERROR); - server_close_connection (server); - server_reconnect_schedule (server); + irc_server_close_connection (server); + irc_server_reconnect_schedule (server); break; } } } /* - * convbase64_8x3_to_6x4 : convert 3 bytes of 8 bits in 4 bytes of 6 bits + * irc_server_convbase64_8x3_to_6x4 : convert 3 bytes of 8 bits in 4 bytes of 6 bits */ void -convbase64_8x3_to_6x4(char *from, char* to) +irc_server_convbase64_8x3_to_6x4 (char *from, char* to) { - unsigned char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - + to[0] = base64_table [ (from[0] & 0xfc) >> 2 ]; to[1] = base64_table [ ((from[0] & 0x03) << 4) + ((from[1] & 0xf0) >> 4) ]; to[2] = base64_table [ ((from[1] & 0x0f) << 2) + ((from[2] & 0xc0) >> 6) ]; @@ -1262,105 +1263,109 @@ convbase64_8x3_to_6x4(char *from, char* to) } /* - * base64encode: encode a string in base64 + * irc_server_base64encode: encode a string in base64 */ void -base64encode(char *from, char *to) +irc_server_base64encode (char *from, char *to) { - char *f, *t; int from_len; - + from_len = strlen(from); - + f = from; t = to; - - while(from_len >= 3) + + while (from_len >= 3) { - convbase64_8x3_to_6x4(f, t); - f += 3 * sizeof(*f); - t += 4 * sizeof(*t); + irc_server_convbase64_8x3_to_6x4 (f, t); + f += 3 * sizeof (*f); + t += 4 * sizeof (*t); from_len -= 3; } - + if (from_len > 0) { char rest[3] = { 0, 0, 0 }; - switch(from_len) + switch (from_len) { - case 1 : - rest[0] = f[0]; - convbase64_8x3_to_6x4(rest, t); - t[2] = t[3] = '='; - break; - case 2 : - rest[0] = f[0]; - rest[1] = f[1]; - convbase64_8x3_to_6x4(rest, t); - t[3] = '='; - break; + case 1 : + rest[0] = f[0]; + irc_server_convbase64_8x3_to_6x4 (rest, t); + t[2] = t[3] = '='; + break; + case 2 : + rest[0] = f[0]; + rest[1] = f[1]; + irc_server_convbase64_8x3_to_6x4 (rest, t); + t[3] = '='; + break; } t[4] = 0; } } /* - * pass_httpproxy: establish connection/authentification to an http proxy - * return : - * - 0 if connexion throw proxy was successful - * - 1 if connexion fails + * irc_server_pass_httpproxy: establish connection/authentification to an + * http proxy + * return : + * - 0 if connexion throw proxy was successful + * - 1 if connexion fails */ int -pass_httpproxy(int sock, char *address, int port) +irc_server_pass_httpproxy (int sock, char *address, int port) { char buffer[256]; char authbuf[128]; char authbuf_base64[196]; int n, m; - - if (strlen(cfg_proxy_username) > 0) + + if (cfg_proxy_username && cfg_proxy_username[0]) { /* authentification */ - snprintf(authbuf, sizeof(authbuf), "%s:%s", cfg_proxy_username, cfg_proxy_password); - base64encode(authbuf, authbuf_base64); - n = snprintf(buffer, sizeof(buffer), "CONNECT %s:%d HTTP/1.0\r\nProxy-Authorization: Basic %s\r\n\r\n", address, port, authbuf_base64); + snprintf (authbuf, sizeof (authbuf), "%s:%s", + cfg_proxy_username, cfg_proxy_password); + irc_server_base64encode (authbuf, authbuf_base64); + n = snprintf (buffer, sizeof (buffer), + "CONNECT %s:%d HTTP/1.0\r\nProxy-Authorization: Basic %s\r\n\r\n", + address, port, authbuf_base64); } else { /* no authentification */ - n = snprintf(buffer, sizeof(buffer), "CONNECT %s:%d HTTP/1.0\r\n\r\n", address, port); + n = snprintf (buffer, sizeof (buffer), + "CONNECT %s:%d HTTP/1.0\r\n\r\n", address, port); } - + m = send (sock, buffer, n, 0); if (n != m) return 1; - - n = recv(sock, buffer, sizeof(buffer), 0); - + + n = recv (sock, buffer, sizeof (buffer), 0); + /* success result must be like: "HTTP/1.0 200 OK" */ if (n < 12) return 1; - + if (memcmp (buffer, "HTTP/", 5) || memcmp (buffer + 9, "200", 3)) return 1; - + return 0; } /* - * resolve: resolve hostname on its IP address - * (works with ipv4 and ipv6) - * return : - * - 0 if resolution was successful - * - 1 if resolution fails + * irc_server_resolve: resolve hostname on its IP address + * (works with ipv4 and ipv6) + * return : + * - 0 if resolution was successful + * - 1 if resolution fails */ int -resolve (char *hostname, char *ip, int *version) +irc_server_resolve (char *hostname, char *ip, int *version) { char ipbuffer[NI_MAXHOST]; struct addrinfo *res; @@ -1369,7 +1374,7 @@ resolve (char *hostname, char *ip, int *version) *version = 0; res = NULL; - + if (getaddrinfo (hostname, NULL, NULL, &res) != 0) return 1; @@ -1395,21 +1400,22 @@ resolve (char *hostname, char *ip, int *version) } /* - * pass_socks4proxy: establish connection/authentification throw a socks4 proxy - * return : - * - 0 if connexion throw proxy was successful - * - 1 if connexion fails + * irc_server_pass_socks4proxy: establish connection/authentification thru a + * socks4 proxy + * return : + * - 0 if connexion thru proxy was successful + * - 1 if connexion fails */ int -pass_socks4proxy (int sock, char *address, int port, char *username) +irc_server_pass_socks4proxy (int sock, char *address, int port, char *username) { /* - * socks4 protocol is explain here: + * socks4 protocol is explained here: * http://archive.socks.permeo.com/protocol/socks4.protocol * */ - + struct s_socks4 { char version; /* 1 byte */ /* socks version : 4 or 5 */ @@ -1420,38 +1426,39 @@ pass_socks4proxy (int sock, char *address, int port, char *username) } socks4; unsigned char buffer[24]; char ip_addr[NI_MAXHOST]; - + socks4.version = 4; socks4.method = 1; socks4.port = htons (port); - resolve(address, ip_addr, NULL); + irc_server_resolve (address, ip_addr, NULL); socks4.address = inet_addr (ip_addr); - strncpy (socks4.user, username, sizeof(socks4.user) - 1); - - send (sock, (char *) &socks4, 8 + strlen(socks4.user) + 1, 0); - recv (sock, buffer, sizeof(buffer), 0); - + strncpy (socks4.user, username, sizeof (socks4.user) - 1); + + send (sock, (char *) &socks4, 8 + strlen (socks4.user) + 1, 0); + recv (sock, buffer, sizeof (buffer), 0); + if (buffer[0] == 0 && buffer[1] == 90) return 0; - + return 1; } /* - * pass_socks5proxy: establish connection/authentification throw a socks5 proxy - * return : - * - 0 if connexion throw proxy was successful - * - 1 if connexion fails + * irc_server_pass_socks5proxy: establish connection/authentification thru a + * socks5 proxy + * return : + * - 0 if connexion thru proxy was successful + * - 1 if connexion fails */ int -pass_socks5proxy(int sock, char *address, int port) +irc_server_pass_socks5proxy (int sock, char *address, int port) { /* * socks5 protocol is explained in RFC 1928 * socks5 authentication with username/pass is explained in RFC 1929 */ - + struct s_sock5 { char version; /* 1 byte */ /* socks version : 4 or 5 */ @@ -1461,23 +1468,21 @@ pass_socks5proxy(int sock, char *address, int port) unsigned char buffer[288]; int username_len, password_len, addr_len, addr_buffer_len; unsigned char *addr_buffer; - + socks5.version = 5; socks5.nmethods = 1; - - if (strlen(cfg_proxy_username) > 0) - /* with authentication */ - socks5.method = 2; + + if (cfg_proxy_username && cfg_proxy_username[0]) + socks5.method = 2; /* with authentication */ else - /* without authentication */ - socks5.method = 0; - + socks5.method = 0; /* without authentication */ + send (sock, (char *) &socks5, sizeof(socks5), 0); /* server socks5 must respond with 2 bytes */ if (recv (sock, buffer, 2, 0) != 2) return 1; - - if (strlen(cfg_proxy_username) > 0) + + if (cfg_proxy_username && cfg_proxy_username[0]) { /* with authentication */ /* -> socks server must respond with : @@ -1497,7 +1502,7 @@ pass_socks5proxy(int sock, char *address, int port) buffer[1] = (unsigned char) username_len; memcpy(buffer + 2, cfg_proxy_username, username_len); buffer[2 + username_len] = (unsigned char) password_len; - memcpy(buffer + 3 + username_len, cfg_proxy_password, password_len); + memcpy (buffer + 3 + username_len, cfg_proxy_password, password_len); send (sock, buffer, 3 + username_len + password_len, 0); @@ -1519,11 +1524,11 @@ pass_socks5proxy(int sock, char *address, int port) if (!(buffer[0] == 5 && buffer[1] == 0)) return 1; } - + /* authentication successful then giving address/port to connect */ addr_len = strlen(address); addr_buffer_len = 4 + 1 + addr_len + 2; - addr_buffer = (unsigned char *) malloc ( addr_buffer_len * sizeof(*addr_buffer)); + addr_buffer = (unsigned char *) malloc (addr_buffer_len * sizeof(*addr_buffer)); if (!addr_buffer) return 1; addr_buffer[0] = 5; /* version 5 */ @@ -1533,80 +1538,81 @@ pass_socks5proxy(int sock, char *address, int port) addr_buffer[4] = (unsigned char) addr_len; memcpy (addr_buffer + 5, address, addr_len); /* server address */ *((unsigned short *) (addr_buffer + 5 + addr_len)) = htons (port); /* server port */ - + send (sock, addr_buffer, addr_buffer_len, 0); - free(addr_buffer); - + free (addr_buffer); + /* dialog with proxy server */ if (recv (sock, buffer, 4, 0) != 4) return 1; - + if (!(buffer[0] == 5 && buffer[1] == 0)) return 1; - - switch(buffer[3]) { - /* buffer[3] = address type */ - case 1 : - /* ipv4 - * server socks return server bound address and port - * address of 4 bytes and port of 2 bytes (= 6 bytes) - */ - if (recv (sock, buffer, 6, 0) != 6) - return 1; - break; - case 3: - /* domainname - * server socks return server bound address and port - */ - /* reading address length */ - if (recv (sock, buffer, 1, 0) != 1) - return 1; - addr_len = buffer[0]; - /* reading address + port = addr_len + 2 */ - if (recv (sock, buffer, addr_len + 2, 0) != (addr_len + 2)) - return 1; - break; - case 4 : - /* ipv6 - * server socks return server bound address and port - * address of 16 bytes and port of 2 bytes (= 18 bytes) - */ - if (recv (sock, buffer, 18, 0) != 18) + + /* buffer[3] = address type */ + switch(buffer[3]) + { + case 1 : + /* ipv4 + * server socks return server bound address and port + * address of 4 bytes and port of 2 bytes (= 6 bytes) + */ + if (recv (sock, buffer, 6, 0) != 6) + return 1; + break; + case 3: + /* domainname + * server socks return server bound address and port + */ + /* reading address length */ + if (recv (sock, buffer, 1, 0) != 1) + return 1; + addr_len = buffer[0]; + /* reading address + port = addr_len + 2 */ + if (recv (sock, buffer, addr_len + 2, 0) != (addr_len + 2)) + return 1; + break; + case 4 : + /* ipv6 + * server socks return server bound address and port + * address of 16 bytes and port of 2 bytes (= 18 bytes) + */ + if (recv (sock, buffer, 18, 0) != 18) + return 1; + break; + default: return 1; - break; - default: - return 1; } - + return 0; } /* - * pass_proxy: establish connection/authentification to a proxy - * return : - * - 0 if connexion throw proxy was successful - * - 1 if connexion fails + * irc_server_pass_proxy: establish connection/authentification to a proxy + * return : + * - 0 if connexion throw proxy was successful + * - 1 if connexion fails */ int -pass_proxy (int sock, char *address, int port, char *username) +irc_server_pass_proxy (int sock, char *address, int port, char *username) { if (strcmp (cfg_proxy_type_values[cfg_proxy_type], "http") == 0) - return pass_httpproxy(sock, address, port); + return irc_server_pass_httpproxy (sock, address, port); if (strcmp (cfg_proxy_type_values[cfg_proxy_type], "socks4") == 0) - return pass_socks4proxy(sock, address, port, username); + return irc_server_pass_socks4proxy (sock, address, port, username); if (strcmp (cfg_proxy_type_values[cfg_proxy_type], "socks5") == 0) - return pass_socks5proxy(sock, address, port); - + return irc_server_pass_socks5proxy (sock, address, port); + return 1; } /* - * server_child: child process trying to connect to server + * irc_server_child: child process trying to connect to server */ int -server_child (t_irc_server *server) +irc_server_child (t_irc_server *server) { struct addrinfo hints, *res, *res_local; int rc; @@ -1651,7 +1657,7 @@ server_child (t_irc_server *server) return 0; } - if (pass_proxy(server->sock, server->address, server->port, server->username)) + if (irc_server_pass_proxy (server->sock, server->address, server->port, server->username)) { write(server->child_write, "4", 1); freeaddrinfo (res); @@ -1734,11 +1740,11 @@ server_child (t_irc_server *server) } /* - * server_connect: connect to an IRC server + * irc_server_connect: connect to an IRC server */ int -server_connect (t_irc_server *server) +irc_server_connect (t_irc_server *server) { int child_pipe[2], set; pid_t pid; @@ -1784,7 +1790,7 @@ server_connect (t_irc_server *server) } /* close any opened connection and kill child process if running */ - server_close_connection (server); + irc_server_close_connection (server); /* init SSL if asked */ server->ssl_connected = 0; @@ -1856,12 +1862,12 @@ server_connect (t_irc_server *server) { /* fork failed */ case -1: - server_close_connection (server); + irc_server_close_connection (server); return 0; /* child process */ case 0: setuid (getuid ()); - server_child (server); + irc_server_child (server); _exit (EXIT_SUCCESS); } @@ -1872,29 +1878,29 @@ server_connect (t_irc_server *server) } /* - * server_reconnect: reconnect to a server (after disconnection) + * irc_server_reconnect: reconnect to a server (after disconnection) */ void -server_reconnect (t_irc_server *server) +irc_server_reconnect (t_irc_server *server) { irc_display_prefix (server, server->buffer, PREFIX_INFO); gui_printf (server->buffer, _("%s: Reconnecting to server...\n"), PACKAGE_NAME); server->reconnect_start = 0; - if (server_connect (server)) + if (irc_server_connect (server)) server->reconnect_join = 1; else - server_reconnect_schedule (server); + irc_server_reconnect_schedule (server); } /* - * server_auto_connect: auto-connect to servers (called at startup) + * irc_server_auto_connect: auto-connect to servers (called at startup) */ void -server_auto_connect (int auto_connect, int command_line) +irc_server_auto_connect (int auto_connect, int command_line) { t_irc_server *ptr_server; @@ -1907,18 +1913,18 @@ server_auto_connect (int auto_connect, int command_line) (void) gui_buffer_new (gui_current_window, ptr_server, NULL, BUFFER_TYPE_STANDARD, 1); gui_window_redraw_buffer (gui_current_window->buffer); - if (!server_connect (ptr_server)) - server_reconnect_schedule (ptr_server); + if (!irc_server_connect (ptr_server)) + irc_server_reconnect_schedule (ptr_server); } } } /* - * server_disconnect: disconnect from an irc server + * irc_server_disconnect: disconnect from an irc server */ void -server_disconnect (t_irc_server *server, int reconnect) +irc_server_disconnect (t_irc_server *server, int reconnect) { t_irc_channel *ptr_channel; @@ -1928,7 +1934,7 @@ server_disconnect (t_irc_server *server, int reconnect) for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { - nick_free_all (ptr_channel); + irc_nick_free_all (ptr_channel); irc_display_prefix (NULL, ptr_channel->buffer, PREFIX_INFO); gui_printf (ptr_channel->buffer, _("Disconnected from server!\n")); gui_nicklist_draw (ptr_channel->buffer, 1, 1); @@ -1936,7 +1942,7 @@ server_disconnect (t_irc_server *server, int reconnect) } } - server_close_connection (server); + irc_server_close_connection (server); if (server->buffer) { @@ -1962,7 +1968,7 @@ server_disconnect (t_irc_server *server, int reconnect) server->lag_next_check = time (NULL) + cfg_irc_lag_check; if ((reconnect) && (server->autoreconnect)) - server_reconnect_schedule (server); + irc_server_reconnect_schedule (server); else server->reconnect_start = 0; @@ -1977,24 +1983,24 @@ server_disconnect (t_irc_server *server, int reconnect) } /* - * server_disconnect_all: disconnect from all irc servers + * irc_server_disconnect_all: disconnect from all irc servers */ void -server_disconnect_all () +irc_server_disconnect_all () { t_irc_server *ptr_server; for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) - server_disconnect (ptr_server, 0); + irc_server_disconnect (ptr_server, 0); } /* - * server_search: return pointer on a server with a name + * irc_server_search: return pointer on a server with a name */ t_irc_server * -server_search (char *servername) +irc_server_search (char *servername) { t_irc_server *ptr_server; @@ -2011,11 +2017,11 @@ server_search (char *servername) } /* - * server_get_number_connected: returns number of connected server + * irc_server_get_number_connected: returns number of connected server */ int -server_get_number_connected () +irc_server_get_number_connected () { t_irc_server *ptr_server; int number; @@ -2030,13 +2036,13 @@ server_get_number_connected () } /* - * server_get_number_buffer: returns position of a server and total number of - * buffers with a buffer + * irc_server_get_number_buffer: returns position of a server and total number of + * buffers with a buffer */ void -server_get_number_buffer (t_irc_server *server, - int *server_pos, int *server_total) +irc_server_get_number_buffer (t_irc_server *server, + int *server_pos, int *server_total) { t_irc_server *ptr_server; @@ -2055,12 +2061,12 @@ server_get_number_buffer (t_irc_server *server, } /* - * server_name_already_exists: return 1 if server name already exists - * otherwise return 0 + * irc_server_name_already_exists: return 1 if server name already exists + * otherwise return 0 */ int -server_name_already_exists (char *name) +irc_server_name_already_exists (char *name) { t_irc_server *ptr_server; @@ -2076,11 +2082,11 @@ server_name_already_exists (char *name) } /* - * server_remove_away: remove away for all chans/nicks (for all servers) + * irc_server_remove_away: remove away for all chans/nicks (for all servers) */ void -server_remove_away () +irc_server_remove_away () { t_irc_server *ptr_server; t_irc_channel *ptr_channel; @@ -2092,18 +2098,18 @@ server_remove_away () for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { if (ptr_channel->type == CHANNEL_TYPE_CHANNEL) - channel_remove_away (ptr_channel); + irc_channel_remove_away (ptr_channel); } } } } /* - * server_check_away: check for away on all channels (for all servers) + * irc_server_check_away: check for away on all channels (for all servers) */ void -server_check_away () +irc_server_check_away () { t_irc_server *ptr_server; t_irc_channel *ptr_channel; @@ -2115,18 +2121,18 @@ server_check_away () for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { if (ptr_channel->type == CHANNEL_TYPE_CHANNEL) - channel_check_away (ptr_server, ptr_channel, 0); + irc_channel_check_away (ptr_server, ptr_channel, 0); } } } } /* - * server_set_away: set/unset away status for a server (all channels) + * irc_server_set_away: set/unset away status for a server (all channels) */ void -server_set_away (t_irc_server *server, char *nick, int is_away) +irc_server_set_away (t_irc_server *server, char *nick, int is_away) { t_irc_channel *ptr_channel; @@ -2135,17 +2141,17 @@ server_set_away (t_irc_server *server, char *nick, int is_away) if (server->is_connected) { if (ptr_channel->type == CHANNEL_TYPE_CHANNEL) - channel_set_away (ptr_channel, nick, is_away); + irc_channel_set_away (ptr_channel, nick, is_away); } } } /* - * server_get_default_notify_level: get default notify level for server + * irc_server_get_default_notify_level: get default notify level for server */ int -server_get_default_notify_level (t_irc_server *server) +irc_server_get_default_notify_level (t_irc_server *server) { int notify, value; char *pos; @@ -2171,11 +2177,11 @@ server_get_default_notify_level (t_irc_server *server) } /* - * server_set_default_notify_level: set default notify level for server + * irc_server_set_default_notify_level: set default notify level for server */ void -server_set_default_notify_level (t_irc_server *server, int notify) +irc_server_set_default_notify_level (t_irc_server *server, int notify) { char level_string[2]; @@ -2188,11 +2194,11 @@ server_set_default_notify_level (t_irc_server *server, int notify) } /* - * server_print_log: print server infos in log (usually for crash dump) + * irc_server_print_log: print server infos in log (usually for crash dump) */ void -server_print_log (t_irc_server *server) +irc_server_print_log (t_irc_server *server) { weechat_log_printf ("[server %s (addr:0x%X)]\n", server->name, server); weechat_log_printf (" autoconnect . . . . : %d\n", server->autoconnect); diff --git a/weechat/src/irc/irc.h b/weechat/src/irc/irc.h index 47a565142..1ce76e8ab 100644 --- a/weechat/src/irc/irc.h +++ b/weechat/src/irc/irc.h @@ -70,11 +70,11 @@ else \ nick->flags &= 0xFFFF - flag; -#define server_sendf_queued(server, fmt, argz...) \ +#define irc_server_sendf_queued(server, fmt, argz...) \ if (server) \ { \ server->queue_msg = 1; \ - server_sendf(server, fmt, ##argz); \ + irc_server_sendf (server, fmt, ##argz); \ server->queue_msg = 0; \ } @@ -363,86 +363,81 @@ extern t_irc_ignore *irc_last_ignore; /* server functions (irc-server.c) */ -extern void server_init (t_irc_server *); -extern int server_init_with_url (char *, t_irc_server *); -extern t_irc_server *server_alloc (); -extern void server_outqueue_free_all (t_irc_server *); -extern void server_destroy (t_irc_server *); -extern void server_free (t_irc_server *); -extern void server_free_all (); -extern t_irc_server *server_new (char *, int, int, int, int, char *, int, int, int, - char *, char *, char *, char *, char *, char *, - char *, char *, int, char *, int, char *); -extern char *server_get_charset_decode_iso (t_irc_server *); -extern char *server_get_charset_decode_utf (t_irc_server *); -extern char *server_get_charset_encode (t_irc_server *); -extern int server_send (t_irc_server *, char *, int); -extern void server_outqueue_send (t_irc_server *); -extern void server_sendf (t_irc_server *, char *, ...); -extern void server_parse_message (char *, char **, char **, char **); -extern void server_recv (t_irc_server *); -extern void server_child_read (t_irc_server *); -extern int server_connect (t_irc_server *); -extern void server_reconnect (t_irc_server *); -extern void server_auto_connect (int, int); -extern void server_disconnect (t_irc_server *, int); -extern void server_disconnect_all (); -extern t_irc_server *server_search (char *); -extern int server_get_number_connected (); -extern void server_get_number_buffer (t_irc_server *, int *, int *); -extern int server_name_already_exists (char *); -extern void server_remove_away (); -extern void server_check_away (); -extern void server_set_away (t_irc_server *, char *, int); -extern int server_get_default_notify_level (t_irc_server *); -extern void server_set_default_notify_level (t_irc_server *, int); -extern void server_print_log (t_irc_server *); - -/* proxy functions (irc-server.c) */ -extern void convbase64_8x3_to_6x4(char *from, char* to); -extern void base64encode(char *from, char *to); -extern int pass_httpproxy(int, char*, int); -extern int resolve(char *hostname, char *ip, int *version); -extern int pass_socks4proxy(int, char*, int, char*); -extern int pass_socks5proxy(int, char*, int); -extern int pass_proxy(int, char*, int, char*); +extern void irc_server_init (t_irc_server *); +extern int irc_server_init_with_url (char *, t_irc_server *); +extern t_irc_server *irc_server_alloc (); +extern void irc_server_outqueue_free_all (t_irc_server *); +extern void irc_server_destroy (t_irc_server *); +extern void irc_server_free (t_irc_server *); +extern void irc_server_free_all (); +extern t_irc_server *irc_server_new (char *, int, int, int, int, char *, int, int, int, + char *, char *, char *, char *, char *, char *, + char *, char *, int, char *, int, char *); +extern char *irc_server_get_charset_decode_iso (t_irc_server *); +extern char *irc_server_get_charset_decode_utf (t_irc_server *); +extern char *irc_server_get_charset_encode (t_irc_server *); +extern int irc_server_send (t_irc_server *, char *, int); +extern void irc_server_outqueue_send (t_irc_server *); +extern void irc_server_sendf (t_irc_server *, char *, ...); +extern void irc_server_parse_message (char *, char **, char **, char **); +extern void irc_server_recv (t_irc_server *); +extern void irc_server_child_read (t_irc_server *); +extern void irc_server_convbase64_8x3_to_6x4 (char *, char*); +extern void irc_server_base64encode (char *, char *); +extern int irc_server_pass_httpproxy (int, char*, int); +extern int irc_server_resolve (char *, char *, int *); +extern int irc_server_pass_socks4proxy (int, char*, int, char*); +extern int irc_server_pass_socks5proxy (int, char*, int); +extern int irc_server_pass_proxy (int, char*, int, char*); +extern int irc_server_connect (t_irc_server *); +extern void irc_server_reconnect (t_irc_server *); +extern void irc_server_auto_connect (int, int); +extern void irc_server_disconnect (t_irc_server *, int); +extern void irc_server_disconnect_all (); +extern t_irc_server *irc_server_search (char *); +extern int irc_server_get_number_connected (); +extern void irc_server_get_number_buffer (t_irc_server *, int *, int *); +extern int irc_server_name_already_exists (char *); +extern void irc_server_remove_away (); +extern void irc_server_check_away (); +extern void irc_server_set_away (t_irc_server *, char *, int); +extern int irc_server_get_default_notify_level (t_irc_server *); +extern void irc_server_set_default_notify_level (t_irc_server *, int); +extern void irc_server_print_log (t_irc_server *); /* channel functions (irc-channel.c) */ -extern t_irc_channel *channel_new (t_irc_server *, int, char *); -extern void channel_free (t_irc_server *, t_irc_channel *); -extern void channel_free_all (t_irc_server *); -extern t_irc_channel *channel_search (t_irc_server *, char *); -extern t_irc_channel *channel_search_any (t_irc_server *, char *); -extern t_irc_channel *channel_search_any_without_buffer (t_irc_server *, char *); -extern t_irc_channel *channel_search_dcc (t_irc_server *, char *); -extern int string_is_channel (char *); -extern char *channel_get_charset_decode_iso (t_irc_server *, t_irc_channel *); -extern char *channel_get_charset_decode_utf (t_irc_server *, t_irc_channel *); -extern char *channel_get_charset_encode (t_irc_server *, t_irc_channel *); -extern void channel_remove_away (t_irc_channel *); -extern void channel_check_away (t_irc_server *, t_irc_channel *, int); -extern void channel_set_away (t_irc_channel *, char *, int); -extern int channel_create_dcc (t_irc_dcc *); -extern int channel_get_notify_level (t_irc_server *, t_irc_channel *); -extern void channel_set_notify_level (t_irc_server *, t_irc_channel *, int); -extern void channel_add_nick_speaking (t_irc_channel *, char *); -extern void channel_print_log (t_irc_channel *); +extern t_irc_channel *irc_channel_new (t_irc_server *, int, char *); +extern void irc_channel_free (t_irc_server *, t_irc_channel *); +extern void irc_channel_free_all (t_irc_server *); +extern t_irc_channel *irc_channel_search (t_irc_server *, char *); +extern t_irc_channel *irc_channel_search_any (t_irc_server *, char *); +extern t_irc_channel *irc_channel_search_any_without_buffer (t_irc_server *, char *); +extern t_irc_channel *irc_channel_search_dcc (t_irc_server *, char *); +extern int irc_channel_is_channel (char *); +extern void irc_channel_remove_away (t_irc_channel *); +extern void irc_channel_check_away (t_irc_server *, t_irc_channel *, int); +extern void irc_channel_set_away (t_irc_channel *, char *, int); +extern int irc_channel_create_dcc (t_irc_dcc *); +extern int irc_channel_get_notify_level (t_irc_server *, t_irc_channel *); +extern void irc_channel_set_notify_level (t_irc_server *, t_irc_channel *, int); +extern void irc_channel_add_nick_speaking (t_irc_channel *, char *); +extern void irc_channel_print_log (t_irc_channel *); /* nick functions (irc-nick.c) */ -extern int nick_find_color (t_irc_nick *); -extern t_irc_nick *nick_new (t_irc_server *, t_irc_channel *, char *, - int, int, int, int, int, int); -extern void nick_resort (t_irc_channel *, t_irc_nick *); -extern void nick_change (t_irc_channel *, t_irc_nick *, char *); -extern void nick_free (t_irc_channel *, t_irc_nick *); -extern void nick_free_all (t_irc_channel *); -extern t_irc_nick *nick_search (t_irc_channel *, char *); -extern void nick_count (t_irc_channel *, int *, int *, int *, int *, int *); -extern int nick_get_max_length (t_irc_channel *); -extern void nick_set_away (t_irc_channel *, t_irc_nick *, int); -extern void nick_print_log (t_irc_nick *); +extern int irc_nick_find_color (t_irc_nick *); +extern t_irc_nick *irc_nick_new (t_irc_server *, t_irc_channel *, char *, + int, int, int, int, int, int); +extern void irc_nick_resort (t_irc_channel *, t_irc_nick *); +extern void irc_nick_change (t_irc_channel *, t_irc_nick *, char *); +extern void irc_nick_free (t_irc_channel *, t_irc_nick *); +extern void irc_nick_free_all (t_irc_channel *); +extern t_irc_nick *irc_nick_search (t_irc_channel *, char *); +extern void irc_nick_count (t_irc_channel *, int *, int *, int *, int *, int *); +extern int irc_nick_get_max_length (t_irc_channel *); +extern void irc_nick_set_away (t_irc_channel *, t_irc_nick *, int); +extern void irc_nick_print_log (t_irc_nick *); /* mode functions (irc-mode.c) */ @@ -452,28 +447,27 @@ extern int irc_mode_nick_prefix_allowed (t_irc_server *, char); /* DCC functions (irc-dcc.c) */ -extern void dcc_redraw (int); -extern void dcc_free (t_irc_dcc *); -extern void dcc_close (t_irc_dcc *, int); -extern void dcc_chat_remove_channel (t_irc_channel *); -extern void dcc_accept (t_irc_dcc *); -extern void dcc_accept_resume (t_irc_server *, char *, int, unsigned long); -extern void dcc_start_resume (t_irc_server *, char *, int, unsigned long); -extern t_irc_dcc *dcc_alloc (); -extern t_irc_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, int, - char *, char *, unsigned long); -extern void dcc_send_request (t_irc_server *, int, char *, char *); -extern void dcc_chat_sendf (t_irc_dcc *, char *, ...); -extern void dcc_file_send_fork (t_irc_dcc *); -extern void dcc_file_recv_fork (t_irc_dcc *); -extern void dcc_handle (); -extern void dcc_end (); -extern void dcc_print_log (); +extern void irc_dcc_redraw (int); +extern void irc_dcc_free (t_irc_dcc *); +extern void irc_dcc_close (t_irc_dcc *, int); +extern void irc_dcc_chat_remove_channel (t_irc_channel *); +extern void irc_dcc_accept (t_irc_dcc *); +extern void irc_dcc_accept_resume (t_irc_server *, char *, int, unsigned long); +extern void irc_dcc_start_resume (t_irc_server *, char *, int, unsigned long); +extern t_irc_dcc *irc_dcc_alloc (); +extern t_irc_dcc *irc_dcc_add (t_irc_server *, int, unsigned long, int, char *, int, + char *, char *, unsigned long); +extern void irc_dcc_send_request (t_irc_server *, int, char *, char *); +extern void irc_dcc_chat_sendf (t_irc_dcc *, char *, ...); +extern void irc_dcc_file_send_fork (t_irc_dcc *); +extern void irc_dcc_file_recv_fork (t_irc_dcc *); +extern void irc_dcc_handle (); +extern void irc_dcc_end (); +extern void irc_dcc_print_log (); /* IRC display (irc-diplay.c) */ -extern void irc_find_context (t_irc_server *, t_irc_channel *, - t_gui_window **, t_gui_buffer **); +extern void irc_display_hide_password (char *, int); extern void irc_display_prefix (t_irc_server *, t_gui_buffer *, char *); extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, char *, int, int, int, int); @@ -484,142 +478,141 @@ extern void irc_display_server (t_irc_server *ptr_server); /* IRC commands issued by user (irc-send.c) */ -extern void irc_login (t_irc_server *); -extern void irc_hide_password (char *, int); -extern int irc_cmd_send_admin (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_ame (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_amsg (t_irc_server *, t_irc_channel *, char *); +extern void irc_send_login (t_irc_server *); +extern int irc_send_cmd_admin (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_ame (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_amsg (t_irc_server *, t_irc_channel *, char *); extern void irc_send_away (t_irc_server *, char *); -extern int irc_cmd_send_away (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_ban (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_ctcp (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_cycle (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_dehalfop (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_deop (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_devoice (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_die (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_halfop (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_info (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_invite (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_ison (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_join (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_kick (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_kickban (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_kill (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_links (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_list (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_lusers (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_me (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_mode (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_away (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_ban (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_ctcp (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_cycle (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_dehalfop (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_deop (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_devoice (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_die (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_halfop (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_info (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_invite (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_ison (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_join (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_kick (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_kickban (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_kill (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_links (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_list (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_lusers (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_me (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_mode (t_irc_server *, t_irc_channel *, char *); extern void irc_send_mode_nicks (t_irc_server *, char *, char *, char *, int, char **); -extern int irc_cmd_send_motd (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_msg (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_names (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_nick (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_notice (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_op (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_oper (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_part (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_ping (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_pong (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_query (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_motd (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_msg (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_names (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_nick (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_notice (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_op (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_oper (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_part (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_ping (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_pong (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_query (t_irc_server *, t_irc_channel *, char *); extern void irc_send_quit_server (t_irc_server *, char *); -extern int irc_cmd_send_quit (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_quote (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_rehash (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_restart (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_service (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_servlist (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_squery (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_squit (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_stats (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_summon (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_time (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_topic (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_trace (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_unban (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_userhost (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_users (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_version (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_voice (t_irc_server *, t_irc_channel *, int, char **); -extern int irc_cmd_send_wallops (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_who (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_whois (t_irc_server *, t_irc_channel *, char *); -extern int irc_cmd_send_whowas (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_quit (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_quote (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_rehash (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_restart (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_service (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_servlist (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_squery (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_squit (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_stats (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_summon (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_time (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_topic (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_trace (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_unban (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_userhost (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_users (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_version (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_voice (t_irc_server *, t_irc_channel *, int, char **); +extern int irc_send_cmd_wallops (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_who (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_whois (t_irc_server *, t_irc_channel *, char *); +extern int irc_send_cmd_whowas (t_irc_server *, t_irc_channel *, char *); /* IRC commands executed when received from server (irc-recv.c) */ -extern int irc_is_highlight (char *, char *); +extern int irc_recv_is_highlight (char *, char *); extern int irc_recv_command (t_irc_server *, char *, char *, char *, char *); -extern int irc_cmd_recv_error (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_invite (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_join (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_kick (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_kill (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_mode (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_nick (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_notice (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_part (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_ping (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_pong (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_privmsg (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_quit (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_server_mode_reason (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_server_msg (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_server_reply (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_topic (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_wallops (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_001 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_005 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_221 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_301 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_302 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_303 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_305 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_306 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_whois_nick_msg (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_310 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_311 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_312 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_314 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_315 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_317 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_319 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_321 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_322 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_323 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_324 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_329 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_331 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_332 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_333 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_338 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_341 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_344 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_345 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_348 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_349 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_351 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_352 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_353 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_365 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_366 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_367 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_368 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_378 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_432 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_433 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_438 (t_irc_server *, char *, char *, char *); -extern int irc_cmd_recv_671 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_error (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_invite (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_join (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_kick (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_kill (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_mode (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_nick (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_notice (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_part (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_ping (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_pong (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_privmsg (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_quit (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_server_mode_reason (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_server_msg (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_server_reply (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_topic (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_wallops (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_001 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_005 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_221 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_301 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_302 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_303 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_305 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_306 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_whois_nick_msg (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_310 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_311 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_312 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_314 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_315 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_317 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_319 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_321 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_322 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_323 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_324 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_329 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_331 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_332 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_333 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_338 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_341 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_344 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_345 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_348 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_349 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_351 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_352 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_353 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_365 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_366 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_367 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_368 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_378 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_432 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_433 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_438 (t_irc_server *, char *, char *, char *); +extern int irc_recv_cmd_671 (t_irc_server *, char *, char *, char *); /* ignore functions (irc-ignore.c) */ -extern int ignore_check (char *, char *, char *, char *); -extern t_irc_ignore *ignore_add (char *, char *, char *, char *); -extern t_irc_ignore *ignore_add_from_config (char *); -extern void ignore_free_all (); -extern int ignore_search_free (char *, char *, char *, char *); -extern int ignore_search_free_by_number (int); -extern void ignore_print_log (); +extern int irc_ignore_check (char *, char *, char *, char *); +extern t_irc_ignore *irc_ignore_add (char *, char *, char *, char *); +extern t_irc_ignore *irc_ignore_add_from_config (char *); +extern void irc_ignore_free_all (); +extern int irc_ignore_search_free (char *, char *, char *, char *); +extern int irc_ignore_search_free_by_number (int); +extern void irc_ignore_print_log (); #endif /* irc.h */ diff --git a/weechat/src/plugins/plugins-interface.c b/weechat/src/plugins/plugins-interface.c index c54caac70..b1bb6414c 100644 --- a/weechat/src/plugins/plugins-interface.c +++ b/weechat/src/plugins/plugins-interface.c @@ -833,7 +833,7 @@ weechat_plugin_set_config (t_weechat_plugin *plugin, char *option, char *value) { strncpy (server_name, option, pos - option); server_name[pos - option] = '\0'; - ptr_server = server_search (server_name); + ptr_server = irc_server_search (server_name); free (server_name); if (ptr_server) return (config_set_server_value (ptr_server, pos + 1, value) == 0); @@ -899,8 +899,8 @@ weechat_plugin_set_plugin_config (t_weechat_plugin *plugin, char *option, char * /* * weechat_plugin_get_server_info: get list of server info - * WARNING: caller has to free structure returned - * by this function after use + * WARNING: caller has to free structure returned + * by this function after use */ t_plugin_server_info * @@ -945,6 +945,7 @@ weechat_plugin_get_server_info (t_weechat_plugin *plugin) new_server_info->ssl_connected = ptr_server->ssl_connected; new_server_info->nick = (ptr_server->nick) ? strdup (ptr_server->nick) : strdup (""); new_server_info->nick_modes = (ptr_server->nick_modes) ? strdup (ptr_server->nick_modes) : strdup (""); + new_server_info->prefix = (ptr_server->prefix) ? strdup (ptr_server->prefix) : strdup (""); new_server_info->is_away = ptr_server->is_away; new_server_info->away_time = ptr_server->away_time; new_server_info->lag = ptr_server->lag; @@ -1005,6 +1006,8 @@ weechat_plugin_free_server_info (t_weechat_plugin *plugin, t_plugin_server_info free (server_info->nick); if (server_info->nick_modes) free (server_info->nick_modes); + if (server_info->prefix) + free (server_info->prefix); new_server_info = server_info->next_server; free (server_info); server_info = new_server_info; @@ -1027,7 +1030,7 @@ weechat_plugin_get_channel_info (t_weechat_plugin *plugin, char *server) if (!plugin || !server || !server[0]) return NULL; - ptr_server = server_search (server); + ptr_server = irc_server_search (server); if (!ptr_server) return NULL; @@ -1111,11 +1114,11 @@ weechat_plugin_get_nick_info (t_weechat_plugin *plugin, char *server, char *chan if (!plugin || !server || !server[0] || !channel || !channel[0]) return NULL; - ptr_server = server_search (server); + ptr_server = irc_server_search (server); if (!ptr_server) return NULL; - ptr_channel = channel_search (ptr_server, channel); + ptr_channel = irc_channel_search (ptr_server, channel); if (!ptr_channel) return NULL; diff --git a/weechat/src/plugins/plugins.c b/weechat/src/plugins/plugins.c index 5650b6d10..2013965a9 100644 --- a/weechat/src/plugins/plugins.c +++ b/weechat/src/plugins/plugins.c @@ -90,7 +90,7 @@ plugin_find_server_channel (char *server, char *channel, { if (server && server[0]) { - (*ptr_server) = server_search (server); + (*ptr_server) = irc_server_search (server); if (!(*ptr_server)) return -1; } @@ -104,7 +104,7 @@ plugin_find_server_channel (char *server, char *channel, if (channel && channel[0]) { if ((*ptr_server)) - (*ptr_channel) = channel_search ((*ptr_server), channel); + (*ptr_channel) = irc_channel_search ((*ptr_server), channel); if (!(*ptr_channel)) return -1; } diff --git a/weechat/src/plugins/scripts/lua/weechat-lua.c b/weechat/src/plugins/scripts/lua/weechat-lua.c index 6526507ec..01d28a898 100644 --- a/weechat/src/plugins/scripts/lua/weechat-lua.c +++ b/weechat/src/plugins/scripts/lua/weechat-lua.c @@ -1731,6 +1731,10 @@ weechat_lua_get_server_info (lua_State *L) lua_pushstring (lua_current_interpreter, "nick_modes"); lua_pushstring (lua_current_interpreter, ptr_server->nick_modes); lua_rawset (lua_current_interpreter, -3); + + lua_pushstring (lua_current_interpreter, "prefix"); + lua_pushstring (lua_current_interpreter, ptr_server->prefix); + lua_rawset (lua_current_interpreter, -3); lua_pushstring (lua_current_interpreter, "away_time"); lua_pushstring (lua_current_interpreter, timebuffer); diff --git a/weechat/src/plugins/scripts/perl/weechat-perl.c b/weechat/src/plugins/scripts/perl/weechat-perl.c index 66418273f..3015de34f 100644 --- a/weechat/src/plugins/scripts/perl/weechat-perl.c +++ b/weechat/src/plugins/scripts/perl/weechat-perl.c @@ -1483,6 +1483,7 @@ static XS (XS_weechat_get_server_info) hv_store (server_hash_member, "ssl_connected", 13, newSViv (ptr_server->ssl_connected), 0); hv_store (server_hash_member, "nick", 4, newSVpv (ptr_server->nick, 0), 0); hv_store (server_hash_member, "nick_modes", 10, newSVpv (ptr_server->nick_modes, 0), 0); + hv_store (server_hash_member, "prefix", 6, newSVpv (ptr_server->prefix, 0), 0); hv_store (server_hash_member, "away_time", 9, newSVpv (timebuffer, 0), 0); hv_store (server_hash_member, "lag", 3, newSViv (ptr_server->lag), 0); diff --git a/weechat/src/plugins/scripts/python/weechat-python.c b/weechat/src/plugins/scripts/python/weechat-python.c index ca73eafb4..ff0e69485 100644 --- a/weechat/src/plugins/scripts/python/weechat-python.c +++ b/weechat/src/plugins/scripts/python/weechat-python.c @@ -1612,6 +1612,12 @@ weechat_python_get_server_info (PyObject *self, PyObject *args) PyDict_SetItem(server_hash_member, key, value); Py_DECREF (key); Py_DECREF (value); + + key = Py_BuildValue("s", "prefix"); + value = Py_BuildValue("s", ptr_server->prefix); + PyDict_SetItem(server_hash_member, key, value); + Py_DECREF (key); + Py_DECREF (value); key = Py_BuildValue("s", "away_time"); value = Py_BuildValue("s", timebuffer); diff --git a/weechat/src/plugins/scripts/ruby/weechat-ruby.c b/weechat/src/plugins/scripts/ruby/weechat-ruby.c index acd35fc3e..233ac0091 100644 --- a/weechat/src/plugins/scripts/ruby/weechat-ruby.c +++ b/weechat/src/plugins/scripts/ruby/weechat-ruby.c @@ -1707,6 +1707,8 @@ weechat_ruby_get_server_info (VALUE class) rb_str_new2(ptr_server->nick)); rb_hash_aset (server_hash_member, rb_str_new2("nick_modes"), rb_str_new2(ptr_server->nick_modes)); + rb_hash_aset (server_hash_member, rb_str_new2("prefix"), + rb_str_new2(ptr_server->prefix)); rb_hash_aset (server_hash_member, rb_str_new2("away_time"), rb_str_new2(timebuffer)); rb_hash_aset (server_hash_member, rb_str_new2("lag"), diff --git a/weechat/src/plugins/weechat-plugin.h b/weechat/src/plugins/weechat-plugin.h index 12bae1ed1..827ca5890 100644 --- a/weechat/src/plugins/weechat-plugin.h +++ b/weechat/src/plugins/weechat-plugin.h @@ -107,6 +107,7 @@ struct t_plugin_server_info int ssl_connected; /* = 1 if connected with SSL */ char *nick; /* current nickname */ char *nick_modes; /* nick modes */ + char *prefix; /* nick prefix allowed */ int is_away; /* 1 is user is marker as away */ time_t away_time; /* time() when user marking as away */ int lag; /* lag (in milliseconds) */ |