comparison src/protocols/rendezvous/rendezvous.c @ 8838:518455386538

[gaim-migrate @ 9604] -Fix the compile error in perl that was my fault -Rename a network.c function and change it's signature (is that work applicable in c?) -Make rendezvous crash when trying to sign on committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 28 Apr 2004 03:16:40 +0000
parents beb7be215db3
children 01c3db200c8f
comparison
equal deleted inserted replaced
8837:25206a0fb4e4 8838:518455386538
479 g_free(myname); 479 g_free(myname);
480 480
481 g_free(rdata); 481 g_free(rdata);
482 } 482 }
483 483
484 static int *rendezvous_get_ip_as_int_array(int fd)
485 {
486 static int ret[4];
487 const char *ip, *nexttoken;
488 int i = 0;
489
490 ip = gaim_network_get_local_system_ip(fd);
491 nexttoken = strtok((char *)ip, ".");
492 while (nexttoken && i < 4) {
493 ret[i] = atoi(nexttoken);
494 nexttoken = strtok(NULL, ".");
495 }
496
497 return ret;
498 }
499
500 static void rendezvous_send_online(GaimConnection *gc) 484 static void rendezvous_send_online(GaimConnection *gc)
501 { 485 {
502 RendezvousData *rd = gc->proto_data; 486 RendezvousData *rd = gc->proto_data;
503 GaimAccount *account = gaim_connection_get_account(gc); 487 GaimAccount *account = gaim_connection_get_account(gc);
504 const gchar *me; 488 const gchar *me;
505 gchar *myname, *mycomp; 489 gchar *myname, *mycomp;
506 unsigned char *myip; 490 const unsigned char *myip;
507 491
508 me = gaim_account_get_username(account); 492 me = gaim_account_get_username(account);
509 myname = g_strdup_printf("%s._presence._tcp.local", me); 493 myname = g_strdup_printf("%s._presence._tcp.local", me);
510 mycomp = g_strdup_printf("%s.local", strchr(me, '@') + 1); 494 mycomp = g_strdup_printf("%s.local", strchr(me, '@') + 1);
511 myip = rendezvous_get_ip_as_int_array(rd->fd); 495 myip = gaim_network_ip_atoi(gaim_network_get_local_system_ip(rd->fd));
512 496
513 mdns_advertise_a(rd->fd, mycomp, myip); 497 mdns_advertise_a(rd->fd, mycomp, myip);
514 mdns_advertise_ptr(rd->fd, "_presence._tcp.local", myname); 498 mdns_advertise_ptr(rd->fd, "_presence._tcp.local", myname);
515 mdns_advertise_srv(rd->fd, myname, 5298, mycomp); 499 mdns_advertise_srv(rd->fd, myname, 5298, mycomp);
516 500