changeset 12652:e739ace2688b

[gaim-migrate @ 14995] Make the ICQ web aware and auth required checkboxes work correctly. To change your setting, use "Set Privacy Options..." in the account tools menu thingy committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 25 Dec 2005 03:41:49 +0000
parents a74cb5952db4
children afaee008da9f
files src/protocols/oscar/aim.h src/protocols/oscar/icq.c src/protocols/oscar/oscar.c
diffstat 3 files changed, 29 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Sun Dec 25 01:36:31 2005 +0000
+++ b/src/protocols/oscar/aim.h	Sun Dec 25 03:41:49 2005 +0000
@@ -1412,8 +1412,7 @@
 
 faim_export int aim_icq_reqofflinemsgs(aim_session_t *sess);
 faim_export int aim_icq_ackofflinemsgs(aim_session_t *sess);
-faim_export int aim_icq_setsecurity(aim_session_t *sess, const int auth, const int web, const int hide);
-faim_export int aim_icq_setauthsetting(aim_session_t *sess, int auth_required);
+faim_export int aim_icq_setsecurity(aim_session_t *sess, gboolean auth_required, gboolean webaware);
 faim_export int aim_icq_changepasswd(aim_session_t *sess, const char *passwd);
 faim_export int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin);
 faim_export int aim_icq_getalias(aim_session_t *sess, const char *uin);
--- a/src/protocols/oscar/icq.c	Sun Dec 25 01:36:31 2005 +0000
+++ b/src/protocols/oscar/icq.c	Sun Dec 25 03:41:49 2005 +0000
@@ -70,16 +70,8 @@
 	return 0;
 }
 
-/**
- * Set your ICQ security.
- *
- * @param sess The oscar session.
- * @param auth Ask authorization when a buddy adds us?
- * @param web  Show our presence on the ICQ web site.
- * @param hide Hide our IP address.
- * @return Return 0 if no errors, otherwise return the error number.
- */
-faim_export int aim_icq_setsecurity(aim_session_t *sess, const int auth, const int web, const int hide)
+faim_export int
+aim_icq_setsecurity(aim_session_t *sess, gboolean auth_required, gboolean webaware)
 {
 	aim_conn_t *conn;
 	aim_frame_t *fr;
@@ -89,48 +81,7 @@
 	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015)))
 		return -EINVAL;
 
-	bslen = 2+4+2+2+2+4;
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen)))
-		return -ENOMEM;
-
-	snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0);
-	aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid);
-
-	/* For simplicity, don't bother using a tlvlist */
-	aimbs_put16(&fr->data, 0x0001);
-	aimbs_put16(&fr->data, bslen);
-
-	aimbs_putle16(&fr->data, bslen - 2);
-	aimbs_putle32(&fr->data, atoi(sess->sn));
-	aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */
-	aimbs_putle16(&fr->data, snacid); /* eh. */
-	aimbs_putle16(&fr->data, 0x0424); /* shrug. */
-	aimbs_putle8(&fr->data, (auth == TRUE) ? 0x00 : 0x01);
-	aimbs_putle8(&fr->data, (web  == TRUE) ? 0x00 : 0x01);
-	aimbs_putle8(&fr->data, (hide == TRUE) ? 0x00 : 0x01);
-	aimbs_putle8(&fr->data, 0x00);
-
-	aim_tx_enqueue(sess, fr);
-
-	return 0;
-}
-
-/**
- * I'm not really sure what the difference is between this function
- * and the one above.  They both definitely exist.
- */
-faim_export int aim_icq_setauthsetting(aim_session_t *sess, int auth_required)
-{
-	aim_conn_t *conn;
-	aim_frame_t *fr;
-	aim_snacid_t snacid;
-	int bslen;
-
-	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015)))
-		return -EINVAL;
-
-	bslen = 2+4+2+2+2+4;
+	bslen = 2+4+2+2+2+2+2+1+1+1+1+1+1;
 
 	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen)))
 		return -ENOMEM;
@@ -147,12 +98,14 @@
 	aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */
 	aimbs_putle16(&fr->data, snacid); /* eh. */
 	aimbs_putle16(&fr->data, 0x0c3a); /* shrug. */
-	aimbs_putle16(&fr->data, 0x02f8);
+	aimbs_putle16(&fr->data, 0x030c);
 	aimbs_putle16(&fr->data, 0x0001);
-	aimbs_putle8(&fr->data, auth_required);
-	aimbs_putle8(&fr->data, 0x0c);
-	aimbs_putle16(&fr->data, 0x0103);
-	aimbs_putle16(&fr->data, 0x0000); /* web enabled or not! */
+	aimbs_putle8(&fr->data, webaware);
+	aimbs_putle8(&fr->data, 0xf8);
+	aimbs_putle8(&fr->data, 0x02);
+	aimbs_putle8(&fr->data, 0x01);
+	aimbs_putle8(&fr->data, 0x00);
+	aimbs_putle8(&fr->data, !auth_required);
 
 	aim_tx_enqueue(sess, fr);
 
