changeset 4898:bd37db7531e4

[gaim-migrate @ 5230] I Nathan D. Walped the gaimrc file so that it writes a .gaimrc.save file and then renames it to .gaimrc, in the hopes of avoiding the loss of this data in a time that could be crucial to forward progress. Or something. I tested it with and without specifying -f I added a "Status: Not Available" (or whatever) string to ICQ tooltips. This should help at least until we get some new icons. AHEM. And then I dunno, I was planning on taking it out after that, but it could be useful. Also updated some comments and var names in oscar.c to keep things accurate, because I'm one of those people that actually does that. Go ask your Goddess if you've served her well committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 27 Mar 2003 21:41:21 +0000
parents 65a0a360e8c4
children 347070472ed6
files src/gaimrc.c src/protocols/oscar/aim.h src/protocols/oscar/im.c src/protocols/oscar/info.c src/protocols/oscar/oscar.c
diffstat 5 files changed, 70 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/src/gaimrc.c	Thu Mar 27 18:32:22 2003 +0000
+++ b/src/gaimrc.c	Thu Mar 27 21:41:21 2003 +0000
@@ -1398,7 +1398,8 @@
 void save_prefs()
 {
 	FILE *f;
-	char buf[BUF_LONG];
+	gchar *filename;
+	gchar *filename_temp;
 
 	debug_printf("enter save_prefs\n");  
 	if (is_loading_prefs) {
@@ -1407,16 +1408,15 @@
 		return;
 	}
 
-	if (opt_rcfile_arg) {
-		g_snprintf(buf, sizeof(buf), "%s", opt_rcfile_arg);
-	}
-	else if (gaim_home_dir()) {
-		g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaimrc", gaim_home_dir());
-	}
-	else {
+	if (opt_rcfile_arg)
+		filename = g_build_filename(opt_rcfile_arg, NULL);
+	else if (gaim_home_dir())
+		filename = g_build_filename(gaim_home_dir(), ".gaimrc", NULL);
+	else
 		return;
-	}
-	if ((f = fopen(buf, "w"))) {
+	filename_temp = g_strdup_printf("%s.save", filename);
+
+	if ((f = fopen(filename_temp, "w"))) {
 		is_saving_prefs = 1;
 		fprintf(f, "# .gaimrc v%d\n", 4);
 		gaimrc_write_users(f);
@@ -1429,22 +1429,25 @@
 #endif
 		gaimrc_write_proxy(f);
 		fclose(f);
-
-		chmod(buf, S_IRUSR | S_IWUSR);
+		chmod(filename, S_IRUSR | S_IWUSR);
+		if (rename(filename_temp, filename) < 0)
+			debug_printf("error renaming %s to %s\n", filename_temp, filename);
 		is_saving_prefs = 0;
-	}
-	else
-	  debug_printf("Error opening .gaimrc\n");
+	} else
+		debug_printf("error opening %s\n", filename_temp);
+
 	if (request_load_prefs) {
 		debug_printf("loading prefs on request\n");
 		load_prefs();
 		request_load_prefs = 0;
 	}
+
+	g_free(filename);
+	g_free(filename_temp);
 	debug_printf("exit save_prefs\n");
 }
 
 
-
 /* This function is called by g_slist_insert_sorted to compare the item
  * being compared to the rest of the items on the list.
  */
--- a/src/protocols/oscar/aim.h	Thu Mar 27 18:32:22 2003 +0000
+++ b/src/protocols/oscar/aim.h	Thu Mar 27 21:41:21 2003 +0000
@@ -883,8 +883,8 @@
 	fu16_t status;
 	fu8_t cookie[8];
 	fu16_t reqclass;
+	const char *proxyip;
 	const char *clientip;
-	const char *clientip2;
 	const char *verifiedip;
 	fu16_t port;
 	fu16_t errorcode;
