Add support to new callback class
[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     try:
33         (<object>conversation_cbs["create_conversation"])(conv.name, conv.type)
34     except KeyError:
35         pass
36
37 cdef void destroy_conversation (conversation.PurpleConversation *conv):
38     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
39                          "destroy_conversation\n")
40     try:
41         (<object>conversation_cbs["destroy_conversation"])("destroy_conversation")
42     except KeyError:
43         pass
44
45 cdef void write_chat (conversation.PurpleConversation *conv, const_char *who,
46                       const_char *message, conversation.PurpleMessageFlags flags,
47                       time_t mtime):
48     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
49                          "write_chat\n")
50     try:
51         (<object>conversation_cbs["write_chat"])("write_chat")
52     except KeyError:
53         pass
54
55 cdef void write_im (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", "write_im\n")
59     if who:
60         sender = <char *> who
61     else:
62         sender = None
63     try:
64         (<object>conversation_cbs["write_im"])(conv.account.username, sender, <char *> message)
65     except KeyError:
66         pass
67
68 cdef void write_conv (conversation.PurpleConversation *conv, const_char *name,
69                       const_char *alias, const_char *message,
70                       conversation.PurpleMessageFlags flags, time_t mtime):
71     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
72                          "write_conv\n")
73     try:
74         (<object>conversation_cbs["write_conv"])("write_conv")
75     except KeyError:
76         pass
77
78 cdef void chat_add_users (conversation.PurpleConversation *conv,
79                           glib.GList *cbuddies, glib.gboolean new_arrivals):
80     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
81                          "chat_add_users\n")
82     try:
83         (<object>conversation_cbs["chat_add_users"])("chat_add_users")
84     except KeyError:
85         pass
86
87 cdef void chat_rename_user (conversation.PurpleConversation *conv,
88                             const_char *old_name, const_char *new_name,
89                             const_char *new_alias):
90     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
91                          "chat_rename_user\n")
92     try:
93         (<object>conversation_cbs["chat_rename_user"])("chat_rename_user")
94     except KeyError:
95         pass
96
97 cdef void chat_remove_users (conversation.PurpleConversation *conv,
98                              glib.GList *users):
99     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
100                          "chat_remove_users\n")
101     try:
102         (<object>conversation_cbs["chat_remove_users"])("chat_remove_users")
103     except KeyError:
104         pass
105
106 cdef void chat_update_user (conversation.PurpleConversation *conv,
107                             const_char *user):
108     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
109                          "chat_update_user\n")
110     try:
111         (<object>conversation_cbs["chat_update_user"])("chat_update_user")
112     except KeyError:
113         pass
114
115 cdef void present (conversation.PurpleConversation *conv):
116     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
117                          "present\n")
118     try:
119         (<object>conversation_cbs["present"])("present")
120     except KeyError:
121         pass
122
123 cdef glib.gboolean has_focus (conversation.PurpleConversation *conv):
124     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
125                          "has_focus\n")
126     try:
127         (<object>conversation_cbs["has_focus"])("has_focus")
128         return False
129     except KeyError:
130         return False
131
132 cdef glib.gboolean custom_smiley_add (conversation.PurpleConversation *conv,
133                                       const_char *smile, glib.gboolean remote):
134     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
135                          "custom_smiley_add\n")
136     try:
137         (<object>conversation_cbs["custom_smiley_add"])("custom_smiley_add")
138         return False
139     except KeyError:
140         return False
141
142 cdef void custom_smiley_write (conversation.PurpleConversation *conv,
143                                const_char *smile, const_guchar *data,
144                                glib.gsize size):
145     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
146                          "custom_smiley_write\n")
147     try:
148         (<object>conversation_cbs["custom_smiley_write"])("custom_smiley_write")
149     except KeyError:
150         pass
151
152
153 cdef void custom_smiley_close (conversation.PurpleConversation *conv,
154                                const_char *smile):
155     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
156                          "custom_smiley_close\n")
157     try:
158         (<object>conversation_cbs["custom_smiley_close"])("custom_smiley_close")
159     except KeyError:
160         pass
161
162 cdef void send_confirm (conversation.PurpleConversation *conv,
163                         const_char *message):
164     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation",
165                          "send_confirm\n")
166     try:
167         (<object>conversation_cbs["send_confirm"])("send_confirm")
168     except KeyError:
169         pass