changeset 17506:bbe9248337ea

Fix network byte order issues with win32 bonjour stuff. Also copy the buddy's ip address so that subsequent calls don't overwrite it (it already is being copied and freed because of the howl implementation).
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 05 Jun 2007 22:30:06 +0000
parents 9ccec98b8ca9
children 6731e5fe3673
files libpurple/protocols/bonjour/mdns_win32.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/mdns_win32.c	Tue Jun 05 22:27:07 2007 +0000
+++ b/libpurple/protocols/bonjour/mdns_win32.c	Tue Jun 05 22:30:06 2007 +0000
@@ -72,7 +72,7 @@
 		struct sockaddr_in *addr = (struct sockaddr_in*)g_slist_nth_data(hosts, 1);
 		BonjourBuddy* buddy = args->buddy;
 
-		buddy->ip = inet_ntoa(addr->sin_addr);
+		buddy->ip = g_strdup(inet_ntoa(addr->sin_addr));
 
 		/* finally, set up the continuous txt record watcher, and add the buddy to purple */
 
@@ -116,7 +116,7 @@
 	}
 	else
 	{
-		args->buddy->port_p2pj = port;
+		args->buddy->port_p2pj = ntohs(port);
 
 		/* parse the text record */
 		_mdns_parse_text_record(args->buddy, txtRecord, txtLen);
@@ -262,7 +262,7 @@
 		{
 			case PUBLISH_START:
 				err = DNSServiceRegister(&data->advertisement, 0, 0, purple_account_get_username(data->account), ICHAT_SERVICE,
-					NULL, NULL, data->port_p2pj, TXTRecordGetLength(&dns_data), TXTRecordGetBytesPtr(&dns_data),
+					NULL, NULL, htons(data->port_p2pj), TXTRecordGetLength(&dns_data), TXTRecordGetBytesPtr(&dns_data),
 					_mdns_service_register_callback, NULL);
 				break;