--- a/plugins/ChangeLog.API Thu Mar 17 11:02:51 2005 -0500
+++ b/plugins/ChangeLog.API Thu Mar 17 12:15:50 2005 -0500
@@ -14,6 +14,10 @@
* Added: GAIM_CBFLAGS_TYPING to GaimConvChatBuddyFlags
+ * Added: gaim_account_request_add which takes the same arguments as + * gaim_account_notify_added but always asks the user if they want to add + * the buddy to the buddy list + * Added: An accompanying request_add GaimAccountUiOp version 1.1.4 (2/24/2005):
--- a/src/account.c Thu Mar 17 11:02:51 2005 -0500
+++ b/src/account.c Thu Mar 17 12:15:50 2005 -0500
@@ -262,6 +262,22 @@
ui_ops->notify_added(account, remote_user, id, alias, message);
+gaim_account_request_add(GaimAccount *account, const char *id, + const char *remote_user, const char *alias, + GaimAccountUiOps *ui_ops; + g_return_if_fail(account != NULL); + g_return_if_fail(remote_user != NULL); + ui_ops = gaim_accounts_get_ui_ops(); + if (ui_ops != NULL && ui_ops->notify_added != NULL) + ui_ops->request_add(account, remote_user, id, alias, message); change_password_cb(GaimAccount *account, GaimRequestFields *fields)
--- a/src/account.h Thu Mar 17 11:02:51 2005 -0500
+++ b/src/account.h Thu Mar 17 12:15:50 2005 -0500
@@ -44,6 +44,9 @@
void (*notify_added)(GaimAccount *account, const char *remote_user,
const char *id, const char *alias,
+ void (*request_add)(GaimAccount *account, const char *remote_user, + const char *id, const char *alias, @@ -145,6 +148,25 @@
+ * Notifies the user that the account was added to a remote user's + * buddy list and asks the user if they want to add the remote user to their + * This will present a dialog informing the local user that the remote user + * added them to the remote users buddy list and will ask if they want to add + * the remote user to the local buddy list. + * @param account The account that was added. + * @param remote_user The name of the user that added this account. + * @param id The optional ID of the local account. Rarely used. + * @param alias The optional alias of the user. + * @param message The optional message sent from the user adding you. +void gaim_account_request_add(GaimAccount *account, const char *remote_user, + const char *id, const char *alias, * Requests information from the user to change the account's password.
* @param account The account to change the password on.
--- a/src/gtkaccount.c Thu Mar 17 11:02:51 2005 -0500
+++ b/src/gtkaccount.c Thu Mar 17 12:15:50 2005 -0500
@@ -2509,6 +2509,28 @@
free_add_user_data(data);
+make_info(GaimAccount *account, GaimConnection *gc, GaimBuddy *buddy, + const char *remote_user, const char *id, const char *alias, + return g_strdup_printf(_("%s%s%s%s has made %s his or her buddy%s%s%s"), + (alias != NULL ? " (" : ""), + (alias != NULL ? alias : ""), + (alias != NULL ? ")" : ""), + : (gaim_connection_get_display_name(gc) != NULL + ? gaim_connection_get_display_name(gc) + : gaim_account_get_username(account))), + (msg != NULL ? ": " : "."), + (msg != NULL ? msg : ""), + : _("\n\nDo you wish to add him or her to your buddy list?"))); gaim_gtk_accounts_notify_added(GaimAccount *account, const char *remote_user,
const char *id, const char *alias,
@@ -2528,21 +2550,7 @@
data->username = g_strdup(remote_user);
data->alias = (alias != NULL ? g_strdup(alias) : NULL);
- buffer = g_strdup_printf(_("%s%s%s%s has made %s his or her buddy%s%s%s"),
- (alias != NULL ? " (" : ""),
- (alias != NULL ? alias : ""),
- (alias != NULL ? ")" : ""),
- : (gaim_connection_get_display_name(gc) != NULL
- ? gaim_connection_get_display_name(gc)
- : gaim_account_get_username(account))),
- (msg != NULL ? ": " : "."),
- (msg != NULL ? msg : ""),
- : _("\n\nDo you wish to add him or her to your buddy list?")));
+ buffer = make_info(account, gc, buddy, remote_user, id, alias, msg); @@ -2559,9 +2567,40 @@
+gaim_gtk_accounts_request_add(GaimAccount *account, const char *remote_user, + const char *id, const char *alias, + GaimGtkAccountAddUserData *data; + gc = gaim_account_get_connection(account); + buddy = gaim_find_buddy(account, remote_user); + data = g_new0(GaimGtkAccountAddUserData, 1); + data->account = account; + data->username = g_strdup(remote_user); + data->alias = (alias != NULL ? g_strdup(alias) : NULL); + buffer = make_info(account, gc, buddy, remote_user, id, alias, msg); + gaim_request_action(NULL, NULL, _("Add buddy to your list?"), + buffer, GAIM_DEFAULT_ACTION_NONE, data, 2, + _("Add"), G_CALLBACK(add_user_cb), + _("Cancel"), G_CALLBACK(free_add_user_data)); static GaimAccountUiOps ui_ops =
- gaim_gtk_accounts_notify_added
+ gaim_gtk_accounts_notify_added, + gaim_gtk_accounts_request_add --- a/src/protocols/jabber/presence.c Thu Mar 17 11:02:51 2005 -0500
+++ b/src/protocols/jabber/presence.c Thu Mar 17 12:15:50 2005 -0500
@@ -156,6 +156,7 @@
struct _jabber_add_permit {
@@ -163,11 +164,22 @@
static void authorize_add_cb(struct _jabber_add_permit *jap)
if(g_list_find(gaim_connections_get_all(), jap->gc)) {
+ GaimBuddy *buddy = NULL; jabber_presence_subscription_set(jap->gc->proto_data, jap->who,
- if(!gaim_find_buddy(jap->gc->account, jap->who))
- gaim_account_notify_added(jap->gc->account, NULL, jap->who, NULL, NULL);
+ buddy = gaim_find_buddy(jap->gc->account, jap->who); + JabberBuddy *jb = NULL; + jb = jabber_buddy_find(jap->js, jap->who, TRUE); + if ((jb->subscription & JABBER_SUB_TO) == 0) + gaim_account_request_add(jap->gc->account, NULL, jap->who, NULL, NULL); + gaim_account_notify_added(jap->gc->account, NULL, jap->who, NULL, NULL); @@ -242,6 +254,7 @@
char *msg = g_strdup_printf(_("The user %s wants to add you to their buddy list."), from);
jap->who = g_strdup(from);
gaim_request_action(js->gc, NULL, msg, NULL, GAIM_DEFAULT_ACTION_NONE,