2 * @file internal.h Internal definitions and includes
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 #ifndef _PURPLE_INTERNAL_H_
27 #define _PURPLE_INTERNAL_H_
33 /* for SIOCGIFCONF in SKYOS */
35 #include <net/sockios.h>
38 * If we're using NLS, make sure gettext works. If not, then define
39 * dummy macros in place of the normal gettext macros.
41 * Also, the perl XS config.h file sometimes defines _ So we need to
42 * make sure _ isn't already defined before trying to define it.
44 * The Singular/Plural/Number ngettext dummy definition below was
45 * taken from an email to the texinfo mailing list by Manuel Guerrero.
46 * Thank you Manuel, and thank you Alex's good friend Google.
51 # define _(String) ((const char *)dgettext(PACKAGE, String))
53 # define N_(String) gettext_noop (String)
55 # define N_(String) (String)
59 # define N_(String) (String)
61 # define _(String) ((const char *)String)
63 # define ngettext(Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural))
64 # define dngettext(Domain, Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural))
72 /* The above should normally be the same as BUF_LEN,
73 * but just so we're explicitly asking for the max message
75 #define BUF_LEN MSG_LEN
76 #define BUF_LONG BUF_LEN * 2
79 #include <sys/types.h>
98 #ifdef HAVE_LANGINFO_CODESET
104 #ifdef PURPLE_PLUGINS
111 # include <netinet/in.h>
112 # include <sys/socket.h>
113 # include <arpa/inet.h>
115 # include <sys/utsname.h>
121 #ifndef HOST_NAME_MAX
122 # define HOST_NAME_MAX 255
127 /* This wasn't introduced until Glib 2.14 :( */
129 # if GLIB_SIZEOF_LONG == 8
130 # define G_MAXSSIZE ((gssize) 0x7fffffffffffffff)
132 # define G_MAXSSIZE ((gssize) 0x7fffffff)
136 #include <glib/gstdio.h>
139 #include "win32dep.h"
143 #if SIZEOF_TIME_T == 4
144 # define PURPLE_TIME_T_MODIFIER "lu"
145 #elif SIZEOF_TIME_T == 8
146 # define PURPLE_TIME_T_MODIFIER "zu"
148 #error Unknown size of time_t
152 #include <glib-object.h>
154 /* Safer ways to work with static buffers. When using non-static
155 * buffers, either use g_strdup_* functions (preferred) or use
156 * g_strlcpy/g_strlcpy directly. */
157 #define purple_strlcpy(dest, src) g_strlcpy(dest, src, sizeof(dest))
158 #define purple_strlcat(dest, src) g_strlcat(dest, src, sizeof(dest))
160 #define PURPLE_WEBSITE "http://pidgin.im/"
161 #define PURPLE_DEVEL_WEBSITE "http://developer.pidgin.im/"
164 /* INTERNAL FUNCTIONS */
167 #include "connection.h"
169 /* This is for the accounts code to notify the buddy icon code that
170 * it's done loading. We may want to replace this with a signal. */
172 _purple_buddy_icons_account_loaded_cb(void);
174 /* This is for the buddy list to notify the buddy icon code that
175 * it's done loading. We may want to replace this with a signal. */
177 _purple_buddy_icons_blist_loaded_cb(void);
179 /* This is for the purple_core_migrate() code to tell the buddy
180 * icon subsystem about the old icons directory so it can
181 * migrate any icons in use. */
183 _purple_buddy_icon_set_old_icons_dir(const char *dirname
);
186 * Creates a connection to the specified account and either connects
187 * or attempts to register a new account. If you are logging in,
188 * the connection uses the current active status for this account.
189 * So if you want to sign on as "away," for example, you need to
190 * have called purple_account_set_status(account, "away").
191 * (And this will call purple_account_connect() automatically).
193 * @note This function should only be called by purple_account_connect()
194 * in account.c. If you're trying to sign on an account, use that
197 * @param account The account the connection should be connecting to.
198 * @param regist Whether we are registering a new account or just
199 * trying to do a normal signon.
200 * @param password The password to use.
202 void _purple_connection_new(PurpleAccount
*account
, gboolean regist
,
203 const char *password
);
205 * Tries to unregister the account on the server. If the account is not
206 * connected, also creates a new connection.
208 * @note This function should only be called by purple_account_unregister()
211 * @param account The account to unregister
212 * @param password The password to use.
213 * @param cb Optional callback to be called when unregistration is complete
214 * @param user_data user data to pass to the callback
216 void _purple_connection_new_unregister(PurpleAccount
*account
, const char *password
,
217 PurpleAccountUnregistrationCb cb
, void *user_data
);
219 * Disconnects and destroys a PurpleConnection.
221 * @note This function should only be called by purple_account_disconnect()
222 * in account.c. If you're trying to sign off an account, use that
225 * @param gc The purple connection to destroy.
227 void _purple_connection_destroy(PurpleConnection
*gc
);
229 #endif /* _PURPLE_INTERNAL_H_ */