changeset 3458:66b1ad9782a9

[gaim-migrate @ 3506] From KingAnt: aim.h: -Change the #defines for AIM client info so they're shorter. -Add 2 #defines for ICQ--the first one (the default) is what Gaim has been using, it was taken out of auth.c. The other is what an ICQ 2002a client uses. -Add an CLIENTINFO_ICQ_KNOWNGOOD auth.c: -Have the ICQ login use the given client info, rather than using hard coded values. oscar.c: -Rename "gaim_caps" to "caps_aim" and added a "caps_icq," so AIM and ICQ can have different capabilities. -Make changes to gaim_parse_login so the ICQ sends ICQ client info, and AIM sends AIM client info. -Make changes to conninitdone_bos so only ICQ sets the privacy flag and visibility mask. AIM sets this via SSI. -Change a few calls to aim_bos_setprofile so ICQ does not send a profile TLV, and so ICQ uses the ICQ caps and AIM uses the AIM caps. -Change a call to g_show_info_text so a pointer to the window is not left haning around? -Correctly set the occupied and do not disturb ICQ states. This is how winicq does it. -Correctly show winicq users as NA. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 28 Aug 2002 06:48:14 +0000
parents 222e23f91092
children d82f53194f09
files src/multi.c src/protocols/oscar/aim.h src/protocols/oscar/auth.c src/protocols/oscar/oscar.c
diffstat 4 files changed, 88 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/src/multi.c	Wed Aug 28 05:55:48 2002 +0000
+++ b/src/multi.c	Wed Aug 28 06:48:14 2002 +0000
@@ -1229,6 +1229,16 @@
 	}
 }
 
+/*
+ * d:)->-< 
+ *
+ * d:O-\-<
+ * 
+ * d:D-/-<
+ *
+ * d8D->-< DANCE!
+ */
+
 static void cancel_signon(GtkWidget *button, struct signon_meter *meter)
 {
 	meter->gc->wants_to_die = TRUE;
--- a/src/protocols/oscar/aim.h	Wed Aug 28 05:55:48 2002 +0000
+++ b/src/protocols/oscar/aim.h	Wed Aug 28 06:48:14 2002 +0000
@@ -146,7 +146,7 @@
 	const char *lang; /* two-letter abbrev */
 };
 
-#define AIM_CLIENTINFO_KNOWNGOOD_3_5_1670 { \
+#define CLIENTINFO_AIM_3_5_1670 { \
 	"AOL Instant Messenger (SM), version 3.5.1670/WIN32", \
 	0x0004, \
 	0x0003, \
@@ -157,7 +157,7 @@
 	"en", \
 }
 
-#define AIM_CLIENTINFO_KNOWNGOOD_4_1_2010 { \
+#define CLIENTINFO_AIM_4_1_2010 { \
 	  "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \
 	  0x0004, \
 	  0x0004, \
@@ -168,15 +168,38 @@
 	  "en", \
 }
 
+#define CLIENTINFO_ICQ_4_65_3281 { \
+	"ICQ Inc. - Product of ICQ (TM) 2000b.4.65.1.3281.85", \
+	0x010a, \
+	0x0004, \
+	0x0041, \
+	0x0001, \
+	0x0cd1, \
+	"us", \
+	"en", \
+}
+
+#define CLIENTINFO_ICQ_5_34_3728 { \
+	"ICQ Inc. - Product of ICQ (TM).2002a.5.34.1.3728.85", \
+	0x010a, \
+	0x0005, \
+	0x0022, \
+	0x0001, \
+	0x0e8f, \
+	"us", \
+	"en", \
+}
+
 /*
  * I would make 4.1.2010 the default, but they seem to have found
  * an alternate way of breaking that one. 
  *
  * 3.5.1670 should work fine, however, you will be subjected to the
- * memory test, which may require you to have a WinAIM binary laying 
+ * memory test, which may require you to have a WinAIM binary lying 
  * around. (see login.c::memrequest())
  */
