Mercurial > pidgin
comparison libpurple/protocols/bonjour/jabber.c @ 17495:d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
There are a few changes by me, mainly to fix the howl implementation.
Fixes #1117 .
There appear to be a few bugs, but I believe that they were also present previously. I'm hoping to do some more tweaking before the next release.
The howl implementation will eventually be supersceded by a native avahi implementation, so I opted for a somewhat dirty hack to enable it instead of doing something with config.h.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 05 Jun 2007 03:38:22 +0000 |
parents | 7ade887fd3f6 |
children | bca2780f7669 |
comparison
equal
deleted
inserted
replaced
17488:7e856734b712 | 17495:d7b50cac1c7a |
---|---|
49 _connect_to_buddy(PurpleBuddy *gb) | 49 _connect_to_buddy(PurpleBuddy *gb) |
50 { | 50 { |
51 gint socket_fd; | 51 gint socket_fd; |
52 gint retorno = 0; | 52 gint retorno = 0; |
53 struct sockaddr_in buddy_address; | 53 struct sockaddr_in buddy_address; |
54 BonjourBuddy *bb = gb->proto_data; | |
54 | 55 |
55 /* Create a socket and make it non-blocking */ | 56 /* Create a socket and make it non-blocking */ |
56 socket_fd = socket(PF_INET, SOCK_STREAM, 0); | 57 socket_fd = socket(PF_INET, SOCK_STREAM, 0); |
57 | 58 |
58 buddy_address.sin_family = PF_INET; | 59 buddy_address.sin_family = PF_INET; |
59 buddy_address.sin_port = htons(((BonjourBuddy*)(gb->proto_data))->port_p2pj); | 60 buddy_address.sin_port = htons(bb->port_p2pj); |
60 inet_aton(((BonjourBuddy*)(gb->proto_data))->ip, &(buddy_address.sin_addr)); | 61 inet_aton(bb->ip, &(buddy_address.sin_addr)); |
61 memset(&(buddy_address.sin_zero), '\0', 8); | 62 memset(&(buddy_address.sin_zero), '\0', 8); |
62 | 63 |
63 retorno = connect(socket_fd, (struct sockaddr*)&buddy_address, sizeof(struct sockaddr)); | 64 retorno = connect(socket_fd, (struct sockaddr*)&buddy_address, sizeof(struct sockaddr)); |
64 if (retorno == -1) { | 65 if (retorno == -1) { |
65 purple_debug_warning("bonjour", "connect error: %s\n", strerror(errno)); | 66 purple_debug_warning("bonjour", "Error connecting to buddy %s at %s:%d error: %s\n", purple_buddy_get_name(gb), bb->ip ? bb->ip : "(null)", buddy_address.sin_port, strerror(errno)); |
66 } | 67 } |
67 fcntl(socket_fd, F_SETFL, O_NONBLOCK); | 68 fcntl(socket_fd, F_SETFL, O_NONBLOCK); |
68 | 69 |
69 return socket_fd; | 70 return socket_fd; |
70 } | 71 } |