comparison libpurple/conversation.c @ 18121:9b9e202eb449

merge of 'bfe8046c64de924e7495c4913a6db09a462b1d85' and 'dedd3ec8f99fdd14b30a54ea1142e9daee336eff'
author Richard Laager <rlaager@wiktel.com>
date Sat, 16 Jun 2007 20:34:35 +0000
parents 97b735ca9d7a 871d9aa8e51c
children ffd706ec0220
comparison
equal deleted inserted replaced
18113:97b735ca9d7a 18121:9b9e202eb449
629 629
630 void 630 void
631 purple_conversation_foreach(void (*func)(PurpleConversation *conv)) 631 purple_conversation_foreach(void (*func)(PurpleConversation *conv))
632 { 632 {
633 PurpleConversation *conv; 633 PurpleConversation *conv;
634 const GList *l; 634 GList *l;
635 635
636 g_return_if_fail(func != NULL); 636 g_return_if_fail(func != NULL);
637 637
638 for (l = purple_get_conversations(); l != NULL; l = l->next) { 638 for (l = purple_get_conversations(); l != NULL; l = l->next) {
639 conv = (PurpleConversation *)l->data; 639 conv = (PurpleConversation *)l->data;
730 g_return_val_if_fail(key != NULL, NULL); 730 g_return_val_if_fail(key != NULL, NULL);
731 731
732 return g_hash_table_lookup(conv->data, key); 732 return g_hash_table_lookup(conv->data, key);
733 } 733 }
734 734
735 const GList * 735 GList *
736 purple_get_conversations(void) 736 purple_get_conversations(void)
737 { 737 {
738 return conversations; 738 return conversations;
739 } 739 }
740 740
741 const GList * 741 GList *
742 purple_get_ims(void) 742 purple_get_ims(void)
743 { 743 {
744 return ims; 744 return ims;
745 } 745 }
746 746
747 const GList * 747 GList *
748 purple_get_chats(void) 748 purple_get_chats(void)
749 { 749 {
750 return chats; 750 return chats;
751 } 751 }
752 752
757 const PurpleAccount *account) 757 const PurpleAccount *account)
758 { 758 {
759 PurpleConversation *c = NULL; 759 PurpleConversation *c = NULL;
760 gchar *name1; 760 gchar *name1;
761 const gchar *name2; 761 const gchar *name2;
762 const GList *cnv; 762 GList *cnv;
763 763
764 g_return_val_if_fail(name != NULL, NULL); 764 g_return_val_if_fail(name != NULL, NULL);
765 765
766 name1 = g_strdup(purple_normalize(account, name)); 766 name1 = g_strdup(purple_normalize(account, name));
767 767
817 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && 817 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT &&
818 (gc == NULL || !g_slist_find(gc->buddy_chats, conv))) 818 (gc == NULL || !g_slist_find(gc->buddy_chats, conv)))
819 return; 819 return;
820 820
821 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && 821 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM &&
822 !g_list_find((GList *)purple_get_conversations(), conv)) 822 !g_list_find(purple_get_conversations(), conv))
823 return; 823 return;
824 824
825 displayed = g_strdup(message); 825 displayed = g_strdup(message);
826 826
827 plugin_return = 827 plugin_return =
1248 chat->in_room = users; 1248 chat->in_room = users;
1249 1249
1250 return users; 1250 return users;
1251 } 1251 }
1252 1252
1253 const GList * 1253 GList *
1254 purple_conv_chat_get_users(const PurpleConvChat *chat) 1254 purple_conv_chat_get_users(const PurpleConvChat *chat)
1255 { 1255 {
1256 g_return_val_if_fail(chat != NULL, NULL); 1256 g_return_val_if_fail(chat != NULL, NULL);
1257 1257
1258 return chat->in_room; 1258 return chat->in_room;
1282 1282
1283 /* Make sure the user is actually ignored. */ 1283 /* Make sure the user is actually ignored. */
1284 if (!purple_conv_chat_is_user_ignored(chat, name)) 1284 if (!purple_conv_chat_is_user_ignored(chat, name))
1285 return; 1285 return;
1286 1286
1287 item = g_list_find((GList *)purple_conv_chat_get_ignored(chat), 1287 item = g_list_find(purple_conv_chat_get_ignored(chat),
1288 purple_conv_chat_get_ignored_user(chat, name)); 1288 purple_conv_chat_get_ignored_user(chat, name));
1289 1289
1290 purple_conv_chat_set_ignored(chat, 1290 purple_conv_chat_set_ignored(chat,
1291 g_list_remove_link(chat->ignored, item)); 1291 g_list_remove_link(chat->ignored, item));
1292 1292
1302 chat->ignored = ignored; 1302 chat->ignored = ignored;
1303 1303
1304 return ignored; 1304 return ignored;
1305 } 1305 }
1306 1306
1307 const GList * 1307 GList *
1308 purple_conv_chat_get_ignored(const PurpleConvChat *chat) 1308 purple_conv_chat_get_ignored(const PurpleConvChat *chat)
1309 { 1309 {
1310 g_return_val_if_fail(chat != NULL, NULL); 1310 g_return_val_if_fail(chat != NULL, NULL);
1311 1311
1312 return chat->ignored; 1312 return chat->ignored;
1313 } 1313 }
1314 1314
1315 const char * 1315 const char *
1316 purple_conv_chat_get_ignored_user(const PurpleConvChat *chat, const char *user) 1316 purple_conv_chat_get_ignored_user(const PurpleConvChat *chat, const char *user)
1317 { 1317 {
1318 const GList *ignored; 1318 GList *ignored;
1319 1319
1320 g_return_val_if_fail(chat != NULL, NULL); 1320 g_return_val_if_fail(chat != NULL, NULL);
1321 g_return_val_if_fail(user != NULL, NULL); 1321 g_return_val_if_fail(user != NULL, NULL);
1322 1322
1323 for (ignored = purple_conv_chat_get_ignored(chat); 1323 for (ignored = purple_conv_chat_get_ignored(chat);
1808 purple_conv_chat_clear_users(PurpleConvChat *chat) 1808 purple_conv_chat_clear_users(PurpleConvChat *chat)
1809 { 1809 {
1810 PurpleConversation *conv; 1810 PurpleConversation *conv;
1811 PurpleConversationUiOps *ops; 1811 PurpleConversationUiOps *ops;
1812 GList *users; 1812 GList *users;
1813 const GList *l; 1813 GList *l;
1814 GList *names = NULL; 1814 GList *names = NULL;
1815 1815
1816 g_return_if_fail(chat != NULL); 1816 g_return_if_fail(chat != NULL);
1817 1817
1818 conv = purple_conv_chat_get_conversation(chat); 1818 conv = purple_conv_chat_get_conversation(chat);
1917 } 1917 }
1918 1918
1919 PurpleConversation * 1919 PurpleConversation *
1920 purple_find_chat(const PurpleConnection *gc, int id) 1920 purple_find_chat(const PurpleConnection *gc, int id)
1921 { 1921 {
1922 const GList *l; 1922 GList *l;
1923 PurpleConversation *conv; 1923 PurpleConversation *conv;
1924 1924
1925 for (l = purple_get_chats(); l != NULL; l = l->next) { 1925 for (l = purple_get_chats(); l != NULL; l = l->next) {
1926 conv = (PurpleConversation *)l->data; 1926 conv = (PurpleConversation *)l->data;
1927 1927
1966 } 1966 }
1967 1967
1968 PurpleConvChatBuddy * 1968 PurpleConvChatBuddy *
1969 purple_conv_chat_cb_find(PurpleConvChat *chat, const char *name) 1969 purple_conv_chat_cb_find(PurpleConvChat *chat, const char *name)
1970 { 1970 {
1971 const GList *l; 1971 GList *l;
1972 PurpleConvChatBuddy *cb = NULL; 1972 PurpleConvChatBuddy *cb = NULL;
1973 1973
1974 g_return_val_if_fail(chat != NULL, NULL); 1974 g_return_val_if_fail(chat != NULL, NULL);
1975 g_return_val_if_fail(name != NULL, NULL); 1975 g_return_val_if_fail(name != NULL, NULL);
1976 1976