-#define AIM_CLIENTINFO_KNOWNGOOD AIM_CLIENTINFO_KNOWNGOOD_3_5_1670
+#define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_3_5_1670
+#define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQ_4_65_3281
 
 #ifndef TRUE
 #define TRUE 1
--- a/src/protocols/oscar/auth.c	Wed Aug 28 05:55:48 2002 +0000
+++ b/src/protocols/oscar/auth.c	Wed Aug 28 06:48:14 2002 +0000
@@ -147,13 +147,10 @@
 }
 
 /*
- * Part two of the ICQ hack.  Note the ignoring of the key and clientinfo.
+ * Part two of the ICQ hack.  Note the ignoring of the key.
  */
-static int goddamnicq2(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password)
+static int goddamnicq2(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password, struct client_info_s *ci)
 {
-	static const char clientstr[] = {"ICQ Inc. - Product of ICQ (TM) 2000b.4.65.1.3281.85"};
-	static const char lang[] = {"en"};
-	static const char country[] = {"us"};
 	aim_frame_t *fr;
 	aim_tlvlist_t *tl = NULL;
 	char *password_encoded;
@@ -168,18 +165,20 @@
 
 	aim_encode_password(password, password_encoded);
 
-	aimbs_put32(&fr->data, 0x00000001);
+	aimbs_put32(&fr->data, 0x00000001); /* FLAP Version */
 	aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), sn);
 	aim_addtlvtochain_raw(&tl, 0x0002, strlen(password), password_encoded);
-	aim_addtlvtochain_raw(&tl, 0x0003, strlen(clientstr), clientstr);
-	aim_addtlvtochain16(&tl, 0x0016, 0x010a); /* cliend ID */
-	aim_addtlvtochain16(&tl, 0x0017, 0x0004); /* major version */
-	aim_addtlvtochain16(&tl, 0x0018, 0x0041); /* minor version */
-	aim_addtlvtochain16(&tl, 0x0019, 0x0001); /* point version */
-	aim_addtlvtochain16(&tl, 0x001a, 0x0cd1); /* build */
+
+	if (ci->clientstring)
+		aim_addtlvtochain_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring);
+	aim_addtlvtochain16(&tl, 0x0016, (fu16_t)ci->clientid);
+	aim_addtlvtochain16(&tl, 0x0017, (fu16_t)ci->major);
+	aim_addtlvtochain16(&tl, 0x0018, (fu16_t)ci->minor);
+	aim_addtlvtochain16(&tl, 0x0019, (fu16_t)ci->point);
+	aim_addtlvtochain16(&tl, 0x001a, (fu16_t)ci->build);
 	aim_addtlvtochain32(&tl, 0x0014, 0x00000055); /* distribution chan */
-	aim_addtlvtochain_raw(&tl, 0x000f, strlen(lang), lang);
-	aim_addtlvtochain_raw(&tl, 0x000e, strlen(country), country);
+	aim_addtlvtochain_raw(&tl, 0x000f, strlen(ci->lang), ci->lang);
+	aim_addtlvtochain_raw(&tl, 0x000e, strlen(ci->country), ci->country);
 
 	aim_writetlvchain(&fr->data, &tl);
 
@@ -276,7 +275,7 @@
 	 *
 	 */
 	if (sess->flags & AIM_SESS_FLAGS_XORLOGIN)
-		return goddamnicq2(sess, conn, sn, password);
+		return goddamnicq2(sess, conn, sn, password, ci);
 
 
 	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152)))
--- a/src/protocols/oscar/oscar.c	Wed Aug 28 05:55:48 2002 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Aug 28 06:48:14 2002 +0000
@@ -73,9 +73,14 @@
 
 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3"
 
