Fixed get_buddies_online return parameter.
[python-purple] / conversation_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 cdef extern from *:
23     ctypedef char const_char "const char"
24     ctypedef glib.guchar const_guchar "const guchar"
25     ctypedef long int time_t
26
27 conversation_cbs = {}
28
29 cdef void create_conversation (conversation.PurpleConversation *conv):
30     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
31                          "create-conversation\n")
32     cdef char *c_name = NULL
33
34     c_name = <char *> conversation.c_purple_conversation_get_name(conv)
35     if c_name == NULL:
36         name = None
37     else:
38         name = c_name
39
40     type = conversation.c_purple_conversation_get_type(conv)
41
42     try:
43         (<object>conversation_cbs["create-conversation"])(name, type)
44     except KeyError:
45         pass
46
47 cdef void destroy_conversation (conversation.PurpleConversation *conv):
48     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
49                          "destroy-conversation\n")
50     try:
51         (<object>conversation_cbs["destroy-conversation"])("destroy-conversation: TODO")
52     except KeyError:
53         pass
54
55 cdef void write_chat (conversation.PurpleConversation *conv, const_char *who,
56                       const_char *message, conversation.PurpleMessageFlags flags,
57                       time_t mtime):
58     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
59                          "write-chat\n")
60     try:
61         (<object>conversation_cbs["write-chat"])("write-chat: TODO")
62     except KeyError:
63         pass
64
65 cdef void write_im (conversation.PurpleConversation *conv, const_char *who,
66                     const_char *message, conversation.PurpleMessageFlags flags,
67                     time_t mtime):
68     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation", "write-im\n")
69     cdef account.PurpleAccount *acc = conversation.c_purple_conversation_get_account(conv)
70     cdef char *c_username = NULL
71
72     c_username = <char *> account.c_purple_account_get_username(acc)
73     if c_username == NULL:
74         username = None
75     else:
76         username = c_username
77
78     if who:
79         sender = <char *> who
80     else:
81         sender = None
82
83     try:
84         (<object>conversation_cbs["write-im"])(username, sender, <char *> message)
85     except KeyError:
86         pass
87
88 cdef void write_conv (conversation.PurpleConversation *conv, const_char *name,
89                       const_char *alias, const_char *message,
90                       conversation.PurpleMessageFlags flags, time_t mtime):
91     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
92                          "write-conv\n")
93     try:
94         (<object>conversation_cbs["write-conv"])("write-conv: TODO")
95     except KeyError:
96         pass
97
98 cdef void chat_add_users (conversation.PurpleConversation *conv,
99                           glib.GList *cbuddies, glib.gboolean new_arrivals):
100     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
101                          "chat-add-users\n")
102     try:
103         (<object>conversation_cbs["chat-add-users"])("chat-add-users: TODO")
104     except KeyError:
105         pass
106
107 cdef void chat_rename_user (conversation.PurpleConversation *conv,
108                             const_char *old_name, const_char *new_name,
109                             const_char *new_alias):
110     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
111                          "chat-rename-user\n")
112     try:
113         (<object>conversation_cbs["chat-rename-user"])("chat-rename-user: TODO")
114     except KeyError:
115         pass
116
117 cdef void chat_remove_users (conversation.PurpleConversation *conv,
118                              glib.GList *users):
119     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
120                          "chat-remove-users\n")
121     try:
122         (<object>conversation_cbs["chat-remove-users"])("chat-remove-users: TODO")
123     except KeyError:
124         pass
125
126 cdef void chat_update_user (conversation.PurpleConversation *conv,
127                             const_char *user):
128     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
129                          "chat-update-user\n")
130     try:
131         (<object>conversation_cbs["chat-update-user"])("chat-update-user: TODO")
132     except KeyError:
133         pass
134
135 cdef void present (conversation.PurpleConversation *conv):
136     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
137                          "present\n")
138     try:
139         (<object>conversation_cbs["present"])("present: TODO")
140     except KeyError:
141         pass
142
143 cdef glib.gboolean has_focus (conversation.PurpleConversation *conv):
144     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
145                          "has-focus\n")
146     try:
147         (<object>conversation_cbs["has-focus"])("has-focus: TODO")
148         return False
149     except KeyError:
150         return False
151
152 cdef glib.gboolean custom_smiley_add (conversation.PurpleConversation *conv,
153                                       const_char *smile, glib.gboolean remote):
154     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
155                          "custom-smiley-add\n")
156     try:
157         (<object>conversation_cbs["custom-smiley-add"])("custom-smiley-add: TODO")
158         return False
159     except KeyError:
160         return False
161
162 cdef void custom_smiley_write (conversation.PurpleConversation *conv,
163                                const_char *smile, const_guchar *data,
164                                glib.gsize size):
165     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
166                          "custom-smiley-write\n")
167     try:
168         (<object>conversation_cbs["custom-smiley-write"])("custom-smiley-write: TODO")
169     except KeyError:
170         pass
171
172
173 cdef void custom_smiley_close (conversation.PurpleConversation *conv,
174                                const_char *smile):
175     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
176                          "custom-smiley-close\n")
177     try:
178         (<object>conversation_cbs["custom-smiley-close"])("custom-smiley-close: TODO")
179     except KeyError:
180         pass
181
182 cdef void send_confirm (conversation.PurpleConversation *conv,
183                         const_char *message):
184     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
185                          "send-confirm\n")
186     try:
187         (<object>conversation_cbs["send-confirm"])("send-confirm: TODO")
188     except KeyError:
189         pass