pidgin/pidgin

71622ee1354e
Parents 925f12595750
Children b1ccd1961499
move PurpleAccountUserSplit to their own file
--- a/libpurple/accountopt.c Wed Oct 09 02:04:50 2019 +0000
+++ b/libpurple/accountopt.c Fri Sep 27 02:07:00 2019 -0500
@@ -59,24 +59,6 @@
} params;
};
-/*
- * A username split.
- *
- * This is used by some protocols to separate the fields of the username
- * into more human-readable components.
- */
-struct _PurpleAccountUserSplit
-{
- char *text; /* The text that will appear to the user. */
- char *default_value; /* The default value. */
- char field_sep; /* The field separator. */
- gboolean reverse; /* TRUE if the separator should be found
- starting a the end of the string, FALSE
- otherwise */
- gboolean constant;
-};
-
-
PurpleAccountOption *
purple_account_option_new(PurplePrefType type, const char *text,
const char *pref_name)
@@ -365,92 +347,3 @@
return option->default_value.list;
}
-
-/**************************************************************************
- * Account User Split API
- **************************************************************************/
-PurpleAccountUserSplit *
-purple_account_user_split_new(const char *text, const char *default_value,
- char sep)
-{
- PurpleAccountUserSplit *split;
-
- g_return_val_if_fail(text != NULL, NULL);
- g_return_val_if_fail(sep != 0, NULL);
-
- split = g_new0(PurpleAccountUserSplit, 1);
-
- split->text = g_strdup(text);
- split->field_sep = sep;
- split->default_value = g_strdup(default_value);
- split->reverse = TRUE;
-
- return split;
-}
-
-void
-purple_account_user_split_destroy(PurpleAccountUserSplit *split)
-{
- g_return_if_fail(split != NULL);
-
- g_free(split->text);
- g_free(split->default_value);
- g_free(split);
-}
-
-const char *
-purple_account_user_split_get_text(const PurpleAccountUserSplit *split)
-{
- g_return_val_if_fail(split != NULL, NULL);
-
- return split->text;
-}
-
-const char *
-purple_account_user_split_get_default_value(const PurpleAccountUserSplit *split)
-{
- g_return_val_if_fail(split != NULL, NULL);
-
- return split->default_value;
-}
-
-char
-purple_account_user_split_get_separator(const PurpleAccountUserSplit *split)
-{
- g_return_val_if_fail(split != NULL, 0);
-
- return split->field_sep;
-}
-
-gboolean
-purple_account_user_split_get_reverse(const PurpleAccountUserSplit *split)
-{
- g_return_val_if_fail(split != NULL, FALSE);
-
- return split->reverse;
-}
-
-void
-purple_account_user_split_set_reverse(PurpleAccountUserSplit *split, gboolean reverse)
-{
- g_return_if_fail(split != NULL);
-
- split->reverse = reverse;
-}
-
-gboolean
-purple_account_user_split_is_constant(const PurpleAccountUserSplit *split)
-{
- g_return_val_if_fail(split != NULL, FALSE);
-
- return split->constant;
-}
-
-void
-purple_account_user_split_set_constant(PurpleAccountUserSplit *split,
- gboolean constant)
-{
- g_return_if_fail(split != NULL);
-
- split->constant = constant;
-}
--- a/libpurple/accountopt.h Wed Oct 09 02:04:50 2019 +0000
+++ b/libpurple/accountopt.h Fri Sep 27 02:07:00 2019 -0500
@@ -44,16 +44,6 @@
*/
typedef struct _PurpleAccountOption PurpleAccountOption;
-/**
- * PurpleAccountUserSplit:
- *
- * A username split.
- *
- * This is used by some protocols to separate the fields of the username
- * into more human-readable components.
- */
-typedef struct _PurpleAccountUserSplit PurpleAccountUserSplit;
-
G_BEGIN_DECLS
/**************************************************************************/
@@ -336,108 +326,6 @@
*/
GList *purple_account_option_get_list(const PurpleAccountOption *option);
-
-/**************************************************************************/
-/* Account User Split API */
-/**************************************************************************/
-
-/**
- * purple_account_user_split_new:
- * @text: The text of the option.
- * @default_value: The default value.
- * @sep: The field separator.
- *
- * Creates a new account username split.
- *
- * Returns: The new user split.
- */
-PurpleAccountUserSplit *purple_account_user_split_new(const char *text,
- const char *default_value,
- char sep);
-
-/**
- * purple_account_user_split_destroy:
- * @split: The split to destroy.
- *
- * Destroys an account username split.
- */
-void purple_account_user_split_destroy(PurpleAccountUserSplit *split);
-
-/**
- * purple_account_user_split_get_text:
- * @split: The account username split.
- *
- * Returns the text for an account username split.
- *
- * Returns: The account username split's text.
- */
-const char *purple_account_user_split_get_text(const PurpleAccountUserSplit *split);
-
-/**
- * purple_account_user_split_get_default_value:
- * @split: The account username split.
- *
- * Returns the default string value for an account split.
- *
- * Returns: The default string.
- */
-const char *purple_account_user_split_get_default_value(
- const PurpleAccountUserSplit *split);
-
-/**
- * purple_account_user_split_get_separator:
- * @split: The account username split.
- *
- * Returns the field separator for an account split.
- *
- * Returns: The field separator.
- */
-char purple_account_user_split_get_separator(const PurpleAccountUserSplit *split);
-
-/**
- * purple_account_user_split_get_reverse:
- * @split: The account username split.
- *
- * Returns the 'reverse' value for an account split.
- *
- * Returns: The 'reverse' value.
- */
-gboolean purple_account_user_split_get_reverse(const PurpleAccountUserSplit *split);
-
-/**
- * purple_account_user_split_set_reverse:
- * @split: The account username split.
- * @reverse: The 'reverse' value
- *
- * Sets the 'reverse' value for an account split.
- */
-void purple_account_user_split_set_reverse(PurpleAccountUserSplit *split, gboolean reverse);
-
-/**
- * purple_account_user_split_is_constant:
- * @split: The account username split.
- *
- * Returns the constant parameter for an account split.
- *
- * When split is constant, it does not need to be displayed
- * in configuration dialog.
- *
- * Returns: %TRUE, if the split is constant.
- */
-gboolean
-purple_account_user_split_is_constant(const PurpleAccountUserSplit *split);
-
-/**
- * purple_account_user_split_set_constant:
- * @split: The account username split.
- * @constant: %TRUE, if the split is a constant part.
- *
- * Sets the constant parameter of account split.
- */
-void
-purple_account_user_split_set_constant(PurpleAccountUserSplit *split,
- gboolean constant);
-
G_END_DECLS
#endif /* PURPLE_ACCOUNTOPT_H */
--- a/libpurple/meson.build Wed Oct 09 02:04:50 2019 +0000
+++ b/libpurple/meson.build Fri Sep 27 02:07:00 2019 -0500
@@ -49,6 +49,7 @@
'protocol.c',
'protocols.c',
'purple-gio.c',
+ 'purpleaccountusersplit.c',
'queuedoutputstream.c',
'request.c',
'request-datasheet.c',
@@ -127,6 +128,7 @@
'protocol.h',
'protocols.h',
'purple-gio.h',
+ 'purpleaccountusersplit.h',
'queuedoutputstream.h',
'request.h',
'request-datasheet.h',
--- a/libpurple/protocol.h Wed Oct 09 02:04:50 2019 +0000
+++ b/libpurple/protocol.h Fri Sep 27 02:07:00 2019 -0500
@@ -51,6 +51,7 @@
#include "message.h"
#include "notify.h"
#include "plugins.h"
+#include "purpleaccountusersplit.h"
#include "roomlist.h"
#include "status.h"
#include "whiteboard.h"
--- a/libpurple/protocols/jabber/gtalk.c Wed Oct 09 02:04:50 2019 +0000
+++ b/libpurple/protocols/jabber/gtalk.c Fri Sep 27 02:07:00 2019 -0500
@@ -24,6 +24,7 @@
#include "chat.h"
#include "core.h"
#include "plugins.h"
+#include "purpleaccountusersplit.h"
#include "gtalk.h"
--- a/libpurple/protocols/jabber/xmpp.c Wed Oct 09 02:04:50 2019 +0000
+++ b/libpurple/protocols/jabber/xmpp.c Fri Sep 27 02:07:00 2019 -0500
@@ -24,6 +24,7 @@
#include "chat.h"
#include "core.h"
#include "plugins.h"
+#include "purpleaccountusersplit.h"
#include "xmpp.h"
--- a/libpurple/protocols/sametime/sametime.c Wed Oct 09 02:04:50 2019 +0000
+++ b/libpurple/protocols/sametime/sametime.c Fri Sep 27 02:07:00 2019 -0500
@@ -43,6 +43,7 @@
#include "notify.h"
#include "plugins.h"
#include "protocol.h"
+#include "purpleaccountusersplit.h"
#include "request.h"
#include "version.h"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/purpleaccountusersplit.c Fri Sep 27 02:07:00 2019 -0500
@@ -0,0 +1,131 @@
+/* purple
+ *
+ * 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
+ * source distribution.
+ *
+ * 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 "internal.h"
+
+#include "purpleaccountusersplit.h"
+#include "util.h"
+#include "glibcompat.h"
+
+/*
+ * A username split.
+ *
+ * This is used by some protocols to separate the fields of the username
+ * into more human-readable components.
+ */
+struct _PurpleAccountUserSplit
+{
+ char *text; /* The text that will appear to the user. */
+ char *default_value; /* The default value. */
+ char field_sep; /* The field separator. */
+ gboolean reverse; /* TRUE if the separator should be found
+ starting a the end of the string, FALSE
+ otherwise */
+ gboolean constant;
+};
+
+/**************************************************************************
+ * Account User Split API
+ **************************************************************************/
+PurpleAccountUserSplit *
+purple_account_user_split_new(const char *text, const char *default_value,
+ char sep)
+{
+ PurpleAccountUserSplit *split;
+
+ g_return_val_if_fail(text != NULL, NULL);
+ g_return_val_if_fail(sep != 0, NULL);
+
+ split = g_new0(PurpleAccountUserSplit, 1);
+
+ split->text = g_strdup(text);
+ split->field_sep = sep;
+ split->default_value = g_strdup(default_value);
+ split->reverse = TRUE;
+
+ return split;
+}
+
+void
+purple_account_user_split_destroy(PurpleAccountUserSplit *split)
+{
+ g_return_if_fail(split != NULL);
+
+ g_free(split->text);
+ g_free(split->default_value);
+ g_free(split);
+}
+
+const char *
+purple_account_user_split_get_text(const PurpleAccountUserSplit *split)
+{
+ g_return_val_if_fail(split != NULL, NULL);
+
+ return split->text;
+}
+
+const char *
+purple_account_user_split_get_default_value(const PurpleAccountUserSplit *split)
+{
+ g_return_val_if_fail(split != NULL, NULL);
+
+ return split->default_value;
+}
+
+char
+purple_account_user_split_get_separator(const PurpleAccountUserSplit *split)
+{
+ g_return_val_if_fail(split != NULL, 0);
+
+ return split->field_sep;
+}
+
+gboolean
+purple_account_user_split_get_reverse(const PurpleAccountUserSplit *split)
+{
+ g_return_val_if_fail(split != NULL, FALSE);
+
+ return split->reverse;
+}
+
+void
+purple_account_user_split_set_reverse(PurpleAccountUserSplit *split, gboolean reverse)
+{
+ g_return_if_fail(split != NULL);
+
+ split->reverse = reverse;
+}
+
+gboolean
+purple_account_user_split_is_constant(const PurpleAccountUserSplit *split)
+{
+ g_return_val_if_fail(split != NULL, FALSE);
+
+ return split->constant;
+}
+
+void
+purple_account_user_split_set_constant(PurpleAccountUserSplit *split,
+ gboolean constant)
+{
+ g_return_if_fail(split != NULL);
+
+ split->constant = constant;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/purpleaccountusersplit.h Fri Sep 27 02:07:00 2019 -0500
@@ -0,0 +1,152 @@
+/* purple
+ *
+ * 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
+ * source distribution.
+ *
+ * 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_ACCOUNT_SPLIT_H
+#define PURPLE_ACCOUNT_SPLIT_H
+/**
+ * SECTION:accountopt
+ * @section_id: libpurple-accountopt
+ * @short_description: <filename>accountopt.h</filename>
+ * @title: Account Options API
+ */
+
+#include "prefs.h"
+
+/**************************************************************************/
+/* Data Structures */
+/**************************************************************************/
+
+/**
+ * PurpleAccountUserSplit:
+ *
+ * A username split.
+ *
+ * This is used by some protocols to separate the fields of the username
+ * into more human-readable components.
+ */
+typedef struct _PurpleAccountUserSplit PurpleAccountUserSplit;
+
+G_BEGIN_DECLS
+
+/**************************************************************************/
+/* Account User Split API */
+/**************************************************************************/
+
+/**
+ * purple_account_user_split_new:
+ * @text: The text of the option.
+ * @default_value: The default value.
+ * @sep: The field separator.
+ *
+ * Creates a new account username split.
+ *
+ * Returns: The new user split.
+ */
+PurpleAccountUserSplit *purple_account_user_split_new(const char *text,
+ const char *default_value,
+ char sep);
+
+/**
+ * purple_account_user_split_destroy:
+ * @split: The split to destroy.
+ *
+ * Destroys an account username split.
+ */
+void purple_account_user_split_destroy(PurpleAccountUserSplit *split);
+
+/**
+ * purple_account_user_split_get_text:
+ * @split: The account username split.
+ *
+ * Returns the text for an account username split.
+ *
+ * Returns: The account username split's text.
+ */
+const char *purple_account_user_split_get_text(const PurpleAccountUserSplit *split);
+
+/**
+ * purple_account_user_split_get_default_value:
+ * @split: The account username split.
+ *
+ * Returns the default string value for an account split.
+ *
+ * Returns: The default string.
+ */
+const char *purple_account_user_split_get_default_value(
+ const PurpleAccountUserSplit *split);
+
+/**
+ * purple_account_user_split_get_separator:
+ * @split: The account username split.
+ *
+ * Returns the field separator for an account split.
+ *
+ * Returns: The field separator.
+ */
+char purple_account_user_split_get_separator(const PurpleAccountUserSplit *split);
+
+/**
+ * purple_account_user_split_get_reverse:
+ * @split: The account username split.
+ *
+ * Returns the 'reverse' value for an account split.
+ *
+ * Returns: The 'reverse' value.
+ */
+gboolean purple_account_user_split_get_reverse(const PurpleAccountUserSplit *split);
+
+/**
+ * purple_account_user_split_set_reverse:
+ * @split: The account username split.
+ * @reverse: The 'reverse' value
+ *
+ * Sets the 'reverse' value for an account split.
+ */
+void purple_account_user_split_set_reverse(PurpleAccountUserSplit *split, gboolean reverse);
+
+/**
+ * purple_account_user_split_is_constant:
+ * @split: The account username split.
+ *
+ * Returns the constant parameter for an account split.
+ *
+ * When split is constant, it does not need to be displayed
+ * in configuration dialog.
+ *
+ * Returns: %TRUE, if the split is constant.
+ */
+gboolean
+purple_account_user_split_is_constant(const PurpleAccountUserSplit *split);
+
+/**
+ * purple_account_user_split_set_constant:
+ * @split: The account username split.
+ * @constant: %TRUE, if the split is a constant part.
+ *
+ * Sets the constant parameter of account split.
+ */
+void
+purple_account_user_split_set_constant(PurpleAccountUserSplit *split,
+ gboolean constant);
+
+G_END_DECLS
+
+#endif /* PURPLE_ACCOUNT_SPLIT_H */