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 connection_cbs.has_key("connect-progress"):
39 (<object> connection_cbs["connect-progress"])(<char *> text, step, step_count)
41 cdef void connected(connection.PurpleConnection *gc):
43 Called when a connection is established (just before the signed-on signal).
45 debug.purple_debug_info("connection", "%s", "connected\n")
46 if connection_cbs.has_key("connected"):
47 (<object> connection_cbs["connected"])("connected: TODO")
49 cdef void disconnected(connection.PurpleConnection *gc):
51 Called when a connection is ended (between the signing-off and signed-off
54 debug.purple_debug_info("connection", "%s", "disconnected\n")
55 if connection_cbs.has_key("disconnected"):
56 (<object> connection_cbs["disconnected"])("disconnected: TODO")
58 cdef void notice(connection.PurpleConnection *gc, const_char *text):
60 Used to display connection-specific notices. (Pidgin's Gtk user interface
61 implements this as a no-op; purple_connection_notice(), which uses this
62 operation, is not used by any of the protocols shipped with libpurple.)
64 debug.purple_debug_info("connection", "%s", "notice\n")
65 if connection_cbs.has_key("notice"):
66 (<object> connection_cbs["notice"])("notice: TODO")
68 cdef void report_disconnect(connection.PurpleConnection *gc, const_char *text):
70 Called when an error causes a connection to be disconnected.
71 Called before disconnected.
72 @param text a localized error message.
73 @see purple_connection_error
74 @deprecated in favour of
75 PurpleConnectionUiOps.report_disconnect_reason.
77 debug.purple_debug_info("connection", "%s", "report-disconnect\n")
78 if connection_cbs.has_key("report-disconnect"):
79 (<object> connection_cbs["report-disconnect"])(<char *> text)
81 cdef void network_connected():
83 Called when libpurple discovers that the computer's network connection
84 is active. On Linux, this uses Network Manager if available; on Windows,
85 it uses Win32's network change notification infrastructure.
87 debug.purple_debug_info("connection", "%s", "network-connected\n")
88 if connection_cbs.has_key("network-connected"):
89 (<object> connection_cbs["network-connected"])()
91 cdef void network_disconnected():
93 Called when libpurple discovers that the computer's network connection
96 debug.purple_debug_info("connection", "%s", "network-disconnected\n")
97 if connection_cbs.has_key("network-disconnected"):
98 (<object> connection_cbs["network-disconnected"])()
100 cdef void report_disconnect_reason(connection.PurpleConnection *gc, \
101 connection.PurpleConnectionError reason, const_char *text):
103 Called when an error causes a connection to be disconnected. Called
104 before disconnected. This op is intended to replace report_disconnect.
105 If both are implemented, this will be called first; however, there's no
106 real reason to implement both.
107 @param reason why the connection ended, if known, or
108 PURPLE_CONNECTION_ERROR_OTHER_ERROR, if not.
109 @param text a localized message describing the disconnection
110 in more detail to the user.
111 @see purple_connection_error_reason
114 debug.purple_debug_info("connection", "%s", "report-disconnect-reason\n")
118 1: 'Invalid username',
119 2: 'Authentication failed',
120 3: 'Authentication impossible',
122 5: 'Encryption error',
124 7: 'Invalid settings',
125 8: 'Certificate not provided',
126 9: 'Certificate untrusted',
127 10: 'Certificate expired',
128 11: 'Certificate not activated',
129 12: 'Certificate hostname mismatch',
130 13: 'Certificate fingerprint mismatch',
131 14: 'Certificate self signed',
132 15: 'Certificate error (other)',
133 16: 'Other error' }[reason]
135 if connection_cbs.has_key("report-disconnect-reason"):
136 (<object> connection_cbs["report-disconnect-reason"])(reason_string, <char *> text)