diff libpurple/account.h @ 21366:8858a42ca237

Make PurpleAccount keep track of the last connection error suffered (or not, if the account is happily connected or is disconnected without error). Add a signal which fires when the current error changes, and an accessor to get the current error. The error itself is stored inside a private struct.
author Will Thompson <will.thompson@collabora.co.uk>
date Sat, 27 Oct 2007 17:26:17 +0000
parents f296be2a1039
children 71c1f2da4ff2
line wrap: on
line diff
--- a/libpurple/account.h	Sat Oct 27 12:14:15 2007 +0000
+++ b/libpurple/account.h	Sat Oct 27 17:26:17 2007 +0000
@@ -140,8 +140,19 @@
 	void *ui_data;              /**< The UI can put data here.              */
 	PurpleAccountRegistrationCb registration_cb;
 	void *registration_cb_user_data;
+
+	gpointer priv;              /**< Pointer to opaque private data. */
 };
 
+/** The error most recently encountered on an account. */
+typedef struct
+{
+	/** The type of error. */
+	PurpleConnectionError reason;
+	/** A localised, human-readable description of the error. */
+	const char *description;
+} PurpleAccountCurrentError;
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -893,6 +904,16 @@
  */
 gboolean purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy);
 
+/**
+ * Get the error that caused the account to be disconnected, or @c NULL if the
+ * account is happily connected or disconnected without an error.
+ *
+ * @param account The account whose error should be retrieved.
+ * @constreturn   The type of error and a human-readable description of the
+ *                current error, or @c NULL if there is no current error.
+ */
+const PurpleAccountCurrentError *purple_account_get_current_error(PurpleAccount *account);
+
 /*@}*/
 
 /**************************************************************************/