Mercurial > pidgin
comparison src/gtkconv.c @ 6407:ba0b99a72be2
[gaim-migrate @ 6913]
Added API commands for adding or removing a batch of users at once to/from
a chat. IRC no longer has half a billion "Diablo-D3 has entered the room."
messages anymore.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 07 Aug 2003 20:47:29 +0000 |
parents | 96de6d9eb422 |
children | 91087e6dfbfd |
comparison
equal
deleted
inserted
replaced
6406:efaff39618a5 | 6407:ba0b99a72be2 |
---|---|
4621 | 4621 |
4622 add_chat_buddy_common(conv, user, pos); | 4622 add_chat_buddy_common(conv, user, pos); |
4623 } | 4623 } |
4624 | 4624 |
4625 static void | 4625 static void |
4626 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) | |
4627 { | |
4628 GaimChat *chat; | |
4629 GaimGtkConversation *gtkconv; | |
4630 GaimGtkChatPane *gtkchat; | |
4631 GList *l; | |
4632 char tmp[BUF_LONG]; | |
4633 int num_users; | |
4634 int pos; | |
4635 | |
4636 chat = GAIM_CHAT(conv); | |
4637 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4638 gtkchat = gtkconv->u.chat; | |
4639 | |
4640 num_users = g_list_length(gaim_chat_get_users(chat)); | |
4641 | |
4642 g_snprintf(tmp, sizeof(tmp), | |
4643 ngettext("%d person in room", "%d people in room", | |
4644 num_users), | |
4645 num_users); | |
4646 | |
4647 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4648 | |
4649 for (l = users; l != NULL; l = l->next) { | |
4650 pos = g_list_index(gaim_chat_get_users(chat), (char *)l->data); | |
4651 | |
4652 add_chat_buddy_common(conv, (char *)l->data, pos); | |
4653 } | |
4654 } | |
4655 | |
4656 static void | |
4626 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, | 4657 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
4627 const char *new_name) | 4658 const char *new_name) |
4628 { | 4659 { |
4629 GaimChat *chat; | 4660 GaimChat *chat; |
4630 GaimGtkConversation *gtkconv; | 4661 GaimGtkConversation *gtkconv; |
4738 if (gtkconv->make_sound) | 4769 if (gtkconv->make_sound) |
4739 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); | 4770 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4740 } | 4771 } |
4741 | 4772 |
4742 static void | 4773 static void |
4774 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) | |
4775 { | |
4776 GaimChat *chat; | |
4777 GaimGtkConversation *gtkconv; | |
4778 GaimGtkChatPane *gtkchat; | |
4779 GtkTreeIter iter; | |
4780 GtkTreeModel *model; | |
4781 GList *names = NULL; | |
4782 GList *l; | |
4783 char tmp[BUF_LONG]; | |
4784 int num_users; | |
4785 int f = 1; | |
4786 | |
4787 chat = GAIM_CHAT(conv); | |
4788 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4789 gtkchat = gtkconv->u.chat; | |
4790 | |
4791 num_users = g_list_length(gaim_chat_get_users(chat)) - | |
4792 g_list_length(users); | |
4793 | |
4794 for (l = users; l != NULL; l = l->next) { | |
4795 for (names = gaim_chat_get_users(chat); | |
4796 names != NULL; | |
4797 names = names->next) { | |
4798 | |
4799 char *u = (char *)names->data; | |
4800 | |
4801 if (!gaim_utf8_strcasecmp(u, (char *)l->data)) { | |
4802 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
4803 | |
4804 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), | |
4805 &iter)) | |
4806 break; | |
4807 | |
4808 while (f != 0) { | |
4809 char *val; | |
4810 | |
4811 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, | |
4812 1, &val, -1); | |
4813 | |
4814 if (!gaim_utf8_strcasecmp((char *)l->data, val)) | |
4815 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | |
4816 | |
4817 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4818 | |
4819 g_free(val); | |
4820 } | |
4821 | |
4822 break; | |
4823 } | |
4824 } | |
4825 } | |
4826 | |
4827 if (names == NULL) | |
4828 return; | |
4829 | |
4830 g_snprintf(tmp, sizeof(tmp), | |
4831 ngettext("%d person in room", "%d people in room", | |
4832 num_users), num_users); | |
4833 | |
4834 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4835 } | |
4836 | |
4837 static void | |
4743 gaim_gtkconv_set_title(GaimConversation *conv, const char *title) | 4838 gaim_gtkconv_set_title(GaimConversation *conv, const char *title) |
4744 { | 4839 { |
4745 GaimGtkConversation *gtkconv; | 4840 GaimGtkConversation *gtkconv; |
4746 GaimWindow *win; | 4841 GaimWindow *win; |
4747 GaimGtkWindow *gtkwin; | 4842 GaimGtkWindow *gtkwin; |
4890 gaim_gtkconv_destroy, /* destroy_conversation */ | 4985 gaim_gtkconv_destroy, /* destroy_conversation */ |
4891 gaim_gtkconv_write_chat, /* write_chat */ | 4986 gaim_gtkconv_write_chat, /* write_chat */ |
4892 gaim_gtkconv_write_im, /* write_im */ | 4987 gaim_gtkconv_write_im, /* write_im */ |
4893 gaim_gtkconv_write_conv, /* write_conv */ | 4988 gaim_gtkconv_write_conv, /* write_conv */ |
4894 gaim_gtkconv_chat_add_user, /* chat_add_user */ | 4989 gaim_gtkconv_chat_add_user, /* chat_add_user */ |
4990 gaim_gtkconv_chat_add_users, /* chat_add_users */ | |
4895 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ | 4991 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
4896 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | 4992 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ |
4993 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ | |
4897 gaim_gtkconv_set_title, /* set_title */ | 4994 gaim_gtkconv_set_title, /* set_title */ |
4898 NULL, /* update_progress */ | 4995 NULL, /* update_progress */ |
4899 gaim_gtkconv_updated /* updated */ | 4996 gaim_gtkconv_updated /* updated */ |
4900 }; | 4997 }; |
4901 | 4998 |