--- a/src/protocols/oscar/oscar.c	Sun Dec 25 01:36:31 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Sun Dec 25 03:41:49 2005 +0000
@@ -310,6 +310,7 @@
 static void recent_buddies_cb(const char *name, GaimPrefType type, gpointer value, gpointer data);
 static void oscar_set_info(GaimConnection *gc, const char *info);
 static void oscar_set_info_and_status(GaimAccount *account, gboolean setinfo, const char *rawinfo, gboolean setstatus, GaimStatus *status);
+static void oscar_set_extendedstatus(GaimConnection *gc);
 
 static void oscar_free_name_data(struct name_data *data) {
 	g_free(data->name);
@@ -5896,11 +5897,10 @@
 
 	if (od->icq) {
 		aim_icq_reqofflinemsgs(sess);
-		/* TODO: Need to also call aim_setextstatus()!!! */
+		oscar_set_extendedstatus(gc);
 		aim_icq_setsecurity(sess,
 			gaim_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION),
-			gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE),
-			gaim_account_get_bool(account, "hide_ip", OSCAR_DEFAULT_HIDE_IP));
+			gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE));
 	}
 
 	aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV);
@@ -6546,18 +6546,25 @@
 	GaimAccount *account;
 	GaimPresence *presence;
 	gboolean invisible;
+	fu32_t data = 0x00000000;
 
 	od = gc->proto_data;
 	account = gaim_connection_get_account(gc);
 	presence = gaim_account_get_presence(account);
 	invisible = gaim_presence_is_status_primitive_active(presence, GAIM_STATUS_INVISIBLE);
 
+	data |= AIM_ICQ_STATE_HIDEIP;
+	if (gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE))
+		data |= AIM_ICQ_STATE_WEBAWARE;
+
 	if (invisible)
-		aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE);
+		data |= AIM_ICQ_STATE_INVISIBLE;
 	else if (!gaim_presence_is_available(presence))
-		aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY);
+		data |= AIM_ICQ_STATE_AWAY;
 	else
-		aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL);
+		data |= AIM_ICQ_STATE_NORMAL;
+
+	aim_setextstatus(od->sess, data);
 }
 
 static void
@@ -8029,23 +8036,19 @@
 	OscarData *od = gc->proto_data;
 	GaimAccount *account = gaim_connection_get_account(gc);
 	GaimRequestField *f;
-	gboolean auth, hide_ip, web_aware;
+	gboolean auth, web_aware;
 
 	f = gaim_request_fields_get_field(fields, "authorization");
 	auth = gaim_request_field_bool_get_value(f);
 
-	f = gaim_request_fields_get_field(fields, "hide_ip");
-	hide_ip = gaim_request_field_bool_get_value(f);
-
 	f = gaim_request_fields_get_field(fields, "web_aware");
 	web_aware = gaim_request_field_bool_get_value(f);
 
 	gaim_account_set_bool(account, "authorization", auth);
-	gaim_account_set_bool(account, "hide_ip", hide_ip);
 	gaim_account_set_bool(account, "web_aware", web_aware);
 
-	/* TODO: Need to also call aim_setextstatus()!!! */
-	aim_icq_setsecurity(od->sess, auth, web_aware, hide_ip);
+	oscar_set_extendedstatus(gc);
+	aim_icq_setsecurity(od->sess, auth, web_aware);
 }
 
 static void
@@ -8056,10 +8059,9 @@
 	GaimRequestFields *fields;
 	GaimRequestFieldGroup *g;
 	GaimRequestField *f;
-	gboolean auth, hide_ip, web_aware;
+	gboolean auth, web_aware;
 
 	auth = gaim_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION);
-	hide_ip = gaim_account_get_bool(account, "hide_ip", OSCAR_DEFAULT_HIDE_IP);
 	web_aware = gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE);
 
 	fields = gaim_request_fields_new();
@@ -8069,9 +8071,6 @@
 	f = gaim_request_field_bool_new("authorization", _("Require authorization"), auth);
 	gaim_request_field_group_add_field(g, f);
 
-	f = gaim_request_field_bool_new("hide_ip", _("Hide IP address"), hide_ip);
-	gaim_request_field_group_add_field(g, f);
-
 	f = gaim_request_field_bool_new("web_aware", _("Web aware (enabling this will cause you to receive SPAM!)"), web_aware);
 	gaim_request_field_group_add_field(g, f);
 
@@ -8340,7 +8339,7 @@
 	if (od->icq)
 	{
 		/* ICQ actions */
-		act = gaim_plugin_action_new(_("Show Privacy Options..."),
+		act = gaim_plugin_action_new(_("Set Privacy Options..."),
 				oscar_show_icq_privacy_opts);
 		m = g_list_append(m, act);
 	}