X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=connection_cbs.pxd;h=fd0d05ae439093cf38b48f3cadde632fe440e86a;hp=ca39432c171d6db569bbe1dbb727906ddbb98143;hb=501c0498d70144d950602879e44840e761e8cc00;hpb=07bfe51b3e6afa82ca011f8a4c29fb4d669ed848 diff --git a/connection_cbs.pxd b/connection_cbs.pxd index ca39432..fd0d05a 100644 --- a/connection_cbs.pxd +++ b/connection_cbs.pxd @@ -27,65 +27,58 @@ cdef extern from *: cdef void connect_progress (connection.PurpleConnection *gc, const_char *text, size_t step, size_t step_count): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection", - "connect_progress\n") - global connection_cbs + "connect-progress\n") try: - (connection_cbs["connect_progress"])("connect_progress") + (connection_cbs["connect-progress"])(text, step, step_count) except KeyError: pass cdef void connected (connection.PurpleConnection *gc): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection", "connected\n") - global connection_cbs try: - (connection_cbs["connected"])("connected") + (connection_cbs["connected"])("connected: TODO") except KeyError: pass cdef void disconnected (connection.PurpleConnection *gc): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection", "disconnected\n") - global connection_cbs try: - (connection_cbs["disconnected"])("disconnected") + (connection_cbs["disconnected"])("disconnected: TODO") except KeyError: pass cdef void notice (connection.PurpleConnection *gc, const_char *text): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection", "notice\n") - global connection_cbs try: - (connection_cbs["notice"])("notice") + (connection_cbs["notice"])("notice: TODO") except KeyError: pass cdef void report_disconnect (connection.PurpleConnection *gc, const_char *text): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection", - "report_disconnect\n") - global connection_cbs + "report-disconnect\n") try: - (connection_cbs["report_disconnect"])("report_disconnect") + (connection_cbs["report-disconnect"])(text) except KeyError: pass cdef void network_connected (): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection", - "network_connected\n") - global connection_cbs + "network-connected\n") try: - (connection_cbs["network_connected"])("network_connected") + (connection_cbs["network-connected"])("network-connected: TODO") except KeyError: pass cdef void network_disconnected (): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection", - "network_disconnected\n") - global connection_cbs + "network-disconnected\n") try: - (connection_cbs["network_disconnected"])("network_disconnected") + (connection_cbs["network-disconnected"])("network-disconnected: TODO") except KeyError: pass @@ -93,9 +86,28 @@ cdef void report_disconnect_reason (connection.PurpleConnection *gc, connection.PurpleConnectionError reason, const_char *text): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection", - "report_disconnect_reason\n") - global connection_cbs + "report-disconnect-reason\n") + + reason_string = { + 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: 'Certificate not provided', + 9: 'Certificate untrusted', + 10: 'Certificate expired', + 11: 'Certificate not activated', + 12: 'Certificate hostname mismatch', + 13: 'Certificate fingerprint mismatch', + 14: 'Certificate self signed', + 15: 'Certificate error (other)', + 16: 'Other error' }[reason] + try: - (connection_cbs["report_disconnect_reason"])("report_disconnect_reason") + (connection_cbs["report-disconnect-reason"])(reason_string, text) except KeyError: pass