-static int gaim_caps = AIM_CAPS_CHAT |
-		       AIM_CAPS_BUDDYICON |
-		       AIM_CAPS_IMIMAGE;
+static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE;
+/* What does AIM_CAPS_ICQ actually mean? -SE */
+/*   static int caps_icq = AIM_CAPS_ICQ; */
+
+/* Set AIM caps, because Gaim can still do them over ICQ and 
+ * Winicq doesn't mind. */
+static int caps_icq = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE;
+
 static fu8_t gaim_features[] = {0x01, 0x01, 0x01, 0x02};
 
 struct oscar_data {
@@ -883,20 +888,25 @@
 }
 
 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) {
-#if 0
-	struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b};
-#else
-	struct client_info_s info = AIM_CLIENTINFO_KNOWNGOOD;
-#endif
 	char *key;
 	va_list ap;
 	struct gaim_connection *gc = sess->aux_data;
+	struct oscar_data *odata = gc->proto_data;
 
 	va_start(ap, fr);
 	key = va_arg(ap, char *);
 	va_end(ap);
 
-	aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key);
+	if (odata->icq) {
+		struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD;
+		aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key);
+	} else {
+#if 0
+		struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b};
+#endif
+		struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD;
+		aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key);
+	}
 
 	return 1;
 }
@@ -2320,6 +2330,8 @@
 }
 
 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) {
+	struct gaim_connection *gc = sess->aux_data;
+	struct oscar_data *od = gc->proto_data;
 
 	aim_reqpersonalinfo(sess, fr->conn);
 	aim_bos_reqlocaterights(sess, fr->conn);
@@ -2328,9 +2340,11 @@
 	aim_reqicbmparams(sess);
 
 	aim_bos_reqrights(sess, fr->conn);
-	aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS);
-	aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE |
-						     AIM_PRIVFLAGS_ALLOWMEMBERSINCE);
+	if (od->icq) {
+		aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS);
+		aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE |
+			AIM_PRIVFLAGS_ALLOWMEMBERSINCE);
+	}
 
 	return 1;
 }
@@ -2418,7 +2432,10 @@
 
 	odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen;
 
-	aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps);
+	if (odata->icq)
+		aim_bos_setprofile(sess, fr->conn, NULL, NULL, caps_icq);
+	else
+		aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, caps_aim);
 
 	return 1;
 }
@@ -2720,6 +2737,7 @@
 	struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
 	struct direct_im *dim = find_direct_im(odata, name);
 	int ret = 0;
+
 	if (dim) {
 		if (dim->connected) {  /* If we're not connected yet, send through server */
 			ret =  aim_send_im_direct(odata->sess, dim->conn, message, len == -1 ? strlen(message) : len);
@@ -2860,7 +2878,10 @@
 
 	inforeal = g_strndup(info, odata->rights.maxsiglen);
 
-	aim_bos_setprofile(odata->sess, odata->conn, inforeal, NULL, gaim_caps);
+	if (odata->icq)
+		aim_bos_setprofile(odata->sess, odata->conn, NULL, NULL, caps_icq);
+	else
+		aim_bos_setprofile(odata->sess, odata->conn, inforeal, NULL, caps_aim);
 
 	g_free(inforeal);
 
@@ -2880,7 +2901,7 @@
 	gc->away = NULL;
 
 	if (!message) {
-		aim_bos_setprofile(od->sess, od->conn, NULL, "", gaim_caps);
+		aim_bos_setprofile(od->sess, od->conn, NULL, "", caps_aim);
 		return;
 	}
 
@@ -2894,7 +2915,7 @@
 	}
 
 	gc->away = g_strndup(message, od->rights.maxawaymsglen);
-	aim_bos_setprofile(od->sess, od->conn, NULL, gc->away, gaim_caps);
+	aim_bos_setprofile(od->sess, od->conn, NULL, gc->away, caps_aim);
 
 	return;
 }
@@ -2930,7 +2951,6 @@
 			aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
 			gc->away = "";
 		} else {
-		  
 			aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
 		}
 	}