comparison src/protocols/rendezvous/rendezvous.c @ 8546:9aa6017da568

[gaim-migrate @ 9288] Might as well have this up to date with the small changes I'd made committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 01 Apr 2004 17:42:12 +0000
parents b06dcc915c45
children 5af95c2b1179
comparison
equal deleted inserted replaced
8545:07059ef55c9c 8546:9aa6017da568
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 #include <glib.h>
23 #include <glib/gprintf.h>
24
25 #include "internal.h" 22 #include "internal.h"
26 23
27 #include "account.h" 24 #include "account.h"
28 #include "accountopt.h" 25 #include "accountopt.h"
29 #include "blist.h" 26 #include "blist.h"
62 g_free(rb->firstandlast); 59 g_free(rb->firstandlast);
63 g_free(rb->msg); 60 g_free(rb->msg);
64 g_free(rb); 61 g_free(rb);
65 } 62 }
66 63
67 /* 64 /**
68 * Extract the "user@host" name from a full presence domain 65 * Extract the "user@host" name from a full presence domain
69 * of the form "user@host._presence._tcp.local" 66 * of the form "user@host._presence._tcp.local"
70 * 67 *
71 * @return If the domain is NOT a _presence._tcp.local domain 68 * @return If the domain is NOT a _presence._tcp.local domain
72 * then return NULL. Otherwise return a newly allocated 69 * then return NULL. Otherwise return a newly allocated
125 if (b == NULL) 122 if (b == NULL)
126 return; 123 return;
127 124
128 serv_got_update(gc, b->name, 0, 0, 0, 0, 0); 125 serv_got_update(gc, b->name, 0, 0, 0, 0, 0);
129 gaim_blist_remove_buddy(b); 126 gaim_blist_remove_buddy(b);
127 /* XXX - This results in incorrect group counts--needs to be fixed in the core */
130 } 128 }
131 129
132 static void rendezvous_removeallfromlocal(GaimConnection *gc) 130 static void rendezvous_removeallfromlocal(GaimConnection *gc)
133 { 131 {
134 GaimAccount *account = gaim_connection_get_account(gc); 132 GaimAccount *account = gaim_connection_get_account(gc);
212 tmp1 = g_hash_table_lookup(rdata, "msg"); 210 tmp1 = g_hash_table_lookup(rdata, "msg");
213 if (tmp1 != NULL) { 211 if (tmp1 != NULL) {
214 g_free(rb->msg); 212 g_free(rb->msg);
215 rb->msg = g_strdup(tmp1); 213 rb->msg = g_strdup(tmp1);
216 } 214 }
215
216 /* XXX - Use the TTL value of the rr to cause this data to expire */
217 } 217 }
218 218
219 /* 219 /*
220 * Parse a resource record and do stuff if we need to. 220 * Parse a resource record and do stuff if we need to.
221 */ 221 */
352 GaimConnection *gc = gaim_account_get_connection(account); 352 GaimConnection *gc = gaim_account_get_connection(account);
353 RendezvousData *rd; 353 RendezvousData *rd;
354 354
355 rd = g_new0(RendezvousData, 1); 355 rd = g_new0(RendezvousData, 1);
356 rd->buddies = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, rendezvous_buddy_free); 356 rd->buddies = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, rendezvous_buddy_free);
357
358 gc->proto_data = rd; 357 gc->proto_data = rd;
359 358
360 gaim_connection_update_progress(gc, _("Preparing Buddy List"), 0, RENDEZVOUS_CONNECT_STEPS); 359 gaim_connection_update_progress(gc, _("Preparing Buddy List"), 0, RENDEZVOUS_CONNECT_STEPS);
361
362 rendezvous_removeallfromlocal(gc); 360 rendezvous_removeallfromlocal(gc);
363 361
364 gaim_connection_update_progress(gc, _("Connecting"), 1, RENDEZVOUS_CONNECT_STEPS); 362 gaim_connection_update_progress(gc, _("Connecting"), 1, RENDEZVOUS_CONNECT_STEPS);
365
366 rd->fd = mdns_establish_socket(); 363 rd->fd = mdns_establish_socket();
367 if (rd->fd == -1) { 364 if (rd->fd == -1) {
368 gaim_connection_error(gc, _("Unable to login to rendezvous")); 365 gaim_connection_error(gc, _("Unable to login to rendezvous"));
369 return; 366 return;
370 } 367 }
371 368
372 gc->inpa = gaim_input_add(rd->fd, GAIM_INPUT_READ, rendezvous_callback, gc); 369 gc->inpa = gaim_input_add(rd->fd, GAIM_INPUT_READ, rendezvous_callback, gc);
373
374 gaim_connection_set_state(gc, GAIM_CONNECTED); 370 gaim_connection_set_state(gc, GAIM_CONNECTED);
375 371
376 mdns_query(rd->fd, "_presence._tcp.local"); 372 mdns_query(rd->fd, "_presence._tcp.local");
377 373
378 #if 0 374 #if 0