changeset 4342:051265d35a36

[gaim-migrate @ 4607] Thanks tp Aubin LaBrosse for a receive-file-transfer fix. Gaim no longer ignores file transfer sends where the other user didn't enter a description. I "fixed" invisibility with ICQ. Currently, if you set yourself to invisible you'll just show up as invisible on everyone's list. The fix is to set your permit/deny setting to "allow only the users below." ...and so this is a little ugly. Basically, parts of the permit/deny code need to be rewritten to allow the prpls to choose the names of the permit/deny lists, and allow a prpl to pick how many lists there are. ICQ has a visible list, an invisible list, and an ignore list. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 18 Jan 2003 22:43:22 +0000
parents 3ba910921aa0
children 36cb0bb95b9c
files src/protocols/oscar/aim.h src/protocols/oscar/info.c src/protocols/oscar/oscar.c src/protocols/oscar/service.c src/protocols/oscar/ssi.c
diffstat 5 files changed, 63 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Sat Jan 18 18:18:50 2003 +0000
+++ b/src/protocols/oscar/aim.h	Sat Jan 18 22:43:22 2003 +0000
@@ -440,14 +440,20 @@
 #define AIM_SESS_FLAGS_DONTTIMEOUTONICBM 0x00000008
 
 /* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */
-#define AIM_ICQ_STATE_NORMAL    0x00000000
-#define AIM_ICQ_STATE_AWAY      0x00000001
-#define AIM_ICQ_STATE_DND       0x00000002
-#define AIM_ICQ_STATE_OUT       0x00000004
-#define AIM_ICQ_STATE_BUSY      0x00000010
-#define AIM_ICQ_STATE_CHAT      0x00000020
-#define AIM_ICQ_STATE_INVISIBLE 0x00000100
-#define AIM_ICQ_STATE_WEBAWARE  0x00010000
+#define AIM_ICQ_STATE_NORMAL		0x00000000
+#define AIM_ICQ_STATE_AWAY		0x00000001
+#define AIM_ICQ_STATE_DND		0x00000002
+#define AIM_ICQ_STATE_OUT		0x00000004
+#define AIM_ICQ_STATE_BUSY		0x00000010
+#define AIM_ICQ_STATE_CHAT		0x00000020
+#define AIM_ICQ_STATE_INVISIBLE		0x00000100
+#define AIM_ICQ_STATE_WEBAWARE		0x00010000
+#define AIM_ICQ_STATE_HIDEIP		0x00020000
+#define AIM_ICQ_STATE_BIRTHDAY		0x00080000
+#define AIM_ICQ_STATE_DIRECTDISABLED	0x00100000
+#define AIM_ICQ_STATE_ICQHOMEPAGE	0x00200000
+#define AIM_ICQ_STATE_DIRECTREQUIREAUTH	0x10000000
+#define AIM_ICQ_STATE_DIRECTCONTACTLIST	0x20000000
 
 /*
  * AIM User Info, Standard Form.
--- a/src/protocols/oscar/info.c	Sat Jan 18 18:18:50 2003 +0000
+++ b/src/protocols/oscar/info.c	Sat Jan 18 22:43:22 2003 +0000
@@ -567,6 +567,10 @@
 			 * random crap containing the IP address,
 			 * apparently a port number, and some Other Stuff.
 			 *
+			 * Format is:
+			 * 4 bytes - Our IP address, 0xc0 a8 01 2b for 192.168.1.43
+			 * 
+			 *
 			 */
 			aimbs_getrawbuf(bs, outinfo->icqinfo.crap, 0x25);
 			outinfo->present |= AIM_USERINFO_PRESENT_ICQDATA;
