X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=connection_cbs.pxd;h=16576c2e9377700cbb25f5234827e2e4518e6fd5;hp=463b17a1582a87db725a3509fe81e16879f73a0e;hb=refs%2Fheads%2Fmaster;hpb=e2eef524bf0c883406b15674eac0769c017d35c6 diff --git a/connection_cbs.pxd b/connection_cbs.pxd index 463b17a..16576c2 100644 --- a/connection_cbs.pxd +++ b/connection_cbs.pxd @@ -17,8 +17,6 @@ # along with this program. If not, see . # -cimport purple - cdef extern from *: ctypedef char const_char "const char" @@ -35,15 +33,16 @@ cdef void connect_progress(connection.PurpleConnection *gc, const_char *text, \ reached (which might be displayed as a progress bar). """ debug.purple_debug_info("connection", "%s", "connect-progress\n") - if connection_cbs.has_key("connect-progress"): - ( connection_cbs["connect-progress"])( text, step, step_count) + if "connect-progress" in connection_cbs: + ( connection_cbs["connect-progress"]) \ + ( text, step, step_count) cdef void connected(connection.PurpleConnection *gc): """ Called when a connection is established (just before the signed-on signal). """ debug.purple_debug_info("connection", "%s", "connected\n") - if connection_cbs.has_key("connected"): + if "connected" in connection_cbs: ( connection_cbs["connected"])("connected: TODO") cdef void disconnected(connection.PurpleConnection *gc): @@ -52,7 +51,7 @@ cdef void disconnected(connection.PurpleConnection *gc): signal). """ debug.purple_debug_info("connection", "%s", "disconnected\n") - if connection_cbs.has_key("disconnected"): + if "disconnected" in connection_cbs: ( connection_cbs["disconnected"])("disconnected: TODO") cdef void notice(connection.PurpleConnection *gc, const_char *text): @@ -62,7 +61,7 @@ cdef void notice(connection.PurpleConnection *gc, const_char *text): operation, is not used by any of the protocols shipped with libpurple.) """ debug.purple_debug_info("connection", "%s", "notice\n") - if connection_cbs.has_key("notice"): + if "notice" in connection_cbs: ( connection_cbs["notice"])("notice: TODO") cdef void report_disconnect(connection.PurpleConnection *gc, const_char *text): @@ -75,7 +74,7 @@ cdef void report_disconnect(connection.PurpleConnection *gc, const_char *text): PurpleConnectionUiOps.report_disconnect_reason. """ debug.purple_debug_info("connection", "%s", "report-disconnect\n") - if connection_cbs.has_key("report-disconnect"): + if "report-disconnect" in connection_cbs: ( connection_cbs["report-disconnect"])( text) cdef void network_connected(): @@ -85,7 +84,7 @@ cdef void network_connected(): it uses Win32's network change notification infrastructure. """ debug.purple_debug_info("connection", "%s", "network-connected\n") - if connection_cbs.has_key("network-connected"): + if "network-connected" in connection_cbs: ( connection_cbs["network-connected"])() cdef void network_disconnected(): @@ -94,11 +93,11 @@ cdef void network_disconnected(): has gone away. """ debug.purple_debug_info("connection", "%s", "network-disconnected\n") - if connection_cbs.has_key("network-disconnected"): + if "network-disconnected" in connection_cbs: ( connection_cbs["network-disconnected"])() cdef void report_disconnect_reason(connection.PurpleConnection *gc, \ - connection.PurpleConnectionError reason, const_char *text): + connection.PurpleConnectionError reason, const_char *c_text): """ Called when an error causes a connection to be disconnected. Called before disconnected. This op is intended to replace report_disconnect. @@ -132,5 +131,11 @@ cdef void report_disconnect_reason(connection.PurpleConnection *gc, \ 15: 'Certificate error (other)', 16: 'Other error' }[reason] - if connection_cbs.has_key("report-disconnect-reason"): - ( connection_cbs["report-disconnect-reason"])(reason_string, text) + if c_text: + text = c_text + else: + text = None + + if "report-disconnect-reason" in connection_cbs: + ( connection_cbs["report-disconnect-reason"]) \ + (reason_string, text)