rename accountopt.[ch] to purpleaccountoption.[ch]
--- a/finch/gntaccount.c Fri Sep 27 02:44:08 2019 -0500
+++ b/finch/gntaccount.c Fri Sep 27 03:43:47 2019 -0500
@@ -37,10 +37,10 @@
+#include <purpleaccountoption.h> #include <savedstatuses.h>
--- a/libpurple/accountopt.c Fri Sep 27 02:44:08 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,349 +0,0 @@
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- * An option for an account.
- * This is set by protocols, and appears in the account settings
-struct _PurpleAccountOption
- PurplePrefType type; /* The type of value. */
- char *text; /* The text that will appear to the user. */
- char *pref_name; /* The name of the associated preference. */
- gboolean boolean; /* The default boolean value. */
- int integer; /* The default integer value. */
- char *string; /* The default string value. */
- GList *list; /* The default list value. */
- gboolean masked; /* Whether the value entered should
- * be obscured from view (for
- * passwords and similar options)
- GSList *hints; /* List of hinted values */
-purple_account_option_new(PurplePrefType type, const char *text,
- PurpleAccountOption *option;
- g_return_val_if_fail(type != PURPLE_PREF_NONE, NULL);
- g_return_val_if_fail(text != NULL, NULL);
- g_return_val_if_fail(pref_name != NULL, NULL);
- option = g_new0(PurpleAccountOption, 1);
- option->text = g_strdup(text);
- option->pref_name = g_strdup(pref_name);
-purple_account_option_bool_new(const char *text, const char *pref_name,
- gboolean default_value)
- PurpleAccountOption *option;
- option = purple_account_option_new(PURPLE_PREF_BOOLEAN, text, pref_name);
- option->default_value.boolean = default_value;
-purple_account_option_int_new(const char *text, const char *pref_name,
- PurpleAccountOption *option;
- option = purple_account_option_new(PURPLE_PREF_INT, text, pref_name);
- option->default_value.integer = default_value;
-purple_account_option_string_new(const char *text, const char *pref_name,
- const char *default_value)
- PurpleAccountOption *option;
- option = purple_account_option_new(PURPLE_PREF_STRING, text, pref_name);
- option->default_value.string = g_strdup(default_value);
-purple_account_option_list_new(const char *text, const char *pref_name,
- PurpleAccountOption *option;
- option = purple_account_option_new(PURPLE_PREF_STRING_LIST, text, pref_name);
- option->default_value.list = list;
-purple_account_option_list_free(gpointer data, gpointer user_data)
- PurpleKeyValuePair *kvp = data;
-purple_account_option_destroy(PurpleAccountOption *option)
- g_return_if_fail(option != NULL);
- g_free(option->pref_name);
- if (option->type == PURPLE_PREF_STRING)
- g_free(option->default_value.string);
- g_slist_free_full(option->params.string.hints, &g_free);
- else if (option->type == PURPLE_PREF_STRING_LIST)
- g_list_free_full(option->default_value.list,
- (GDestroyNotify)purple_account_option_list_free);
-purple_account_option_set_default_bool(PurpleAccountOption *option,
- g_return_if_fail(option != NULL);
- g_return_if_fail(option->type == PURPLE_PREF_BOOLEAN);
- option->default_value.boolean = value;
-purple_account_option_set_default_int(PurpleAccountOption *option, int value)
- g_return_if_fail(option != NULL);
- g_return_if_fail(option->type == PURPLE_PREF_INT);
- option->default_value.integer = value;
-purple_account_option_set_default_string(PurpleAccountOption *option,
- g_return_if_fail(option != NULL);
- g_return_if_fail(option->type == PURPLE_PREF_STRING);
- g_free(option->default_value.string);
- option->default_value.string = g_strdup(value);
-purple_account_option_string_set_masked(PurpleAccountOption *option, gboolean masked)
- g_return_if_fail(option != NULL);
- g_return_if_fail(option->type == PURPLE_PREF_STRING);
- option->params.string.masked = masked;
-purple_account_option_string_set_hints(PurpleAccountOption *option, GSList *hints)
- g_return_if_fail(option != NULL);
- g_return_if_fail(option->type == PURPLE_PREF_STRING);
- g_slist_free_full(option->params.string.hints, &g_free);
- option->params.string.hints = hints;
-purple_account_option_set_list(PurpleAccountOption *option, GList *values)
- g_return_if_fail(option != NULL);
- g_return_if_fail(option->type == PURPLE_PREF_STRING_LIST);
- g_list_free_full(option->default_value.list,
- (GDestroyNotify)purple_account_option_list_free);
- option->default_value.list = values;
-purple_account_option_add_list_item(PurpleAccountOption *option,
- const char *key, const char *value)
- PurpleKeyValuePair *kvp;
- g_return_if_fail(option != NULL);
- g_return_if_fail(key != NULL);
- g_return_if_fail(value != NULL);
- g_return_if_fail(option->type == PURPLE_PREF_STRING_LIST);
- kvp = g_new0(PurpleKeyValuePair, 1);
- kvp->key = g_strdup(key);
- kvp->value = g_strdup(value);
- option->default_value.list = g_list_append(option->default_value.list,
-purple_account_option_get_pref_type(const PurpleAccountOption *option)
- g_return_val_if_fail(option != NULL, PURPLE_PREF_NONE);
-purple_account_option_get_text(const PurpleAccountOption *option)
- g_return_val_if_fail(option != NULL, NULL);
-purple_account_option_get_setting(const PurpleAccountOption *option)
- g_return_val_if_fail(option != NULL, NULL);
- return option->pref_name;
-purple_account_option_get_default_bool(const PurpleAccountOption *option)
- g_return_val_if_fail(option != NULL, FALSE);
- g_return_val_if_fail(option->type == PURPLE_PREF_BOOLEAN, FALSE);
- return option->default_value.boolean;
-purple_account_option_get_default_int(const PurpleAccountOption *option)
- g_return_val_if_fail(option != NULL, -1);
- g_return_val_if_fail(option->type == PURPLE_PREF_INT, -1);
- return option->default_value.integer;
-purple_account_option_get_default_string(const PurpleAccountOption *option)
- g_return_val_if_fail(option != NULL, NULL);
- g_return_val_if_fail(option->type == PURPLE_PREF_STRING, NULL);
- return option->default_value.string;
-purple_account_option_get_default_list_value(const PurpleAccountOption *option)
- PurpleKeyValuePair *kvp;
- g_return_val_if_fail(option != NULL, NULL);
- g_return_val_if_fail(option->type == PURPLE_PREF_STRING_LIST, NULL);
- if (option->default_value.list == NULL)
- kvp = option->default_value.list->data;
- return (kvp ? kvp->value : NULL);
-purple_account_option_string_get_masked(const PurpleAccountOption *option)
- g_return_val_if_fail(option != NULL, FALSE);
- g_return_val_if_fail(option->type == PURPLE_PREF_STRING, FALSE);
- return option->params.string.masked;
-purple_account_option_string_get_hints(const PurpleAccountOption *option)
- g_return_val_if_fail(option != NULL, FALSE);
- g_return_val_if_fail(option->type == PURPLE_PREF_STRING, FALSE);
- return option->params.string.hints;
-purple_account_option_get_list(const PurpleAccountOption *option)
- g_return_val_if_fail(option != NULL, NULL);
- g_return_val_if_fail(option->type == PURPLE_PREF_STRING_LIST, NULL);
- return option->default_value.list;
--- a/libpurple/accountopt.h Fri Sep 27 02:44:08 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,331 +0,0 @@
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
-#ifndef PURPLE_ACCOUNTOPT_H
-#define PURPLE_ACCOUNTOPT_H
- * @section_id: libpurple-accountopt
- * @short_description: <filename>accountopt.h</filename>
- * @title: Account Options API
-/**************************************************************************/
-/**************************************************************************/
- * An option for an account.
- * This is set by protocols, and appears in the account settings
-typedef struct _PurpleAccountOption PurpleAccountOption;
-/**************************************************************************/
-/* Account Option API */
-/**************************************************************************/
- * purple_account_option_new:
- * @type: The type of option.
- * @text: The text of the option.
- * @pref_name: The account preference name for the option.
- * Creates a new account option. If you know what @a type will be in advance,
- * consider using purple_account_option_bool_new(),
- * purple_account_option_int_new(), purple_account_option_string_new() or
- * purple_account_option_list_new() (as appropriate) instead.
- * Returns: The account option.
-PurpleAccountOption *purple_account_option_new(PurplePrefType type,
- const char *text, const char *pref_name);
- * purple_account_option_bool_new:
- * @text: The text of the option.
- * @pref_name: The account preference name for the option.
- * @default_value: The default value.
- * Creates a new boolean account option.
- * Returns: The account option.
-PurpleAccountOption *purple_account_option_bool_new(const char *text,
- const char *pref_name, gboolean default_value);
- * purple_account_option_int_new:
- * @text: The text of the option.
- * @pref_name: The account preference name for the option.
- * @default_value: The default value.
- * Creates a new integer account option.
- * Returns: The account option.
-PurpleAccountOption *purple_account_option_int_new(const char *text,
- const char *pref_name, int default_value);
- * purple_account_option_string_new:
- * @text: The text of the option.
- * @pref_name: The account preference name for the option.
- * @default_value: The default value.
- * Creates a new string account option.
- * Returns: The account option.
-PurpleAccountOption *purple_account_option_string_new(const char *text,
- const char *pref_name, const char *default_value);
- * purple_account_option_list_new:
- * @text: The text of the option.
- * @pref_name: The account preference name for the option.
- * @list: (element-type PurpleKeyValuePair) (transfer full): The key, value list.
- * Creates a new list account option.
- * The list passed will be owned by the account option, and the
- * strings inside will be freed automatically.
- * The list is a list of #PurpleKeyValuePair items. The key is the label that
- * should be displayed to the user, and the <type>(const char *)</type> value is
- * the internal ID that should be passed to purple_account_set_string() to
- * Returns: The account option.
-PurpleAccountOption *purple_account_option_list_new(const char *text,
- const char *pref_name, GList *list);
- * purple_account_option_destroy:
- * @option: The option to destroy.
- * Destroys an account option.
-void purple_account_option_destroy(PurpleAccountOption *option);
- * purple_account_option_set_default_bool:
- * @option: The account option.
- * @value: The default boolean value.
- * Sets the default boolean value for an account option.
-void purple_account_option_set_default_bool(PurpleAccountOption *option,
- * purple_account_option_set_default_int:
- * @option: The account option.
- * @value: The default integer value.
- * Sets the default integer value for an account option.
-void purple_account_option_set_default_int(PurpleAccountOption *option,
- * purple_account_option_set_default_string:
- * @option: The account option.
- * @value: The default string value.
- * Sets the default string value for an account option.
-void purple_account_option_set_default_string(PurpleAccountOption *option,
- * purple_account_option_string_set_masked:
- * @option: The account option.
- * @masked: The masking.
- * Sets the masking for an account option. Setting this to %TRUE acts
- * as a hint to the UI that the option's value should be obscured from
- * view, like a password.
-purple_account_option_string_set_masked(PurpleAccountOption *option, gboolean masked);
- * purple_account_option_string_set_hints:
- * @option: The account option.
- * @hints: (element-type utf8) (transfer full): The list of hints, stored as strings.
- * Sets the hint list for an account option.
- * The list passed will be owned by the account option, and the
- * strings inside will be freed automatically.
-void purple_account_option_string_set_hints(PurpleAccountOption *option,
- * purple_account_option_set_list:
- * @option: The account option.
- * @values: (element-type PurpleKeyValuePair) (transfer full): The default list
- * Sets the list values for an account option.
- * The list passed will be owned by the account option, and the
- * strings inside will be freed automatically.
- * The list is in key, value pairs. The key is the ID stored and used
- * internally, and the value is the label displayed.
-void purple_account_option_set_list(PurpleAccountOption *option, GList *values);
- * purple_account_option_add_list_item:
- * @option: The account option.
- * Adds an item to a list account option.
-void purple_account_option_add_list_item(PurpleAccountOption *option,
- const char *key, const char *value);
- * purple_account_option_get_pref_type:
- * @option: The account option.
- * Returns the specified account option's type.
- * Returns: The account option's type.
-PurplePrefType purple_account_option_get_pref_type(const PurpleAccountOption *option);
- * purple_account_option_get_text:
- * @option: The account option.
- * Returns the text for an account option.
- * Returns: The account option's text.
-const char *purple_account_option_get_text(const PurpleAccountOption *option);
- * purple_account_option_get_setting:
- * @option: The account option.
- * Returns the name of an account option. This corresponds to the @c pref_name
- * parameter supplied to purple_account_option_new() or one of the
- * type-specific constructors.
- * Returns: The option's name.
-const char *purple_account_option_get_setting(const PurpleAccountOption *option);
- * purple_account_option_get_default_bool:
- * @option: The account option.
- * Returns the default boolean value for an account option.
- * Returns: The default boolean value.
-gboolean purple_account_option_get_default_bool(const PurpleAccountOption *option);
- * purple_account_option_get_default_int:
- * @option: The account option.
- * Returns the default integer value for an account option.
- * Returns: The default integer value.
-int purple_account_option_get_default_int(const PurpleAccountOption *option);
- * purple_account_option_get_default_string:
- * @option: The account option.
- * Returns the default string value for an account option.
- * Returns: The default string value.
-const char *purple_account_option_get_default_string(
- const PurpleAccountOption *option);
- * purple_account_option_get_default_list_value:
- * @option: The account option.
- * Returns the default string value for a list account option.
- * Returns: The default list string value.
-const char *purple_account_option_get_default_list_value(
- const PurpleAccountOption *option);
- * purple_account_option_string_get_masked:
- * @option: The account option.
- * Returns whether an option's value should be masked from view, like a
- * password. If so, the UI might display each character of the option
- * as a '*' (for example).
- * Returns: %TRUE if the option's value should be obscured.
-purple_account_option_string_get_masked(const PurpleAccountOption *option);
- * purple_account_option_string_get_hints:
- * @option: The account option.
- * Returns the list of hints for an account option.
- * Returns: (element-type utf8) (transfer none): A list of hints.
-const GSList * purple_account_option_string_get_hints(const PurpleAccountOption *option);
- * purple_account_option_get_list:
- * @option: The account option.
- * Returns the list values for an account option.
- * Returns: (element-type PurpleKeyValuePair) (transfer none): A list of
- * #PurpleKeyValuePair, mapping the human-readable description of the
- * value to the <type>(const char *)</type> that should be passed to
- * purple_account_set_string() to set the option.
-GList *purple_account_option_get_list(const PurpleAccountOption *option);
-#endif /* PURPLE_ACCOUNTOPT_H */
--- a/libpurple/meson.build Fri Sep 27 02:44:08 2019 -0500
+++ b/libpurple/meson.build Fri Sep 27 03:43:47 2019 -0500
@@ -1,7 +1,6 @@
@@ -49,6 +48,7 @@
+ 'purpleaccountoption.c', 'purpleaccountusersplit.c',
@@ -84,7 +84,6 @@
@@ -128,6 +127,7 @@
+ 'purpleaccountoption.h', 'purpleaccountusersplit.h',
--- a/libpurple/protocol.h Fri Sep 27 02:44:08 2019 -0500
+++ b/libpurple/protocol.h Fri Sep 27 03:43:47 2019 -0500
@@ -39,7 +39,6 @@
typedef struct _PurpleProtocolClass PurpleProtocolClass;
@@ -51,6 +50,7 @@
+#include "purpleaccountoption.h" #include "purpleaccountusersplit.h"
--- a/libpurple/protocols.c Fri Sep 27 02:44:08 2019 -0500
+++ b/libpurple/protocols.c Fri Sep 27 03:43:47 2019 -0500
@@ -21,12 +21,12 @@
#include "conversation.h"
+#include "purpleaccountoption.h" --- a/libpurple/protocols/facebook/facebook.c Fri Sep 27 02:44:08 2019 -0500
+++ b/libpurple/protocols/facebook/facebook.c Fri Sep 27 03:43:47 2019 -0500
@@ -22,7 +22,6 @@
@@ -42,6 +41,7 @@
+#include "purpleaccountoption.h" --- a/libpurple/protocols/gg/gg.c Fri Sep 27 02:44:08 2019 -0500
+++ b/libpurple/protocols/gg/gg.c Fri Sep 27 03:43:47 2019 -0500
@@ -33,7 +33,7 @@
+#include "purpleaccountoption.h" --- a/libpurple/protocols/gg/servconn.h Fri Sep 27 02:44:08 2019 -0500
+++ b/libpurple/protocols/gg/servconn.h Fri Sep 27 03:43:47 2019 -0500
@@ -31,7 +31,7 @@
#define PURPLE_GG_SERVCONN_H
+#include <purpleaccountoption.h> void ggp_servconn_setup(PurpleAccountOption *server_option);
void ggp_servconn_cleanup(void);
--- a/libpurple/protocols/jabber/jabber.c Fri Sep 27 02:44:08 2019 -0500
+++ b/libpurple/protocols/jabber/jabber.c Fri Sep 27 03:43:47 2019 -0500
@@ -23,7 +23,6 @@
@@ -36,6 +35,7 @@
+#include "purpleaccountoption.h" --- a/libpurple/protocols/novell/novell.c Fri Sep 27 02:44:08 2019 -0500
+++ b/libpurple/protocols/novell/novell.c Fri Sep 27 03:43:47 2019 -0500
@@ -20,7 +20,6 @@
@@ -28,6 +27,7 @@
+#include "purpleaccountoption.h" --- a/libpurple/protocols/oscar/oscar.c Fri Sep 27 02:44:08 2019 -0500
+++ b/libpurple/protocols/oscar/oscar.c Fri Sep 27 03:43:47 2019 -0500
@@ -31,7 +31,6 @@
#include "conversation.h"
@@ -42,6 +41,7 @@
+#include "purpleaccountoption.h" --- a/libpurple/protocols/oscar/oscarcommon.h Fri Sep 27 02:44:08 2019 -0500
+++ b/libpurple/protocols/oscar/oscarcommon.h Fri Sep 27 03:43:47 2019 -0500
@@ -29,10 +29,10 @@
+#include "purpleaccountoption.h" #define AIM_DEFAULT_LOGIN_SERVER "login.oscar.aol.com"
--- a/libpurple/protocols/sametime/sametime.c Fri Sep 27 02:44:08 2019 -0500
+++ b/libpurple/protocols/sametime/sametime.c Fri Sep 27 03:43:47 2019 -0500
@@ -33,7 +33,6 @@
#include "circularbuffer.h"
#include "conversation.h"
@@ -43,6 +42,7 @@
+#include "purpleaccountoption.h" #include "purpleaccountusersplit.h"
--- a/libpurple/protocols/zephyr/zephyr.c Fri Sep 27 02:44:08 2019 -0500
+++ b/libpurple/protocols/zephyr/zephyr.c Fri Sep 27 03:43:47 2019 -0500
@@ -28,7 +28,7 @@
#include "libpurple/internal.h"
+#include "purpleaccountoption.h" --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/purpleaccountoption.c Fri Sep 27 03:43:47 2019 -0500
@@ -0,0 +1,349 @@
+ * Purple is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +#include "purpleaccountoption.h" + * An option for an account. + * This is set by protocols, and appears in the account settings +struct _PurpleAccountOption + PurplePrefType type; /* The type of value. */ + char *text; /* The text that will appear to the user. */ + char *pref_name; /* The name of the associated preference. */ + gboolean boolean; /* The default boolean value. */ + int integer; /* The default integer value. */ + char *string; /* The default string value. */ + GList *list; /* The default list value. */ + gboolean masked; /* Whether the value entered should + * be obscured from view (for + * passwords and similar options) + GSList *hints; /* List of hinted values */ +purple_account_option_new(PurplePrefType type, const char *text, + PurpleAccountOption *option; + g_return_val_if_fail(type != PURPLE_PREF_NONE, NULL); + g_return_val_if_fail(text != NULL, NULL); + g_return_val_if_fail(pref_name != NULL, NULL); + option = g_new0(PurpleAccountOption, 1); + option->text = g_strdup(text); + option->pref_name = g_strdup(pref_name); +purple_account_option_bool_new(const char *text, const char *pref_name, + gboolean default_value) + PurpleAccountOption *option; + option = purple_account_option_new(PURPLE_PREF_BOOLEAN, text, pref_name); + option->default_value.boolean = default_value; +purple_account_option_int_new(const char *text, const char *pref_name, + PurpleAccountOption *option; + option = purple_account_option_new(PURPLE_PREF_INT, text, pref_name); + option->default_value.integer = default_value; +purple_account_option_string_new(const char *text, const char *pref_name, + const char *default_value) + PurpleAccountOption *option; + option = purple_account_option_new(PURPLE_PREF_STRING, text, pref_name); + option->default_value.string = g_strdup(default_value); +purple_account_option_list_new(const char *text, const char *pref_name, + PurpleAccountOption *option; + option = purple_account_option_new(PURPLE_PREF_STRING_LIST, text, pref_name); + option->default_value.list = list; +purple_account_option_list_free(gpointer data, gpointer user_data) + PurpleKeyValuePair *kvp = data; +purple_account_option_destroy(PurpleAccountOption *option) + g_return_if_fail(option != NULL); + g_free(option->pref_name); + if (option->type == PURPLE_PREF_STRING) + g_free(option->default_value.string); + g_slist_free_full(option->params.string.hints, &g_free); + else if (option->type == PURPLE_PREF_STRING_LIST) + g_list_free_full(option->default_value.list, + (GDestroyNotify)purple_account_option_list_free); +purple_account_option_set_default_bool(PurpleAccountOption *option, + g_return_if_fail(option != NULL); + g_return_if_fail(option->type == PURPLE_PREF_BOOLEAN); + option->default_value.boolean = value; +purple_account_option_set_default_int(PurpleAccountOption *option, int value) + g_return_if_fail(option != NULL); + g_return_if_fail(option->type == PURPLE_PREF_INT); + option->default_value.integer = value; +purple_account_option_set_default_string(PurpleAccountOption *option, + g_return_if_fail(option != NULL); + g_return_if_fail(option->type == PURPLE_PREF_STRING); + g_free(option->default_value.string); + option->default_value.string = g_strdup(value); +purple_account_option_string_set_masked(PurpleAccountOption *option, gboolean masked) + g_return_if_fail(option != NULL); + g_return_if_fail(option->type == PURPLE_PREF_STRING); + option->params.string.masked = masked; +purple_account_option_string_set_hints(PurpleAccountOption *option, GSList *hints) + g_return_if_fail(option != NULL); + g_return_if_fail(option->type == PURPLE_PREF_STRING); + g_slist_free_full(option->params.string.hints, &g_free); + option->params.string.hints = hints; +purple_account_option_set_list(PurpleAccountOption *option, GList *values) + g_return_if_fail(option != NULL); + g_return_if_fail(option->type == PURPLE_PREF_STRING_LIST); + g_list_free_full(option->default_value.list, + (GDestroyNotify)purple_account_option_list_free); + option->default_value.list = values; +purple_account_option_add_list_item(PurpleAccountOption *option, + const char *key, const char *value) + PurpleKeyValuePair *kvp; + g_return_if_fail(option != NULL); + g_return_if_fail(key != NULL); + g_return_if_fail(value != NULL); + g_return_if_fail(option->type == PURPLE_PREF_STRING_LIST); + kvp = g_new0(PurpleKeyValuePair, 1); + kvp->key = g_strdup(key); + kvp->value = g_strdup(value); + option->default_value.list = g_list_append(option->default_value.list, +purple_account_option_get_pref_type(const PurpleAccountOption *option) + g_return_val_if_fail(option != NULL, PURPLE_PREF_NONE); +purple_account_option_get_text(const PurpleAccountOption *option) + g_return_val_if_fail(option != NULL, NULL); +purple_account_option_get_setting(const PurpleAccountOption *option) + g_return_val_if_fail(option != NULL, NULL); + return option->pref_name; +purple_account_option_get_default_bool(const PurpleAccountOption *option) + g_return_val_if_fail(option != NULL, FALSE); + g_return_val_if_fail(option->type == PURPLE_PREF_BOOLEAN, FALSE); + return option->default_value.boolean; +purple_account_option_get_default_int(const PurpleAccountOption *option) + g_return_val_if_fail(option != NULL, -1); + g_return_val_if_fail(option->type == PURPLE_PREF_INT, -1); + return option->default_value.integer; +purple_account_option_get_default_string(const PurpleAccountOption *option) + g_return_val_if_fail(option != NULL, NULL); + g_return_val_if_fail(option->type == PURPLE_PREF_STRING, NULL); + return option->default_value.string; +purple_account_option_get_default_list_value(const PurpleAccountOption *option) + PurpleKeyValuePair *kvp; + g_return_val_if_fail(option != NULL, NULL); + g_return_val_if_fail(option->type == PURPLE_PREF_STRING_LIST, NULL); + if (option->default_value.list == NULL) + kvp = option->default_value.list->data; + return (kvp ? kvp->value : NULL); +purple_account_option_string_get_masked(const PurpleAccountOption *option) + g_return_val_if_fail(option != NULL, FALSE); + g_return_val_if_fail(option->type == PURPLE_PREF_STRING, FALSE); + return option->params.string.masked; +purple_account_option_string_get_hints(const PurpleAccountOption *option) + g_return_val_if_fail(option != NULL, FALSE); + g_return_val_if_fail(option->type == PURPLE_PREF_STRING, FALSE); + return option->params.string.hints; +purple_account_option_get_list(const PurpleAccountOption *option) + g_return_val_if_fail(option != NULL, NULL); + g_return_val_if_fail(option->type == PURPLE_PREF_STRING_LIST, NULL); + return option->default_value.list; --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/purpleaccountoption.h Fri Sep 27 03:43:47 2019 -0500
@@ -0,0 +1,331 @@
+ * Purple is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +#ifndef PURPLE_ACCOUNTOPT_H +#define PURPLE_ACCOUNTOPT_H + * @section_id: libpurple-accountopt + * @short_description: <filename>accountopt.h</filename> + * @title: Account Options API +/**************************************************************************/ +/**************************************************************************/ + * An option for an account. + * This is set by protocols, and appears in the account settings +typedef struct _PurpleAccountOption PurpleAccountOption; +/**************************************************************************/ +/* Account Option API */ +/**************************************************************************/ + * purple_account_option_new: + * @type: The type of option. + * @text: The text of the option. + * @pref_name: The account preference name for the option. + * Creates a new account option. If you know what @a type will be in advance, + * consider using purple_account_option_bool_new(), + * purple_account_option_int_new(), purple_account_option_string_new() or + * purple_account_option_list_new() (as appropriate) instead. + * Returns: The account option. +PurpleAccountOption *purple_account_option_new(PurplePrefType type, + const char *text, const char *pref_name); + * purple_account_option_bool_new: + * @text: The text of the option. + * @pref_name: The account preference name for the option. + * @default_value: The default value. + * Creates a new boolean account option. + * Returns: The account option. +PurpleAccountOption *purple_account_option_bool_new(const char *text, + const char *pref_name, gboolean default_value); + * purple_account_option_int_new: + * @text: The text of the option. + * @pref_name: The account preference name for the option. + * @default_value: The default value. + * Creates a new integer account option. + * Returns: The account option. +PurpleAccountOption *purple_account_option_int_new(const char *text, + const char *pref_name, int default_value); + * purple_account_option_string_new: + * @text: The text of the option. + * @pref_name: The account preference name for the option. + * @default_value: The default value. + * Creates a new string account option. + * Returns: The account option. +PurpleAccountOption *purple_account_option_string_new(const char *text, + const char *pref_name, const char *default_value); + * purple_account_option_list_new: + * @text: The text of the option. + * @pref_name: The account preference name for the option. + * @list: (element-type PurpleKeyValuePair) (transfer full): The key, value list. + * Creates a new list account option. + * The list passed will be owned by the account option, and the + * strings inside will be freed automatically. + * The list is a list of #PurpleKeyValuePair items. The key is the label that + * should be displayed to the user, and the <type>(const char *)</type> value is + * the internal ID that should be passed to purple_account_set_string() to + * Returns: The account option. +PurpleAccountOption *purple_account_option_list_new(const char *text, + const char *pref_name, GList *list); + * purple_account_option_destroy: + * @option: The option to destroy. + * Destroys an account option. +void purple_account_option_destroy(PurpleAccountOption *option); + * purple_account_option_set_default_bool: + * @option: The account option. + * @value: The default boolean value. + * Sets the default boolean value for an account option. +void purple_account_option_set_default_bool(PurpleAccountOption *option, + * purple_account_option_set_default_int: + * @option: The account option. + * @value: The default integer value. + * Sets the default integer value for an account option. +void purple_account_option_set_default_int(PurpleAccountOption *option, + * purple_account_option_set_default_string: + * @option: The account option. + * @value: The default string value. + * Sets the default string value for an account option. +void purple_account_option_set_default_string(PurpleAccountOption *option, + * purple_account_option_string_set_masked: + * @option: The account option. + * @masked: The masking. + * Sets the masking for an account option. Setting this to %TRUE acts + * as a hint to the UI that the option's value should be obscured from + * view, like a password. +purple_account_option_string_set_masked(PurpleAccountOption *option, gboolean masked); + * purple_account_option_string_set_hints: + * @option: The account option. + * @hints: (element-type utf8) (transfer full): The list of hints, stored as strings. + * Sets the hint list for an account option. + * The list passed will be owned by the account option, and the + * strings inside will be freed automatically. +void purple_account_option_string_set_hints(PurpleAccountOption *option, + * purple_account_option_set_list: + * @option: The account option. + * @values: (element-type PurpleKeyValuePair) (transfer full): The default list + * Sets the list values for an account option. + * The list passed will be owned by the account option, and the + * strings inside will be freed automatically. + * The list is in key, value pairs. The key is the ID stored and used + * internally, and the value is the label displayed. +void purple_account_option_set_list(PurpleAccountOption *option, GList *values); + * purple_account_option_add_list_item: + * @option: The account option. + * Adds an item to a list account option. +void purple_account_option_add_list_item(PurpleAccountOption *option, + const char *key, const char *value); + * purple_account_option_get_pref_type: + * @option: The account option. + * Returns the specified account option's type. + * Returns: The account option's type. +PurplePrefType purple_account_option_get_pref_type(const PurpleAccountOption *option); + * purple_account_option_get_text: + * @option: The account option. + * Returns the text for an account option. + * Returns: The account option's text. +const char *purple_account_option_get_text(const PurpleAccountOption *option); + * purple_account_option_get_setting: + * @option: The account option. + * Returns the name of an account option. This corresponds to the @c pref_name + * parameter supplied to purple_account_option_new() or one of the + * type-specific constructors. + * Returns: The option's name. +const char *purple_account_option_get_setting(const PurpleAccountOption *option); + * purple_account_option_get_default_bool: + * @option: The account option. + * Returns the default boolean value for an account option. + * Returns: The default boolean value. +gboolean purple_account_option_get_default_bool(const PurpleAccountOption *option); + * purple_account_option_get_default_int: + * @option: The account option. + * Returns the default integer value for an account option. + * Returns: The default integer value. +int purple_account_option_get_default_int(const PurpleAccountOption *option); + * purple_account_option_get_default_string: + * @option: The account option. + * Returns the default string value for an account option. + * Returns: The default string value. +const char *purple_account_option_get_default_string( + const PurpleAccountOption *option); + * purple_account_option_get_default_list_value: + * @option: The account option. + * Returns the default string value for a list account option. + * Returns: The default list string value. +const char *purple_account_option_get_default_list_value( + const PurpleAccountOption *option); + * purple_account_option_string_get_masked: + * @option: The account option. + * Returns whether an option's value should be masked from view, like a + * password. If so, the UI might display each character of the option + * as a '*' (for example). + * Returns: %TRUE if the option's value should be obscured. +purple_account_option_string_get_masked(const PurpleAccountOption *option); + * purple_account_option_string_get_hints: + * @option: The account option. + * Returns the list of hints for an account option. + * Returns: (element-type utf8) (transfer none): A list of hints. +const GSList * purple_account_option_string_get_hints(const PurpleAccountOption *option); + * purple_account_option_get_list: + * @option: The account option. + * Returns the list values for an account option. + * Returns: (element-type PurpleKeyValuePair) (transfer none): A list of + * #PurpleKeyValuePair, mapping the human-readable description of the + * value to the <type>(const char *)</type> that should be passed to + * purple_account_set_string() to set the option. +GList *purple_account_option_get_list(const PurpleAccountOption *option); +#endif /* PURPLE_ACCOUNTOPT_H */ --- a/pidgin/gtkaccount.c Fri Sep 27 02:44:08 2019 -0500
+++ b/pidgin/gtkaccount.c Fri Sep 27 03:43:47 2019 -0500
@@ -23,13 +23,13 @@
+#include "purpleaccountoption.h" #include "savedstatuses.h"