--- a/src/protocols/oscar/oscar.c	Sat Jan 18 18:18:50 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Sat Jan 18 22:43:22 2003 +0000
@@ -1947,7 +1947,7 @@
 
 		if (!args->cookie || !args->verifiedip || !args->port ||
 		    !args->info.sendfile.filename || !args->info.sendfile.totsize ||
-		    !args->info.sendfile.totfiles || !args->msg || !args->reqclass)
+		    !args->info.sendfile.totfiles || !args->reqclass)
 			return 1;
 		if ((oft = find_oft_by_cookie(sess->aux_data, args->cookie)))
 		{
@@ -2425,21 +2425,21 @@
 static char *gaim_icq_status(int state) {
 	/* Make a cute little string that shows the status of the dude or dudet */
 	if (state & AIM_ICQ_STATE_CHAT)
-		return g_strdup_printf("Free For Chat");
+		return g_strdup_printf(_("Free For Chat"));
 	else if (state & AIM_ICQ_STATE_DND)
-		return g_strdup_printf("Do Not Disturb");
+		return g_strdup_printf(_("Do Not Disturb"));
 	else if (state & AIM_ICQ_STATE_OUT)
-		return g_strdup_printf("Not Available");
+		return g_strdup_printf(_("Not Available"));
 	else if (state & AIM_ICQ_STATE_BUSY)
-		return g_strdup_printf("Occupied");
+		return g_strdup_printf(_("Occupied"));
 	else if (state & AIM_ICQ_STATE_AWAY)
-		return g_strdup_printf("Away");
+		return g_strdup_printf(_("Away"));
 	else if (state & AIM_ICQ_STATE_WEBAWARE)
-		return g_strdup_printf("Web Aware");
+		return g_strdup_printf(_("Web Aware"));
 	else if (state & AIM_ICQ_STATE_INVISIBLE)
-		return g_strdup_printf("Invisible");
+		return g_strdup_printf(_("Invisible"));
 	else
-		return g_strdup_printf("Online");
+		return g_strdup_printf(_("Online"));
 }
 
 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) {
@@ -2577,7 +2577,7 @@
 	/* If this was a file transfer request, data is a cookie. */
 	if ((oft = find_oft_by_cookie(gc, data))) {
 		transfer_abort(oft->xfer,
-				(reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason was given."));
+				(reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason given."));
 
 		oscar_file_transfer_disconnect(sess, oft->conn);
 		return 1;
@@ -2585,7 +2585,7 @@
 
 	/* Data is assumed to be the destination sn. */
 	snprintf(buf, sizeof(buf), _("Your message to %s did not get sent:"), data);
-	do_error_dialog(buf, (reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason was given."), GAIM_ERROR);
+	do_error_dialog(buf, (reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason given."), GAIM_ERROR);
 
 	return 1;
 }
@@ -2637,7 +2637,7 @@
 	va_end(ap);
 
 	snprintf(buf, sizeof(buf), _("User information for %s unavailable:"), destn);
-	do_error_dialog(buf, (reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason was given."), GAIM_ERROR);
+	do_error_dialog(buf, (reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason given."), GAIM_ERROR);
 
 	return 1;
 }
@@ -3908,24 +3908,32 @@
 		gc->away = NULL;
 	}
 
-	if (!strcmp(state, "Online"))
+	if (strcmp(state, _("Invisible"))) {
+		if (aim_ssi_getpermdeny(od->sess->ssi.local) != gc->permdeny)
+			aim_ssi_setpermdeny(od->sess, od->conn, gc->permdeny, 0xffffffff);
+	} else {
+		if (aim_ssi_getpermdeny(od->sess->ssi.local) != 0x03)
+			aim_ssi_setpermdeny(od->sess, od->conn, 0x03, 0xffffffff);
+	}
+
+	if (!strcmp(state, _("Online")))
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
-	else if (!strcmp(state, "Away")) {
+	else if (!strcmp(state, _("Away"))) {
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
 		gc->away = g_strdup("");
-	} else if (!strcmp(state, "Do Not Disturb")) {
+	} else if (!strcmp(state, _("Do Not Disturb"))) {
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY);
 		gc->away = g_strdup("");
-	} else if (!strcmp(state, "Not Available")) {
+	} else if (!strcmp(state, _("Not Available"))) {
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
 		gc->away = g_strdup("");
-	} else if (!strcmp(state, "Occupied")) {
+	} else if (!strcmp(state, _("Occupied"))) {
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY);
 		gc->away = g_strdup("");
-	} else if (!strcmp(state, "Free For Chat")) {
+	} else if (!strcmp(state, _("Free For Chat"))) {
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT);
 		gc->away = g_strdup("");
-	} else if (!strcmp(state, "Invisible")) {
+	} else if (!strcmp(state, _("Invisible"))) {
 		aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE);
 		gc->away = g_strdup("");
 	} else if (!strcmp(state, GAIM_AWAY_CUSTOM)) {
@@ -4119,12 +4127,6 @@
 
 	debug_printf("ssi: syncing local list and server list\n");
 
-	/* Activate SSI */
-	/* Sending the enable causes other people to be able to see you */
-	/* Maybe send it after merging the lists? */
-	debug_printf("ssi: activating server-stored buddy list\n");
-	aim_ssi_enable(sess, fr->conn);
-
 	/* Clean the buddy list */
 	aim_ssi_cleanlist(sess, fr->conn);
 
@@ -4191,6 +4193,9 @@
 					if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != gc->permdeny)) {
 						debug_printf("ssi: changing permdeny from %d to %hhu\n", gc->permdeny, permdeny);
 						gc->permdeny = permdeny;
+						if (od->icq && gc->permdeny == 0x03) {
+							serv_set_away(gc, "Invisible", "");
+						}
 						tmp++;
 					}
 				}
@@ -4267,6 +4272,12 @@
 		
 	} /* end if (gc) */
 
+	/* Activate SSI */
+	/* Sending the enable causes other people to be able to see you, and you to see them */
+	/* Make sure your privacy setting/invisibility is set how you want it before this! */
+	debug_printf("ssi: activating server-stored buddy list\n");
+	aim_ssi_enable(sess, fr->conn);
+
 	return 1;
 }
 
@@ -4813,9 +4824,9 @@
 	if (typing) {
 		/* I had to leave this. It's just too funny. It reminds me of my sister. */
 		debug_printf("ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn);
-		serv_got_typing(gc,sn,0, TYPING);
+		serv_got_typing(gc, sn, 0, TYPING);
 	} else
-		serv_got_typing_stopped(gc,sn);
+		serv_got_typing_stopped(gc, sn);
 	return 1;
 }
 
--- a/src/protocols/oscar/service.c	Sat Jan 18 18:18:50 2003 +0000
+++ b/src/protocols/oscar/service.c	Sat Jan 18 22:43:22 2003 +0000
@@ -729,6 +729,8 @@
  *
  * Currently only works if using ICQ.
  *
+ * These are the same TLVs seen in user info.  You can 
+ * also set 0x0008 and 0x000c.
  */
 faim_export int aim_setextstatus(aim_session_t *sess, aim_conn_t *conn, fu32_t status)
 {
@@ -737,7 +739,7 @@
 	aim_tlvlist_t *tl = NULL;
 	fu32_t data;
 
-	data = 0x00030000 | status; /* yay for error checking ;^) */
+	data = AIM_ICQ_STATE_HIDEIP | AIM_ICQ_STATE_WEBAWARE | status; /* yay for error checking ;^) */
 
 	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8)))
 		return -ENOMEM;
--- a/src/protocols/oscar/ssi.c	Sat Jan 18 18:18:50 2003 +0000
+++ b/src/protocols/oscar/ssi.c	Sat Jan 18 22:43:22 2003 +0000
@@ -406,6 +406,8 @@
  * Locally find the alias of the given buddy.
  *
  * @param list A pointer to the current list of items.
+ * @param gn The group of the buddy.
+ * @param sn The name of the buddy.
  * @return A pointer to a NULL terminated string that is the buddies 
  *         alias, or NULL if the buddy has no alias.  You should free
  *         this returned value!
@@ -432,6 +434,8 @@
  * Locally find if you are waiting for authorization for a buddy.
  *
  * @param list A pointer to the current list of items.
+ * @param gn The group of the buddy.
+ * @param sn The name of the buddy.
  * @return A pointer to a NULL terminated string that is the buddies 
  *         alias, or NULL if the buddy has no alias.  You should free
  *         this returned value!