pidgin: 7dc77dba: Add an invite menu for chats
wabz at pidgin.im
wabz at pidgin.im
Wed May 28 01:35:59 EDT 2008
-----------------------------------------------------------------
Revision: 7dc77dba4b47a788d706e867dbed7e7d3c404b52
Ancestor: d425c6047a5d33761dfc83c887d89f4a643a7da2
Author: wabz at pidgin.im
Date: 2008-05-28T05:30:02
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/7dc77dba4b47a788d706e867dbed7e7d3c404b52
Modified files:
ChangeLog finch/gntconv.c
ChangeLog:
Add an invite menu for chats
-------------- next part --------------
============================================================
--- ChangeLog b5449faddad14427b4806580b3797072c177f314
+++ ChangeLog 1faf84786e1e74373d3e2b4229a1d2adc6ce8a19
@@ -18,6 +18,9 @@ version 2.5.0 (??/??/2008):
* Group and Chat buddy list entries can now be given custom buddy
icons.
+ Finch:
+ * Added "Invite..." menu to chats.
+
version 2.4.2 (05/17/2008):
libpurple:
* In MySpaceIM, messages from spambots are discarded (Justin Williams)
============================================================
--- finch/gntconv.c 30745c858f6b474ab29f64d930263a461a9d7a77
+++ finch/gntconv.c dcd3cdd7ca031dc38243c954152a5eeeaf61cb64
@@ -38,10 +38,11 @@
#include "gntdebug.h"
#include "gntlog.h"
#include "gntplugin.h"
+#include "gntpounce.h"
#include "gntprefs.h"
+#include "gntrequest.h"
#include "gntsound.h"
#include "gntstatus.h"
-#include "gntpounce.h"
#include "gnt.h"
#include "gntbox.h"
@@ -557,6 +558,47 @@ static void
}
static void
+invite_select_cb(FinchConv *fc, PurpleRequestFields *fields)
+{
+ PurpleConversation *conv = fc->active_conv;
+ const char *buddy = purple_request_fields_get_string(fields, "screenname");
+ const char *message = purple_request_fields_get_string(fields, "message");
+ serv_chat_invite(purple_conversation_get_gc(conv),
+ purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)),
+ message, buddy);
+
+}
+
+static void
+invite_cb(GntMenuItem *item, gpointer ggconv)
+{
+ PurpleRequestFields *fields;
+ PurpleRequestFieldGroup *group;
+ PurpleRequestField *field;
+
+ fields = purple_request_fields_new();
+
+ group = purple_request_field_group_new(NULL);
+ purple_request_fields_add_group(fields, group);
+
+ field = purple_request_field_string_new("screenname", _("Name"), NULL, FALSE);
+ purple_request_field_set_type_hint(field, "screenname");
+ purple_request_field_set_required(field, TRUE);
+ purple_request_field_group_add_field(group, field);
+ field = purple_request_field_string_new("message", _("Invite message"), NULL, FALSE);
+ purple_request_field_group_add_field(group, field);
+ purple_request_fields(finch_conv_get_handle(), _("Invite"),
+ NULL,
+ _("Please enter the name of the user "
+ "you wish to invite,\nalong with an optional invite message."),
+ fields,
+ _("OK"), G_CALLBACK(invite_select_cb),
+ _("Cancel"), NULL,
+ NULL, NULL, NULL,
+ ggconv);
+}
+
+static void
gg_create_menu(FinchConv *ggc)
{
GntWidget *menu, *sub;
@@ -606,6 +648,10 @@ gg_create_menu(FinchConv *ggc)
}
generate_send_to_menu(ggc);
+ } else if (purple_conversation_get_type(ggc->active_conv) == PURPLE_CONV_TYPE_CHAT) {
+ item = gnt_menuitem_new(_("Invite..."));
+ gnt_menu_add_item(GNT_MENU(sub), item);
+ gnt_menuitem_set_callback(item, invite_cb, ggc);
}
item = gnt_menuitem_new(_("View Log..."));
More information about the Commits
mailing list