Mercurial > pidgin
comparison libpurple/conversation.h @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | 98520ee78f12 |
children |
comparison
equal
deleted
inserted
replaced
32818:01ff09d4a463 | 32819:2c6510167895 |
---|---|
123 PURPLE_MESSAGE_RAW = 0x0800, /**< "Raw" message - don't | 123 PURPLE_MESSAGE_RAW = 0x0800, /**< "Raw" message - don't |
124 apply formatting */ | 124 apply formatting */ |
125 PURPLE_MESSAGE_IMAGES = 0x1000, /**< Message contains images */ | 125 PURPLE_MESSAGE_IMAGES = 0x1000, /**< Message contains images */ |
126 PURPLE_MESSAGE_NOTIFY = 0x2000, /**< Message is a notification */ | 126 PURPLE_MESSAGE_NOTIFY = 0x2000, /**< Message is a notification */ |
127 PURPLE_MESSAGE_NO_LINKIFY = 0x4000, /**< Message should not be auto- | 127 PURPLE_MESSAGE_NO_LINKIFY = 0x4000, /**< Message should not be auto- |
128 linkified @since 2.1.0 */ | 128 linkified */ |
129 PURPLE_MESSAGE_INVISIBLE = 0x8000 /**< Message should not be displayed */ | 129 PURPLE_MESSAGE_INVISIBLE = 0x8000 /**< Message should not be displayed */ |
130 } PurpleMessageFlags; | 130 } PurpleMessageFlags; |
131 | 131 |
132 /** | 132 /** |
133 * Flags applicable to users in Chats. | 133 * Flags applicable to users in Chats. |
138 PURPLE_CBFLAGS_VOICE = 0x0001, /**< Voiced user or "Participant" */ | 138 PURPLE_CBFLAGS_VOICE = 0x0001, /**< Voiced user or "Participant" */ |
139 PURPLE_CBFLAGS_HALFOP = 0x0002, /**< Half-op */ | 139 PURPLE_CBFLAGS_HALFOP = 0x0002, /**< Half-op */ |
140 PURPLE_CBFLAGS_OP = 0x0004, /**< Channel Op or Moderator */ | 140 PURPLE_CBFLAGS_OP = 0x0004, /**< Channel Op or Moderator */ |
141 PURPLE_CBFLAGS_FOUNDER = 0x0008, /**< Channel Founder */ | 141 PURPLE_CBFLAGS_FOUNDER = 0x0008, /**< Channel Founder */ |
142 PURPLE_CBFLAGS_TYPING = 0x0010, /**< Currently typing */ | 142 PURPLE_CBFLAGS_TYPING = 0x0010, /**< Currently typing */ |
143 PURPLE_CBFLAGS_AWAY = 0x0020 /**< Currently away. @since 2.8.0 */ | 143 PURPLE_CBFLAGS_AWAY = 0x0020 /**< Currently away. */ |
144 | 144 |
145 } PurpleConvChatBuddyFlags; | 145 } PurpleConvChatBuddyFlags; |
146 | 146 |
147 #include "account.h" | 147 #include "account.h" |
148 #include "buddyicon.h" | 148 #include "buddyicon.h" |
247 void (*_purple_reserved2)(void); | 247 void (*_purple_reserved2)(void); |
248 void (*_purple_reserved3)(void); | 248 void (*_purple_reserved3)(void); |
249 void (*_purple_reserved4)(void); | 249 void (*_purple_reserved4)(void); |
250 }; | 250 }; |
251 | 251 |
252 /** | 252 G_BEGIN_DECLS |
253 * Data specific to Instant Messages. | |
254 */ | |
255 struct _PurpleConvIm | |
256 { | |
257 PurpleConversation *conv; /**< The parent conversation. */ | |
258 | |
259 PurpleTypingState typing_state; /**< The current typing state. */ | |
260 guint typing_timeout; /**< The typing timer handle. */ | |
261 time_t type_again; /**< The type again time. */ | |
262 guint send_typed_timeout; /**< The type again timer handle. */ | |
263 | |
264 PurpleBuddyIcon *icon; /**< The buddy icon. */ | |
265 }; | |
266 | |
267 /** | |
268 * Data specific to Chats. | |
269 */ | |
270 struct _PurpleConvChat | |
271 { | |
272 PurpleConversation *conv; /**< The parent conversation. */ | |
273 | |
274 GList *in_room; /**< The users in the room. | |
275 * @deprecated Will be removed in 3.0.0 | |
276 */ | |
277 GList *ignored; /**< Ignored users. */ | |
278 char *who; /**< The person who set the topic. */ | |
279 char *topic; /**< The topic. */ | |
280 int id; /**< The chat ID. */ | |
281 char *nick; /**< Your nick in this chat. */ | |
282 | |
283 gboolean left; /**< We left the chat and kept the window open */ | |
284 GHashTable *users; /**< Hash table of the users in the room. | |
285 * @since 2.9.0 | |
286 */ | |
287 }; | |
288 | |
289 /** | |
290 * Data for "Chat Buddies" | |
291 */ | |
292 struct _PurpleConvChatBuddy | |
293 { | |
294 char *name; /**< The chat participant's name in the chat. */ | |
295 char *alias; /**< The chat participant's alias, if known; | |
296 * @a NULL otherwise. | |
297 */ | |
298 char *alias_key; /**< A string by which this buddy will be sorted, | |
299 * or @c NULL if the buddy should be sorted by | |
300 * its @c name. (This is currently always @c | |
301 * NULL.) | |
302 */ | |
303 gboolean buddy; /**< @a TRUE if this chat participant is on the | |
304 * buddy list; @a FALSE otherwise. | |
305 */ | |
306 PurpleConvChatBuddyFlags flags; /**< A bitwise OR of flags for this participant, | |
307 * such as whether they are a channel operator. | |
308 */ | |
309 GHashTable *attributes; /**< A hash table of attributes about the user, such as | |
310 * real name, user@host, etc. | |
311 */ | |
312 gpointer ui_data; /** < The UI can put whatever it wants here. */ | |
313 }; | |
314 | |
315 /** | |
316 * Description of a conversation message | |
317 * | |
318 * @since 2.2.0 | |
319 */ | |
320 struct _PurpleConvMessage | |
321 { | |
322 char *who; | |
323 char *what; | |
324 PurpleMessageFlags flags; | |
325 time_t when; | |
326 PurpleConversation *conv; /**< @since 2.3.0 */ | |
327 char *alias; /**< @since 2.3.0 */ | |
328 }; | |
329 | |
330 /** | |
331 * A core representation of a conversation between two or more people. | |
332 * | |
333 * The conversation can be an IM or a chat. | |
334 */ | |
335 struct _PurpleConversation | |
336 { | |
337 PurpleConversationType type; /**< The type of conversation. */ | |
338 | |
339 PurpleAccount *account; /**< The user using this conversation. */ | |
340 | |
341 | |
342 char *name; /**< The name of the conversation. */ | |
343 char *title; /**< The window title. */ | |
344 | |
345 gboolean logging; /**< The status of logging. */ | |
346 | |
347 GList *logs; /**< This conversation's logs */ | |
348 | |
349 union | |
350 { | |
351 PurpleConvIm *im; /**< IM-specific data. */ | |
352 PurpleConvChat *chat; /**< Chat-specific data. */ | |
353 void *misc; /**< Misc. data. */ | |
354 | |
355 } u; | |
356 | |
357 PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ | |
358 void *ui_data; /**< UI-specific data. */ | |
359 | |
360 GHashTable *data; /**< Plugin-specific data. */ | |
361 | |
362 PurpleConnectionFlags features; /**< The supported features */ | |
363 GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ | |
364 }; | |
365 | |
366 #ifdef __cplusplus | |
367 extern "C" { | |
368 #endif | |
369 | 253 |
370 /**************************************************************************/ | 254 /**************************************************************************/ |
371 /** @name Conversation API */ | 255 /** @name Conversation API */ |
372 /**************************************************************************/ | 256 /**************************************************************************/ |
373 /*@{*/ | 257 /*@{*/ |
467 PurpleAccount *purple_conversation_get_account(const PurpleConversation *conv); | 351 PurpleAccount *purple_conversation_get_account(const PurpleConversation *conv); |
468 | 352 |
469 /** | 353 /** |
470 * Returns the specified conversation's purple_connection. | 354 * Returns the specified conversation's purple_connection. |
471 * | 355 * |
472 * This is the same as purple_conversation_get_user(conv)->gc. | |
473 * | |
474 * @param conv The conversation. | 356 * @param conv The conversation. |
475 * | 357 * |
476 * @return The conversation's purple_connection. | 358 * @return The conversation's purple_connection. |
477 */ | 359 */ |
478 PurpleConnection *purple_conversation_get_gc(const PurpleConversation *conv); | 360 PurpleConnection *purple_conversation_get_connection(const PurpleConversation *conv); |
479 | 361 |
480 /** | 362 /** |
481 * Sets the specified conversation's title. | 363 * Sets the specified conversation's title. |
482 * | 364 * |
483 * @param conv The conversation. | 365 * @param conv The conversation. |
742 * @param conv The conversation | 624 * @param conv The conversation |
743 * | 625 * |
744 * @return A GList of PurpleConvMessage's. The must not modify the list or the data within. | 626 * @return A GList of PurpleConvMessage's. The must not modify the list or the data within. |
745 * The list contains the newest message at the beginning, and the oldest message at | 627 * The list contains the newest message at the beginning, and the oldest message at |
746 * the end. | 628 * the end. |
747 * | |
748 * @since 2.2.0 | |
749 */ | 629 */ |
750 GList *purple_conversation_get_message_history(PurpleConversation *conv); | 630 GList *purple_conversation_get_message_history(PurpleConversation *conv); |
751 | 631 |
752 /** | 632 /** |
753 * Clear the message history of a conversation. | 633 * Clear the message history of a conversation. |
754 * | 634 * |
755 * @param conv The conversation | 635 * @param conv The conversation |
756 * | |
757 * @since 2.2.0 | |
758 */ | 636 */ |
759 void purple_conversation_clear_message_history(PurpleConversation *conv); | 637 void purple_conversation_clear_message_history(PurpleConversation *conv); |
760 | 638 |
761 /** | 639 /** |
762 * Get the sender from a PurpleConvMessage | 640 * Get the sender from a PurpleConvMessage |
763 * | 641 * |
764 * @param msg A PurpleConvMessage | 642 * @param msg A PurpleConvMessage |
765 * | 643 * |
766 * @return The name of the sender of the message | 644 * @return The name of the sender of the message |
767 * | 645 */ |
768 * @since 2.2.0 | 646 const char *purple_conversation_message_get_sender(const PurpleConvMessage *msg); |
769 */ | |
770 const char *purple_conversation_message_get_sender(PurpleConvMessage *msg); | |
771 | 647 |
772 /** | 648 /** |
773 * Get the message from a PurpleConvMessage | 649 * Get the message from a PurpleConvMessage |
774 * | 650 * |
775 * @param msg A PurpleConvMessage | 651 * @param msg A PurpleConvMessage |
776 * | 652 * |
777 * @return The name of the sender of the message | 653 * @return The name of the sender of the message |
778 * | 654 */ |
779 * @since 2.2.0 | 655 const char *purple_conversation_message_get_message(const PurpleConvMessage *msg); |
780 */ | |
781 const char *purple_conversation_message_get_message(PurpleConvMessage *msg); | |
782 | 656 |
783 /** | 657 /** |
784 * Get the message-flags of a PurpleConvMessage | 658 * Get the message-flags of a PurpleConvMessage |
785 * | 659 * |
786 * @param msg A PurpleConvMessage | 660 * @param msg A PurpleConvMessage |
787 * | 661 * |
788 * @return The message flags | 662 * @return The message flags |
789 * | 663 */ |
790 * @since 2.2.0 | 664 PurpleMessageFlags purple_conversation_message_get_flags(const PurpleConvMessage *msg); |
791 */ | |
792 PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg); | |
793 | 665 |
794 /** | 666 /** |
795 * Get the timestamp of a PurpleConvMessage | 667 * Get the timestamp of a PurpleConvMessage |
796 * | 668 * |
797 * @param msg A PurpleConvMessage | 669 * @param msg A PurpleConvMessage |
798 * | 670 * |
799 * @return The timestamp of the message | 671 * @return The timestamp of the message |
800 * | 672 */ |
801 * @since 2.2.0 | 673 time_t purple_conversation_message_get_timestamp(const PurpleConvMessage *msg); |
802 */ | 674 |
803 time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg); | 675 /** |
676 * Get the alias from a PurpleConvMessage | |
677 * | |
678 * @param msg A PurpleConvMessage | |
679 * | |
680 * @return The alias of the sender of the message | |
681 */ | |
682 const char *purple_conversation_message_get_alias(const PurpleConvMessage *msg); | |
683 | |
684 /** | |
685 * Get the conversation associated with the PurpleConvMessage | |
686 * | |
687 * @param msg A PurpleConvMessage | |
688 * | |
689 * @return The conversation | |
690 */ | |
691 PurpleConversation *purple_conversation_message_get_conv(const PurpleConvMessage *msg); | |
692 | |
693 /** | |
694 * Set the UI data associated with this conversation. | |
695 * | |
696 * @param conv The conversation. | |
697 * @param ui_data A pointer to associate with this conversation. | |
698 */ | |
699 void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data); | |
700 | |
701 /** | |
702 * Get the UI data associated with this conversation. | |
703 * | |
704 * @param conv The conversation. | |
705 * | |
706 * @return The UI data associated with this conversation. This is a | |
707 * convenience field provided to the UIs--it is not | |
708 * used by the libpurple core. | |
709 */ | |
710 gpointer purple_conversation_get_ui_data(const PurpleConversation *conv); | |
804 | 711 |
805 /*@}*/ | 712 /*@}*/ |
806 | 713 |
807 | 714 |
808 /**************************************************************************/ | 715 /**************************************************************************/ |
1057 * @param chat The chat. | 964 * @param chat The chat. |
1058 * | 965 * |
1059 * @return The parent conversation. | 966 * @return The parent conversation. |
1060 */ | 967 */ |
1061 PurpleConversation *purple_conv_chat_get_conversation(const PurpleConvChat *chat); | 968 PurpleConversation *purple_conv_chat_get_conversation(const PurpleConvChat *chat); |
1062 | |
1063 /** | |
1064 * Sets the list of users in the chat room. | |
1065 * | |
1066 * @note Calling this function will not update the display of the users. | |
1067 * Please use purple_conv_chat_add_user(), purple_conv_chat_add_users(), | |
1068 * purple_conv_chat_remove_user(), and purple_conv_chat_remove_users() instead. | |
1069 * | |
1070 * @param chat The chat. | |
1071 * @param users The list of users. | |
1072 * | |
1073 * @return The list passed. | |
1074 * | |
1075 * @deprecated This function will be removed in 3.0.0. You shouldn't be using it anyway. | |
1076 */ | |
1077 GList *purple_conv_chat_set_users(PurpleConvChat *chat, GList *users); | |
1078 | 969 |
1079 /** | 970 /** |
1080 * Returns a list of users in the chat room. The members of the list | 971 * Returns a list of users in the chat room. The members of the list |
1081 * are PurpleConvChatBuddy objects. | 972 * are PurpleConvChatBuddy objects. |
1082 * | 973 * |
1360 * @param chat The chat. | 1251 * @param chat The chat. |
1361 * @param user The user to invite to the chat. | 1252 * @param user The user to invite to the chat. |
1362 * @param message The message to send with the invitation. | 1253 * @param message The message to send with the invitation. |
1363 * @param confirm Prompt before sending the invitation. The user is always | 1254 * @param confirm Prompt before sending the invitation. The user is always |
1364 * prompted if either \a user or \a message is @c NULL. | 1255 * prompted if either \a user or \a message is @c NULL. |
1365 * | |
1366 * @since 2.6.0 | |
1367 */ | 1256 */ |
1368 void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, | 1257 void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, |
1369 const char *message, gboolean confirm); | 1258 const char *message, gboolean confirm); |
1370 | 1259 |
1371 /** | 1260 /** |
1398 * @param name The name of the chat buddy to find. | 1287 * @param name The name of the chat buddy to find. |
1399 */ | 1288 */ |
1400 PurpleConvChatBuddy *purple_conv_chat_cb_find(PurpleConvChat *chat, const char *name); | 1289 PurpleConvChatBuddy *purple_conv_chat_cb_find(PurpleConvChat *chat, const char *name); |
1401 | 1290 |
1402 /** | 1291 /** |
1292 * Set the UI data associated with this chat buddy. | |
1293 * | |
1294 * @param cb The chat buddy | |
1295 * @param ui_data A pointer to associate with this chat buddy. | |
1296 */ | |
1297 void purple_conv_chat_cb_set_ui_data(PurpleConvChatBuddy *cb, gpointer ui_data); | |
1298 | |
1299 /** | |
1300 * Get the UI data associated with this chat buddy. | |
1301 * | |
1302 * @param cb The chat buddy. | |
1303 * | |
1304 * @return The UI data associated with this chat buddy. This is a | |
1305 * convenience field provided to the UIs--it is not | |
1306 * used by the libpurple core. | |
1307 */ | |
1308 gpointer purple_conv_chat_cb_get_ui_data(const PurpleConvChatBuddy *conv); | |
1309 | |
1310 /** | |
1311 * Get the alias of a chat buddy | |
1312 * | |
1313 * @param cb The chat buddy. | |
1314 * | |
1315 * @return The alias of the chat buddy. | |
1316 */ | |
1317 const char *purple_conv_chat_cb_get_alias(const PurpleConvChatBuddy *cb); | |
1318 | |
1319 /** | |
1403 * Get the name of a chat buddy | 1320 * Get the name of a chat buddy |
1404 * | 1321 * |
1405 * @param cb The chat buddy. | 1322 * @param cb The chat buddy. |
1406 * | 1323 * |
1407 * @return The name of the chat buddy. | 1324 * @return The name of the chat buddy. |
1408 */ | 1325 */ |
1409 const char *purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb); | 1326 const char *purple_conv_chat_cb_get_name(const PurpleConvChatBuddy *cb); |
1327 | |
1328 /** | |
1329 * Get the flags of a chat buddy. | |
1330 * | |
1331 * @param cb The chat buddy. | |
1332 * | |
1333 * @return The flags of the chat buddy. | |
1334 */ | |
1335 PurpleConvChatBuddyFlags purple_conv_chat_cb_get_flags(const PurpleConvChatBuddy *cb); | |
1336 | |
1337 /** | |
1338 * Indicates if this chat buddy is on the buddy list. | |
1339 * | |
1340 * @param cb The chat buddy. | |
1341 * | |
1342 * @return TRUE if the chat buddy is on the buddy list. | |
1343 */ | |
1344 gboolean purple_conv_chat_cb_is_buddy(const PurpleConvChatBuddy *cb); | |
1410 | 1345 |
1411 /** | 1346 /** |
1412 * Destroys a chat buddy | 1347 * Destroys a chat buddy |
1413 * | 1348 * |
1414 * @param cb The chat buddy to destroy | 1349 * @param cb The chat buddy to destroy |
1421 * @param conv The conversation. | 1356 * @param conv The conversation. |
1422 * | 1357 * |
1423 * @return A list of PurpleMenuAction items, harvested by the | 1358 * @return A list of PurpleMenuAction items, harvested by the |
1424 * chat-extended-menu signal. The list and the menuaction | 1359 * chat-extended-menu signal. The list and the menuaction |
1425 * items should be freed by the caller. | 1360 * items should be freed by the caller. |
1426 * | |
1427 * @since 2.1.0 | |
1428 */ | 1361 */ |
1429 GList * purple_conversation_get_extended_menu(PurpleConversation *conv); | 1362 GList * purple_conversation_get_extended_menu(PurpleConversation *conv); |
1430 | 1363 |
1431 /** | 1364 /** |
1432 * Perform a command in a conversation. Similar to @see purple_cmd_do_command | 1365 * Perform a command in a conversation. Similar to @see purple_cmd_do_command |
1436 * @param markup @c NULL, or the formatted command line. | 1369 * @param markup @c NULL, or the formatted command line. |
1437 * @param error If the command failed errormsg is filled in with the appropriate error | 1370 * @param error If the command failed errormsg is filled in with the appropriate error |
1438 * message, if not @c NULL. It must be freed by the caller with g_free(). | 1371 * message, if not @c NULL. It must be freed by the caller with g_free(). |
1439 * | 1372 * |
1440 * @return @c TRUE if the command was executed successfully, @c FALSE otherwise. | 1373 * @return @c TRUE if the command was executed successfully, @c FALSE otherwise. |
1441 * | |
1442 * @since 2.1.0 | |
1443 */ | 1374 */ |
1444 gboolean purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, const gchar *markup, gchar **error); | 1375 gboolean purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, const gchar *markup, gchar **error); |
1445 | 1376 |
1446 /*@}*/ | 1377 /*@}*/ |
1447 | 1378 |
1467 */ | 1398 */ |
1468 void purple_conversations_uninit(void); | 1399 void purple_conversations_uninit(void); |
1469 | 1400 |
1470 /*@}*/ | 1401 /*@}*/ |
1471 | 1402 |
1472 #ifdef __cplusplus | 1403 G_END_DECLS |
1473 } | |
1474 #endif | |
1475 | 1404 |
1476 #endif /* _PURPLE_CONVERSATION_H_ */ | 1405 #endif /* _PURPLE_CONVERSATION_H_ */ |