+cdef void signal_signed_on_cb(connection.PurpleConnection *gc, \
+ glib.gpointer null):
+ """
+ Emitted when a connection has signed on.
+ @params gc The connection that has signed on.
+ """
+ cdef account.PurpleAccount *acc = connection.purple_connection_get_account(gc)
+ cdef char *c_username = NULL
+ cdef char *c_protocol_id = NULL
+
+ c_username = <char *> account.purple_account_get_username(acc)
+ if c_username == NULL:
+ username = None
+ else:
+ username = c_username
+
+ c_protocol_id = <char *> account.purple_account_get_protocol_id(acc)
+ if c_protocol_id == NULL:
+ protocol_id = None
+ else:
+ protocol_id = c_protocol_id
+
+ if signal_cbs.has_key("signed-on"):
+ (<object> signal_cbs["signed-on"])(username, protocol_id)
+
+cdef void signal_signed_off_cb(connection.PurpleConnection *gc, \
+ glib.gpointer null):
+ """
+ Emitted when a connection has signed off.
+ @params gc The connection that has signed off.
+ """
+ cdef account.PurpleAccount *acc = connection.purple_connection_get_account(gc)
+ cdef char *c_username = NULL
+ cdef char *c_protocol_id = NULL
+
+ c_username = <char *> account.purple_account_get_username(acc)
+ if c_username == NULL:
+ username = None
+ else:
+ username = c_username
+
+ c_protocol_id = <char *> account.purple_account_get_protocol_id(acc)
+ if c_protocol_id == NULL:
+ protocol_id = None
+ else:
+ protocol_id = c_protocol_id
+
+ if signal_cbs.has_key("signed-off"):
+ (<object> signal_cbs["signed-off"])(username, protocol_id)
+
+cdef void signal_connection_error_cb(connection.PurpleConnection *gc, \
+ connection.PurpleConnectionError err, char *c_desc):
+ """
+ Emitted when a connection error occurs, before signed-off.
+ @params gc The connection on which the error has occured
+ @params err The error that occured
+ @params desc A description of the error, giving more information
+ """
+
+ short_desc = {
+ 0: "Network error",
+ 1: "Invalid username",
+ 2: "Authentication failed",
+ 3: "Authentication impossible",
+ 4: "No SSL support",
+ 5: "Encryption error",
+ 6: "Name in use",
+ 7: "Invalid settings",
+ 8: "SSL certificate not provided",
+ 9: "SSL certificate untrusted",
+ 10: "SSL certificate expired",
+ 11: "SSL certificate not activated",
+ 12: "SSL certificate hostname mismatch",
+ 13: "SSL certificate fingerprint mismatch",
+ 14: "SSL certificate self signed",
+ 15: "SSL certificate other error",
+ 16: "Other error" }[<int>err]
+
+ if c_desc == NULL:
+ desc = None