ca39432c171d6db569bbe1dbb727906ddbb98143
[python-purple] / connection_cbs.pxd
1 #
2 #  Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia
3 #
4 #  This file is part of python-purple.
5 #
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.
10 #
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.
15 #
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/>.
18 #
19
20 cimport purple
21
22 connection_cbs = {}
23
24 cdef extern from *:
25     ctypedef int size_t
26
27 cdef void connect_progress (connection.PurpleConnection *gc, const_char *text,
28                             size_t step, size_t step_count):
29     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection",
30                          "connect_progress\n")
31     global connection_cbs
32     try:
33         (<object>connection_cbs["connect_progress"])("connect_progress")
34     except KeyError:
35         pass
36
37 cdef void connected (connection.PurpleConnection *gc):
38     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection",
39                          "connected\n")
40     global connection_cbs
41     try:
42         (<object>connection_cbs["connected"])("connected")
43     except KeyError:
44         pass
45
46 cdef void disconnected (connection.PurpleConnection *gc):
47     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection",
48                          "disconnected\n")
49     global connection_cbs
50     try:
51         (<object>connection_cbs["disconnected"])("disconnected")
52     except KeyError:
53         pass
54
55 cdef void notice (connection.PurpleConnection *gc, const_char *text):
56     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection",
57                          "notice\n")
58     global connection_cbs
59     try:
60         (<object>connection_cbs["notice"])("notice")
61     except KeyError:
62         pass
63
64 cdef void report_disconnect (connection.PurpleConnection *gc,
65                              const_char *text):
66     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection",
67                          "report_disconnect\n")
68     global connection_cbs
69     try:
70         (<object>connection_cbs["report_disconnect"])("report_disconnect")
71     except KeyError:
72         pass
73
74 cdef void network_connected ():
75     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection",
76                          "network_connected\n")
77     global connection_cbs
78     try:
79         (<object>connection_cbs["network_connected"])("network_connected")
80     except KeyError:
81         pass
82
83 cdef void network_disconnected ():
84     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection",
85                          "network_disconnected\n")
86     global connection_cbs
87     try:
88         (<object>connection_cbs["network_disconnected"])("network_disconnected")
89     except KeyError:
90         pass
91
92 cdef void report_disconnect_reason (connection.PurpleConnection *gc,
93                                     connection.PurpleConnectionError reason,
94                                     const_char *text):
95     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "connection",
96                          "report_disconnect_reason\n")
97     global connection_cbs
98     try:
99         (<object>connection_cbs["report_disconnect_reason"])("report_disconnect_reason")
100     except KeyError:
101         pass