Frameworks/libpurple.framework/Versions/0.6.2/Headers/connection.h
changeset 2592 e8d15275025e
parent 2504 97ec2ce929ec
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Frameworks/libpurple.framework/Versions/0.6.2/Headers/connection.h	Fri Aug 21 13:25:11 2009 -0700
     1.3 @@ -0,0 +1,625 @@
     1.4 +/**
     1.5 + * @file connection.h Connection API
     1.6 + * @ingroup core
     1.7 + * @see @ref connection-signals
     1.8 + */
     1.9 +
    1.10 +/* purple
    1.11 + *
    1.12 + * Purple is the legal property of its developers, whose names are too numerous
    1.13 + * to list here.  Please refer to the COPYRIGHT file distributed with this
    1.14 + * source distribution.
    1.15 + *
    1.16 + * This program is free software; you can redistribute it and/or modify
    1.17 + * it under the terms of the GNU General Public License as published by
    1.18 + * the Free Software Foundation; either version 2 of the License, or
    1.19 + * (at your option) any later version.
    1.20 + *
    1.21 + * This program is distributed in the hope that it will be useful,
    1.22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.24 + * GNU General Public License for more details.
    1.25 + *
    1.26 + * You should have received a copy of the GNU General Public License
    1.27 + * along with this program; if not, write to the Free Software
    1.28 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
    1.29 + */
    1.30 +#ifndef _PURPLE_CONNECTION_H_
    1.31 +#define _PURPLE_CONNECTION_H_
    1.32 +
    1.33 +/** @copydoc _PurpleConnection */
    1.34 +typedef struct _PurpleConnection PurpleConnection;
    1.35 +
    1.36 +/**
    1.37 + * Flags to change behavior of the client for a given connection.
    1.38 + */
    1.39 +typedef enum
    1.40 +{
    1.41 +	PURPLE_CONNECTION_HTML       = 0x0001, /**< Connection sends/receives in 'HTML'. */
    1.42 +	PURPLE_CONNECTION_NO_BGCOLOR = 0x0002, /**< Connection does not send/receive
    1.43 +					           background colors.                  */
    1.44 +	PURPLE_CONNECTION_AUTO_RESP  = 0x0004,  /**< Send auto responses when away.       */
    1.45 +	PURPLE_CONNECTION_FORMATTING_WBFO = 0x0008, /**< The text buffer must be formatted as a whole */
    1.46 +	PURPLE_CONNECTION_NO_NEWLINES = 0x0010, /**< No new lines are allowed in outgoing messages */
    1.47 +	PURPLE_CONNECTION_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */
    1.48 +	PURPLE_CONNECTION_NO_URLDESC = 0x0040,  /**< Connection does not support descriptions with links */
    1.49 +	PURPLE_CONNECTION_NO_IMAGES = 0x0080,  /**< Connection does not support sending of images */
    1.50 +	PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY = 0x0100 /**< Connection supports sending and receiving custom smileys */
    1.51 +
    1.52 +} PurpleConnectionFlags;
    1.53 +
    1.54 +typedef enum
    1.55 +{
    1.56 +	PURPLE_DISCONNECTED = 0, /**< Disconnected. */
    1.57 +	PURPLE_CONNECTED,        /**< Connected.    */
    1.58 +	PURPLE_CONNECTING        /**< Connecting.   */
    1.59 +
    1.60 +} PurpleConnectionState;
    1.61 +
    1.62 +/**
    1.63 + * Possible errors that can cause a connection to be closed.
    1.64 + *
    1.65 + *  @since 2.3.0
    1.66 + */
    1.67 +typedef enum
    1.68 +{
    1.69 +	/** There was an error sending or receiving on the network socket, or
    1.70 +	 *  there was some protocol error (such as the server sending malformed
    1.71 +	 *  data).
    1.72 +	 */
    1.73 +	PURPLE_CONNECTION_ERROR_NETWORK_ERROR = 0,
    1.74 +	/** The username supplied was not valid. */
    1.75 +	PURPLE_CONNECTION_ERROR_INVALID_USERNAME = 1,
    1.76 +	/** The username, password or some other credential was incorrect.  Use
    1.77 +	 *  #PURPLE_CONNECTION_ERROR_INVALID_USERNAME instead if the username
    1.78 +	 *  is known to be invalid.
    1.79 +	 */
    1.80 +	PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED = 2,
    1.81 +	/** libpurple doesn't speak any of the authentication methods the
    1.82 +	 *  server offered.
    1.83 +	 */
    1.84 +	PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE = 3,
    1.85 +	/** libpurple was built without SSL support, and the connection needs
    1.86 +	 *  SSL.
    1.87 +	 */
    1.88 +	PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT = 4,
    1.89 +	/** There was an error negotiating SSL on this connection, or the
    1.90 +	 *  server does not support encryption but an account option was set to
    1.91 +	 *  require it.
    1.92 +	 */
    1.93 +	PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR = 5,
    1.94 +	/** Someone is already connected to the server using the name you are
    1.95 +	 *  trying to connect with.
    1.96 +	 */
    1.97 +	PURPLE_CONNECTION_ERROR_NAME_IN_USE = 6,
    1.98 +
    1.99 +	/** The username/server/other preference for the account isn't valid.
   1.100 +	 *  For instance, on IRC the username cannot contain white space.
   1.101 +	 *  This reason should not be used for incorrect passwords etc: use
   1.102 +	 *  #PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED for that.
   1.103 +	 *
   1.104 +	 *  @todo This reason really shouldn't be necessary.  Usernames and
   1.105 +	 *        other account preferences should be validated when the
   1.106 +	 *        account is created.
   1.107 +	 */
   1.108 +	PURPLE_CONNECTION_ERROR_INVALID_SETTINGS = 7,
   1.109 +
   1.110 +	/** The server did not provide a SSL certificate. */
   1.111 +	PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED = 8,
   1.112 +	/** The server's SSL certificate could not be trusted. */
   1.113 +	PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED = 9,
   1.114 +	/** The server's SSL certificate has expired. */
   1.115 +	PURPLE_CONNECTION_ERROR_CERT_EXPIRED = 10,
   1.116 +	/** The server's SSL certificate is not yet valid. */
   1.117 +	PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED = 11,
   1.118 +	/** The server's SSL certificate did not match its hostname. */
   1.119 +	PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH = 12,
   1.120 +	/** The server's SSL certificate does not have the expected
   1.121 +	 *  fingerprint.
   1.122 +	 */
   1.123 +	PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH = 13,
   1.124 +	/** The server's SSL certificate is self-signed.  */
   1.125 +	PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED = 14,
   1.126 +	/** There was some other error validating the server's SSL certificate.
   1.127 +	 */
   1.128 +	PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR = 15,
   1.129 +
   1.130 +	/** Some other error occurred which fits into none of the other
   1.131 +	 *  categories.
   1.132 +	 */
   1.133 +	/* purple_connection_error_reason() in connection.c uses the fact that
   1.134 +	 * this is the last member of the enum when sanity-checking; if other
   1.135 +	 * reasons are added after it, the check must be updated.
   1.136 +	 */
   1.137 +	PURPLE_CONNECTION_ERROR_OTHER_ERROR = 16
   1.138 +} PurpleConnectionError;
   1.139 +
   1.140 +/** Holds the type of an error along with its description. */
   1.141 +typedef struct
   1.142 +{
   1.143 +	/** The type of error. */
   1.144 +	PurpleConnectionError type;
   1.145 +	/** A localised, human-readable description of the error. */
   1.146 +	char *description;
   1.147 +} PurpleConnectionErrorInfo;
   1.148 +
   1.149 +#include <time.h>
   1.150 +
   1.151 +#include "account.h"
   1.152 +#include "plugin.h"
   1.153 +#include "status.h"
   1.154 +#include "sslconn.h"
   1.155 +
   1.156 +/**
   1.157 + * Connection UI operations.  Used to notify the user of changes to
   1.158 + * connections, such as being disconnected, and to respond to the
   1.159 + * underlying network connection appearing and disappearing.  UIs should
   1.160 + * call #purple_connections_set_ui_ops() with an instance of this struct.
   1.161 + *
   1.162 + * @see @ref ui-ops
   1.163 + */
   1.164 +typedef struct
   1.165 +{
   1.166 +	/**
   1.167 +	 * When an account is connecting, this operation is called to notify
   1.168 +	 * the UI of what is happening, as well as which @a step out of @a
   1.169 +	 * step_count has been reached (which might be displayed as a progress
   1.170 +	 * bar).
   1.171 +	 * @see #purple_connection_update_progress
   1.172 +	 */
   1.173 +	void (*connect_progress)(PurpleConnection *gc,
   1.174 +	                         const char *text,
   1.175 +	                         size_t step,
   1.176 +	                         size_t step_count);
   1.177 +
   1.178 +	/**
   1.179 +	 * Called when a connection is established (just before the
   1.180 +	 * @ref signed-on signal).
   1.181 +	 */
   1.182 +	void (*connected)(PurpleConnection *gc);
   1.183 +
   1.184 +	/**
   1.185 +	 * Called when a connection is ended (between the @ref signing-off
   1.186 +	 * and @ref signed-off signals).
   1.187 +	 */
   1.188 +	void (*disconnected)(PurpleConnection *gc);
   1.189 +
   1.190 +	/**
   1.191 +	 * Used to display connection-specific notices.  (Pidgin's Gtk user
   1.192 +	 * interface implements this as a no-op; #purple_connection_notice(),
   1.193 +	 * which uses this operation, is not used by any of the protocols
   1.194 +	 * shipped with libpurple.)
   1.195 +	 */
   1.196 +	void (*notice)(PurpleConnection *gc, const char *text);
   1.197 +
   1.198 +	/**
   1.199 +	 * Called when an error causes a connection to be disconnected.
   1.200 +	 * Called before #disconnected.
   1.201 +	 * @param text  a localized error message.
   1.202 +	 * @see #purple_connection_error
   1.203 +	 * @deprecated in favour of
   1.204 +	 *             #PurpleConnectionUiOps.report_disconnect_reason.
   1.205 +	 */
   1.206 +	void (*report_disconnect)(PurpleConnection *gc, const char *text);
   1.207 +
   1.208 +	/**
   1.209 +	 * Called when libpurple discovers that the computer's network
   1.210 +	 * connection is active.  On Linux, this uses Network Manager if
   1.211 +	 * available; on Windows, it uses Win32's network change notification
   1.212 +	 * infrastructure.
   1.213 +	 */
   1.214 +	void (*network_connected)(void);
   1.215 +
   1.216 +	/**
   1.217 +	 * Called when libpurple discovers that the computer's network
   1.218 +	 * connection has gone away.
   1.219 +	 */
   1.220 +	void (*network_disconnected)(void);
   1.221 +
   1.222 +	/**
   1.223 +	 * Called when an error causes a connection to be disconnected.
   1.224 +	 *  Called before #disconnected.  This op is intended to replace
   1.225 +	 *  #report_disconnect.  If both are implemented, this will be called
   1.226 +	 *  first; however, there's no real reason to implement both.
   1.227 +	 *
   1.228 +	 *  @param reason  why the connection ended, if known, or
   1.229 +	 *                 #PURPLE_CONNECTION_ERROR_OTHER_ERROR, if not.
   1.230 +	 *  @param text  a localized message describing the disconnection
   1.231 +	 *               in more detail to the user.
   1.232 +	 *  @see #purple_connection_error_reason
   1.233 +	 *
   1.234 +	 *  @since 2.3.0
   1.235 +	 */
   1.236 +	void (*report_disconnect_reason)(PurpleConnection *gc,
   1.237 +	                                 PurpleConnectionError reason,
   1.238 +	                                 const char *text);
   1.239 +
   1.240 +	void (*_purple_reserved1)(void);
   1.241 +	void (*_purple_reserved2)(void);
   1.242 +	void (*_purple_reserved3)(void);
   1.243 +} PurpleConnectionUiOps;
   1.244 +
   1.245 +
   1.246 +/* Represents an active connection on an account. */
   1.247 +struct _PurpleConnection
   1.248 +{
   1.249 +	PurplePlugin *prpl;            /**< The protocol plugin.               */
   1.250 +	PurpleConnectionFlags flags;   /**< Connection flags.                  */
   1.251 +
   1.252 +	PurpleConnectionState state;   /**< The connection state.              */
   1.253 +
   1.254 +	PurpleAccount *account;        /**< The account being connected to.    */
   1.255 +	char *password;              /**< The password used.                 */
   1.256 +	int inpa;                    /**< The input watcher.                 */
   1.257 +
   1.258 +	GSList *buddy_chats;         /**< A list of active chats
   1.259 +	                                  (#PurpleConversation structs of type
   1.260 +	                                  #PURPLE_CONV_TYPE_CHAT).           */
   1.261 +	void *proto_data;            /**< Protocol-specific data.            */
   1.262 +
   1.263 +	char *display_name;          /**< How you appear to other people.    */
   1.264 +	guint keepalive;             /**< Keep-alive.                        */
   1.265 +
   1.266 +	/** Wants to Die state.  This is set when the user chooses to log out, or
   1.267 +	 * when the protocol is disconnected and should not be automatically
   1.268 +	 * reconnected (incorrect password, etc.).  prpls should rely on
   1.269 +	 * purple_connection_error_reason() to set this for them rather than
   1.270 +	 * setting it themselves.
   1.271 +	 * @see purple_connection_error_is_fatal
   1.272 +	 */
   1.273 +	gboolean wants_to_die;
   1.274 +
   1.275 +	guint disconnect_timeout;    /**< Timer used for nasty stack tricks  */
   1.276 +	time_t last_received;        /**< When we last received a packet. Set by the
   1.277 +					  prpl to avoid sending unneeded keepalives */
   1.278 +};
   1.279 +
   1.280 +#ifdef __cplusplus
   1.281 +extern "C" {
   1.282 +#endif
   1.283 +
   1.284 +/**************************************************************************/
   1.285 +/** @name Connection API                                                  */
   1.286 +/**************************************************************************/
   1.287 +/*@{*/
   1.288 +
   1.289 +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_)
   1.290 +/**
   1.291 + * This function should only be called by purple_account_connect()
   1.292 + * in account.c.  If you're trying to sign on an account, use that
   1.293 + * function instead.
   1.294 + *
   1.295 + * Creates a connection to the specified account and either connects
   1.296 + * or attempts to register a new account.  If you are logging in,
   1.297 + * the connection uses the current active status for this account.
   1.298 + * So if you want to sign on as "away," for example, you need to
   1.299 + * have called purple_account_set_status(account, "away").
   1.300 + * (And this will call purple_account_connect() automatically).
   1.301 + *
   1.302 + * @param account  The account the connection should be connecting to.
   1.303 + * @param regist   Whether we are registering a new account or just
   1.304 + *                 trying to do a normal signon.
   1.305 + * @param password The password to use.
   1.306 + *
   1.307 + * @deprecated As this is internal, we should make it private in 3.0.0.
   1.308 + */
   1.309 +void purple_connection_new(PurpleAccount *account, gboolean regist,
   1.310 +									const char *password);
   1.311 +#endif
   1.312 +
   1.313 +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_)
   1.314 +/**
   1.315 + * This function should only be called by purple_account_unregister()
   1.316 + * in account.c.
   1.317 + *
   1.318 + * Tries to unregister the account on the server. If the account is not
   1.319 + * connected, also creates a new connection.
   1.320 + *
   1.321 + * @param account  The account to unregister
   1.322 + * @param password The password to use.
   1.323 + * @param cb Optional callback to be called when unregistration is complete
   1.324 + * @param user_data user data to pass to the callback
   1.325 + *
   1.326 + * @deprecated As this is internal, we should make it private in 3.0.0.
   1.327 + */
   1.328 +void purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data);
   1.329 +#endif
   1.330 +
   1.331 +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_)
   1.332 +/**
   1.333 + * Disconnects and destroys a PurpleConnection.
   1.334 + *
   1.335 + * This function should only be called by purple_account_disconnect()
   1.336 + * in account.c.  If you're trying to sign off an account, use that
   1.337 + * function instead.
   1.338 + *
   1.339 + * @param gc The purple connection to destroy.
   1.340 + *
   1.341 + * @deprecated As this is internal, we should make it private in 3.0.0.
   1.342 + */
   1.343 +void purple_connection_destroy(PurpleConnection *gc);
   1.344 +#endif
   1.345 +
   1.346 +/**
   1.347 + * Sets the connection state.  PRPLs should call this and pass in
   1.348 + * the state #PURPLE_CONNECTED when the account is completely
   1.349 + * signed on.  What does it mean to be completely signed on?  If
   1.350 + * the core can call prpl->set_status, and it successfully changes
   1.351 + * your status, then the account is online.
   1.352 + *
   1.353 + * @param gc    The connection.
   1.354 + * @param state The connection state.
   1.355 + */
   1.356 +void purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state);
   1.357 +
   1.358 +/**
   1.359 + * Sets the connection's account.
   1.360 + *
   1.361 + * @param gc      The connection.
   1.362 + * @param account The account.
   1.363 + */
   1.364 +void purple_connection_set_account(PurpleConnection *gc, PurpleAccount *account);
   1.365 +
   1.366 +/**
   1.367 + * Sets the connection's displayed name.
   1.368 + *
   1.369 + * @param gc   The connection.
   1.370 + * @param name The displayed name.
   1.371 + */
   1.372 +void purple_connection_set_display_name(PurpleConnection *gc, const char *name);
   1.373 +
   1.374 +/**
   1.375 + * Sets the protocol data for a connection.
   1.376 + *
   1.377 + * @param connection The PurpleConnection.
   1.378 + * @param proto_data The protocol data to set for the connection.
   1.379 + *
   1.380 + * @since 2.6.0
   1.381 + */
   1.382 +void purple_connection_set_protocol_data(PurpleConnection *connection, void *proto_data);
   1.383 +
   1.384 +/**
   1.385 + * Returns the connection state.
   1.386 + *
   1.387 + * @param gc The connection.
   1.388 + *
   1.389 + * @return The connection state.
   1.390 + */
   1.391 +PurpleConnectionState purple_connection_get_state(const PurpleConnection *gc);
   1.392 +
   1.393 +/**
   1.394 + * Returns TRUE if the account is connected, otherwise returns FALSE.
   1.395 + *
   1.396 + * @return TRUE if the account is connected, otherwise returns FALSE.
   1.397 + */
   1.398 +#define PURPLE_CONNECTION_IS_CONNECTED(gc) \
   1.399 +	(purple_connection_get_state(gc) == PURPLE_CONNECTED)
   1.400 +
   1.401 +/**
   1.402 + * Returns the connection's account.
   1.403 + *
   1.404 + * @param gc The connection.
   1.405 + *
   1.406 + * @return The connection's account.
   1.407 + */
   1.408 +PurpleAccount *purple_connection_get_account(const PurpleConnection *gc);
   1.409 +
   1.410 +/**
   1.411 + * Returns the protocol plugin managing a connection.
   1.412 + *
   1.413 + * @param gc The connection.
   1.414 + *
   1.415 + * @return The protocol plugin.
   1.416 + *
   1.417 + * @since 2.4.0
   1.418 + */
   1.419 +PurplePlugin * purple_connection_get_prpl(const PurpleConnection *gc);
   1.420 +
   1.421 +/**
   1.422 + * Returns the connection's password.
   1.423 + *
   1.424 + * @param gc The connection.
   1.425 + *
   1.426 + * @return The connection's password.
   1.427 + */
   1.428 +const char *purple_connection_get_password(const PurpleConnection *gc);
   1.429 +
   1.430 +/**
   1.431 + * Returns the connection's displayed name.
   1.432 + *
   1.433 + * @param gc The connection.
   1.434 + *
   1.435 + * @return The connection's displayed name.
   1.436 + */
   1.437 +const char *purple_connection_get_display_name(const PurpleConnection *gc);
   1.438 +
   1.439 +/**
   1.440 + * Gets the protocol data from a connection.
   1.441 + *
   1.442 + * @param connection The PurpleConnection.
   1.443 + *
   1.444 + * @return The protocol data for the connection.
   1.445 + *
   1.446 + * @since 2.6.0
   1.447 + */
   1.448 +void *purple_connection_get_protocol_data(const PurpleConnection *connection);
   1.449 +
   1.450 +/**
   1.451 + * Updates the connection progress.
   1.452 + *
   1.453 + * @param gc    The connection.
   1.454 + * @param text  Information on the current step.
   1.455 + * @param step  The current step.
   1.456 + * @param count The total number of steps.
   1.457 + */
   1.458 +void purple_connection_update_progress(PurpleConnection *gc, const char *text,
   1.459 +									 size_t step, size_t count);
   1.460 +
   1.461 +/**
   1.462 + * Displays a connection-specific notice.
   1.463 + *
   1.464 + * @param gc   The connection.
   1.465 + * @param text The notice text.
   1.466 + */
   1.467 +void purple_connection_notice(PurpleConnection *gc, const char *text);
   1.468 +
   1.469 +/**
   1.470 + * Closes a connection with an error.
   1.471 + *
   1.472 + * @param gc     The connection.
   1.473 + * @param reason The error text, which may not be @c NULL.
   1.474 + * @deprecated in favour of #purple_connection_error_reason.  Calling
   1.475 + *  @c purple_connection_error(gc, text) is equivalent to calling
   1.476 + *  @c purple_connection_error_reason(gc, reason, text) where @c reason is
   1.477 + *  #PURPLE_CONNECTION_ERROR_OTHER_ERROR if @c gc->wants_to_die is @c TRUE, and
   1.478 + *  #PURPLE_CONNECTION_ERROR_NETWORK_ERROR if not.  (This is to keep
   1.479 + *  auto-reconnection behaviour the same when using old prpls which don't use
   1.480 + *  reasons yet.)
   1.481 + */
   1.482 +void purple_connection_error(PurpleConnection *gc, const char *reason);
   1.483 +
   1.484 +/**
   1.485 + * Closes a connection with an error and a human-readable description of the
   1.486 + * error.  It also sets @c gc->wants_to_die to the value of
   1.487 + * #purple_connection_error_is_fatal(@a reason), mainly for
   1.488 + * backwards-compatibility.
   1.489 + *
   1.490 + * @param gc          the connection which is closing.
   1.491 + * @param reason      why the connection is closing.
   1.492 + * @param description a non-@c NULL localized description of the error.
   1.493 + *
   1.494 + * @since 2.3.0
   1.495 + */
   1.496 +void
   1.497 +purple_connection_error_reason (PurpleConnection *gc,
   1.498 +                                PurpleConnectionError reason,
   1.499 +                                const char *description);
   1.500 +
   1.501 +/**
   1.502 + * Closes a connection due to an SSL error; this is basically a shortcut to
   1.503 + * turning the #PurpleSslErrorType into a #PurpleConnectionError and a
   1.504 + * human-readable string and then calling purple_connection_error_reason().
   1.505 + *
   1.506 + * @since 2.3.0
   1.507 + */
   1.508 +void
   1.509 +purple_connection_ssl_error (PurpleConnection *gc,
   1.510 +                             PurpleSslErrorType ssl_error);
   1.511 +
   1.512 +/**
   1.513 + * Reports whether a disconnection reason is fatal (in which case the account
   1.514 + * should probably not be automatically reconnected) or transient (so
   1.515 + * auto-reconnection is a good idea).
   1.516 + * For instance, #PURPLE_CONNECTION_ERROR_NETWORK_ERROR is a temporary error,
   1.517 + * which might be caused by losing the network connection, so <tt>
   1.518 + * purple_connection_error_is_fatal (PURPLE_CONNECTION_ERROR_NETWORK_ERROR)</tt>
   1.519 + * is @c FALSE.  On the other hand,
   1.520 + * #PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED probably indicates a
   1.521 + * misconfiguration of the account which needs the user to go fix it up, so
   1.522 + * <tt> purple_connection_error_is_fatal
   1.523 + * (PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED)</tt> is @c TRUE.
   1.524 + *
   1.525 + * (This function is meant to replace checking PurpleConnection.wants_to_die.)
   1.526 + *
   1.527 + * @return @c TRUE if the account should not be automatically reconnected, and
   1.528 + *         @c FALSE otherwise.
   1.529 + *
   1.530 + * @since 2.3.0
   1.531 + */
   1.532 +gboolean
   1.533 +purple_connection_error_is_fatal (PurpleConnectionError reason);
   1.534 +
   1.535 +/*@}*/
   1.536 +
   1.537 +/**************************************************************************/
   1.538 +/** @name Connections API                                                 */
   1.539 +/**************************************************************************/
   1.540 +/*@{*/
   1.541 +
   1.542 +/**
   1.543 + * Disconnects from all connections.
   1.544 + */
   1.545 +void purple_connections_disconnect_all(void);
   1.546 +
   1.547 +/**
   1.548 + * Returns a list of all active connections.  This does not
   1.549 + * include connections that are in the process of connecting.
   1.550 + *
   1.551 + * @constreturn A list of all active connections.
   1.552 + */
   1.553 +GList *purple_connections_get_all(void);
   1.554 +
   1.555 +/**
   1.556 + * Returns a list of all connections in the process of connecting.
   1.557 + *
   1.558 + * @constreturn A list of connecting connections.
   1.559 + */
   1.560 +GList *purple_connections_get_connecting(void);
   1.561 +
   1.562 +/**
   1.563 + * Checks if gc is still a valid pointer to a gc.
   1.564 + *
   1.565 + * @return @c TRUE if gc is valid.
   1.566 + *
   1.567 + * @deprecated Do not use this.  Instead, cancel your asynchronous request
   1.568 + *             when the PurpleConnection is destroyed.
   1.569 + */
   1.570 +/*
   1.571 + * TODO: Eventually this bad boy will be removed, because it is
   1.572 + *       a gross fix for a crashy problem.
   1.573 + */
   1.574 +#define PURPLE_CONNECTION_IS_VALID(gc) (g_list_find(purple_connections_get_all(), (gc)) != NULL)
   1.575 +
   1.576 +/*@}*/
   1.577 +
   1.578 +/**************************************************************************/
   1.579 +/** @name UI Registration Functions                                       */
   1.580 +/**************************************************************************/
   1.581 +/*@{*/
   1.582 +
   1.583 +/**
   1.584 + * Sets the UI operations structure to be used for connections.
   1.585 + *
   1.586 + * @param ops The UI operations structure.
   1.587 + */
   1.588 +void purple_connections_set_ui_ops(PurpleConnectionUiOps *ops);
   1.589 +
   1.590 +/**
   1.591 + * Returns the UI operations structure used for connections.
   1.592 + *
   1.593 + * @return The UI operations structure in use.
   1.594 + */
   1.595 +PurpleConnectionUiOps *purple_connections_get_ui_ops(void);
   1.596 +
   1.597 +/*@}*/
   1.598 +
   1.599 +/**************************************************************************/
   1.600 +/** @name Connections Subsystem                                           */
   1.601 +/**************************************************************************/
   1.602 +/*@{*/
   1.603 +
   1.604 +/**
   1.605 + * Initializes the connections subsystem.
   1.606 + */
   1.607 +void purple_connections_init(void);
   1.608 +
   1.609 +/**
   1.610 + * Uninitializes the connections subsystem.
   1.611 + */
   1.612 +void purple_connections_uninit(void);
   1.613 +
   1.614 +/**
   1.615 + * Returns the handle to the connections subsystem.
   1.616 + *
   1.617 + * @return The connections subsystem handle.
   1.618 + */
   1.619 +void *purple_connections_get_handle(void);
   1.620 +
   1.621 +/*@}*/
   1.622 +
   1.623 +
   1.624 +#ifdef __cplusplus
   1.625 +}
   1.626 +#endif
   1.627 +
   1.628 +#endif /* _PURPLE_CONNECTION_H_ */