libpurple/account.c

changeset 41903
27f355b8b497
parent 41894
92fb22f0f0ab
child 41905
a84e44c85f4f
--- a/libpurple/account.c	Mon Nov 07 23:28:31 2022 -0600
+++ b/libpurple/account.c	Mon Nov 07 23:29:57 2022 -0600
@@ -91,9 +91,6 @@
 
 	PurplePresence *presence;     /* Presence.                            */
 
-	PurpleAccountRegistrationCb registration_cb;
-	void *registration_cb_user_data;
-
 	PurpleConnectionErrorInfo *current_error;	/* Errors */
 	PurpleNotification *error_notification;
 } PurpleAccountPrivate;
@@ -105,13 +102,6 @@
 
 } PurpleAccountSetting;
 
-typedef struct
-{
-	PurpleAccount *account;
-	GCallback cb;
-	gpointer data;
-} PurpleCallbackBundle;
-
 /* GObject Property enums */
 enum
 {
@@ -179,101 +169,6 @@
 }
 
 static void
-purple_account_register_got_password_cb(GObject *obj, GAsyncResult *res,
-                                        gpointer data)
-{
-	PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
-	PurpleAccount *account = PURPLE_ACCOUNT(data);
-	GError *error = NULL;
-	gchar *password = NULL;
-
-	password = purple_credential_manager_read_password_finish(manager, res,
-	                                                          &error);
-	if(error != NULL) {
-		/* If we failed to read a password, just log it, as it could not be
-		 * stored yet, in which case we will just prompt the user later in the
-		 * connection process.
-		 */
-		purple_debug_warning("account", "failed to read password: %s",
-		                     error->message);
-		g_clear_error(&error);
-	}
-
-	purple_account_real_connect(account, password);
-
-	g_free(password);
-}
-
-void
-purple_account_register(PurpleAccount *account)
-{
-	PurpleCredentialManager *manager = NULL;
-
-	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
-
-	purple_debug_info("account", "Registering account %s\n",
-					purple_account_get_username(account));
-
-	manager = purple_credential_manager_get_default();
-	purple_credential_manager_read_password_async(manager, account, NULL,
-	                                              purple_account_register_got_password_cb,
-	                                              account);
-}
-
-static void
-purple_account_unregister_got_password_cb(GObject *obj, GAsyncResult *res,
-                                          gpointer data)
-{
-	PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
-	PurpleCallbackBundle *cbb = data;
-	PurpleAccountUnregistrationCb cb;
-	GError *error = NULL;
-	gchar *password = NULL;
-
-	cb = (PurpleAccountUnregistrationCb)cbb->cb;
-
-	password = purple_credential_manager_read_password_finish(manager, res,
-	                                                          &error);
-
-	if(error != NULL) {
-		purple_debug_warning("account", "failed to read password: %s",
-		                     error->message);
-
-		g_error_free(error);
-	}
-
-	_purple_connection_new_unregister(cbb->account, password, cb, cbb->data);
-
-	g_free(password);
-	g_free(cbb);
-}
-
-struct register_completed_closure
-{
-	PurpleAccount *account;
-	gboolean succeeded;
-};
-
-static gboolean
-purple_account_register_completed_cb(gpointer data)
-{
-	PurpleAccount *account = NULL;
-	struct register_completed_closure *closure = data;
-
-	account = closure->account;
-
-	if (account->registration_cb) {
-		(account->registration_cb)(closure->account, closure->succeeded,
-		                           account->registration_cb_user_data);
-	}
-
-	g_object_unref(closure->account);
-	g_free(closure);
-
-	return FALSE;
-}
-
-static void
 request_password_write_cb(GObject *obj, GAsyncResult *res, gpointer data) {
 	PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj);
 	PurpleAccount *account = PURPLE_ACCOUNT(data);
@@ -1158,52 +1053,6 @@
 }
 
 void
-purple_account_set_register_callback(PurpleAccount *account, PurpleAccountRegistrationCb cb, void *user_data)
-{
-	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
-
-	account->registration_cb = cb;
-	account->registration_cb_user_data = user_data;
-}
-
-void
-purple_account_register_completed(PurpleAccount *account, gboolean succeeded)
-{
-	struct register_completed_closure *closure;
-
-	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
-
-	closure = g_new0(struct register_completed_closure, 1);
-	closure->account = g_object_ref(account);
-	closure->succeeded = succeeded;
-
-	g_timeout_add(0, purple_account_register_completed_cb, closure);
-}
-
-void
-purple_account_unregister(PurpleAccount *account,
-                          PurpleAccountUnregistrationCb cb, gpointer user_data)
-{
-	PurpleCallbackBundle *cbb;
-	PurpleCredentialManager *manager = NULL;
-
-	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
-
-	purple_debug_info("account", "Unregistering account %s\n",
-					  purple_account_get_username(account));
-
-	cbb = g_new0(PurpleCallbackBundle, 1);
-	cbb->account = account;
-	cbb->cb = G_CALLBACK(cb);
-	cbb->data = user_data;
-
-	manager = purple_credential_manager_get_default();
-	purple_credential_manager_read_password_async(manager, account, NULL,
-	                                              purple_account_unregister_got_password_cb,
-	                                              cbb);
-}
-
-void
 purple_account_disconnect(PurpleAccount *account)
 {
 	GError *error = NULL;

mercurial