diff options
-rw-r--r-- | src/plugins/xfer/xfer-buffer.c | 3 | ||||
-rw-r--r-- | src/plugins/xfer/xfer-buffer.h | 2 | ||||
-rw-r--r-- | src/plugins/xfer/xfer-upgrade.c | 7 | ||||
-rw-r--r-- | src/plugins/xfer/xfer.c | 15 |
4 files changed, 22 insertions, 5 deletions
diff --git a/src/plugins/xfer/xfer-buffer.c b/src/plugins/xfer/xfer-buffer.c index 4623b6dba..7d3b134be 100644 --- a/src/plugins/xfer/xfer-buffer.c +++ b/src/plugins/xfer/xfer-buffer.c @@ -26,6 +26,7 @@ #include "../weechat-plugin.h" #include "xfer.h" +#include "xfer-buffer.h" #include "xfer-config.h" #include "xfer-network.h" @@ -311,7 +312,7 @@ xfer_buffer_open () { if (!xfer_buffer) { - xfer_buffer = weechat_buffer_new ("xfer.list", + xfer_buffer = weechat_buffer_new (XFER_BUFFER_NAME, &xfer_buffer_input_cb, NULL, &xfer_buffer_close_cb, NULL); diff --git a/src/plugins/xfer/xfer-buffer.h b/src/plugins/xfer/xfer-buffer.h index fc263cc35..3f6059042 100644 --- a/src/plugins/xfer/xfer-buffer.h +++ b/src/plugins/xfer/xfer-buffer.h @@ -20,6 +20,8 @@ #ifndef __WEECHAT_XFER_DISPLAY_H #define __WEECHAT_XFER_DISPLAY_H 1 +#define XFER_BUFFER_NAME "xfer.list" + extern struct t_gui_buffer *xfer_buffer; extern int xfer_buffer_selected_line; diff --git a/src/plugins/xfer/xfer-upgrade.c b/src/plugins/xfer/xfer-upgrade.c index ae20b3ea5..3061819cd 100644 --- a/src/plugins/xfer/xfer-upgrade.c +++ b/src/plugins/xfer/xfer-upgrade.c @@ -20,6 +20,7 @@ #include <stdlib.h> +#include <string.h> #include "../weechat-plugin.h" #include "xfer.h" @@ -27,7 +28,6 @@ #include "xfer-buffer.h" - /* * xfer_upgrade_save_xfers: save xfers info to upgrade file */ @@ -83,6 +83,11 @@ xfer_upgrade_set_buffer_callbacks () ptr_buffer = weechat_infolist_pointer (infolist, "pointer"); weechat_buffer_set_pointer (ptr_buffer, "close_callback", &xfer_buffer_close_cb); weechat_buffer_set_pointer (ptr_buffer, "input_callback", &xfer_buffer_input_cb); + if (strcmp (weechat_infolist_string (infolist, "name"), + XFER_BUFFER_NAME) == 0) + { + xfer_buffer = ptr_buffer; + } } } } diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c index cdc0ceea7..553381232 100644 --- a/src/plugins/xfer/xfer.c +++ b/src/plugins/xfer/xfer.c @@ -1432,9 +1432,7 @@ xfer_debug_dump_cb (void *data, const char *signal, const char *type_data, int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { - /* make C compiler happy */ - (void) argc; - (void) argv; + int i, upgrading; weechat_plugin = plugin; @@ -1459,6 +1457,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) xfer_completion_init (); xfer_info_init (); + + /* look at arguments */ + upgrading = 0; + for (i = 0; i < argc; i++) + { + if (weechat_strcasecmp (argv[i], "--upgrade") == 0) + upgrading = 1; + } + + if (upgrading) + xfer_upgrade_load (); return WEECHAT_RC_OK; } |