3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 * @section_id: libpurple-core
27 * @short_description: <filename>core.h</filename>
28 * @title: Startup and Shutdown of libpurple
29 * @see_also: <link linkend="chapter-signals-core">Core signals</link>
33 #include <glib-object.h>
35 #define PURPLE_TYPE_CORE_UI_OPS (purple_core_ui_ops_get_type())
37 typedef struct PurpleCore PurpleCore
;
38 typedef struct _PurpleCoreUiOps PurpleCoreUiOps
;
42 * @ui_prefs_init: Called just after the preferences subsystem is initialized;
43 * the UI could use this callback to add some preferences it
44 * needs to be in place when other subsystems are initialized.
45 * @debug_ui_init: Called just after the debug subsystem is initialized, but
46 * before just about every other component's initialization. The
47 * UI should use this hook to call purple_debug_set_ui_ops() so
48 * that debugging information for other components can be logged
49 * during their initialization.
50 * @ui_init: Called after all of libpurple has been initialized. The UI
51 * should use this hook to set all other necessary
52 * <link linkend="chapter-ui-ops"><literal>UiOps structures</literal></link>.
53 * @quit: Called after most of libpurple has been uninitialized.
54 * @get_ui_info: Called by purple_core_get_ui_info(); should return the
55 * information documented there.
57 * Callbacks that fire at different points of the initialization and teardown
58 * of libpurple, along with a hook to return descriptive information about the
61 struct _PurpleCoreUiOps
63 void (*ui_prefs_init
)(void);
64 void (*debug_ui_init
)(void);
65 void (*ui_init
)(void);
69 GHashTable
* (*get_ui_info
)(void);
72 void (*_purple_reserved1
)(void);
73 void (*_purple_reserved2
)(void);
74 void (*_purple_reserved3
)(void);
75 void (*_purple_reserved4
)(void);
81 * purple_core_ui_ops_get_type:
83 * Returns: The #GType for the #PurpleCoreUiOps boxed structure.
85 GType
purple_core_ui_ops_get_type(void);
89 * @ui: The ID of the UI using the core. This should be a
90 * unique ID, registered with the purple team.
92 * Initializes the core of purple.
94 * This will setup preferences for all the core subsystems.
96 * Returns: %TRUE if successful, or %FALSE otherwise.
98 gboolean
purple_core_init(const char *ui
);
103 * Quits the core of purple, which, depending on the UI, may quit the
104 * application using the purple core.
106 void purple_core_quit(void);
109 * purple_core_quit_cb:
111 * Calls purple_core_quit(). This can be used as the function
112 * passed to g_timeout_add() when you want to shutdown Purple
113 * in a specified amount of time. When shutting down Purple
114 * from a plugin, you must use this instead of purple_core_quit();
115 * for an immediate exit, use a timeout value of 0:
118 * g_timeout_add(0, purple_core_quitcb, NULL)
121 * This is ensures that code from your plugin is not being
122 * executed when purple_core_quit() is called. If the plugin
123 * called purple_core_quit() directly, you would get a core dump
124 * after purple_core_quit() executes and control returns to your
125 * plugin because purple_core_quit() frees all plugins.
127 gboolean
purple_core_quit_cb(gpointer unused
);
130 * purple_core_get_version:
132 * Returns the version of the core library.
134 * Returns: The version of the core library.
136 const char *purple_core_get_version(void);
139 * purple_core_get_ui:
141 * Returns the ID of the UI that is using the core, as passed to
142 * purple_core_init().
144 * Returns: The ID of the UI that is currently using the core.
146 const char *purple_core_get_ui(void);
151 * This is used to connect to
152 * <link linkend="chapter-signals-core">core signals</link>.
154 * Returns: A handle to the purple core.
156 PurpleCore
*purple_get_core(void);
159 * purple_core_set_ui_ops:
160 * @ops: A UI ops structure for the core.
162 * Sets the UI ops for the core.
164 void purple_core_set_ui_ops(PurpleCoreUiOps
*ops
);
167 * purple_core_get_ui_ops:
169 * Returns the UI ops for the core.
171 * Returns: The core's UI ops structure.
173 PurpleCoreUiOps
*purple_core_get_ui_ops(void);
176 * purple_core_get_ui_info:
178 * Returns a hash table containing various information about the UI. The
179 * following well-known entries may be in the table (along with any others the
180 * UI might choose to include):
182 * <informaltable frame='none'>
183 * <tgroup cols='2'><tbody>
185 * <entry><literal>name</literal></entry>
186 * <entry>the user-readable name for the UI.</entry>
189 * <entry><literal>version</literal></entry>
190 * <entry>a user-readable description of the current version of the UI.</entry>
193 * <entry><literal>website</literal></entry>
194 * <entry>the UI's website, such as https://pidgin.im.</entry>
197 * <entry><literal>dev_website</literal></entry>
198 * <entry>the UI's development/support website, such as
199 * https://developer.pidgin.im.</entry>
202 * <entry><literal>client_type</literal></entry>
203 * <entry>the type of UI. Possible values include 'pc', 'console', 'phone',
204 * 'handheld', 'web', and 'bot'. These values are compared
205 * programmatically and should not be localized.</entry>
210 * Returns: (transfer none): A GHashTable with strings for keys and values.
211 * This hash table should not be modified.
214 GHashTable
* purple_core_get_ui_info(void);
217 * purple_core_migrate_to_xdg_base_dirs:
219 * Migrates from legacy directory for libpurple to location following
220 * XDG base dir spec. https://developer.pidgin.im/ticket/10029
221 * NOTE This is not finished yet. Need to decide where other profile files
222 * should be moved. Search for usages of purple_user_dir().
224 * Returns: TRUE if migrated successfully, FALSE otherwise. On failure,
225 * the application must display an error to the user and then exit.
227 gboolean
purple_core_migrate_to_xdg_base_dirs(void);
231 #endif /* PURPLE_CORE_H */
236 `//"\\ """"`---.___.-""
237 ______-==| | | \\ _-"`
238 __--""" ,-/-==\\ | | `\ ,'
239 _-" /' | \\ ___ / / \ /
240 .' / | \\ /" "\ /' / \ /'
241 / ____ / | \`\.__/-"" D O \_/' / \/'
242 /-'" """""---__ | "-/" O G R /' _--"`
243 \_| / R __--_ t ), __--""
244 '""--_/ T _-"_>--<_\ h '-" \
245 {\__--_/} / \\__>--<__\ e B \
246 /' (_/ _-" | |__>--<__| U |
247 | _/) )-" | |__>--<__| R |
248 / /" ,_/ / /__>---<__/ N |
249 o-o _// /-"_>---<__-" I /
250 (^(" /"_>---<__- N _-"
252 ,//('( |__>--<__| T / .----_
253 ( ( ')) |__>--<__| | /' _---_"\
254 `-)) )) ( |__>--<__| O | /' / "\`\
255 ,/,'//( ( \__>--<__\ R \ /' // ||
256 ,( ( ((, )) "-__>--<_"-_ "--____---"' _/'/ /'
257 `"/ )` ) ,/| "-_">--<_/-__ __-" _/
258 ._-"//( )/ )) ` ""-'_/_/ /"""""""__--"
259 ;'( ')/ ,)( """"""""""