conversation.h
Go to the documentation of this file.
1 
7 /* purple
8  *
9  * Purple is the legal property of its developers, whose names are too numerous
10  * to list here. Please refer to the COPYRIGHT file distributed with this
11  * source distribution.
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26  */
27 #ifndef _PURPLE_CONVERSATION_H_
28 #define _PURPLE_CONVERSATION_H_
29 
30 /**************************************************************************/
32 /**************************************************************************/
33 
34 
40 typedef struct _PurpleConvIm PurpleConvIm;
47 
51 typedef enum
52 {
60 
64 typedef enum
65 {
76  /*
77  * XXX These need to go when we implement a more generic core/UI event
78  * system.
79  */
84  PURPLE_CONV_UPDATE_TITLE,
85  PURPLE_CONV_UPDATE_CHATLEFT,
86 
90 
94 typedef enum
95 {
101 
105 typedef enum
106 {
131 
135 typedef enum
136 {
140  PURPLE_CBFLAGS_OP = 0x0004,
146 
147 #include "account.h"
148 #include "buddyicon.h"
149 #include "log.h"
150 #include "server.h"
151 
159 {
164 
171  void (*write_chat)(PurpleConversation *conv, const char *who,
172  const char *message, PurpleMessageFlags flags,
173  time_t mtime);
178  void (*write_im)(PurpleConversation *conv, const char *who,
179  const char *message, PurpleMessageFlags flags,
180  time_t mtime);
190  const char *name,
191  const char *alias,
192  const char *message,
193  PurpleMessageFlags flags,
194  time_t mtime);
195 
203  GList *cbuddies,
204  gboolean new_arrivals);
210  void (*chat_rename_user)(PurpleConversation *conv, const char *old_name,
211  const char *new_name, const char *new_alias);
216  void (*chat_remove_users)(PurpleConversation *conv, GList *users);
220  void (*chat_update_user)(PurpleConversation *conv, const char *user);
221 
225  void (*present)(PurpleConversation *conv);
226 
231  gboolean (*has_focus)(PurpleConversation *conv);
232 
233  /* Custom Smileys */
234  gboolean (*custom_smiley_add)(PurpleConversation *conv, const char *smile, gboolean remote);
235  void (*custom_smiley_write)(PurpleConversation *conv, const char *smile,
236  const guchar *data, gsize size);
237  void (*custom_smiley_close)(PurpleConversation *conv, const char *smile);
238 
244  void (*send_confirm)(PurpleConversation *conv, const char *message);
245 
246  void (*_purple_reserved1)(void);
247  void (*_purple_reserved2)(void);
248  void (*_purple_reserved3)(void);
249  void (*_purple_reserved4)(void);
250 };
251 
256 {
261  time_t type_again;
265 };
266 
271 {
274  GList *in_room;
277  GList *ignored;
278  char *who;
279  char *topic;
280  int id;
281  char *nick;
283  gboolean left;
284  GHashTable *users;
287 };
288 
293 {
294  char *name;
295  char *alias;
298  char *alias_key;
303  gboolean buddy;
309  GHashTable *attributes;
312  gpointer ui_data;
313 };
314 
321 {
322  char *who;
323  char *what;
324  PurpleMessageFlags flags;
325  time_t when;
327  char *alias;
328 };
329 
336 {
342  char *name;
343  char *title;
345  gboolean logging;
347  GList *logs;
349  union
350  {
353  void *misc;
355  } u;
356 
358  void *ui_data;
360  GHashTable *data;
364 };
365 
366 #ifdef __cplusplus
367 extern "C" {
368 #endif
369 
370 /**************************************************************************/
372 /**************************************************************************/
387  PurpleAccount *account,
388  const char *name);
389 
400 
401 
408 
409 
418 
427 
434 
443  const PurpleConversation *conv);
444 
455  PurpleAccount *account);
456 
468 
479 
486 void purple_conversation_set_title(PurpleConversation *conv, const char *title);
487 
495 const char *purple_conversation_get_title(const PurpleConversation *conv);
496 
506 
513 void purple_conversation_set_name(PurpleConversation *conv, const char *name);
514 
523 const char *purple_conversation_get_name(const PurpleConversation *conv);
524 
533 const char *purple_conv_chat_cb_get_attribute(PurpleConvChatBuddy *cb, const char *key);
534 
543 
552 void purple_conv_chat_cb_set_attribute(PurpleConvChat *chat, PurpleConvChatBuddy *cb, const char *key, const char *value);
553 
562 void
563 purple_conv_chat_cb_set_attributes(PurpleConvChat *chat, PurpleConvChatBuddy *cb, GList *keys, GList *values);
564 
571 void purple_conversation_set_logging(PurpleConversation *conv, gboolean log);
572 
581 
592 
603 
604 #define PURPLE_CONV_IM(c) (purple_conversation_get_im_data(c))
605 
616 
617 #define PURPLE_CONV_CHAT(c) (purple_conversation_get_chat_data(c))
618 
626 void purple_conversation_set_data(PurpleConversation *conv, const char *key,
627  gpointer data);
628 
637 gpointer purple_conversation_get_data(PurpleConversation *conv, const char *key);
638 
646 GList *purple_get_conversations(void);
647 
653 GList *purple_get_ims(void);
654 
660 GList *purple_get_chats(void);
661 
672  PurpleConversationType type, const char *name,
673  const PurpleAccount *account);
674 
695 void purple_conversation_write(PurpleConversation *conv, const char *who,
696  const char *message, PurpleMessageFlags flags,
697  time_t mtime);
698 
705  PurpleConnectionFlags features);
706 
707 
713 
723 
731 
737 void purple_conversation_foreach(void (*func)(PurpleConversation *conv));
738 
751 
760 
771 
782 
793 
804 
808 /**************************************************************************/
810 /**************************************************************************/
821 
834 
843 
851 
860 
868 
875 
884 
896 void purple_conv_im_set_type_again(PurpleConvIm *im, unsigned int val);
897 
907 
914 
921 
930 
937 
947 void purple_conv_im_write(PurpleConvIm *im, const char *who,
948  const char *message, PurpleMessageFlags flags,
949  time_t mtime);
950 
964 gboolean purple_conv_present_error(const char *who, PurpleAccount *account, const char *what);
965 
972 void purple_conv_im_send(PurpleConvIm *im, const char *message);
973 
986 void purple_conv_send_confirm(PurpleConversation *conv, const char *message);
987 
995 void purple_conv_im_send_with_flags(PurpleConvIm *im, const char *message, PurpleMessageFlags flags);
996 
1016 gboolean purple_conv_custom_smiley_add(PurpleConversation *conv, const char *smile,
1017  const char *cksum_type, const char *chksum,
1018  gboolean remote);
1019 
1020 
1031  const char *smile,
1032  const guchar *data,
1033  gsize size);
1034 
1044 void purple_conv_custom_smiley_close(PurpleConversation *conv, const char *smile);
1045 
1049 /**************************************************************************/
1051 /**************************************************************************/
1062 
1077 GList *purple_conv_chat_set_users(PurpleConvChat *chat, GList *users);
1078 
1087 GList *purple_conv_chat_get_users(const PurpleConvChat *chat);
1088 
1095 void purple_conv_chat_ignore(PurpleConvChat *chat, const char *name);
1096 
1103 void purple_conv_chat_unignore(PurpleConvChat *chat, const char *name);
1104 
1113 GList *purple_conv_chat_set_ignored(PurpleConvChat *chat, GList *ignored);
1114 
1122 GList *purple_conv_chat_get_ignored(const PurpleConvChat *chat);
1123 
1138 const char *purple_conv_chat_get_ignored_user(const PurpleConvChat *chat,
1139  const char *user);
1140 
1150  const char *user);
1151 
1159 void purple_conv_chat_set_topic(PurpleConvChat *chat, const char *who,
1160  const char *topic);
1161 
1169 const char *purple_conv_chat_get_topic(const PurpleConvChat *chat);
1170 
1177 void purple_conv_chat_set_id(PurpleConvChat *chat, int id);
1178 
1186 int purple_conv_chat_get_id(const PurpleConvChat *chat);
1187 
1197 void purple_conv_chat_write(PurpleConvChat *chat, const char *who,
1198  const char *message, PurpleMessageFlags flags,
1199  time_t mtime);
1200 
1207 void purple_conv_chat_send(PurpleConvChat *chat, const char *message);
1208 
1216 void purple_conv_chat_send_with_flags(PurpleConvChat *chat, const char *message, PurpleMessageFlags flags);
1217 
1227 void purple_conv_chat_add_user(PurpleConvChat *chat, const char *user,
1228  const char *extra_msg, PurpleConvChatBuddyFlags flags,
1229  gboolean new_arrival);
1230 
1248 void purple_conv_chat_add_users(PurpleConvChat *chat, GList *users, GList *extra_msgs,
1249  GList *flags, gboolean new_arrivals);
1250 
1258 void purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user,
1259  const char *new_user);
1260 
1270 void purple_conv_chat_remove_user(PurpleConvChat *chat, const char *user,
1271  const char *reason);
1272 
1280 void purple_conv_chat_remove_users(PurpleConvChat *chat, GList *users,
1281  const char *reason);
1282 
1291 gboolean purple_conv_chat_find_user(PurpleConvChat *chat, const char *user);
1292 
1300 void purple_conv_chat_user_set_flags(PurpleConvChat *chat, const char *user,
1301  PurpleConvChatBuddyFlags flags);
1302 
1312  const char *user);
1313 
1320 
1327 void purple_conv_chat_set_nick(PurpleConvChat *chat, const char *nick);
1328 
1335 const char *purple_conv_chat_get_nick(PurpleConvChat *chat);
1336 
1346 
1354 
1368 void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user,
1369  const char *message, gboolean confirm);
1370 
1381 
1391 PurpleConvChatBuddy *purple_conv_chat_cb_new(const char *name, const char *alias,
1392  PurpleConvChatBuddyFlags flags);
1393 
1401 
1410 
1417 
1430 
1444 gboolean purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, const gchar *markup, gchar **error);
1445 
1448 /**************************************************************************/
1450 /**************************************************************************/
1459 
1463 void purple_conversations_init(void);
1464 
1468 void purple_conversations_uninit(void);
1469 
1472 #ifdef __cplusplus
1473 }
1474 #endif
1475 
1476 #endif /* _PURPLE_CONVERSATION_H_ */