comparison finch/gntconv.c @ 26541:15ae2dea92b3

Open a chat-invite dialog when a buddy is dragged onto a chat. A somewhat warmenhoved patch from Zzzoom. Closes #504. Refs #8871.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 11 Apr 2009 06:40:48 +0000
parents 0e08c847517d
children 4fc04d98e1e8
comparison
equal deleted inserted replaced
26540:384eaba9974e 26541:15ae2dea92b3
557 g_object_set_data_full(G_OBJECT(item), "purple_buddy_name", name, g_free); 557 g_object_set_data_full(G_OBJECT(item), "purple_buddy_name", name, g_free);
558 } 558 }
559 } 559 }
560 560
561 static void 561 static void
562 invite_select_cb(FinchConv *fc, PurpleRequestFields *fields) 562 invite_cb(GntMenuItem *item, gpointer ggconv)
563 { 563 {
564 FinchConv *fc = ggconv;
564 PurpleConversation *conv = fc->active_conv; 565 PurpleConversation *conv = fc->active_conv;
565 const char *buddy = purple_request_fields_get_string(fields, "screenname"); 566 purple_conv_chat_invite_user(PURPLE_CONV_CHAT(conv), NULL, NULL, TRUE);
566 const char *message = purple_request_fields_get_string(fields, "message");
567 serv_chat_invite(purple_conversation_get_gc(conv),
568 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)),
569 message, buddy);
570
571 }
572
573 static void
574 invite_cb(GntMenuItem *item, gpointer ggconv)
575 {
576 PurpleRequestFields *fields;
577 PurpleRequestFieldGroup *group;
578 PurpleRequestField *field;
579
580 fields = purple_request_fields_new();
581
582 group = purple_request_field_group_new(NULL);
583 purple_request_fields_add_group(fields, group);
584
585 field = purple_request_field_string_new("screenname", _("Name"), NULL, FALSE);
586 purple_request_field_set_type_hint(field, "screenname");
587 purple_request_field_set_required(field, TRUE);
588 purple_request_field_group_add_field(group, field);
589 field = purple_request_field_string_new("message", _("Invite message"), NULL, FALSE);
590 purple_request_field_group_add_field(group, field);
591 purple_request_fields(finch_conv_get_handle(), _("Invite"),
592 NULL,
593 _("Please enter the name of the user "
594 "you wish to invite,\nalong with an optional invite message."),
595 fields,
596 _("OK"), G_CALLBACK(invite_select_cb),
597 _("Cancel"), NULL,
598 NULL, NULL, NULL,
599 ggconv);
600 } 567 }
601 568
602 static void 569 static void
603 gg_create_menu(FinchConv *ggc) 570 gg_create_menu(FinchConv *ggc)
604 { 571 {