changeset 14552:7ca5e82ffd6f

[gaim-migrate @ 17275] Advertise the same capabilities for both AIM and ICQ committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 14 Sep 2006 18:50:32 +0000
parents 3a35a71210fd
children 8ec842950d92
files libgaim/protocols/oscar/family_oservice.c libgaim/protocols/oscar/oscar.c
diffstat 2 files changed, 31 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/oscar/family_oservice.c	Thu Sep 14 07:52:26 2006 +0000
+++ b/libgaim/protocols/oscar/family_oservice.c	Thu Sep 14 18:50:32 2006 +0000
@@ -801,6 +801,8 @@
  *
  * These are the same TLVs seen in user info.  You can
  * also set 0x0008 and 0x000c.
+ *
+ * TODO: Combine this with the function below.
  */
 int
 aim_setextstatus(OscarData *od, guint32 status)
@@ -843,6 +845,8 @@
  *
  * These are the same TLVs seen in user info.  You can
  * also set 0x0008 and 0x000c.
+ *
+ * TODO: Combine this with the above function.
  */
 int
 aim_srv_setstatusmsg(OscarData *od, const char *msg)
@@ -850,37 +854,30 @@
 	FlapConnection *conn;
 	FlapFrame *frame;
 	aim_snacid_t snacid;
+	int msglen;
 
 	if (!od || !(conn = flap_connection_findbygroup(od, 0x0004)))
 		return -EINVAL;
 
-	if ((msg != NULL) && *msg != '\0') {
-		frame = flap_frame_new(od, 0x02, 10 + 4 + strlen(msg) + 8);
+	if (msg == NULL)
+		msglen = 0;
+	else
+		msglen = strlen(msg);
 
-		snacid = aim_cachesnac(od, 0x0001, 0x001e, 0x0000, NULL, 0);
-		aim_putsnac(&frame->data, 0x0001, 0x001e, 0x0000, snacid);
+	frame = flap_frame_new(od, 0x02, 10 + 4 + msglen + 8);
 
-		byte_stream_put16(&frame->data, 0x001d); /* userinfo TLV type */
-		byte_stream_put16(&frame->data, strlen(msg)+8); /* total length of userinfo TLV data */
-		byte_stream_put16(&frame->data, 0x0002);
-		byte_stream_put8(&frame->data, 0x04);
-		byte_stream_put8(&frame->data, strlen(msg)+4);
-		byte_stream_put16(&frame->data, strlen(msg));
+	snacid = aim_cachesnac(od, 0x0001, 0x001e, 0x0000, NULL, 0);
+	aim_putsnac(&frame->data, 0x0001, 0x001e, 0x0000, snacid);
+
+	byte_stream_put16(&frame->data, 0x001d); /* userinfo TLV type */
+	byte_stream_put16(&frame->data, msglen + 8); /* total length of userinfo TLV data */
+	byte_stream_put16(&frame->data, 0x0002);
+	byte_stream_put8(&frame->data, 0x04);
+	byte_stream_put8(&frame->data, msglen+4);
+	byte_stream_put16(&frame->data, msglen);
+	if (msglen > 0)
 		byte_stream_putstr(&frame->data, msg);
-		byte_stream_put16(&frame->data, 0x0000);
-	} else {
-		frame = flap_frame_new(od, 0x02, 10 + 4 + 8);
-
-		snacid = aim_cachesnac(od, 0x0001, 0x001e, 0x0000, NULL, 0);
-		aim_putsnac(&frame->data, 0x0001, 0x001e, 0x0000, snacid);
-
-		byte_stream_put16(&frame->data, 0x001d);
-		byte_stream_put16(&frame->data, 0x0008);
-		byte_stream_put16(&frame->data, 0x0002);
-		byte_stream_put16(&frame->data, 0x0404);
-		byte_stream_put16(&frame->data, 0x0000);
-		byte_stream_put16(&frame->data, 0x0000);
-	}
+	byte_stream_put16(&frame->data, 0x0000);
 
 	flap_connection_send(conn, frame);
 
--- a/libgaim/protocols/oscar/oscar.c	Thu Sep 14 07:52:26 2006 +0000
+++ b/libgaim/protocols/oscar/oscar.c	Thu Sep 14 18:50:32 2006 +0000
@@ -68,8 +68,7 @@
 #define OSCAR_DEFAULT_WEB_AWARE FALSE
 #define OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY FALSE
 
-static int caps_aim = OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM | OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_INTEROPERATE | OSCAR_CAPABILITY_ICHAT;
-static int caps_icq = OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM | OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_ICQUTF8 | OSCAR_CAPABILITY_INTEROPERATE | OSCAR_CAPABILITY_ICHAT;
+static OscarCapability gaim_caps = OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM | OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_ICQUTF8 | OSCAR_CAPABILITY_INTEROPERATE | OSCAR_CAPABILITY_ICHAT;
 
 static guint8 features_aim[] = {0x01, 0x01, 0x01, 0x02};
 static guint8 features_icq[] = {0x01, 0x06};
@@ -584,7 +583,7 @@
 	return g_string_free(cpy, FALSE);
 }
 
-static gchar *oscar_caps_to_string(guint caps)
+static gchar *oscar_caps_to_string(OscarCapability caps)
 {
 	GString *str;
 	const gchar *tmp;
@@ -1806,9 +1805,9 @@
 
 static void gaim_check_comment(OscarData *od, const char *str) {
 	if ((str == NULL) || strcmp(str, (const char *)ck))
-		aim_locate_setcaps(od, caps_aim);
+		aim_locate_setcaps(od, gaim_caps);
 	else
-		aim_locate_setcaps(od, caps_aim | OSCAR_CAPABILITY_SECUREIM);
+		aim_locate_setcaps(od, gaim_caps | OSCAR_CAPABILITY_SECUREIM);
 }
 
 static int gaim_parse_offgoing(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
@@ -3470,10 +3469,7 @@
 
 	od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen;
 
-	if (od->icq)
-		aim_locate_setcaps(od, caps_icq);
-	else
-		aim_locate_setcaps(od, caps_aim);
+	aim_locate_setcaps(od, gaim_caps);
 	oscar_set_info_and_status(account, TRUE, account->user_info, TRUE,
 							  gaim_account_get_active_status(account));
 
@@ -4804,8 +4800,11 @@
 					}
 					if (!aim_sncmp(curitem->name, account->username)) {
 						char *comment = aim_ssi_getcomment(od->ssi.local, gname, curitem->name);
-						gaim_check_comment(od, comment);
-						g_free(comment);
+						if (comment != NULL)
+						{
+							gaim_check_comment(od, comment);
+							g_free(comment);
+						}
 					}
 					g_free(gname_utf8);
 					g_free(alias_utf8);