| 774 pidgin_request_add_permit(account, purple_conversation_get_name(conv)); |
774 pidgin_request_add_permit(account, purple_conversation_get_name(conv)); |
| 775 |
775 |
| 776 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry); |
776 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry); |
| 777 } |
777 } |
| 778 |
778 |
| 779 static gboolean |
779 static void |
| 780 chat_invite_filter(const PidginBuddyCompletionEntry *entry, gpointer data) |
780 do_invite(GtkWidget *w, int resp, gpointer data) |
| 781 { |
781 { |
| 782 PurpleAccount *filter_account = data; |
782 PidginInviteDialog *dialog = PIDGIN_INVITE_DIALOG(w); |
| 783 PurpleAccount *account = NULL; |
783 PurpleChatConversation *chat = pidgin_invite_dialog_get_conversation(dialog); |
| 784 |
|
| 785 if (entry->is_buddy) { |
|
| 786 if (PURPLE_BUDDY_IS_ONLINE(entry->entry.buddy)) |
|
| 787 account = purple_buddy_get_account(entry->entry.buddy); |
|
| 788 else |
|
| 789 return FALSE; |
|
| 790 } else { |
|
| 791 account = entry->entry.logged_buddy->account; |
|
| 792 } |
|
| 793 if (account == filter_account) |
|
| 794 return TRUE; |
|
| 795 return FALSE; |
|
| 796 } |
|
| 797 |
|
| 798 static void |
|
| 799 do_invite(GtkWidget *w, int resp, PurpleChatConversation *chat) |
|
| 800 { |
|
| 801 const gchar *contact, *message; |
784 const gchar *contact, *message; |
| 802 |
785 |
| 803 if (resp == GTK_RESPONSE_ACCEPT) { |
786 if (resp == GTK_RESPONSE_ACCEPT) { |
| 804 contact = pidgin_invite_dialog_get_contact(PIDGIN_INVITE_DIALOG(w)); |
787 contact = pidgin_invite_dialog_get_contact(dialog); |
| 805 if (!g_ascii_strcasecmp(contact, "")) |
788 if (!g_ascii_strcasecmp(contact, "")) |
| 806 return; |
789 return; |
| 807 |
790 |
| 808 message = pidgin_invite_dialog_get_message(PIDGIN_INVITE_DIALOG(w)); |
791 message = pidgin_invite_dialog_get_message(dialog); |
| 809 |
792 |
| 810 purple_serv_chat_invite(purple_conversation_get_connection(PURPLE_CONVERSATION(chat)), |
793 purple_serv_chat_invite(purple_conversation_get_connection(PURPLE_CONVERSATION(chat)), |
| 811 purple_chat_conversation_get_id(chat), |
794 purple_chat_conversation_get_id(chat), |
| 812 message, contact); |
795 message, contact); |
| 813 } |
796 } |
| 819 invite_cb(GtkWidget *widget, PidginConversation *gtkconv) |
802 invite_cb(GtkWidget *widget, PidginConversation *gtkconv) |
| 820 { |
803 { |
| 821 PurpleChatConversation *chat = PURPLE_CHAT_CONVERSATION(gtkconv->active_conv); |
804 PurpleChatConversation *chat = PURPLE_CHAT_CONVERSATION(gtkconv->active_conv); |
| 822 |
805 |
| 823 if (invite_dialog == NULL) { |
806 if (invite_dialog == NULL) { |
| 824 invite_dialog = pidgin_invite_dialog_new(); |
807 invite_dialog = pidgin_invite_dialog_new(chat); |
| 825 |
|
| 826 /* |
|
| 827 pidgin_setup_screenname_autocomplete(info->entry, NULL, chat_invite_filter, |
|
| 828 purple_conversation_get_account(PURPLE_CONVERSATION(chat))); |
|
| 829 */ |
|
| 830 |
808 |
| 831 /* Connect the signals. */ |
809 /* Connect the signals. */ |
| 832 g_signal_connect(G_OBJECT(invite_dialog), "response", |
810 g_signal_connect(G_OBJECT(invite_dialog), "response", |
| 833 G_CALLBACK(do_invite), chat); |
811 G_CALLBACK(do_invite), NULL); |
| 834 } |
812 } |
| 835 |
813 |
| 836 gtk_widget_show_all(invite_dialog); |
814 gtk_widget_show_all(invite_dialog); |
| 837 } |
815 } |
| 838 |
816 |