--- a/finch/gntaccount.c Mon Aug 22 22:20:45 2022 -0500 +++ b/finch/gntaccount.c Tue Aug 23 01:09:33 2022 -0500 @@ -896,109 +896,3 @@ if (accounts.window) gnt_widget_destroy(accounts.window); } - -/* The following uiops stuff are copied from gtkaccount.c */ -typedef struct -{ - PurpleAccount *account; - char *username; - char *alias; -} AddUserData; - -static char * -make_info(PurpleAccount *account, PurpleConnection *gc, const char *remote_user, - const char *id, const char *alias, const char *msg) -{ - if (msg != NULL && *msg == '\0') - msg = NULL; - - return g_strdup_printf(_("%s%s%s%s has made %s his or her buddy%s%s"), - remote_user, - (alias != NULL ? " (" : ""), - (alias != NULL ? alias : ""), - (alias != NULL ? ")" : ""), - (id != NULL - ? id - : (purple_connection_get_display_name(gc) != NULL - ? purple_connection_get_display_name(gc) - : purple_account_get_username(account))), - (msg != NULL ? ": " : "."), - (msg != NULL ? msg : "")); -} - -static void -free_add_user_data(AddUserData *data) -{ - g_free(data->username); - - g_free(data->alias); - - g_free(data); -} - -static void -add_user_cb(AddUserData *data) -{ - PurpleConnection *gc = purple_account_get_connection(data->account); - - if (g_list_find(purple_connections_get_all(), gc)) - { - purple_blist_request_add_buddy(data->account, data->username, - NULL, data->alias); - } - - free_add_user_data(data); -} - -static void -request_add(PurpleAccount *account, const char *remote_user, - const char *id, const char *alias, - const char *msg) -{ - char *buffer; - PurpleConnection *gc; - AddUserData *data; - - gc = purple_account_get_connection(account); - - data = g_new0(AddUserData, 1); - data->account = account; - data->username = g_strdup(remote_user); - data->alias = (alias != NULL ? g_strdup(alias) : NULL); - - buffer = make_info(account, gc, remote_user, id, alias, msg); - purple_request_action(NULL, NULL, _("Add buddy to your list?"), buffer, - PURPLE_DEFAULT_ACTION_NONE, - purple_request_cpar_from_account(account), data, 2, - _("Add"), G_CALLBACK(add_user_cb), - _("Cancel"), G_CALLBACK(free_add_user_data)); - g_free(buffer); -} - -/* Copied from gtkaccount.c */ -typedef struct { - PurpleAccountRequestAuthorizationCb auth_cb; - PurpleAccountRequestAuthorizationCb deny_cb; - void *data; - char *username; - char *alias; - PurpleAccount *account; -} auth_and_add; - -static void -finch_request_close(void *uihandle) -{ - purple_request_close(PURPLE_REQUEST_ACTION, uihandle); -} - -static PurpleAccountUiOps ui_ops = -{ - .request_add = request_add, - .close_account_request = finch_request_close, -}; - -PurpleAccountUiOps *finch_accounts_get_ui_ops() -{ - return &ui_ops; -} -