Frameworks/libpurple.framework/Versions/0.6.2/Headers/internal.h
changeset 2592 e8d15275025e
parent 2535 39c3c161de14
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Frameworks/libpurple.framework/Versions/0.6.2/Headers/internal.h	Fri Aug 21 13:25:11 2009 -0700
     1.3 @@ -0,0 +1,352 @@
     1.4 +/**
     1.5 + * @file internal.h Internal definitions and includes
     1.6 + * @ingroup core
     1.7 + */
     1.8 +
     1.9 +/* purple
    1.10 + *
    1.11 + * Purple is the legal property of its developers, whose names are too numerous
    1.12 + * to list here.  Please refer to the COPYRIGHT file distributed with this
    1.13 + * source distribution.
    1.14 + *
    1.15 + * This program is free software; you can redistribute it and/or modify
    1.16 + * it under the terms of the GNU General Public License as published by
    1.17 + * the Free Software Foundation; either version 2 of the License, or
    1.18 + * (at your option) any later version.
    1.19 + *
    1.20 + * This program is distributed in the hope that it will be useful,
    1.21 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.22 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.23 + * GNU General Public License for more details.
    1.24 + *
    1.25 + * You should have received a copy of the GNU General Public License
    1.26 + * along with this program; if not, write to the Free Software
    1.27 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
    1.28 + */
    1.29 +#ifndef _PURPLE_INTERNAL_H_
    1.30 +#define _PURPLE_INTERNAL_H_
    1.31 +
    1.32 +#ifdef HAVE_CONFIG_H
    1.33 +# include <config.h>
    1.34 +#endif
    1.35 +
    1.36 +/* for SIOCGIFCONF  in SKYOS */
    1.37 +#ifdef SKYOS
    1.38 +#include <net/sockios.h>
    1.39 +#endif
    1.40 +/*
    1.41 + * If we're using NLS, make sure gettext works.  If not, then define
    1.42 + * dummy macros in place of the normal gettext macros.
    1.43 + *
    1.44 + * Also, the perl XS config.h file sometimes defines _  So we need to
    1.45 + * make sure _ isn't already defined before trying to define it.
    1.46 + *
    1.47 + * The Singular/Plural/Number ngettext dummy definition below was
    1.48 + * taken from an email to the texinfo mailing list by Manuel Guerrero.
    1.49 + * Thank you Manuel, and thank you Alex's good friend Google.
    1.50 + */
    1.51 +#ifdef ENABLE_NLS
    1.52 +#  include <locale.h>
    1.53 +#  include <libintl.h>
    1.54 +#  define _(String) ((const char *)dgettext(PACKAGE, String))
    1.55 +#  ifdef gettext_noop
    1.56 +#    define N_(String) gettext_noop (String)
    1.57 +#  else
    1.58 +#    define N_(String) (String)
    1.59 +#  endif
    1.60 +#else
    1.61 +#  include <locale.h>
    1.62 +#  define N_(String) (String)
    1.63 +#  ifndef _
    1.64 +#    define _(String) ((const char *)String)
    1.65 +#  endif
    1.66 +#  define ngettext(Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural))
    1.67 +#  define dngettext(Domain, Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural))
    1.68 +#endif
    1.69 +
    1.70 +#ifdef HAVE_ENDIAN_H
    1.71 +# include <endian.h>
    1.72 +#endif
    1.73 +
    1.74 +#define MSG_LEN 2048
    1.75 +/* The above should normally be the same as BUF_LEN,
    1.76 + * but just so we're explicitly asking for the max message
    1.77 + * length. */
    1.78 +#define BUF_LEN MSG_LEN
    1.79 +#define BUF_LONG BUF_LEN * 2
    1.80 +
    1.81 +#include <sys/stat.h>
    1.82 +#include <sys/types.h>
    1.83 +#ifndef _WIN32
    1.84 +#include <sys/time.h>
    1.85 +#include <sys/wait.h>
    1.86 +#include <sys/time.h>
    1.87 +#endif
    1.88 +#include <ctype.h>
    1.89 +#include <errno.h>
    1.90 +#include <fcntl.h>
    1.91 +#include <math.h>
    1.92 +#include <stdio.h>
    1.93 +#include <stdlib.h>
    1.94 +#include <string.h>
    1.95 +#include <time.h>
    1.96 +
    1.97 +#ifdef HAVE_ICONV
    1.98 +#include <iconv.h>
    1.99 +#endif
   1.100 +
   1.101 +#ifdef HAVE_LANGINFO_CODESET
   1.102 +#include <langinfo.h>
   1.103 +#endif
   1.104 +
   1.105 +#include <gmodule.h>
   1.106 +
   1.107 +#ifdef PURPLE_PLUGINS
   1.108 +# ifdef HAVE_DLFCN_H
   1.109 +#  include <dlfcn.h>
   1.110 +# endif
   1.111 +#endif
   1.112 +
   1.113 +#ifndef _WIN32
   1.114 +# include <netinet/in.h>
   1.115 +# include <sys/socket.h>
   1.116 +# include <arpa/inet.h>
   1.117 +# include <sys/un.h>
   1.118 +# include <sys/utsname.h>
   1.119 +# include <netdb.h>
   1.120 +# include <signal.h>
   1.121 +# include <unistd.h>
   1.122 +#endif
   1.123 +
   1.124 +/* MAXPATHLEN should only be used with readlink() on glib < 2.4.0.  For
   1.125 + * anything else, use g_file_read_link() or other dynamic functions.  This is
   1.126 + * important because Hurd has no hard limits on path length. */
   1.127 +#if !GLIB_CHECK_VERSION(2,4,0)
   1.128 +# ifndef MAXPATHLEN
   1.129 +#  ifdef PATH_MAX
   1.130 +#   define MAXPATHLEN PATH_MAX
   1.131 +#  else
   1.132 +#   define MAXPATHLEN 1024
   1.133 +#  endif
   1.134 +# endif
   1.135 +#endif
   1.136 +
   1.137 +#ifndef HOST_NAME_MAX
   1.138 +# define HOST_NAME_MAX 255
   1.139 +#endif
   1.140 +
   1.141 +#include <glib.h>
   1.142 +#if !GLIB_CHECK_VERSION(2,4,0)
   1.143 +#	define G_MAXUINT32 ((guint32) 0xffffffff)
   1.144 +#endif
   1.145 +
   1.146 +#ifndef G_MAXSIZE
   1.147 +#	if GLIB_SIZEOF_LONG == 8
   1.148 +#		define G_MAXSIZE ((gsize) 0xffffffffffffffff)
   1.149 +#	else
   1.150 +#		define G_MAXSIZE ((gsize) 0xffffffff)
   1.151 +#	endif
   1.152 +#endif
   1.153 +
   1.154 +#ifndef G_MAXSSIZE
   1.155 +#	if GLIB_SIZEOF_LONG == 8
   1.156 +#		define G_MAXSSIZE ((gssize) 0x7fffffffffffffff)
   1.157 +#	else
   1.158 +#		define G_MAXSSIZE ((gssize) 0x7fffffff)
   1.159 +#	endif
   1.160 +#endif
   1.161 +
   1.162 +#if GLIB_CHECK_VERSION(2,6,0)
   1.163 +#	include <glib/gstdio.h>
   1.164 +#endif
   1.165 +
   1.166 +#if !GLIB_CHECK_VERSION(2,6,0)
   1.167 +#	define g_freopen freopen
   1.168 +#	define g_fopen fopen
   1.169 +#	define g_rmdir rmdir
   1.170 +#	define g_remove remove
   1.171 +#	define g_unlink unlink
   1.172 +#	define g_lstat lstat
   1.173 +#	define g_stat stat
   1.174 +#	define g_mkdir mkdir
   1.175 +#	define g_rename rename
   1.176 +#	define g_open open
   1.177 +#endif
   1.178 +
   1.179 +#if !GLIB_CHECK_VERSION(2,8,0) && !defined _WIN32
   1.180 +#	define g_access access
   1.181 +#endif
   1.182 +
   1.183 +#if !GLIB_CHECK_VERSION(2,10,0)
   1.184 +#	define g_slice_new(type) g_new(type, 1)
   1.185 +#	define g_slice_new0(type) g_new0(type, 1)
   1.186 +#	define g_slice_free(type, mem) g_free(mem)
   1.187 +#endif
   1.188 +
   1.189 +#ifdef _WIN32
   1.190 +#include "win32dep.h"
   1.191 +#endif
   1.192 +
   1.193 +/* ugly ugly ugly */
   1.194 +/* This is a workaround for the fact that G_GINT64_MODIFIER and G_GSIZE_FORMAT
   1.195 + * are only defined in Glib >= 2.4 */
   1.196 +#ifndef G_GINT64_MODIFIER
   1.197 +#	if GLIB_SIZEOF_LONG == 8
   1.198 +#		define G_GINT64_MODIFIER "l"
   1.199 +#	else
   1.200 +#		define G_GINT64_MODIFIER "ll"
   1.201 +#	endif
   1.202 +#endif
   1.203 +
   1.204 +#ifndef G_GSIZE_MODIFIER
   1.205 +#	if GLIB_SIZEOF_LONG == 8
   1.206 +#		define G_GSIZE_MODIFIER "l"
   1.207 +#	else
   1.208 +#		define G_GSIZE_MODIFIER ""
   1.209 +#	endif
   1.210 +#endif
   1.211 +
   1.212 +#ifndef G_GSIZE_FORMAT
   1.213 +#	if GLIB_SIZEOF_LONG == 8
   1.214 +#		define G_GSIZE_FORMAT "lu"
   1.215 +#	else
   1.216 +#		define G_GSIZE_FORMAT "u"
   1.217 +#	endif
   1.218 +#endif
   1.219 +
   1.220 +#ifndef G_GSSIZE_FORMAT
   1.221 +#	if GLIB_SIZEOF_LONG == 8
   1.222 +#		define G_GSSIZE_FORMAT "li"
   1.223 +#	else
   1.224 +#		define G_GSSIZE_FORMAT "i"
   1.225 +#	endif
   1.226 +#endif
   1.227 +
   1.228 +#ifndef G_GNUC_NULL_TERMINATED
   1.229 +#	if     __GNUC__ >= 4
   1.230 +#		define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
   1.231 +#	else
   1.232 +#		define G_GNUC_NULL_TERMINATED
   1.233 +#	endif
   1.234 +#endif
   1.235 +
   1.236 +#ifdef HAVE_CONFIG_H
   1.237 +#if SIZEOF_TIME_T == 4
   1.238 +#	define PURPLE_TIME_T_MODIFIER "lu"
   1.239 +#elif SIZEOF_TIME_T == 8
   1.240 +#	define PURPLE_TIME_T_MODIFIER "zu"
   1.241 +#else
   1.242 +#error Unknown size of time_t
   1.243 +#endif
   1.244 +#endif
   1.245 +
   1.246 +#include <glib-object.h>
   1.247 +
   1.248 +#ifndef G_DEFINE_TYPE
   1.249 +#define G_DEFINE_TYPE(TypeName, type_name, TYPE_PARENT) \
   1.250 +\
   1.251 +static void     type_name##_init              (TypeName        *self); \
   1.252 +static void     type_name##_class_init        (TypeName##Class *klass); \
   1.253 +static gpointer type_name##_parent_class = NULL; \
   1.254 +static void     type_name##_class_intern_init (gpointer klass) \
   1.255 +{ \
   1.256 +  type_name##_parent_class = g_type_class_peek_parent (klass); \
   1.257 +  type_name##_class_init ((TypeName##Class*) klass); \
   1.258 +} \
   1.259 +\
   1.260 +GType \
   1.261 +type_name##_get_type (void) \
   1.262 +{ \
   1.263 +  static GType g_define_type_id = 0; \
   1.264 +  if (G_UNLIKELY (g_define_type_id == 0)) \
   1.265 +    { \
   1.266 +      g_define_type_id = \
   1.267 +        g_type_register_static_simple (TYPE_PARENT, \
   1.268 +                                       g_intern_static_string (#TypeName), \
   1.269 +                                       sizeof (TypeName##Class), \
   1.270 +                                       (GClassInitFunc)type_name##_class_intern_init, \
   1.271 +                                       sizeof (TypeName), \
   1.272 +                                       (GInstanceInitFunc)type_name##_init, \
   1.273 +                                       (GTypeFlags) 0); \
   1.274 +    }					\
   1.275 +  return g_define_type_id;		\
   1.276 +} /* closes type_name##_get_type() */
   1.277 +
   1.278 +#endif
   1.279 +
   1.280 +/* Safer ways to work with static buffers. When using non-static
   1.281 + * buffers, either use g_strdup_* functions (preferred) or use
   1.282 + * g_strlcpy/g_strlcpy directly. */
   1.283 +#define purple_strlcpy(dest, src) g_strlcpy(dest, src, sizeof(dest))
   1.284 +#define purple_strlcat(dest, src) g_strlcat(dest, src, sizeof(dest))
   1.285 +
   1.286 +#define PURPLE_WEBSITE "http://pidgin.im/"
   1.287 +#define PURPLE_DEVEL_WEBSITE "http://developer.pidgin.im/"
   1.288 +
   1.289 +
   1.290 +/* INTERNAL FUNCTIONS */
   1.291 +
   1.292 +#include "account.h"
   1.293 +#include "connection.h"
   1.294 +
   1.295 +/* This is for the accounts code to notify the buddy icon code that
   1.296 + * it's done loading.  We may want to replace this with a signal. */
   1.297 +void
   1.298 +_purple_buddy_icons_account_loaded_cb(void);
   1.299 +
   1.300 +/* This is for the buddy list to notify the buddy icon code that
   1.301 + * it's done loading.  We may want to replace this with a signal. */
   1.302 +void
   1.303 +_purple_buddy_icons_blist_loaded_cb(void);
   1.304 +
   1.305 +/* This is for the purple_core_migrate() code to tell the buddy
   1.306 + * icon subsystem about the old icons directory so it can
   1.307 + * migrate any icons in use. */
   1.308 +void
   1.309 +_purple_buddy_icon_set_old_icons_dir(const char *dirname);
   1.310 +
   1.311 +/**
   1.312 + * Creates a connection to the specified account and either connects
   1.313 + * or attempts to register a new account.  If you are logging in,
   1.314 + * the connection uses the current active status for this account.
   1.315 + * So if you want to sign on as "away," for example, you need to
   1.316 + * have called purple_account_set_status(account, "away").
   1.317 + * (And this will call purple_account_connect() automatically).
   1.318 + *
   1.319 + * @note This function should only be called by purple_account_connect()
   1.320 + *       in account.c.  If you're trying to sign on an account, use that
   1.321 + *       function instead.
   1.322 + *
   1.323 + * @param account  The account the connection should be connecting to.
   1.324 + * @param regist   Whether we are registering a new account or just
   1.325 + *                 trying to do a normal signon.
   1.326 + * @param password The password to use.
   1.327 + */
   1.328 +void _purple_connection_new(PurpleAccount *account, gboolean regist,
   1.329 +                            const char *password);
   1.330 +/**
   1.331 + * Tries to unregister the account on the server. If the account is not
   1.332 + * connected, also creates a new connection.
   1.333 + *
   1.334 + * @note This function should only be called by purple_account_unregister()
   1.335 + *       in account.c.
   1.336 + *
   1.337 + * @param account  The account to unregister
   1.338 + * @param password The password to use.
   1.339 + * @param cb Optional callback to be called when unregistration is complete
   1.340 + * @param user_data user data to pass to the callback
   1.341 + */
   1.342 +void _purple_connection_new_unregister(PurpleAccount *account, const char *password,
   1.343 +                                       PurpleAccountUnregistrationCb cb, void *user_data);
   1.344 +/**
   1.345 + * Disconnects and destroys a PurpleConnection.
   1.346 + *
   1.347 + * @note This function should only be called by purple_account_disconnect()
   1.348 + *        in account.c.  If you're trying to sign off an account, use that
   1.349 + *        function instead.
   1.350 + *
   1.351 + * @param gc The purple connection to destroy.
   1.352 + */
   1.353 +void _purple_connection_destroy(PurpleConnection *gc);
   1.354 +
   1.355 +#endif /* _PURPLE_INTERNAL_H_ */