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/>.
23 ctypedef char const_char "const char"
24 ctypedef glib.guchar const_guchar "const guchar"
25 ctypedef long int time_t
29 cdef void create_conversation(conversation.PurpleConversation *conv):
31 Called when a conv is created (but before the conversation-created
34 debug.purple_debug_info("conversation", "%s", "create-conversation\n")
35 cdef char *c_name = NULL
37 c_name = <char *> conversation.purple_conversation_get_name(conv)
43 type = conversation.purple_conversation_get_type(conv)
45 if conversation_cbs.has_key("create-conversation"):
46 (<object> conversation_cbs["create-conversation"])(name, type)
48 cdef void destroy_conversation(conversation.PurpleConversation *conv):
50 Called just before a conv is freed.
52 debug.purple_debug_info("conversation", "%s", "destroy-conversation\n")
53 if conversation_cbs.has_key("destroy-conversation"):
54 (<object> conversation_cbs["destroy-conversation"])("destroy-conversation: TODO")
56 cdef void write_chat(conversation.PurpleConversation *conv, const_char *who, \
57 const_char *message, conversation.PurpleMessageFlags flags, \
60 Write a message to a chat. If this field is NULL, libpurple will fall
61 back to using write_conv.
62 @see purple_conv_chat_write()
64 debug.purple_debug_info("conversation", "%s", "write-chat\n")
65 if conversation_cbs.has_key("write-chat"):
66 (<object> conversation_cbs["write-chat"])("write-chat: TODO")
68 cdef void write_im(conversation.PurpleConversation *conv, const_char *who, \
69 const_char *c_message, conversation.PurpleMessageFlags flags, \
72 Write a message to an IM conversation. If this field is NULL, libpurple
73 will fall back to using write_conv.
74 @see purple_conv_im_write()
76 debug.purple_debug_info("conversation", "%s", "write-im\n")
77 cdef account.PurpleAccount *acc = conversation.purple_conversation_get_account(conv)
78 cdef blist.PurpleBuddy *buddy = NULL
79 cdef char *c_username = NULL
80 cdef char *c_sender_alias = NULL
82 c_username = <char *> account.purple_account_get_username(acc)
89 who = conversation.purple_conversation_get_name(conv)
92 buddy = blist.purple_find_buddy(acc, <char *> who)
94 c_sender_alias = <char *> blist.purple_buddy_get_alias_only(buddy)
97 sender_alias = unicode(c_sender_alias, 'utf-8')
102 message = <char *> c_message
106 if conversation_cbs.has_key("write-im"):
107 (<object> conversation_cbs["write-im"])(username, sender, \
108 sender_alias, message)
110 cdef void write_conv(conversation.PurpleConversation *conv, const_char *name, \
111 const_char *alias, const_char *message, \
112 conversation.PurpleMessageFlags flags, time_t mtime):
114 Write a message to a conversation. This is used rather than the chat- or
115 im-specific ops for errors, system messages (such as "x is now known as
116 y"), and as the fallback if write_im and write_chat are not implemented.
117 It should be implemented, or the UI will miss conversation error messages
118 and your users will hate you.
119 @see purple_conversation_write()
121 debug.purple_debug_info("conversation", "%s", "write-conv\n")
122 if conversation_cbs.has_key("write-conv"):
123 (<object> conversation_cbs["write-conv"])("write-conv: TODO")
125 cdef void chat_add_users(conversation.PurpleConversation *conv, \
126 glib.GList *cbuddies, glib.gboolean new_arrivals):
128 Add cbuddies to a chat.
129 @param cbuddies A GList of PurpleConvChatBuddy structs.
130 @param new_arrivals Wheter join notices should be shown.
131 (Join notices are actually written to the
132 conversation by purple_conv_chat_add_users().)
133 @see purple_conv_chat_add_users()
135 debug.purple_debug_info("conversation", "%s", "chat-add-users\n")
136 if conversation_cbs.has_key("chat-add-users"):
137 (<object> conversation_cbs["chat-add-users"])("chat-add-users: TODO")
139 cdef void chat_rename_user(conversation.PurpleConversation *conv, \
140 const_char *old_name, const_char *new_name,
141 const_char *new_alias):
143 Rename the user in this chat name old_name to new_name. (The rename
144 message is written to the conversation by libpurple.)
145 @param new_alias new_name's new_alias, if they have one.
146 @see purple_conv_chat_rename_user()
148 debug.purple_debug_info("conversation", "%s", "chat-rename-user\n")
149 if conversation_cbs.has_key("chat-rename-user"):
150 (<object> conversation_cbs["chat-rename-user"])("chat-rename-user: TODO")
152 cdef void chat_remove_users(conversation.PurpleConversation *conv, \
155 Remove users from a chat.
156 @param users A GList of const char *s.
158 debug.purple_debug_info("conversation", "%s", "chat-remove-users\n")
159 if conversation_cbs.has_key("chat-remove-users"):
160 (<object> conversation_cbs["chat-remove-users"])("chat-remove-users: TODO")
162 cdef void chat_update_user(conversation.PurpleConversation *conv, \
165 Called when a user's flags are changed.
166 @see purple_conv_chat_user_set_flags()
168 debug.purple_debug_info("conversation", "%s", "chat-update-user\n")
169 if conversation_cbs.has_key("chat-update-user"):
170 (<object> conversation_cbs["chat-update-user"])("chat-update-user: TODO")
172 cdef void present(conversation.PurpleConversation *conv):
174 Present this conversation to the user; for example, by displaying the IM
177 debug.purple_debug_info("conversation", "%s", "present\n")
178 if conversation_cbs.has_key("present"):
179 (<object> conversation_cbs["present"])("present: TODO")
181 cdef glib.gboolean has_focus(conversation.PurpleConversation *conv):
183 If this UI has a concept of focus (as in a windowing system) and this
184 conversation has the focus, return TRUE; otherwise, return FALSE.
186 debug.purple_debug_info("conversation", "%s", "has-focus\n")
187 if conversation_cbs.has_key("has-focus"):
188 (<object> conversation_cbs["has-focus"])("has-focus: TODO")
191 cdef glib.gboolean custom_smiley_add(conversation.PurpleConversation *conv, \
192 const_char *smile, glib.gboolean remote):
194 Custom smileys (add).
196 debug.purple_debug_info("conversation", "%s", "custom-smiley-add\n")
197 if conversation_cbs.has_key("custom-smiley-add"):
198 (<object> conversation_cbs["custom-smiley-add"])("custom-smiley-add: TODO")
201 cdef void custom_smiley_write(conversation.PurpleConversation *conv, \
202 const_char *smile, const_guchar *data, glib.gsize size):
204 Custom smileys (write).
206 debug.purple_debug_info("conversation", "%s", "custom-smiley-write\n")
207 if conversation_cbs.has_key("custom-smiley-write"):
208 (<object> conversation_cbs["custom-smiley-write"])("custom-smiley-write: TODO")
210 cdef void custom_smiley_close(conversation.PurpleConversation *conv, \
213 Custom smileys (close).
215 debug.purple_debug_info("conversation", "%s", "custom-smiley-close\n")
216 if conversation_cbs.has_key("custom-smiley-close"):
217 (<object> conversation_cbs["custom-smiley-close"])("custom-smiley-close: TODO")
219 cdef void send_confirm(conversation.PurpleConversation *conv, \
220 const_char *message):
222 Prompt the user for confirmation to send mesage. This function should
223 arrange for the message to be sent if the user accepts. If this field
224 is NULL, libpurple will fall back to using purple_request_action().
226 debug.purple_debug_info("conversation", "%s", "send-confirm\n")
227 if conversation_cbs.has_key("send-confirm"):
228 (<object> conversation_cbs["send-confirm"])("send-confirm: TODO")