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