2 # Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia
4 # This file is part of python-purple.
6 # python-purple is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # python-purple is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 ctypedef char const_char "const char"
30 cdef void connect_progress(connection.PurpleConnection *gc, const_char *text, \
31 size_t step, size_t step_count):
33 When an account is connecting, this operation is called to notify the UI
34 of what is happening, as well as which a step out of step_count has been
35 reached (which might be displayed as a progress bar).
37 debug.purple_debug_info("connection", "%s", "connect-progress\n")
38 if "connect-progress" in connection_cbs:
39 (<object> connection_cbs["connect-progress"]) \
40 (<char *> text, step, step_count)
42 cdef void connected(connection.PurpleConnection *gc):
44 Called when a connection is established (just before the signed-on signal).
46 debug.purple_debug_info("connection", "%s", "connected\n")
47 if "connected" in connection_cbs:
48 (<object> connection_cbs["connected"])("connected: TODO")
50 cdef void disconnected(connection.PurpleConnection *gc):
52 Called when a connection is ended (between the signing-off and signed-off
55 debug.purple_debug_info("connection", "%s", "disconnected\n")
56 if "disconnected" in connection_cbs:
57 (<object> connection_cbs["disconnected"])("disconnected: TODO")
59 cdef void notice(connection.PurpleConnection *gc, const_char *text):
61 Used to display connection-specific notices. (Pidgin's Gtk user interface
62 implements this as a no-op; purple_connection_notice(), which uses this
63 operation, is not used by any of the protocols shipped with libpurple.)
65 debug.purple_debug_info("connection", "%s", "notice\n")
66 if "notice" in connection_cbs:
67 (<object> connection_cbs["notice"])("notice: TODO")
69 cdef void report_disconnect(connection.PurpleConnection *gc, const_char *text):
71 Called when an error causes a connection to be disconnected.
72 Called before disconnected.
73 @param text a localized error message.
74 @see purple_connection_error
75 @deprecated in favour of
76 PurpleConnectionUiOps.report_disconnect_reason.
78 debug.purple_debug_info("connection", "%s", "report-disconnect\n")
79 if "report-disconnect" in connection_cbs:
80 (<object> connection_cbs["report-disconnect"])(<char *> text)
82 cdef void network_connected():
84 Called when libpurple discovers that the computer's network connection
85 is active. On Linux, this uses Network Manager if available; on Windows,
86 it uses Win32's network change notification infrastructure.
88 debug.purple_debug_info("connection", "%s", "network-connected\n")
89 if "network-connected" in connection_cbs:
90 (<object> connection_cbs["network-connected"])()
92 cdef void network_disconnected():
94 Called when libpurple discovers that the computer's network connection
97 debug.purple_debug_info("connection", "%s", "network-disconnected\n")
98 if "network-disconnected" in connection_cbs:
99 (<object> connection_cbs["network-disconnected"])()
101 cdef void report_disconnect_reason(connection.PurpleConnection *gc, \
102 connection.PurpleConnectionError reason, const_char *c_text):
104 Called when an error causes a connection to be disconnected. Called
105 before disconnected. This op is intended to replace report_disconnect.
106 If both are implemented, this will be called first; however, there's no
107 real reason to implement both.
108 @param reason why the connection ended, if known, or
109 PURPLE_CONNECTION_ERROR_OTHER_ERROR, if not.
110 @param text a localized message describing the disconnection
111 in more detail to the user.
112 @see purple_connection_error_reason
115 debug.purple_debug_info("connection", "%s", "report-disconnect-reason\n")
119 1: 'Invalid username',
120 2: 'Authentication failed',
121 3: 'Authentication impossible',
123 5: 'Encryption error',
125 7: 'Invalid settings',
126 8: 'Certificate not provided',
127 9: 'Certificate untrusted',
128 10: 'Certificate expired',
129 11: 'Certificate not activated',
130 12: 'Certificate hostname mismatch',
131 13: 'Certificate fingerprint mismatch',
132 14: 'Certificate self signed',
133 15: 'Certificate error (other)',
134 16: 'Other error' }[reason]
137 text = <char *> c_text
141 if "report-disconnect-reason" in connection_cbs:
142 (<object> connection_cbs["report-disconnect-reason"]) \
143 (reason_string, <char *> text)