2 * @file core.h Startup and shutdown of libpurple
3 * @defgroup core libpurple
4 * @see @ref core-signals
9 * Purple is the legal property of its developers, whose names are too numerous
10 * to list here. Please refer to the COPYRIGHT file distributed with this
11 * source distribution.
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
27 #ifndef _PURPLE_CORE_H_
28 #define _PURPLE_CORE_H_
30 typedef struct PurpleCore PurpleCore;
32 /** Callbacks that fire at different points of the initialization and teardown
33 * of libpurple, along with a hook to return descriptive information about the
38 /** Called just after the preferences subsystem is initialized; the UI
39 * could use this callback to add some preferences it needs to be in
40 * place when other subsystems are initialized.
42 void (*ui_prefs_init)(void);
43 /** Called just after the debug subsystem is initialized, but before
44 * just about every other component's initialization. The UI should
45 * use this hook to call purple_debug_set_ui_ops() so that debugging
46 * information for other components can be logged during their
49 void (*debug_ui_init)(void);
50 /** Called after all of libpurple has been initialized. The UI should
51 * use this hook to set all other necessary UiOps structures.
55 void (*ui_init)(void);
56 /** Called after most of libpurple has been uninitialized. */
59 /** Called by purple_core_get_ui_info(); should return the information
62 GHashTable* (*get_ui_info)(void);
64 void (*_purple_reserved1)(void);
65 void (*_purple_reserved2)(void);
66 void (*_purple_reserved3)(void);
74 * Initializes the core of purple.
76 * This will setup preferences for all the core subsystems.
78 * @param ui The ID of the UI using the core. This should be a
79 * unique ID, registered with the purple team.
81 * @return @c TRUE if successful, or @c FALSE otherwise.
83 gboolean purple_core_init(const char *ui);
86 * Quits the core of purple, which, depending on the UI, may quit the
87 * application using the purple core.
89 void purple_core_quit(void);
93 * Calls purple_core_quit(). This can be used as the function
94 * passed to purple_timeout_add() when you want to shutdown Purple
95 * in a specified amount of time. When shutting down Purple
96 * from a plugin, you must use this instead of purple_core_quit();
97 * for an immediate exit, use a timeout value of 0:
100 * <code>purple_timeout_add(0, purple_core_quitcb, NULL);</code>
103 * This is ensures that code from your plugin is not being
104 * executed when purple_core_quit() is called. If the plugin
105 * called purple_core_quit() directly, you would get a core dump
106 * after purple_core_quit() executes and control returns to your
107 * plugin because purple_core_quit() frees all plugins.
110 gboolean purple_core_quit_cb(gpointer unused);
113 * Returns the version of the core library.
115 * @return The version of the core library.
117 const char *purple_core_get_version(void);
120 * Returns the ID of the UI that is using the core, as passed to
121 * purple_core_init().
123 * @return The ID of the UI that is currently using the core.
125 const char *purple_core_get_ui(void);
128 * Returns a handle to the purple core.
130 * This is used to connect to @ref core-signals "core signals".
132 PurpleCore *purple_get_core(void);
135 * Sets the UI ops for the core.
137 * @param ops A UI ops structure for the core.
139 void purple_core_set_ui_ops(PurpleCoreUiOps *ops);
142 * Returns the UI ops for the core.
144 * @return The core's UI ops structure.
146 PurpleCoreUiOps *purple_core_get_ui_ops(void);
149 * Migrates from <tt>.gaim</tt> to <tt>.purple</tt>.
151 * UIs <strong>must not</strong> call this if they have been told to use a
152 * custom user directory.
154 * @return A boolean indicating success or migration failure. On failure,
155 * the application must display an error to the user and then exit.
157 gboolean purple_core_migrate(void);
160 * Ensures that only one instance is running. If libpurple is built with D-Bus
161 * support, this checks if another process owns the libpurple bus name and if
162 * so whether that process is using the same configuration directory as this
165 * @return @c TRUE if this is the first instance of libpurple running;
166 * @c FALSE if there is another instance running.
170 gboolean purple_core_ensure_single_instance(void);
173 * Returns a hash table containing various information about the UI. The
174 * following well-known entries may be in the table (along with any others the
175 * UI might choose to include):
178 * <dt><tt>name</tt></dt>
179 * <dd>the user-readable name for the UI.</dd>
181 * <dt><tt>version</tt></dt>
182 * <dd>a user-readable description of the current version of the UI.</dd>
184 * <dt><tt>website</tt></dt>
185 * <dd>the UI's website, such as http://pidgin.im.</dd>
187 * <dt><tt>dev_website</tt></dt>
188 * <dd>the UI's development/support website, such as http://developer.pidgin.im.</dd>
190 * <dt><tt>client_type</tt></dt>
191 * <dd>the type of UI. Possible values include 'pc', 'console', 'phone',
192 * 'handheld', 'web', and 'bot'. These values are compared
193 * programmatically and should not be localized.</dd>
197 * @return A GHashTable with strings for keys and values. This
198 * hash table must not be freed and should not be modified.
203 GHashTable* purple_core_get_ui_info(void);
209 #endif /* _PURPLE_CORE_H_ */
214 `//"\\ """"`---.___.-""
215 ______-==| | | \\ _-"`
216 __--""" ,-/-==\\ | | `\ ,'
217 _-" /' | \\ ___ / / \ /
218 .' / | \\ /" "\ /' / \ /'
219 / ____ / | \`\.__/-"" D O \_/' / \/'
220 /-'" """""---__ | "-/" O G R /' _--"`
221 \_| / R __--_ t ), __--""
222 '""--_/ T _-"_>--<_\ h '-" \
223 {\__--_/} / \\__>--<__\ e B \
224 /' (_/ _-" | |__>--<__| U |
225 | _/) )-" | |__>--<__| R |
226 / /" ,_/ / /__>---<__/ N |
227 o-o _// /-"_>---<__-" I /
228 (^(" /"_>---<__- N _-"
230 ,//('( |__>--<__| T / .----_
231 ( ( ')) |__>--<__| | /' _---_"\
232 `-)) )) ( |__>--<__| O | /' / "\`\
233 ,/,'//( ( \__>--<__\ R \ /' // ||
234 ,( ( ((, )) "-__>--<_"-_ "--____---"' _/'/ /'
235 `"/ )` ) ,/| "-_">--<_/-__ __-" _/
236 ._-"//( )/ )) ` ""-'_/_/ /"""""""__--"
237 ;'( ')/ ,)( """"""""""