soc.2010.icq-tlc: 12ba055c: Show authorization request sender's nick...
ivan.komarov at soc.pidgin.im
ivan.komarov at soc.pidgin.im
Sun May 23 15:35:49 EDT 2010
-----------------------------------------------------------------
Revision: 12ba055ceeb14a00597ed9c99982d8cb3ab6950f
Ancestor: 4b6b4c6044607c2117d736601fd7f6e25e11ce67
Author: ivan.komarov at soc.pidgin.im
Date: 2010-05-23T18:28:46
Branch: im.pidgin.soc.2010.icq-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/12ba055ceeb14a00597ed9c99982d8cb3ab6950f
Modified files:
libpurple/protocols/oscar/family_icq.c
libpurple/protocols/oscar/oscar.c
libpurple/protocols/oscar/oscar.h
ChangeLog:
Show authorization request sender's nickname in the "Authorize buddy?"
dialog.
Fixes #3207. I've slightly modified the original patch (courtesy of Collin):
* the code emitting the "buddy-status-changed" signal was removed,
because it doesn't appear to be necessary;
* "info->uin && info->nick" check in purple_icqalias() was removed,
since icqresponse() in family_icq.c already does that.
-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/family_icq.c 7c3075fe5ac4a2161d72102227f77b1cda2801e0
+++ libpurple/protocols/oscar/family_icq.c 8576051188f57d3828dee9075f4aeb2d027808cc
@@ -232,7 +232,7 @@ int aim_icq_getallinfo(OscarData *od, co
return 0;
}
-int aim_icq_getalias(OscarData *od, const char *uin)
+int aim_icq_getalias(OscarData *od, const char *uin, gboolean for_auth_request, char *auth_request_reason)
{
FlapConnection *conn;
ByteStream bs;
@@ -274,6 +274,8 @@ int aim_icq_getalias(OscarData *od, cons
info->reqid = snacid;
info->uin = atoi(uin);
info->next = od->icq_info;
+ info->for_auth_request = for_auth_request;
+ info->auth_request_reason = g_strdup(auth_request_reason);
od->icq_info = info;
return 0;
============================================================
--- libpurple/protocols/oscar/oscar.c 6b8b45623896204448ac4b212a0c631655822ad1
+++ libpurple/protocols/oscar/oscar.c eab2862612cf8346cfb4e160f97bc07ee58792c3
@@ -2895,7 +2895,6 @@ incomingim_chan4(OscarData *od, FlapConn
case 0x06: { /* Someone requested authorization */
if (i >= 6) {
- struct name_data *data = g_new(struct name_data, 1);
gchar *bn = g_strdup_printf("%u", args->uin);
gchar *reason = NULL;
@@ -2905,14 +2904,8 @@ incomingim_chan4(OscarData *od, FlapConn
purple_debug_info("oscar",
"Received an authorization request from UIN %u\n",
args->uin);
- data->gc = gc;
- data->name = bn;
- data->nick = NULL;
-
- purple_account_request_authorization(account, bn, NULL, NULL,
- reason, purple_find_buddy(account, bn) != NULL,
- purple_auth_grant,
- purple_auth_dontgrant_msgprompt, data);
+ aim_icq_getalias(od, bn, TRUE, reason);
+ g_free(bn);
g_free(reason);
}
} break;
@@ -4210,15 +4203,28 @@ static int purple_icqalias(OscarData *od
info = va_arg(ap, struct aim_icq_info *);
va_end(ap);
- if (info->uin && info->nick && info->nick[0] && (utf8 = oscar_utf8_try_convert(account, od, info->nick))) {
- g_snprintf(who, sizeof(who), "%u", info->uin);
- serv_got_alias(gc, who, utf8);
- if ((b = purple_find_buddy(account, who))) {
- purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", utf8);
+ if (info->nick[0] && (utf8 = oscar_utf8_try_convert(account, od, info->nick))) {
+ if (info->for_auth_request) {
+ struct name_data *data = g_new(struct name_data, 1);
+
+ data->gc = gc;
+ data->name = g_strdup_printf("%u", info->uin);
+ data->nick = utf8;
+
+ purple_account_request_authorization(account, data->name, NULL, data->nick,
+ info->auth_request_reason, purple_find_buddy(account, data->name) != NULL,
+ purple_auth_grant, purple_auth_dontgrant_msgprompt, data);
+ } else {
+ g_snprintf(who, sizeof(who), "%u", info->uin);
+ serv_got_alias(gc, who, utf8);
+ if ((b = purple_find_buddy(account, who))) {
+ purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", utf8);
+ }
+ g_free(utf8);
}
- g_free(utf8);
}
+ g_free(info->auth_request_reason);
return 1;
}
@@ -5029,7 +5035,7 @@ oscar_add_buddy(PurpleConnection *gc, Pu
/* XXX - Should this be done from AIM accounts, as well? */
if (od->icq)
- aim_icq_getalias(od, bname);
+ aim_icq_getalias(od, bname, FALSE, NULL);
}
void oscar_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) {
@@ -5653,24 +5659,18 @@ static int purple_ssi_authrequest(OscarD
static int purple_ssi_authrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
{
- PurpleConnection *gc = od->gc;
va_list ap;
const char *bn;
- const char *msg;
- PurpleAccount *account = purple_connection_get_account(gc);
- struct name_data *data;
- PurpleBuddy *buddy;
+ char *msg;
va_start(ap, fr);
bn = va_arg(ap, const char *);
- msg = va_arg(ap, const char *);
+ msg = va_arg(ap, char *);
va_end(ap);
purple_debug_info("oscar",
"ssi: received authorization request from %s\n", bn);
- buddy = purple_find_buddy(account, bn);
-
if (!msg) {
purple_debug_warning("oscar", "Received auth request from %s with "
"empty message\n", bn);
@@ -5680,16 +5680,7 @@ static int purple_ssi_authrequest(OscarD
msg = NULL;
}
- data = g_new(struct name_data, 1);
- data->gc = gc;
- data->name = g_strdup(bn);
- data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL);
-
- purple_account_request_authorization(account, bn, NULL,
- (buddy ? purple_buddy_get_alias_only(buddy) : NULL),
- msg, buddy != NULL, purple_auth_grant,
- purple_auth_dontgrant_msgprompt, data);
-
+ aim_icq_getalias(od, bn, TRUE, msg);
return 1;
}
============================================================
--- libpurple/protocols/oscar/oscar.h 07b3c643a4476d8241423917560d20bafdb62995
+++ libpurple/protocols/oscar/oscar.h 271b819e904b536e55d2f895df21d7f4b5d1337d
@@ -1416,6 +1416,9 @@ struct aim_icq_info
/* status note info */
guint8 icbm_cookie[8];
char *status_note_title;
+
+ gboolean for_auth_request;
+ char *auth_request_reason;
};
#ifdef OLDSTYLE_ICQ_OFFLINEMSGS
@@ -1425,7 +1428,7 @@ int aim_icq_getsimpleinfo(OscarData *od,
int aim_icq_setsecurity(OscarData *od, gboolean auth_required, gboolean webaware);
int aim_icq_changepasswd(OscarData *od, const char *passwd);
int aim_icq_getsimpleinfo(OscarData *od, const char *uin);
-int aim_icq_getalias(OscarData *od, const char *uin);
+int aim_icq_getalias(OscarData *od, const char *uin, gboolean for_auth_request, char *auth_request_reason);
int aim_icq_getallinfo(OscarData *od, const char *uin);
int aim_icq_sendsms(OscarData *od, const char *name, const char *msg, const char *alias);
More information about the Commits
mailing list