changeset 4625:819ba05f5b1b

[gaim-migrate @ 4916] This fixes some problems with gender, in that, if someone specified either male of female, Gaim would always show "Age: Female," which isn't exactly right. Gender?! I don't even know her! I also made bunches of email addresses show up, and made them show up as mailto: links. I guess these will just get passed to your browser. And I fixed the UIN field. That was a dumb mistake. So aliases should update themselves better now. Still not automagically, though. Oh, and I made the day show up as MM/DD/YY instead of DD/MM/YY. For a second there I thought I was in a different country, but I safe and sound now, back in good old 1955. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 28 Feb 2003 07:29:17 +0000
parents a964972cb361
children 43f0bfd14614
files src/protocols/oscar/aim.h src/protocols/oscar/icq.c src/protocols/oscar/oscar.c
diffstat 3 files changed, 32 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Fri Feb 28 04:26:37 2003 +0000
+++ b/src/protocols/oscar/aim.h	Fri Feb 28 07:29:17 2003 +0000
@@ -1293,7 +1293,7 @@
 
 	/* email (0x00eb) */
 	fu16_t numaddresses;
-	char *email2;
+	char **email2;
 
 	/* we keep track of these in a linked list because we're 1337 */
 	struct aim_icq_info *next;
--- a/src/protocols/oscar/icq.c	Fri Feb 28 04:26:37 2003 +0000
+++ b/src/protocols/oscar/icq.c	Fri Feb 28 07:29:17 2003 +0000
@@ -147,7 +147,7 @@
 	/* Keep track of this request and the ICQ number and request ID */
 	info = (struct aim_icq_info *)calloc(1, sizeof(struct aim_icq_info));
 	info->reqid = snacid;
-	info->uin = atoi(sess->sn);
+	info->uin = atoi(uin);
 	info->next = sess->icq_info;
 	sess->icq_info = info;
 
@@ -230,6 +230,8 @@
 }
 
 static void aim_icq_freeinfo(struct aim_icq_info *info) {
+	int i;
+
 	if (!info)
 		return;
 	free(info->nick);
@@ -244,6 +246,9 @@
 	free(info->mobile);
 	free(info->homezip);
 	free(info->personalwebpage);
+	if (info->email2)
+		for (i = 0; i < info->numaddresses; i++)
+			free(info->email2[i]);
 	free(info->email2);
 	free(info->workcity);
 	free(info->workstate);
@@ -349,8 +354,9 @@
 			info->mobile = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
 			info->homezip = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
 			info->homecountry = aimbs_getle16(&qbs);
-			/* 1 byte timezone */
-			/* 1 byte hide email flag */
+			/* 0x0a 00 02 00 */
+			/* 1 byte timezone? */
+			/* 1 byte hide email flag? */
 		} break;
 
 		case 0x00dc: { /* personal information */
@@ -364,9 +370,9 @@
 			info->language1 = aimbs_getle8(&qbs);
 			info->language2 = aimbs_getle8(&qbs);
 			info->language3 = aimbs_getle8(&qbs);
+			/* 0x00 00 01 00 00 01 00 00 00 00 00 */
 		} break;
 
-		/* XXX - Look into the webpage thing for this, too */
 		case 0x00d2: { /* work information */
 			info->workcity = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
 			info->workstate = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
@@ -378,7 +384,7 @@
 			info->workcompany = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
 			info->workdivision = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
 			info->workposition = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-			aim_bstream_advance(&qbs, 2); /* Number of webpage addresses? */
+			aim_bstream_advance(&qbs, 2); /* 0x01 00 */
 			info->workwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
 		} break;
 
@@ -386,10 +392,15 @@
 			info->info = aimbs_getstr(&qbs, aimbs_getle16(&qbs)-1);
 		} break;
 
-		/* XXX - Find out the structure of this.  Probably make a 2d array of strings */
 		case 0x00eb: { /* email address(es) */
+			int i;
 			info->numaddresses = aimbs_getle16(&qbs);
-			info->email2 = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->email2 = (char **)calloc(info->numaddresses, sizeof(char *));
+			for (i = 0; i < info->numaddresses; i++) {
+				info->email2[i] = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+				if (i+1 != info->numaddresses)
+					aim_bstream_advance(&qbs, 1); /* 0x00 */
+			}
 		} break;
 
 		case 0x00f0: { /* personal interests */
@@ -399,6 +410,7 @@
 		} break;
 
 		case 0x010e: { /* unknown */
+			/* 0x00 00 */
 		} break;
 
 		case 0x019a: { /* simple info */
--- a/src/protocols/oscar/oscar.c	Fri Feb 28 04:26:37 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Fri Feb 28 07:29:17 2003 +0000
@@ -3531,14 +3531,23 @@
 		tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>Last Name:</b> ", info->last, NULL);  g_free(tmp);
 	}
 	if (info->email) {
-		tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>Email Address:</b> ", info->email, NULL);  g_free(tmp);
+		tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>Email Address:</b> <a href=\"mailto:", info->email, "\">", info->email, "</a>", NULL);  g_free(tmp);
+	}
+	if (info->numaddresses && info->email2) {
+		int i;
+		for (i = 0; i < info->numaddresses; i++) {
+			tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>Email Address:</b> <a href=\"mailto:", info->email2[i], "\">", info->email2[i], "</a>", NULL);  g_free(tmp);
+		}
 	}
 	if (info->mobile) {
-		tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>Mobile:</b> ", info->mobile, NULL);  g_free(tmp);
+		tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>Mobile Phone:</b> ", info->mobile, NULL);  g_free(tmp);
+	}
+	if (info->gender) {
+		tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>Gender:</b> ", info->gender==1 ? "Female" : "Male", NULL);  g_free(tmp);
 	}
 	if (info->birthyear || info->birthmonth || info->birthday) {
 		char date[15];
-		snprintf(date, sizeof(date), "%hhd/%hhd/%hd", info->birthday, info->birthmonth, info->birthyear);
+		snprintf(date, sizeof(date), "%hhd/%hhd/%hd", info->birthmonth, info->birthday, info->birthyear);
 		tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>Birthday:</b> ", date, NULL);  g_free(tmp);
 	}
 	if (info->age) {
@@ -3546,9 +3555,6 @@
 		snprintf(age, sizeof(age), "%hhd", info->age);
 		tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>Age:</b> ", age, NULL);  g_free(tmp);
 	}
-	if (info->gender) {
-		tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>Age:</b> ", info->gender ? "Male" : "Female", NULL);  g_free(tmp);
-	}
 	if (info->personalwebpage) {
 		tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>Personal Web Page:</b> <a href=\"", info->personalwebpage, "\">", info->personalwebpage, "</a>", NULL);  g_free(tmp);
 	}