pidgin: 263fb40c: Show invite message entry in the Add Bud...
qulogic at pidgin.im
qulogic at pidgin.im
Sun Mar 20 20:32:37 EDT 2011
----------------------------------------------------------------------
Revision: 263fb40c821964de0d52cc232890fa54cea5b2c6
Parent: 8b9e8f9ef88d2c352fb11c6c14692022694f4bbb
Author: qulogic at pidgin.im
Date: 03/20/11 18:04:23
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/263fb40c821964de0d52cc232890fa54cea5b2c6
Changelog:
Show invite message entry in the Add Buddy dialog.
Changes against parent 8b9e8f9ef88d2c352fb11c6c14692022694f4bbb
patched pidgin/gtkblist.c
-------------- next part --------------
============================================================
--- pidgin/gtkblist.c b625b64e79a3a36130ef90870f1943017e608195
+++ pidgin/gtkblist.c 3f42109863afcbb33bbf73825ca3b6ab933f6eeb
@@ -85,6 +85,7 @@ typedef struct
GtkWidget *combo;
GtkWidget *entry;
GtkWidget *entry_for_alias;
+ GtkWidget *entry_for_invite;
} PidginAddBuddyData;
@@ -6966,8 +6967,24 @@ add_buddy_select_account_cb(GObject *w,
add_buddy_select_account_cb(GObject *w, PurpleAccount *account,
PidginAddBuddyData *data)
{
+ PurpleConnection *pc = NULL;
+ PurplePlugin *prpl = NULL;
+ PurplePluginProtocolInfo *prpl_info = NULL;
+ gboolean invite_enabled = TRUE;
+
/* Save our account */
data->rq_data.account = account;
+
+ if (account)
+ pc = purple_account_get_connection(account);
+ if (pc)
+ prpl = purple_connection_get_prpl(pc);
+ if (prpl)
+ prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+ if (prpl_info && !(prpl_info->options & OPT_PROTO_INVITE_MESSAGE))
+ invite_enabled = FALSE;
+
+ gtk_widget_set_sensitive(data->entry_for_invite, invite_enabled);
}
static void
@@ -6979,7 +6996,7 @@ add_buddy_cb(GtkWidget *w, int resp, Pid
static void
add_buddy_cb(GtkWidget *w, int resp, PidginAddBuddyData *data)
{
- const char *grp, *who, *whoalias;
+ const char *grp, *who, *whoalias, *invite;
PurpleAccount *account;
PurpleGroup *g;
PurpleBuddy *b;
@@ -6993,6 +7010,9 @@ add_buddy_cb(GtkWidget *w, int resp, Pid
whoalias = gtk_entry_get_text(GTK_ENTRY(data->entry_for_alias));
if (*whoalias == '\0')
whoalias = NULL;
+ invite = gtk_entry_get_text(GTK_ENTRY(data->entry_for_invite));
+ if (*invite == '\0')
+ invite = NULL;
account = data->rq_data.account;
@@ -7018,7 +7038,7 @@ add_buddy_cb(GtkWidget *w, int resp, Pid
purple_blist_add_buddy(b, NULL, g, NULL);
}
- purple_account_add_buddy(account, b);
+ purple_account_add_buddy_with_invite(account, b, invite);
/* Offer to merge people with the same alias. */
if (whoalias != NULL && g != NULL)
@@ -7056,9 +7076,11 @@ pidgin_blist_request_add_buddy(PurpleAcc
{
PidginAddBuddyData *data = g_new0(PidginAddBuddyData, 1);
+ if (account == NULL)
+ account = purple_connection_get_account(purple_connections_get_all()->data);
+
make_blist_request_dialog((PidginBlistRequestData *)data,
- (account != NULL
- ? account : purple_connection_get_account(purple_connections_get_all()->data)),
+ account,
_("Add Buddy"), "add_buddy",
_("Add a buddy.\n"),
G_CALLBACK(add_buddy_select_account_cb), NULL,
@@ -7102,11 +7124,19 @@ pidgin_blist_request_add_buddy(PurpleAcc
if (username != NULL)
gtk_widget_grab_focus(GTK_WIDGET(data->entry_for_alias));
+ data->entry_for_invite = gtk_entry_new();
+ pidgin_add_widget_to_vbox(data->rq_data.vbox, _("(Optional) _Invite message:"),
+ data->rq_data.sg, data->entry_for_invite, TRUE,
+ NULL);
+
data->combo = pidgin_text_combo_box_entry_new(group, groups_tree());
pidgin_add_widget_to_vbox(data->rq_data.vbox, _("Add buddy to _group:"),
data->rq_data.sg, data->combo, TRUE, NULL);
gtk_widget_show_all(data->rq_data.window);
+
+ /* Force update of invite message entry sensitivity */
+ add_buddy_select_account_cb(NULL, account, data);
}
static void
More information about the Commits
mailing list