Mercurial > pidgin.yaz
comparison libpurple/conversation.c @ 32827:4a34689eeb33 default tip
merged from im.pidgin.pidgin
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 19 Nov 2011 14:42:54 +0900 |
parents | 0f94ec89f0bc 3e7a7e14af62 |
children |
comparison
equal
deleted
inserted
replaced
32692:0f94ec89f0bc | 32827:4a34689eeb33 |
---|---|
33 #include "signals.h" | 33 #include "signals.h" |
34 #include "util.h" | 34 #include "util.h" |
35 | 35 |
36 #define SEND_TYPED_TIMEOUT_SECONDS 5 | 36 #define SEND_TYPED_TIMEOUT_SECONDS 5 |
37 | 37 |
38 /** | |
39 * Data specific to Chats. | |
40 */ | |
41 struct _PurpleConvChat | |
42 { | |
43 PurpleConversation *conv; /**< The parent conversation. */ | |
44 | |
45 GList *in_room; /**< The users in the room. | |
46 * @deprecated Will be removed in 3.0.0 | |
47 */ | |
48 GList *ignored; /**< Ignored users. */ | |
49 char *who; /**< The person who set the topic. */ | |
50 char *topic; /**< The topic. */ | |
51 int id; /**< The chat ID. */ | |
52 char *nick; /**< Your nick in this chat. */ | |
53 | |
54 gboolean left; /**< We left the chat and kept the window open */ | |
55 GHashTable *users; /**< Hash table of the users in the room. */ | |
56 }; | |
57 | |
58 /** | |
59 * Data specific to Instant Messages. | |
60 */ | |
61 struct _PurpleConvIm | |
62 { | |
63 PurpleConversation *conv; /**< The parent conversation. */ | |
64 | |
65 PurpleTypingState typing_state; /**< The current typing state. */ | |
66 guint typing_timeout; /**< The typing timer handle. */ | |
67 time_t type_again; /**< The type again time. */ | |
68 guint send_typed_timeout; /**< The type again timer handle. */ | |
69 | |
70 PurpleBuddyIcon *icon; /**< The buddy icon. */ | |
71 }; | |
72 | |
73 /** | |
74 * Data for "Chat Buddies" | |
75 */ | |
76 struct _PurpleConvChatBuddy | |
77 { | |
78 /** The chat participant's name in the chat. */ | |
79 char *name; | |
80 | |
81 /** The chat participant's alias, if known; @a NULL otherwise. */ | |
82 char *alias; | |
83 | |
84 /** | |
85 * A string by which this buddy will be sorted, or @c NULL if the | |
86 * buddy should be sorted by its @c name. (This is currently always | |
87 * @c NULL. | |
88 */ | |
89 char *alias_key; | |
90 | |
91 /** | |
92 * @a TRUE if this chat participant is on the buddy list; | |
93 * @a FALSE otherwise. | |
94 */ | |
95 gboolean buddy; | |
96 | |
97 /** | |
98 * A bitwise OR of flags for this participant, such as whether they | |
99 * are a channel operator. | |
100 */ | |
101 PurpleConvChatBuddyFlags flags; | |
102 | |
103 /** | |
104 * A hash table of attributes about the user, such as real name, | |
105 * user\@host, etc. | |
106 */ | |
107 GHashTable *attributes; | |
108 | |
109 /** The UI can put whatever it wants here. */ | |
110 gpointer ui_data; | |
111 }; | |
112 | |
113 /** | |
114 * A core representation of a conversation between two or more people. | |
115 * | |
116 * The conversation can be an IM or a chat. | |
117 */ | |
118 struct _PurpleConversation | |
119 { | |
120 PurpleConversationType type; /**< The type of conversation. */ | |
121 | |
122 PurpleAccount *account; /**< The user using this conversation. */ | |
123 | |
124 | |
125 char *name; /**< The name of the conversation. */ | |
126 char *title; /**< The window title. */ | |
127 | |
128 gboolean logging; /**< The status of logging. */ | |
129 | |
130 GList *logs; /**< This conversation's logs */ | |
131 | |
132 union | |
133 { | |
134 PurpleConvIm *im; /**< IM-specific data. */ | |
135 PurpleConvChat *chat; /**< Chat-specific data. */ | |
136 void *misc; /**< Misc. data. */ | |
137 | |
138 } u; | |
139 | |
140 PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ | |
141 void *ui_data; /**< UI-specific data. */ | |
142 | |
143 GHashTable *data; /**< Plugin-specific data. */ | |
144 | |
145 PurpleConnectionFlags features; /**< The supported features */ | |
146 GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ | |
147 }; | |
148 | |
149 /** | |
150 * Description of a conversation message | |
151 */ | |
152 struct _PurpleConvMessage | |
153 { | |
154 char *who; | |
155 char *what; | |
156 PurpleMessageFlags flags; | |
157 time_t when; | |
158 PurpleConversation *conv; | |
159 char *alias; | |
160 }; | |
161 | |
162 | |
38 static GList *conversations = NULL; | 163 static GList *conversations = NULL; |
39 static GList *ims = NULL; | 164 static GList *ims = NULL; |
40 static GList *chats = NULL; | 165 static GList *chats = NULL; |
41 static PurpleConversationUiOps *default_ops = NULL; | 166 static PurpleConversationUiOps *default_ops = NULL; |
42 | 167 |
114 PurpleConnection *gc; | 239 PurpleConnection *gc; |
115 const char *name; | 240 const char *name; |
116 | 241 |
117 g_return_val_if_fail(conv != NULL, FALSE); | 242 g_return_val_if_fail(conv != NULL, FALSE); |
118 | 243 |
119 gc = purple_conversation_get_gc(conv); | 244 gc = purple_conversation_get_connection(conv); |
120 name = purple_conversation_get_name(conv); | 245 name = purple_conversation_get_name(conv); |
121 | 246 |
122 if (gc != NULL && name != NULL) { | 247 if (gc != NULL && name != NULL) { |
123 /* We set this to 1 so that PURPLE_TYPING will be sent | 248 /* We set this to 1 so that PURPLE_TYPING will be sent |
124 * if the Purple user types anything else. | 249 * if the Purple user types anything else. |
144 | 269 |
145 if (*message == '\0') | 270 if (*message == '\0') |
146 return; | 271 return; |
147 | 272 |
148 account = purple_conversation_get_account(conv); | 273 account = purple_conversation_get_account(conv); |
149 gc = purple_conversation_get_gc(conv); | 274 gc = purple_conversation_get_connection(conv); |
150 | 275 |
151 g_return_if_fail(account != NULL); | 276 g_return_if_fail(account != NULL); |
152 g_return_if_fail(gc != NULL); | 277 g_return_if_fail(gc != NULL); |
153 | 278 |
154 type = purple_conversation_get_type(conv); | 279 type = purple_conversation_get_type(conv); |
260 if (flags & PURPLE_MESSAGE_SEND) { | 385 if (flags & PURPLE_MESSAGE_SEND) { |
261 const char *me = NULL; | 386 const char *me = NULL; |
262 if (gc) | 387 if (gc) |
263 me = purple_connection_get_display_name(gc); | 388 me = purple_connection_get_display_name(gc); |
264 if (!me) | 389 if (!me) |
265 me = conv->account->username; | 390 me = purple_account_get_username(conv->account); |
266 who = me; | 391 who = me; |
267 } | 392 } |
268 | 393 |
269 msg = g_new0(PurpleConvMessage, 1); | 394 msg = g_new0(PurpleConvMessage, 1); |
270 PURPLE_DBUS_REGISTER_POINTER(msg, PurpleConvMessage); | 395 PURPLE_DBUS_REGISTER_POINTER(msg, PurpleConvMessage); |
379 conv->name = g_strdup(name); | 504 conv->name = g_strdup(name); |
380 conv->title = g_strdup(name); | 505 conv->title = g_strdup(name); |
381 conv->data = g_hash_table_new_full(g_str_hash, g_str_equal, | 506 conv->data = g_hash_table_new_full(g_str_hash, g_str_equal, |
382 g_free, NULL); | 507 g_free, NULL); |
383 /* copy features from the connection. */ | 508 /* copy features from the connection. */ |
384 conv->features = gc->flags; | 509 conv->features = purple_connection_get_flags(gc); |
385 | 510 |
386 if (type == PURPLE_CONV_TYPE_IM) | 511 if (type == PURPLE_CONV_TYPE_IM) |
387 { | 512 { |
388 PurpleBuddyIcon *icon; | 513 PurpleBuddyIcon *icon; |
389 conv->u.im = g_new0(PurpleConvIm, 1); | 514 conv->u.im = g_new0(PurpleConvIm, 1); |
414 _purple_conversation_user_equal, g_free, NULL); | 539 _purple_conversation_user_equal, g_free, NULL); |
415 PURPLE_DBUS_REGISTER_POINTER(conv->u.chat, PurpleConvChat); | 540 PURPLE_DBUS_REGISTER_POINTER(conv->u.chat, PurpleConvChat); |
416 | 541 |
417 chats = g_list_prepend(chats, conv); | 542 chats = g_list_prepend(chats, conv); |
418 | 543 |
419 if ((disp = purple_connection_get_display_name(account->gc))) | 544 if ((disp = purple_connection_get_display_name(purple_account_get_connection(account)))) |
420 purple_conv_chat_set_nick(conv->u.chat, disp); | 545 purple_conv_chat_set_nick(conv->u.chat, disp); |
421 else | 546 else |
422 purple_conv_chat_set_nick(conv->u.chat, | 547 purple_conv_chat_set_nick(conv->u.chat, |
423 purple_account_get_username(account)); | 548 purple_account_get_username(account)); |
424 | 549 |
467 g_return_if_fail(conv != NULL); | 592 g_return_if_fail(conv != NULL); |
468 | 593 |
469 purple_request_close_with_handle(conv); | 594 purple_request_close_with_handle(conv); |
470 | 595 |
471 ops = purple_conversation_get_ui_ops(conv); | 596 ops = purple_conversation_get_ui_ops(conv); |
472 gc = purple_conversation_get_gc(conv); | 597 gc = purple_conversation_get_connection(conv); |
473 name = purple_conversation_get_name(conv); | 598 name = purple_conversation_get_name(conv); |
474 | 599 |
475 if (gc != NULL) | 600 if (gc != NULL) |
476 { | 601 { |
477 /* Still connected */ | 602 /* Still connected */ |
692 | 817 |
693 return conv->account; | 818 return conv->account; |
694 } | 819 } |
695 | 820 |
696 PurpleConnection * | 821 PurpleConnection * |
697 purple_conversation_get_gc(const PurpleConversation *conv) | 822 purple_conversation_get_connection(const PurpleConversation *conv) |
698 { | 823 { |
699 PurpleAccount *account; | 824 PurpleAccount *account; |
700 | 825 |
701 g_return_val_if_fail(conv != NULL, NULL); | 826 g_return_val_if_fail(conv != NULL, NULL); |
702 | 827 |
703 account = purple_conversation_get_account(conv); | 828 account = purple_conversation_get_account(conv); |
704 | 829 |
705 if (account == NULL) | 830 if (account == NULL) |
706 return NULL; | 831 return NULL; |
707 | 832 |
708 return account->gc; | 833 return purple_account_get_connection(account); |
709 } | 834 } |
710 | 835 |
711 void | 836 void |
712 purple_conversation_set_title(PurpleConversation *conv, const char *title) | 837 purple_conversation_set_title(PurpleConversation *conv, const char *title) |
713 { | 838 { |
992 if (flags & PURPLE_MESSAGE_SEND) { | 1117 if (flags & PURPLE_MESSAGE_SEND) { |
993 b = purple_find_buddy(account, | 1118 b = purple_find_buddy(account, |
994 purple_account_get_username(account)); | 1119 purple_account_get_username(account)); |
995 | 1120 |
996 if (purple_account_get_alias(account) != NULL) | 1121 if (purple_account_get_alias(account) != NULL) |
997 alias = account->alias; | 1122 alias = purple_account_get_alias(account); |
998 else if (b != NULL && !purple_strequal(purple_buddy_get_name(b), purple_buddy_get_contact_alias(b))) | 1123 else if (b != NULL && !purple_strequal(purple_buddy_get_name(b), purple_buddy_get_contact_alias(b))) |
999 alias = purple_buddy_get_contact_alias(b); | 1124 alias = purple_buddy_get_contact_alias(b); |
1000 else if (purple_connection_get_display_name(gc) != NULL) | 1125 else if (purple_connection_get_display_name(gc) != NULL) |
1001 alias = purple_connection_get_display_name(gc); | 1126 alias = purple_connection_get_display_name(gc); |
1002 else | 1127 else |
1546 g_return_if_fail(chat != NULL); | 1671 g_return_if_fail(chat != NULL); |
1547 g_return_if_fail(who != NULL); | 1672 g_return_if_fail(who != NULL); |
1548 g_return_if_fail(message != NULL); | 1673 g_return_if_fail(message != NULL); |
1549 | 1674 |
1550 conv = purple_conv_chat_get_conversation(chat); | 1675 conv = purple_conv_chat_get_conversation(chat); |
1551 gc = purple_conversation_get_gc(conv); | 1676 gc = purple_conversation_get_connection(conv); |
1552 account = purple_connection_get_account(gc); | 1677 account = purple_connection_get_account(gc); |
1553 | 1678 |
1554 /* Don't display this if the person who wrote it is ignored. */ | 1679 /* Don't display this if the person who wrote it is ignored. */ |
1555 if (purple_conv_chat_is_user_ignored(chat, who)) | 1680 if (purple_conv_chat_is_user_ignored(chat, who)) |
1556 return; | 1681 return; |
1662 g_return_if_fail(users != NULL); | 1787 g_return_if_fail(users != NULL); |
1663 | 1788 |
1664 conv = purple_conv_chat_get_conversation(chat); | 1789 conv = purple_conv_chat_get_conversation(chat); |
1665 ops = purple_conversation_get_ui_ops(conv); | 1790 ops = purple_conversation_get_ui_ops(conv); |
1666 | 1791 |
1667 gc = purple_conversation_get_gc(conv); | 1792 gc = purple_conversation_get_connection(conv); |
1668 g_return_if_fail(gc != NULL); | 1793 g_return_if_fail(gc != NULL); |
1669 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); | 1794 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
1670 g_return_if_fail(prpl_info != NULL); | 1795 g_return_if_fail(prpl_info != NULL); |
1671 | 1796 |
1672 ul = users; | 1797 ul = users; |
1689 if (display_name != NULL) | 1814 if (display_name != NULL) |
1690 alias = display_name; | 1815 alias = display_name; |
1691 } | 1816 } |
1692 } else { | 1817 } else { |
1693 PurpleBuddy *buddy; | 1818 PurpleBuddy *buddy; |
1694 if ((buddy = purple_find_buddy(gc->account, user)) != NULL) | 1819 if ((buddy = purple_find_buddy(purple_connection_get_account(gc), user)) != NULL) |
1695 alias = purple_buddy_get_contact_alias(buddy); | 1820 alias = purple_buddy_get_contact_alias(buddy); |
1696 } | 1821 } |
1697 } | 1822 } |
1698 | 1823 |
1699 quiet = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_conversations_get_handle(), | 1824 quiet = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_conversations_get_handle(), |
1763 g_return_if_fail(new_user != NULL); | 1888 g_return_if_fail(new_user != NULL); |
1764 | 1889 |
1765 conv = purple_conv_chat_get_conversation(chat); | 1890 conv = purple_conv_chat_get_conversation(chat); |
1766 ops = purple_conversation_get_ui_ops(conv); | 1891 ops = purple_conversation_get_ui_ops(conv); |
1767 | 1892 |
1768 gc = purple_conversation_get_gc(conv); | 1893 gc = purple_conversation_get_connection(conv); |
1769 g_return_if_fail(gc != NULL); | 1894 g_return_if_fail(gc != NULL); |
1770 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); | 1895 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
1771 g_return_if_fail(prpl_info != NULL); | 1896 g_return_if_fail(prpl_info != NULL); |
1772 | 1897 |
1773 if (purple_strequal(chat->nick, purple_normalize(conv->account, old_user))) { | 1898 if (purple_strequal(chat->nick, purple_normalize(conv->account, old_user))) { |
1787 alias = display_name; | 1912 alias = display_name; |
1788 } | 1913 } |
1789 } | 1914 } |
1790 } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { | 1915 } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
1791 PurpleBuddy *buddy; | 1916 PurpleBuddy *buddy; |
1792 if ((buddy = purple_find_buddy(gc->account, new_user)) != NULL) | 1917 if ((buddy = purple_find_buddy(purple_connection_get_account(gc), new_user)) != NULL) |
1793 new_alias = purple_buddy_get_contact_alias(buddy); | 1918 new_alias = purple_buddy_get_contact_alias(buddy); |
1794 } | 1919 } |
1795 | 1920 |
1796 flags = purple_conv_chat_user_get_flags(chat, old_user); | 1921 flags = purple_conv_chat_user_get_flags(chat, old_user); |
1797 cb = purple_conv_chat_cb_new(new_user, new_alias, flags); | 1922 cb = purple_conv_chat_cb_new(new_user, new_alias, flags); |
1836 char *escaped2; | 1961 char *escaped2; |
1837 | 1962 |
1838 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { | 1963 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
1839 PurpleBuddy *buddy; | 1964 PurpleBuddy *buddy; |
1840 | 1965 |
1841 if ((buddy = purple_find_buddy(gc->account, old_user)) != NULL) | 1966 if ((buddy = purple_find_buddy(purple_connection_get_account(gc), old_user)) != NULL) |
1842 old_alias = purple_buddy_get_contact_alias(buddy); | 1967 old_alias = purple_buddy_get_contact_alias(buddy); |
1843 if ((buddy = purple_find_buddy(gc->account, new_user)) != NULL) | 1968 if ((buddy = purple_find_buddy(purple_connection_get_account(gc), new_user)) != NULL) |
1844 new_alias = purple_buddy_get_contact_alias(buddy); | 1969 new_alias = purple_buddy_get_contact_alias(buddy); |
1845 } | 1970 } |
1846 | 1971 |
1847 escaped = g_markup_escape_text(old_alias, -1); | 1972 escaped = g_markup_escape_text(old_alias, -1); |
1848 escaped2 = g_markup_escape_text(new_alias, -1); | 1973 escaped2 = g_markup_escape_text(new_alias, -1); |
1882 g_return_if_fail(chat != NULL); | 2007 g_return_if_fail(chat != NULL); |
1883 g_return_if_fail(users != NULL); | 2008 g_return_if_fail(users != NULL); |
1884 | 2009 |
1885 conv = purple_conv_chat_get_conversation(chat); | 2010 conv = purple_conv_chat_get_conversation(chat); |
1886 | 2011 |
1887 gc = purple_conversation_get_gc(conv); | 2012 gc = purple_conversation_get_connection(conv); |
1888 g_return_if_fail(gc != NULL); | 2013 g_return_if_fail(gc != NULL); |
1889 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); | 2014 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
1890 g_return_if_fail(prpl_info != NULL); | 2015 g_return_if_fail(prpl_info != NULL); |
1891 | 2016 |
1892 ops = purple_conversation_get_ui_ops(conv); | 2017 ops = purple_conversation_get_ui_ops(conv); |
1913 char *tmp; | 2038 char *tmp; |
1914 | 2039 |
1915 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { | 2040 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
1916 PurpleBuddy *buddy; | 2041 PurpleBuddy *buddy; |
1917 | 2042 |
1918 if ((buddy = purple_find_buddy(gc->account, user)) != NULL) | 2043 if ((buddy = purple_find_buddy(purple_connection_get_account(gc), user)) != NULL) |
1919 alias = purple_buddy_get_contact_alias(buddy); | 2044 alias = purple_buddy_get_contact_alias(buddy); |
1920 } | 2045 } |
1921 | 2046 |
1922 alias_esc = g_markup_escape_text(alias, -1); | 2047 alias_esc = g_markup_escape_text(alias, -1); |
1923 | 2048 |
2067 | 2192 |
2068 for (l = purple_get_chats(); l != NULL; l = l->next) { | 2193 for (l = purple_get_chats(); l != NULL; l = l->next) { |
2069 conv = (PurpleConversation *)l->data; | 2194 conv = (PurpleConversation *)l->data; |
2070 | 2195 |
2071 if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)) == id && | 2196 if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)) == id && |
2072 purple_conversation_get_gc(conv) == gc) | 2197 purple_conversation_get_connection(conv) == gc) |
2073 return conv; | 2198 return conv; |
2074 } | 2199 } |
2075 | 2200 |
2076 return NULL; | 2201 return NULL; |
2077 } | 2202 } |
2095 conv = data; | 2220 conv = data; |
2096 chat = PURPLE_CONV_CHAT(conv); | 2221 chat = PURPLE_CONV_CHAT(conv); |
2097 user = purple_request_fields_get_string(fields, "screenname"); | 2222 user = purple_request_fields_get_string(fields, "screenname"); |
2098 message = purple_request_fields_get_string(fields, "message"); | 2223 message = purple_request_fields_get_string(fields, "message"); |
2099 | 2224 |
2100 serv_chat_invite(purple_conversation_get_gc(conv), chat->id, message, user); | 2225 serv_chat_invite(purple_conversation_get_connection(conv), chat->id, message, user); |
2101 } | 2226 } |
2102 | 2227 |
2103 void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, | 2228 void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, |
2104 const char *message, gboolean confirm) | 2229 const char *message, gboolean confirm) |
2105 { | 2230 { |
2196 | 2321 |
2197 PURPLE_DBUS_UNREGISTER_POINTER(cb); | 2322 PURPLE_DBUS_UNREGISTER_POINTER(cb); |
2198 g_free(cb); | 2323 g_free(cb); |
2199 } | 2324 } |
2200 | 2325 |
2326 void purple_conv_chat_cb_set_ui_data(PurpleConvChatBuddy *cb, gpointer ui_data) | |
2327 { | |
2328 g_return_if_fail(cb != NULL); | |
2329 | |
2330 cb->ui_data = ui_data; | |
2331 } | |
2332 | |
2333 gpointer purple_conv_chat_cb_get_ui_data(const PurpleConvChatBuddy *cb) | |
2334 { | |
2335 g_return_val_if_fail(cb != NULL, NULL); | |
2336 | |
2337 return cb->ui_data; | |
2338 } | |
2339 | |
2201 const char * | 2340 const char * |
2202 purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb) | 2341 purple_conv_chat_cb_get_alias(const PurpleConvChatBuddy *cb) |
2203 { | 2342 { |
2204 g_return_val_if_fail(cb != NULL, NULL); | 2343 g_return_val_if_fail(cb != NULL, NULL); |
2205 | 2344 |
2345 return cb->alias; | |
2346 } | |
2347 | |
2348 const char * | |
2349 purple_conv_chat_cb_get_name(const PurpleConvChatBuddy *cb) | |
2350 { | |
2351 g_return_val_if_fail(cb != NULL, NULL); | |
2352 | |
2206 return cb->name; | 2353 return cb->name; |
2354 } | |
2355 | |
2356 PurpleConvChatBuddyFlags | |
2357 purple_conv_chat_cb_get_flags(const PurpleConvChatBuddy *cb) | |
2358 { | |
2359 g_return_val_if_fail(cb != NULL, PURPLE_CBFLAGS_NONE); | |
2360 | |
2361 return cb->flags; | |
2362 } | |
2363 | |
2364 gboolean purple_conv_chat_cb_is_buddy(const PurpleConvChatBuddy *cb) | |
2365 { | |
2366 g_return_val_if_fail(cb != NULL, FALSE); | |
2367 | |
2368 return cb->buddy; | |
2207 } | 2369 } |
2208 | 2370 |
2209 const char * | 2371 const char * |
2210 purple_conv_chat_cb_get_attribute(PurpleConvChatBuddy *cb, const char *key) | 2372 purple_conv_chat_cb_get_attribute(PurpleConvChatBuddy *cb, const char *key) |
2211 { | 2373 { |
2301 GList *purple_conversation_get_message_history(PurpleConversation *conv) | 2463 GList *purple_conversation_get_message_history(PurpleConversation *conv) |
2302 { | 2464 { |
2303 return conv->message_history; | 2465 return conv->message_history; |
2304 } | 2466 } |
2305 | 2467 |
2306 const char *purple_conversation_message_get_sender(PurpleConvMessage *msg) | 2468 const char *purple_conversation_message_get_sender(const PurpleConvMessage *msg) |
2307 { | 2469 { |
2308 g_return_val_if_fail(msg, NULL); | 2470 g_return_val_if_fail(msg, NULL); |
2309 return msg->who; | 2471 return msg->who; |
2310 } | 2472 } |
2311 | 2473 |
2312 const char *purple_conversation_message_get_message(PurpleConvMessage *msg) | 2474 const char *purple_conversation_message_get_message(const PurpleConvMessage *msg) |
2313 { | 2475 { |
2314 g_return_val_if_fail(msg, NULL); | 2476 g_return_val_if_fail(msg, NULL); |
2315 return msg->what; | 2477 return msg->what; |
2316 } | 2478 } |
2317 | 2479 |
2318 PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg) | 2480 PurpleMessageFlags purple_conversation_message_get_flags(const PurpleConvMessage *msg) |
2319 { | 2481 { |
2320 g_return_val_if_fail(msg, 0); | 2482 g_return_val_if_fail(msg, 0); |
2321 return msg->flags; | 2483 return msg->flags; |
2322 } | 2484 } |
2323 | 2485 |
2324 time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg) | 2486 time_t purple_conversation_message_get_timestamp(const PurpleConvMessage *msg) |
2325 { | 2487 { |
2326 g_return_val_if_fail(msg, 0); | 2488 g_return_val_if_fail(msg, 0); |
2327 return msg->when; | 2489 return msg->when; |
2490 } | |
2491 | |
2492 const char *purple_conversation_message_get_alias(const PurpleConvMessage *msg) | |
2493 { | |
2494 g_return_val_if_fail(msg, NULL); | |
2495 return msg->alias; | |
2496 } | |
2497 | |
2498 PurpleConversation *purple_conversation_message_get_conv(const PurpleConvMessage *msg) | |
2499 { | |
2500 g_return_val_if_fail(msg, NULL); | |
2501 return msg->conv; | |
2328 } | 2502 } |
2329 | 2503 |
2330 void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data) | 2504 void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data) |
2331 { | 2505 { |
2332 g_return_if_fail(conv != NULL); | 2506 g_return_if_fail(conv != NULL); |