diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/irc/irc-command.c | 10 | ||||
-rw-r--r-- | src/plugins/irc/irc-ctcp.c | 18 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 46 | ||||
-rw-r--r-- | src/plugins/xfer/xfer-chat.c | 7 |
4 files changed, 24 insertions, 57 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index b982d55dc..e700610de 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -1018,7 +1018,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc, unsigned long address; struct t_infolist *infolist; struct t_infolist_item *item; - char plugin_id[128], str_address[128], charset_modifier[256]; + char str_address[128], charset_modifier[256]; IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("dcc", 1); @@ -1049,9 +1049,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc, if (item) { weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); - snprintf (plugin_id, sizeof (plugin_id), - "%lx", (long unsigned int)ptr_server); - weechat_infolist_new_var_string (item, "plugin_id", plugin_id); + weechat_infolist_new_var_string (item, "plugin_id", ptr_server->name); weechat_infolist_new_var_string (item, "type", "file_send"); weechat_infolist_new_var_string (item, "protocol", "dcc"); weechat_infolist_new_var_string (item, "remote_nick", argv[2]); @@ -1082,9 +1080,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc, if (item) { weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); - snprintf (plugin_id, sizeof (plugin_id), - "%lx", (long unsigned int)ptr_server); - weechat_infolist_new_var_string (item, "plugin_id", plugin_id); + weechat_infolist_new_var_string (item, "plugin_id", ptr_server->name); weechat_infolist_new_var_string (item, "type", "chat_send"); weechat_infolist_new_var_string (item, "remote_nick", argv[2]); weechat_infolist_new_var_string (item, "local_nick", ptr_server->nick); diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c index 2a0cf894c..5928181b2 100644 --- a/src/plugins/irc/irc-ctcp.c +++ b/src/plugins/irc/irc-ctcp.c @@ -407,7 +407,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick, char *pos_start_resume, *filename; struct t_infolist *infolist; struct t_infolist_item *item; - char plugin_id[128], charset_modifier[256]; + char charset_modifier[256]; if (!arguments || !arguments[0]) return; @@ -509,9 +509,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick, if (item) { weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); - snprintf (plugin_id, sizeof (plugin_id), - "%lx", (long unsigned int)server); - weechat_infolist_new_var_string (item, "plugin_id", plugin_id); + weechat_infolist_new_var_string (item, "plugin_id", server->name); weechat_infolist_new_var_string (item, "type", "file_recv"); weechat_infolist_new_var_string (item, "protocol", "dcc"); weechat_infolist_new_var_string (item, "remote_nick", nick); @@ -614,9 +612,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick, if (item) { weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); - snprintf (plugin_id, sizeof (plugin_id), - "%lx", (long unsigned int)server); - weechat_infolist_new_var_string (item, "plugin_id", plugin_id); + weechat_infolist_new_var_string (item, "plugin_id", server->name); weechat_infolist_new_var_string (item, "type", "file_recv"); weechat_infolist_new_var_string (item, "filename", (filename) ? filename : pos_file); @@ -713,9 +709,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick, if (item) { weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); - snprintf (plugin_id, sizeof (plugin_id), - "%lx", (long unsigned int)server); - weechat_infolist_new_var_string (item, "plugin_id", plugin_id); + weechat_infolist_new_var_string (item, "plugin_id", server->name); weechat_infolist_new_var_string (item, "type", "file_recv"); weechat_infolist_new_var_string (item, "filename", (filename) ? filename : pos_file); @@ -822,9 +816,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick, if (item) { weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); - snprintf (plugin_id, sizeof (plugin_id), - "%lx", (long unsigned int)server); - weechat_infolist_new_var_string (item, "plugin_id", plugin_id); + weechat_infolist_new_var_string (item, "plugin_id", server->name); weechat_infolist_new_var_string (item, "type", "chat_recv"); weechat_infolist_new_var_string (item, "remote_nick", nick); weechat_infolist_new_var_string (item, "local_nick", server->nick); diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index e84225bac..f846ca8fd 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -3846,8 +3846,7 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal, const char *type_data, void *signal_data) { struct t_infolist *infolist; - struct t_irc_server *server, *ptr_server; - long unsigned int value; + struct t_irc_server *ptr_server; const char *plugin_name, *plugin_id, *type, *filename; int spaces_in_name; @@ -3864,14 +3863,7 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal, plugin_id = weechat_infolist_string (infolist, "plugin_id"); if (plugin_name && (strcmp (plugin_name, IRC_PLUGIN_NAME) == 0) && plugin_id) { - sscanf (plugin_id, "%lx", &value); - server = (struct t_irc_server *)value; - for (ptr_server = irc_servers; ptr_server; - ptr_server = ptr_server->next_server) - { - if (ptr_server == server) - break; - } + ptr_server = irc_server_search (plugin_id); if (ptr_server) { type = weechat_infolist_string (infolist, "type"); @@ -3881,7 +3873,7 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal, { filename = weechat_infolist_string (infolist, "filename"); spaces_in_name = (strchr (filename, ' ') != NULL); - irc_server_sendf (server, + irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "PRIVMSG %s :\01DCC SEND %s%s%s " "%s %d %s\01", @@ -3895,7 +3887,7 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal, } else if (strcmp (type, "chat_send") == 0) { - irc_server_sendf (server, + irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "PRIVMSG %s :\01DCC CHAT chat %s %d\01", weechat_infolist_string (infolist, "remote_nick"), @@ -3925,8 +3917,7 @@ irc_server_xfer_resume_ready_cb (void *data, const char *signal, const char *type_data, void *signal_data) { struct t_infolist *infolist; - struct t_irc_server *server, *ptr_server; - long unsigned int value; + struct t_irc_server *ptr_server; const char *plugin_name, *plugin_id, *filename; int spaces_in_name; @@ -3943,19 +3934,13 @@ irc_server_xfer_resume_ready_cb (void *data, const char *signal, plugin_id = weechat_infolist_string (infolist, "plugin_id"); if (plugin_name && (strcmp (plugin_name, IRC_PLUGIN_NAME) == 0) && plugin_id) { - sscanf (plugin_id, "%lx", &value); - server = (struct t_irc_server *)value; - for (ptr_server = irc_servers; ptr_server; - ptr_server = ptr_server->next_server) - { - if (ptr_server == server) - break; - } + ptr_server = irc_server_search (plugin_id); if (ptr_server) { filename = weechat_infolist_string (infolist, "filename"); spaces_in_name = (strchr (filename, ' ') != NULL); - irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + irc_server_sendf (ptr_server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "PRIVMSG %s :\01DCC RESUME %s%s%s %d %s\01", weechat_infolist_string (infolist, "remote_nick"), (spaces_in_name) ? "\"" : "", @@ -3986,8 +3971,7 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal, void *signal_data) { struct t_infolist *infolist; - struct t_irc_server *server, *ptr_server; - long unsigned int value; + struct t_irc_server *ptr_server; const char *plugin_name, *plugin_id, *filename; int spaces_in_name; @@ -4004,19 +3988,13 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal, plugin_id = weechat_infolist_string (infolist, "plugin_id"); if (plugin_name && (strcmp (plugin_name, IRC_PLUGIN_NAME) == 0) && plugin_id) { - sscanf (plugin_id, "%lx", &value); - server = (struct t_irc_server *)value; - for (ptr_server = irc_servers; ptr_server; - ptr_server = ptr_server->next_server) - { - if (ptr_server == server) - break; - } + ptr_server = irc_server_search (plugin_id); if (ptr_server) { filename = weechat_infolist_string (infolist, "filename"); spaces_in_name = (strchr (filename, ' ') != NULL); - irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + irc_server_sendf (ptr_server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "PRIVMSG %s :\01DCC ACCEPT %s%s%s %d %s\01", weechat_infolist_string (infolist, "remote_nick"), (spaces_in_name) ? "\"" : "", diff --git a/src/plugins/xfer/xfer-chat.c b/src/plugins/xfer/xfer-chat.c index 069fbb288..6373991d4 100644 --- a/src/plugins/xfer/xfer-chat.c +++ b/src/plugins/xfer/xfer-chat.c @@ -316,12 +316,13 @@ xfer_chat_open_buffer (struct t_xfer *xfer) buffer_created = 0; - length = strlen (xfer->plugin_name) + 8 + strlen (xfer->remote_nick) + 1; + length = strlen (xfer->plugin_name) + 8 + strlen (xfer->plugin_id) + 1 + + strlen (xfer->remote_nick) + 1; name = malloc (length); if (name) { - snprintf (name, length, "%s_dcc_%s", - xfer->plugin_name, xfer->remote_nick); + snprintf (name, length, "%s_dcc.%s.%s", + xfer->plugin_name, xfer->plugin_id, xfer->remote_nick); xfer->buffer = weechat_buffer_search (XFER_PLUGIN_NAME, name); if (!xfer->buffer) { |