--- a/libpurple/account.c Sat Oct 01 04:09:51 2022 -0500
+++ b/libpurple/account.c Sat Oct 01 22:10:59 2022 -0500
@@ -51,6 +51,7 @@
char *username; /* The username. */
+ gboolean require_password; char *alias; /* How you appear to yourself. */
char *user_info; /* User information. */
@@ -117,6 +118,7 @@
@@ -645,6 +647,11 @@
child = purple_xmlnode_new_child(node, "name");
purple_xmlnode_insert_data(child, purple_account_get_username(account), -1);
+ child = purple_xmlnode_new_child(node, "require_password"); + data = g_strdup_printf("%d", account->require_password); + purple_xmlnode_insert_data(child, data, -1); + g_clear_pointer(&data, g_free); child = purple_xmlnode_new_child(node, "enabled");
data = g_strdup_printf("%d", account->enabled);
purple_xmlnode_insert_data(child, data, -1);
@@ -708,6 +715,10 @@
purple_account_set_username(account, g_value_get_string(value));
+ case PROP_REQUIRE_PASSWORD: + purple_account_set_require_password(account, + g_value_get_boolean(value)); purple_account_set_private_alias(account, g_value_get_string(value));
@@ -753,6 +764,10 @@
g_value_set_string(value, purple_account_get_username(account));
+ case PROP_REQUIRE_PASSWORD: + g_value_set_boolean(value, + purple_account_get_require_password(account)); g_value_set_string(value, purple_account_get_private_alias(account));
@@ -939,6 +954,21 @@
"The username for the account.", NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
+ * PurpleAccount:require-password: + * Whether or not this account should require a password. This is only used + * if the [class@Purple.Protocol] that this account is for allows optional + properties[PROP_REQUIRE_PASSWORD] = g_param_spec_boolean( + "require-password", "Require password", + "Whether or not to require a password for this account", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); properties[PROP_PRIVATE_ALIAS] = g_param_spec_string("private-alias",
"The private alias for the account.", NULL,
@@ -2369,3 +2399,27 @@
_purple_account_set_current_error(account, NULL);
+purple_account_set_require_password(PurpleAccount *account, + gboolean require_password) + g_return_if_fail(PURPLE_IS_ACCOUNT(account)); + old = account->require_password; + account->require_password = require_password; + if(old != require_password) { + g_object_notify_by_pspec(G_OBJECT(account), + properties[PROP_REQUIRE_PASSWORD]); +purple_account_get_require_password(PurpleAccount *account) { + g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE); + return account->require_password; --- a/libpurple/account.h Sat Oct 01 04:09:51 2022 -0500
+++ b/libpurple/account.h Sat Oct 01 22:10:59 2022 -0500
@@ -1010,6 +1010,31 @@
void purple_account_clear_current_error(PurpleAccount *account);
+ * purple_account_set_require_password: + * @account: The instance. + * @require_password: Whether or not this account should require a password. + * For protocols that have an optional password, this settings tells libpurple + * that it should look for a password in the [class@Purple.CredentialManager] + * or prompt the user if a password can not be found. +void purple_account_set_require_password(PurpleAccount *account, gboolean require_password); + * purple_account_get_require_password: + * @account: The instance. + * Gets whether or not @account requires a password. + * Returns: %TRUE if the account requires a password, %FALSE otherwise. +gboolean purple_account_get_require_password(PurpleAccount *account); #endif /* PURPLE_ACCOUNT_H */
--- a/libpurple/accounts.c Sat Oct 01 04:09:51 2022 -0500
+++ b/libpurple/accounts.c Sat Oct 01 22:10:59 2022 -0500
@@ -309,6 +309,7 @@
gboolean enabled = FALSE;
+ gboolean require_password = FALSE; child = purple_xmlnode_get_child(node, "id");
@@ -330,6 +331,11 @@
name = purple_xmlnode_get_data(child);
+ child = purple_xmlnode_get_child(node, "require_password"); + require_password = atoi(purple_xmlnode_get_data(child)); child = purple_xmlnode_get_child(node, "enabled");
enabled = atoi(purple_xmlnode_get_data(child));
@@ -351,6 +357,7 @@
"protocol-id", protocol_id,
+ "require-password", require_password,