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/>.
21 ctypedef char const_char "const char"
28 cdef void connect_progress(connection.PurpleConnection *gc, const_char *text, \
29 size_t step, size_t step_count):
31 When an account is connecting, this operation is called to notify the UI
32 of what is happening, as well as which a step out of step_count has been
33 reached (which might be displayed as a progress bar).
35 debug.purple_debug_info("connection", "%s", "connect-progress\n")
36 if "connect-progress" in connection_cbs:
37 (<object> connection_cbs["connect-progress"]) \
38 (<char *> text, step, step_count)
40 cdef void connected(connection.PurpleConnection *gc):
42 Called when a connection is established (just before the signed-on signal).
44 debug.purple_debug_info("connection", "%s", "connected\n")
45 if "connected" in connection_cbs:
46 (<object> connection_cbs["connected"])("connected: TODO")
48 cdef void disconnected(connection.PurpleConnection *gc):
50 Called when a connection is ended (between the signing-off and signed-off
53 debug.purple_debug_info("connection", "%s", "disconnected\n")
54 if "disconnected" in connection_cbs:
55 (<object> connection_cbs["disconnected"])("disconnected: TODO")
57 cdef void notice(connection.PurpleConnection *gc, const_char *text):
59 Used to display connection-specific notices. (Pidgin's Gtk user interface
60 implements this as a no-op; purple_connection_notice(), which uses this
61 operation, is not used by any of the protocols shipped with libpurple.)
63 debug.purple_debug_info("connection", "%s", "notice\n")
64 if "notice" in connection_cbs:
65 (<object> connection_cbs["notice"])("notice: TODO")
67 cdef void report_disconnect(connection.PurpleConnection *gc, const_char *text):
69 Called when an error causes a connection to be disconnected.
70 Called before disconnected.
71 @param text a localized error message.
72 @see purple_connection_error
73 @deprecated in favour of
74 PurpleConnectionUiOps.report_disconnect_reason.
76 debug.purple_debug_info("connection", "%s", "report-disconnect\n")
77 if "report-disconnect" in connection_cbs:
78 (<object> connection_cbs["report-disconnect"])(<char *> text)
80 cdef void network_connected():
82 Called when libpurple discovers that the computer's network connection
83 is active. On Linux, this uses Network Manager if available; on Windows,
84 it uses Win32's network change notification infrastructure.
86 debug.purple_debug_info("connection", "%s", "network-connected\n")
87 if "network-connected" in connection_cbs:
88 (<object> connection_cbs["network-connected"])()
90 cdef void network_disconnected():
92 Called when libpurple discovers that the computer's network connection
95 debug.purple_debug_info("connection", "%s", "network-disconnected\n")
96 if "network-disconnected" in connection_cbs:
97 (<object> connection_cbs["network-disconnected"])()
99 cdef void report_disconnect_reason(connection.PurpleConnection *gc, \
100 connection.PurpleConnectionError reason, const_char *c_text):
102 Called when an error causes a connection to be disconnected. Called
103 before disconnected. This op is intended to replace report_disconnect.
104 If both are implemented, this will be called first; however, there's no
105 real reason to implement both.
106 @param reason why the connection ended, if known, or
107 PURPLE_CONNECTION_ERROR_OTHER_ERROR, if not.
108 @param text a localized message describing the disconnection
109 in more detail to the user.
110 @see purple_connection_error_reason
113 debug.purple_debug_info("connection", "%s", "report-disconnect-reason\n")
117 1: 'Invalid username',
118 2: 'Authentication failed',
119 3: 'Authentication impossible',
121 5: 'Encryption error',
123 7: 'Invalid settings',
124 8: 'Certificate not provided',
125 9: 'Certificate untrusted',
126 10: 'Certificate expired',
127 11: 'Certificate not activated',
128 12: 'Certificate hostname mismatch',
129 13: 'Certificate fingerprint mismatch',
130 14: 'Certificate self signed',
131 15: 'Certificate error (other)',
132 16: 'Other error' }[reason]
135 text = <char *> c_text
139 if "report-disconnect-reason" in connection_cbs:
140 (<object> connection_cbs["report-disconnect-reason"]) \
141 (reason_string, <char *> text)