Added request_authorize/close_account_request.
[python-purple] / libpurple / conversation.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 glib
21
22 cimport account
23 cimport connection
24 cimport buddyicon
25
26 cdef extern from "time.h":
27     ctypedef long int time_t
28
29 cdef extern from "libpurple/conversation.h":
30     ctypedef struct PurpleConversationUiOps
31     ctypedef struct PurpleConversation
32     ctypedef struct PurpleConvIm
33     ctypedef struct PurpleConvChat
34     ctypedef struct PurpleConvChatBuddy
35     ctypedef struct PurpleConvMessage
36
37     ctypedef enum PurpleConversationType:
38         PURPLE_CONV_TYPE_UNKNOWN = 0
39         PURPLE_CONV_TYPE_IM
40         PURPLE_CONV_TYPE_CHAT
41         PURPLE_CONV_TYPE_MISC
42         PURPLE_CONV_TYPE_ANY
43
44     ctypedef enum PurpleConvUpdateType:
45         PURPLE_CONV_UPDATE_ADD = 0
46         PURPLE_CONV_UPDATE_REMOVE
47         PURPLE_CONV_UPDATE_ACCOUNT
48         PURPLE_CONV_UPDATE_TYPING
49         PURPLE_CONV_UPDATE_UNSEEN
50         PURPLE_CONV_UPDATE_LOGGING
51         PURPLE_CONV_UPDATE_TOPIC
52         PURPLE_CONV_ACCOUNT_ONLINE
53         PURPLE_CONV_ACCOUNT_OFFLINE
54         PURPLE_CONV_UPDATE_AWAY
55         PURPLE_CONV_UPDATE_ICON
56         PURPLE_CONV_UPDATE_TITLE
57         PURPLE_CONV_UPDATE_CHATLEFT
58         PURPLE_CONV_UPDATE_FEATURES
59
60     ctypedef enum PurpleTypingState:
61         PURPLE_NOT_TYPING = 0
62         PURPLE_TYPING
63         PURPLE_TYPED
64
65     ctypedef enum PurpleMessageFlags:
66         PURPLE_MESSAGE_SEND = 0x0001
67         PURPLE_MESSAGE_RECV = 0x0002
68         PURPLE_MESSAGE_SYSTEM = 0x0004
69         PURPLE_MESSAGE_AUTO_RESP = 0x0008
70         PURPLE_MESSAGE_ACTIVE_ONLY = 0x0010
71         PURPLE_MESSAGE_NICK = 0x0020
72         PURPLE_MESSAGE_NO_LOG = 0x0040
73         PURPLE_MESSAGE_WHISPER = 0x0080
74         PURPLE_MESSAGE_ERROR = 0x0200
75         PURPLE_MESSAGE_DELAYED = 0x0400
76         PURPLE_MESSAGE_RAW = 0x0800
77         PURPLE_MESSAGE_IMAGES = 0x1000
78         PURPLE_MESSAGE_NOTIFY = 0x2000
79         PURPLE_MESSAGE_NO_LINKIFY = 0x4000
80         PURPLE_MESSAGE_INVISIBLE = 0x8000
81
82     ctypedef enum PurpleConvChatBuddyFlags:
83         PURPLE_CBFLAGS_NONE = 0x0000
84         PURPLE_CBFLAGS_VOICE = 0x0001
85         PURPLE_CBFLAGS_HALFOP = 0x0002
86         PURPLE_CBFLAGS_OP = 0x0004
87         PURPLE_CBFLAGS_FOUNDER = 0x0008
88         PURPLE_CBFLAGS_TYPING = 0x0010
89
90     ctypedef struct PurpleConversationUiOps:
91         void (*create_conversation) (PurpleConversation *conv)
92         void (*destroy_conversation) (PurpleConversation *conv)
93         void (*write_chat) (PurpleConversation *conv, char *who, char *message, PurpleMessageFlags flags, time_t mtime)
94         void (*write_im) (PurpleConversation *conv, char *who, char *message, PurpleMessageFlags flags, time_t mtime)
95         void (*write_conv) (PurpleConversation *conv, char *name, char *alias, char *message, PurpleMessageFlags flags, time_t mtime)
96         void (*chat_add_users) (PurpleConversation *conv, glib.GList *cbuddies, glib.gboolean new_arrivals)
97         void (*chat_rename_user) (PurpleConversation *conv, char *old_name, char *new_name, char *new_alias)
98         void (*chat_remove_users) (PurpleConversation *conv, glib.GList *users)
99         void (*chat_update_user) (PurpleConversation *conv, char *user)
100         void (*present) (PurpleConversation *conv)
101         glib.gboolean (*has_focus) (PurpleConversation *conv)
102         glib.gboolean (*custom_smiley_add) (PurpleConversation *conv, char *smile, glib.gboolean remote)
103         void (*custom_smiley_write) (PurpleConversation *conv, char *smile, glib.guchar *data, glib.gsize size)
104         void (*custom_smiley_close) (PurpleConversation *conv, char *smile)
105         void (*send_confirm) (PurpleConversation *conv, char *message)
106
107     ctypedef struct PurpleConvIm:
108         PurpleConversation *conv
109         PurpleTypingState typing_state
110         glib.guint typing_timeout
111         time_t type_again
112         glib.guint send_typed_timeout
113         buddyicon.PurpleBuddyIcon *icon
114
115     ctypedef struct PurpleConvChat:
116         PurpleConversation *conv
117         glib.GList *in_room
118         glib.GList *ignored
119         char *who
120         char *topic
121         int id
122         char *nick
123         glib.gboolean left
124
125     ctypedef struct PurpleConvChatBuddy:
126         char *name
127         char *alias
128         char *alias_key
129         glib.gboolean buddy
130         PurpleConvChatBuddyFlags flags
131
132     ctypedef struct PurpleConvMessage:
133         char *who
134         char *what
135         PurpleMessageFlags flags
136         time_t when
137         PurpleConversation *conv
138         char *alias
139
140     ctypedef union UnionType:
141         PurpleConvIm *im
142         PurpleConvChat *chat
143         void *misc
144
145     ctypedef struct PurpleConversation:
146         PurpleConversationType type
147         account.PurpleAccount *account
148         char *name
149         char *title
150         glib.gboolean logging
151         glib.GList *logs
152         UnionType u
153         PurpleConversationUiOps *ui_ops
154         void *ui_data
155         glib.GHashTable *data
156         connection.PurpleConnectionFlags features
157         glib.GList *message_history
158
159     # Conversation API
160     PurpleConversation *purple_conversation_new(int type, \
161             account.PurpleAccount *account, char *name)
162     void purple_conversation_destroy(PurpleConversation *conv)
163     void purple_conversation_present(PurpleConversation *conv)
164     PurpleConversationType purple_conversation_get_type( \
165             PurpleConversation *conv)
166     void purple_conversation_set_ui_ops(PurpleConversation *conv, \
167             PurpleConversationUiOps *ops)
168     void purple_conversations_set_ui_ops(PurpleConversationUiOps *ops)
169     PurpleConversationUiOps *purple_conversation_get_ui_ops( \
170             PurpleConversation *conv)
171     void purple_conversation_set_account(PurpleConversation *conv, \
172             account.PurpleAccount *account)
173     account.PurpleAccount *purple_conversation_get_account( \
174             PurpleConversation *conv)
175     connection.PurpleConnection *purple_conversation_get_gc( \
176             PurpleConversation *conv)
177     void purple_conversation_set_title(PurpleConversation *conv, char *title)
178     char *purple_conversation_get_title(PurpleConversation *conv)
179     void purple_conversation_autoset_title(PurpleConversation *conv)
180     void purple_conversation_set_name(PurpleConversation *conv, char *name)
181     char *purple_conversation_get_name(PurpleConversation *conv)
182     void purple_conversation_set_logging(PurpleConversation *conv, \
183             glib.gboolean log)
184     glib.gboolean purple_conversation_is_logging(PurpleConversation *conv)
185     void purple_conversation_close_logs(PurpleConversation *conv)
186     PurpleConvIm *purple_conversation_get_im_data(PurpleConversation *conv)
187     PurpleConvChat *purple_conversation_get_chat_data(PurpleConversation *conv)
188     void purple_conversation_set_data(PurpleConversation *conv, char *key, \
189             glib.gpointer data)
190     glib.gpointer purple_conversation_get_data(PurpleConversation *conv, \
191             char *key)
192     glib.GList *purple_get_conversations()
193     glib.GList *purple_get_ims()
194     glib.GList *purple_get_chats()
195     PurpleConversation *purple_find_conversation_with_account( \
196             PurpleConversationType type, char *name, \
197             account.PurpleAccount *account)
198     void purple_conversation_write(PurpleConversation *conv, char *who, \
199     char *message, PurpleMessageFlags flags, time_t mtime)
200     void purple_conversation_set_features(PurpleConversation *conv, \
201             connection.PurpleConnectionFlags features)
202     connection.PurpleConnectionFlags purple_conversation_get_features( \
203             PurpleConversation *conv)
204     glib.gboolean purple_conversation_has_focus(PurpleConversation *conv)
205     void purple_conversation_update(PurpleConversation *conv, \
206             PurpleConvUpdateType type)
207     void purple_conversation_foreach(void (*func)(PurpleConversation *conv))
208     glib.GList *purple_conversation_get_message_history( \
209             PurpleConversation *conv)
210     void purple_conversation_clear_message_history(PurpleConversation *conv)
211     char *purple_conversation_message_get_sender(PurpleConvMessage *msg)
212     char *purple_conversation_message_get_message(PurpleConvMessage *msg)
213     PurpleMessageFlags purple_conversation_message_get_flags( \
214             PurpleConvMessage *msg)
215     time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg)
216
217     #IM Conversation API
218     PurpleConversation *purple_conv_im_get_conversation(PurpleConvIm *im)
219     void purple_conv_im_set_icon(PurpleConvIm *im, \
220             buddyicon.PurpleBuddyIcon *icon)
221     buddyicon.PurpleBuddyIcon *purple_conv_im_get_icon(PurpleConvIm *im)
222     void purple_conv_im_set_typing_state(PurpleConvIm *im, \
223             PurpleTypingState state)
224     PurpleTypingState purple_conv_im_get_typing_state(PurpleConvIm *im)
225     void purple_conv_im_start_typing_timeout(PurpleConvIm *im, int timeout)
226     void purple_conv_im_stop_typing_timeout(PurpleConvIm *im)
227     glib.guint purple_conv_im_get_typing_timeout(PurpleConvIm *im)
228     void purple_conv_im_set_type_again(PurpleConvIm *im, unsigned int val)
229     time_t purple_conv_im_get_type_again(PurpleConvIm *im)
230     void purple_conv_im_start_send_typed_timeout(PurpleConvIm *im)
231     void purple_conv_im_stop_send_typed_timeout(PurpleConvIm *im)
232     glib.guint purple_conv_im_get_send_typed_timeout(PurpleConvIm *im)
233     void purple_conv_im_update_typing(PurpleConvIm *im)
234     void purple_conv_im_write(PurpleConvIm *im, char *who, \
235             char *message, PurpleMessageFlags flags, time_t mtime)
236     glib.gboolean purple_conv_present_error(char *who, \
237             account.PurpleAccount *account, char *what)
238     void purple_conv_im_send(PurpleConvIm *im, char *message)
239     void purple_conv_send_confirm(PurpleConversation *conv, \
240             char *message)
241     void purple_conv_im_send_with_flags(PurpleConvIm *im, char *message, \
242             PurpleMessageFlags flags)
243     glib.gboolean purple_conv_custom_smiley_add(PurpleConversation *conv, \
244             char *smile, char *cksum_type, char *chksum, glib.gboolean remote)
245     void purple_conv_custom_smiley_write(PurpleConversation *conv, \
246             char *smile, glib.guchar *data, glib.gsize size)
247     void purple_conv_custom_smiley_close(PurpleConversation *conv, char *smile)
248
249     # Chat Conversation API
250     PurpleConversation *purple_conv_chat_get_conversation(PurpleConvChat *chat)
251     glib.GList *purple_conv_chat_set_users(PurpleConvChat *chat, \
252             glib.GList *users)
253     glib.GList *purple_conv_chat_get_users(PurpleConvChat *chat)
254     void purple_conv_chat_ignore(PurpleConvChat *chat, char *name)
255     void purple_conv_chat_unignore(PurpleConvChat *chat, char *name)
256     glib.GList *purple_conv_chat_set_ignored(PurpleConvChat *chat, \
257             glib.GList *ignored)
258     glib.GList *purple_conv_chat_get_ignored(PurpleConvChat *chat)
259     char *purple_conv_chat_get_ignored_user(PurpleConvChat *chat, char *user)
260     glib.gboolean purple_conv_chat_is_user_ignored(PurpleConvChat *chat, \
261             char *user)
262     void purple_conv_chat_set_topic(PurpleConvChat *chat, char *who, \
263             char *topic)
264     char *purple_conv_chat_get_topic(PurpleConvChat *chat)
265     void purple_conv_chat_set_id(PurpleConvChat *chat, int id)
266     int purple_conv_chat_get_id(PurpleConvChat *chat)
267     void purple_conv_chat_write(PurpleConvChat *chat, char *who, \
268             char *message, PurpleMessageFlags flags, time_t mtime)
269     void purple_conv_chat_send(PurpleConvChat *chat, char *message)
270     void purple_conv_chat_send_with_flags(PurpleConvChat *chat, \
271             char *message, PurpleMessageFlags flags)
272     void purple_conv_chat_add_user(PurpleConvChat *chat, char *user, \
273             char *extra_msg, PurpleConvChatBuddyFlags flags, \
274             glib.gboolean new_arrival)
275     void purple_conv_chat_add_users(PurpleConvChat *chat, glib.GList *users, \
276             glib.GList *extra_msgs, glib.GList *flags, \
277             glib.gboolean new_arrivals)
278     void purple_conv_chat_rename_user(PurpleConvChat *chat, \
279             char *old_user, char *new_user)
280     void purple_conv_chat_remove_user(PurpleConvChat *chat, \
281             char *user, char *reason)
282     void purple_conv_chat_remove_users(PurpleConvChat *chat, \
283             glib.GList *users, char *reason)
284     glib.gboolean purple_conv_chat_find_user(PurpleConvChat *chat, char *user)
285     void purple_conv_chat_user_set_flags(PurpleConvChat *chat, char *user, \
286             PurpleConvChatBuddyFlags flags)
287     PurpleConvChatBuddyFlags purple_conv_chat_user_get_flags( \
288             PurpleConvChat *chat, char *user)
289     void purple_conv_chat_clear_users(PurpleConvChat *chat)
290     void purple_conv_chat_set_nick(PurpleConvChat *chat, char *nick)
291     char *purple_conv_chat_get_nick(PurpleConvChat *chat)
292     PurpleConversation *purple_find_chat(connection.PurpleConnection *gc, \
293             int id)
294     void purple_conv_chat_left(PurpleConvChat *chat)
295     glib.gboolean purple_conv_chat_has_left(PurpleConvChat *chat)
296     PurpleConvChatBuddy *purple_conv_chat_cb_new(char *name, char *alias, \
297             PurpleConvChatBuddyFlags flags)
298     PurpleConvChatBuddy *purple_conv_chat_cb_find(PurpleConvChat *chat, \
299             char *name)
300     char *purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb)
301     void purple_conv_chat_cb_destroy(PurpleConvChatBuddy *cb)
302     glib.GList * purple_conversation_get_extended_menu( \
303             PurpleConversation *conv)
304     glib.gboolean purple_conversation_do_command(PurpleConversation *conv, \
305             glib.gchar *cmdline, glib.gchar *markup, glib.gchar **error)
306
307     # Conversations Subsystem
308     void *purple_conversations_get_handle()
309     void purple_conversations_init()
310     void purple_conversations_uninit()