diff src/protocols/yahoo/yahoo.c @ 9281:adde46ad65e9

[gaim-migrate @ 10084] This keeps track of IP addresses that other clients send us, and displays them in the Get Info dialog. Eventually we'll want to do other stuff with them, probably. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Mon, 14 Jun 2004 07:05:10 +0000
parents 2104c1039626
children 66ff39319900
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo.c	Mon Jun 14 06:09:26 2004 +0000
+++ b/src/protocols/yahoo/yahoo.c	Mon Jun 14 07:05:10 2004 +0000
@@ -1828,13 +1828,27 @@
 	}
 
 	if (base64) {
+		guint32 ip;
+		char *tmp2;
+		YahooFriend *f;
+
 		gaim_base64_decode(base64, &decoded, &len);
 		if (len) {
 			char *tmp = gaim_str_binary_to_ascii(decoded, len);
 			gaim_debug_info("yahoo", "Got P2P service packet (from server): who = %s, ip = %s\n", who, tmp);
 			g_free(tmp);
 		}
+
+		tmp2 = g_strndup(decoded, len); /* so its \0 terminated...*/
+		ip = strtol(tmp2, NULL, 10);
+		g_free(tmp2);
 		g_free(decoded);
+		tmp2 = g_strdup_printf("%u.%u.%u.%u", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff,
+		                       (ip >> 24) & 0xff);
+		f = yahoo_friend_find(gc, who);
+		if (f)
+			yahoo_friend_set_ip(f, tmp2);
+		g_free(tmp2);
 	}
 }