From bd59c587d851fabde050acf851f522f6e0b85ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 3 Dec 2014 07:37:16 +0100 Subject: [PATCH] xfer: rename callback for infolist "xfer" --- src/plugins/xfer/xfer-info.c | 68 +++++++++++++++++------------------- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/src/plugins/xfer/xfer-info.c b/src/plugins/xfer/xfer-info.c index 38999638e..7dc7f0c8f 100644 --- a/src/plugins/xfer/xfer-info.c +++ b/src/plugins/xfer/xfer-info.c @@ -27,56 +27,51 @@ /* - * Returns infolist with xfer info. + * Returns xfer infolist "xfer". */ struct t_infolist * -xfer_info_get_infolist_cb (void *data, const char *infolist_name, - void *pointer, const char *arguments) +xfer_info_infolist_xfer_cb (void *data, const char *infolist_name, + void *pointer, const char *arguments) { struct t_infolist *ptr_infolist; struct t_xfer *ptr_xfer; /* make C compiler happy */ (void) data; + (void) infolist_name; (void) arguments; - if (!infolist_name || !infolist_name[0]) + if (pointer && !xfer_valid (pointer)) return NULL; - if (weechat_strcasecmp (infolist_name, "xfer") == 0) - { - if (pointer && !xfer_valid (pointer)) - return NULL; + ptr_infolist = weechat_infolist_new (); + if (!ptr_infolist) + return NULL; - ptr_infolist = weechat_infolist_new (); - if (ptr_infolist) + if (pointer) + { + /* build list with only one xfer */ + if (!xfer_add_to_infolist (ptr_infolist, pointer)) { - if (pointer) + weechat_infolist_free (ptr_infolist); + return NULL; + } + return ptr_infolist; + } + else + { + /* build list with all xfers */ + for (ptr_xfer = xfer_list; ptr_xfer; + ptr_xfer = ptr_xfer->next_xfer) + { + if (!xfer_add_to_infolist (ptr_infolist, ptr_xfer)) { - /* build list with only one xfer */ - if (!xfer_add_to_infolist (ptr_infolist, pointer)) - { - weechat_infolist_free (ptr_infolist); - return NULL; - } - return ptr_infolist; - } - else - { - /* build list with all xfers */ - for (ptr_xfer = xfer_list; ptr_xfer; - ptr_xfer = ptr_xfer->next_xfer) - { - if (!xfer_add_to_infolist (ptr_infolist, ptr_xfer)) - { - weechat_infolist_free (ptr_infolist); - return NULL; - } - } - return ptr_infolist; + weechat_infolist_free (ptr_infolist); + return NULL; } } + return ptr_infolist; } return NULL; @@ -89,8 +84,9 @@ xfer_info_get_infolist_cb (void *data, const char *infolist_name, void xfer_info_init () { - weechat_hook_infolist ("xfer", N_("list of xfer"), - N_("xfer pointer (optional)"), - NULL, - &xfer_info_get_infolist_cb, NULL); + weechat_hook_infolist ( + "xfer", N_("list of xfer"), + N_("xfer pointer (optional)"), + NULL, + &xfer_info_infolist_xfer_cb, NULL); }