--- a/src/protocols/oscar/im.c	Thu Mar 27 18:32:22 2003 +0000
+++ b/src/protocols/oscar/im.c	Thu Mar 27 21:41:21 2003 +0000
@@ -1644,8 +1644,8 @@
 	fu8_t *cookie2;
 	int ret = 0;
 
-	char clientip1[30] = {""};
-	char clientip2[30] = {""};
+	char proxyip[30] = {""};
+	char clientip[30] = {""};
 	char verifiedip[30] = {""};
 
 	memset(&args, 0, sizeof(args));
@@ -1687,7 +1687,7 @@
 	list2 = aim_readtlvchain(&bbs);
 
 	/*
-	 * IP address from the perspective of the client.
+	 * IP address to proxy the file transfer through.
 	 *
 	 * XXX - I don't like this.  Maybe just read in an int?  Or inet_ntoa...
 	 */
@@ -1696,7 +1696,7 @@
 
 		iptlv = aim_gettlv(list2, 0x0002, 1);
 
-		snprintf(clientip1, sizeof(clientip1), "%d.%d.%d.%d",
+		snprintf(proxyip, sizeof(proxyip), "%d.%d.%d.%d",
 				aimutil_get8(iptlv->value+0),
 				aimutil_get8(iptlv->value+1),
 				aimutil_get8(iptlv->value+2),
@@ -1704,14 +1704,14 @@
 	}
 
 	/*
-	 * Secondary IP address from the perspective of the client.
+	 * IP address from the perspective of the client.
 	 */
 	if (aim_gettlv(list2, 0x0003, 1)) {
 		aim_tlv_t *iptlv;
 
 		iptlv = aim_gettlv(list2, 0x0003, 1);
 
-		snprintf(clientip2, sizeof(clientip2), "%d.%d.%d.%d",
+		snprintf(clientip, sizeof(clientip), "%d.%d.%d.%d",
 				aimutil_get8(iptlv->value+0),
 				aimutil_get8(iptlv->value+1),
 				aimutil_get8(iptlv->value+2),
@@ -1773,14 +1773,24 @@
 	if (aim_gettlv(list2, 0x000e, 1))
 		args.language = aim_gettlv_str(list2, 0x000e, 1);
 
-	/* Unknown -- no value */
+	/*
+	 * Unknown -- no value
+	 */
 	if (aim_gettlv(list2, 0x000f, 1))
 		;
 
-	if (strlen(clientip1))
-		args.clientip = (char *)clientip1;
-	if (strlen(clientip2))
-		args.clientip2 = (char *)clientip2;
+	/*
+	 * Unknown -- no value
+	 *
+	 * Maybe means we should proxy the file transfer through an AIM server?
+	 */
+	if (aim_gettlv(list2, 0x0010, 1))
+		;
+
+	if (strlen(proxyip))
+		args.proxyip = (char *)proxyip;
+	if (strlen(clientip))
+		args.clientip = (char *)clientip;
 	if (strlen(verifiedip))
 		args.verifiedip = (char *)verifiedip;
 
--- a/src/protocols/oscar/info.c	Thu Mar 27 18:32:22 2003 +0000
+++ b/src/protocols/oscar/info.c	Thu Mar 27 21:41:21 2003 +0000
@@ -307,9 +307,13 @@
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	/*
-	 * Setting this lets AIM users receive messages from 
-	 * ICQ users, and ICQ users receive messages from AIM 
-	 * users.
+	 * Setting this lets AIM users receive messages from ICQ users, and ICQ 
+	 * users receive messages from AIM users.  It also lets ICQ users show 
+	 * up in buddy lists for AIM users, and AIM users show up in buddy lists 
+	 * for ICQ users.  And ICQ privacy/invisibility acts like AIM privacy, 
+	 * in that if you add a user to your deny list, you will not be able to 
+	 * see them as online (previous you could still see them, but they 
+	 * couldn't see you.
 	 */
 	{AIM_CAPS_INTEROPERATE,
 	 {0x09, 0x46, 0x13, 0x4d, 0x4c, 0x7f, 0x11, 0xd1,
--- a/src/protocols/oscar/oscar.c	Thu Mar 27 18:32:22 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Thu Mar 27 21:41:21 2003 +0000
@@ -163,8 +163,9 @@
 /* BBB */
 struct oscar_xfer_data {
 	fu8_t cookie[8];
+	gchar *proxyip;
 	gchar *clientip;
-	gchar *clientip2;
+	gchar *verifiedip;
 	fu32_t modtime;
 	fu32_t checksum;
 	aim_conn_t *conn;
@@ -846,8 +847,9 @@
 	if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE)
 		aim_oft_sendheader(xfer_data->conn->sessv, xfer_data->conn, AIM_CB_OFT_DONE, xfer_data->cookie, xfer->filename, 1, 1, xfer->size, xfer->size, xfer_data->modtime, xfer_data->checksum, 0x02, xfer->size, xfer_data->checksum);
 
+	g_free(xfer_data->proxyip);
 	g_free(xfer_data->clientip);
-	g_free(xfer_data->clientip2);
+	g_free(xfer_data->verifiedip);
 
 	if ((gc = xfer_data->gc)) {
 		if ((od = gc->proto_data))
@@ -877,8 +879,9 @@
 				aim_im_sendch2_sendfile_cancel(sess, xfer_data->cookie, xfer->who, AIM_CAPS_SENDFILE);
 	}
 
+	g_free(xfer_data->proxyip);
 	g_free(xfer_data->clientip);
-	g_free(xfer_data->clientip2);
+	g_free(xfer_data->verifiedip);
 
 	if ((gc = xfer_data->gc))
 		if ((od = gc->proto_data))
@@ -907,8 +910,9 @@
 				aim_im_sendch2_sendfile_cancel(sess, xfer_data->cookie, xfer->who, AIM_CAPS_SENDFILE);
 	}
 
+	g_free(xfer_data->proxyip);
 	g_free(xfer_data->clientip);
-	g_free(xfer_data->clientip2);
+	g_free(xfer_data->verifiedip);
 
 	if ((gc = xfer_data->gc))
 		if ((od = gc->proto_data))
@@ -2252,10 +2256,12 @@
 			gaim_xfer_set_size(xfer, args->info.sendfile.totsize);
 			xfer->remote_port = args->port;
 			xfer->remote_ip = g_strdup(args->verifiedip);
+			if (args->proxyip)
+				xfer_data->proxyip = g_strdup(args->proxyip);
 			if (args->clientip)
 				xfer_data->clientip = g_strdup(args->clientip);
-			if (args->clientip2)
-				xfer_data->clientip2 = g_strdup(args->clientip2);
+			if (args->verifiedip)
+				xfer_data->verifiedip = g_strdup(args->verifiedip);
 
 			 /* Setup our I/O op functions */
 			gaim_xfer_set_init_fnc(xfer, oscar_xfer_init);
@@ -2946,7 +2952,7 @@
 				tmp = _("Voice");
 				break;
 			case 0x4:
-				tmp = _("IM Image");
+				tmp = _("Direct IM");
 				break;
 			case 0x8:
 				tmp = _("Chat");
@@ -2962,7 +2968,7 @@
 				tmp = _("Games");
 				break;
 			case 0x80:
-				tmp = _("Stocks");
+				tmp = _("Add-Ins");
 				break;
 			case 0x100:
 				tmp = _("Send Buddy List");
@@ -3018,6 +3024,14 @@
 		yay = g_strdup_printf(_("<b>Logged In:</b> %s%s%s"), tstr, 
 				       caps ? _("\n<b>Capabilities:</b> ") : "", caps ? caps : "");
 		free(tstr);
+
+		if (isdigit(b->name[0])) {
+			char *tmp, *status = gaim_icq_status((b->uc & 0xffff0000) >> 16);
+			tmp = yay;
+			yay = g_strconcat(tmp, _("\n<b>Status:</b> "), status, NULL);
+			g_free(tmp);
+			g_free(status);
+		}
 		return yay;
 	} else {
 		return NULL;