Mercurial > pidgin
comparison libpurple/protocols/bonjour/mdns_avahi.c @ 22052:1be0d49532a1
Fix the _presence._tcp. record not to be referred to as the ICHAT_PRESENCE, that has been bothering me for a while.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 09 Jan 2008 19:07:16 +0000 |
parents | 41959f031322 |
children | d50194ab3016 |
comparison
equal
deleted
inserted
replaced
22051:92eeb7f5b3c9 | 22052:1be0d49532a1 |
---|---|
443 case PUBLISH_START: | 443 case PUBLISH_START: |
444 publish_result = avahi_entry_group_add_service_strlst( | 444 publish_result = avahi_entry_group_add_service_strlst( |
445 idata->group, AVAHI_IF_UNSPEC, | 445 idata->group, AVAHI_IF_UNSPEC, |
446 AVAHI_PROTO_INET, 0, | 446 AVAHI_PROTO_INET, 0, |
447 purple_account_get_username(data->account), | 447 purple_account_get_username(data->account), |
448 ICHAT_SERVICE, NULL, NULL, data->port_p2pj, lst); | 448 LINK_LOCAL_RECORD_NAME, NULL, NULL, data->port_p2pj, lst); |
449 break; | 449 break; |
450 case PUBLISH_UPDATE: | 450 case PUBLISH_UPDATE: |
451 publish_result = avahi_entry_group_update_service_txt_strlst( | 451 publish_result = avahi_entry_group_update_service_txt_strlst( |
452 idata->group, AVAHI_IF_UNSPEC, | 452 idata->group, AVAHI_IF_UNSPEC, |
453 AVAHI_PROTO_INET, 0, | 453 AVAHI_PROTO_INET, 0, |
454 purple_account_get_username(data->account), | 454 purple_account_get_username(data->account), |
455 ICHAT_SERVICE, NULL, lst); | 455 LINK_LOCAL_RECORD_NAME, NULL, lst); |
456 break; | 456 break; |
457 } | 457 } |
458 | 458 |
459 /* Free the memory used by temp data */ | 459 /* Free the memory used by temp data */ |
460 avahi_string_list_free(lst); | 460 avahi_string_list_free(lst); |
461 | 461 |
462 if (publish_result < 0) { | 462 if (publish_result < 0) { |
463 purple_debug_error("bonjour", | 463 purple_debug_error("bonjour", |
464 "Failed to add the " ICHAT_SERVICE " service. Error: %s\n", | 464 "Failed to add the " LINK_LOCAL_RECORD_NAME " service. Error: %s\n", |
465 avahi_strerror(publish_result)); | 465 avahi_strerror(publish_result)); |
466 return FALSE; | 466 return FALSE; |
467 } | 467 } |
468 | 468 |
469 if (type == PUBLISH_START | 469 if (type == PUBLISH_START |
470 && (publish_result = avahi_entry_group_commit(idata->group)) < 0) { | 470 && (publish_result = avahi_entry_group_commit(idata->group)) < 0) { |
471 purple_debug_error("bonjour", | 471 purple_debug_error("bonjour", |
472 "Failed to commit " ICHAT_SERVICE " service. Error: %s\n", | 472 "Failed to commit " LINK_LOCAL_RECORD_NAME " service. Error: %s\n", |
473 avahi_strerror(publish_result)); | 473 avahi_strerror(publish_result)); |
474 return FALSE; | 474 return FALSE; |
475 } | 475 } |
476 | 476 |
477 return TRUE; | 477 return TRUE; |
480 gboolean _mdns_browse(BonjourDnsSd *data) { | 480 gboolean _mdns_browse(BonjourDnsSd *data) { |
481 AvahiSessionImplData *idata = data->mdns_impl_data; | 481 AvahiSessionImplData *idata = data->mdns_impl_data; |
482 | 482 |
483 g_return_val_if_fail(idata != NULL, FALSE); | 483 g_return_val_if_fail(idata != NULL, FALSE); |
484 | 484 |
485 idata->sb = avahi_service_browser_new(idata->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_INET, ICHAT_SERVICE, NULL, 0, _browser_callback, data->account); | 485 idata->sb = avahi_service_browser_new(idata->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_INET, LINK_LOCAL_RECORD_NAME, NULL, 0, _browser_callback, data->account); |
486 if (!idata->sb) { | 486 if (!idata->sb) { |
487 | 487 |
488 purple_debug_error("bonjour", | 488 purple_debug_error("bonjour", |
489 "Unable to initialize service browser. Error: %s.\n", | 489 "Unable to initialize service browser. Error: %s.\n", |
490 avahi_strerror(avahi_client_errno(idata->client))); | 490 avahi_strerror(avahi_client_errno(idata->client))); |
522 "Unable to initialize the buddy icon group (%s).\n", | 522 "Unable to initialize the buddy icon group (%s).\n", |
523 avahi_strerror(avahi_client_errno(idata->client))); | 523 avahi_strerror(avahi_client_errno(idata->client))); |
524 return FALSE; | 524 return FALSE; |
525 } | 525 } |
526 | 526 |
527 svc_name = g_strdup_printf("%s." ICHAT_SERVICE "local", | 527 svc_name = g_strdup_printf("%s." LINK_LOCAL_RECORD_NAME "local", |
528 purple_account_get_username(data->account)); | 528 purple_account_get_username(data->account)); |
529 | 529 |
530 ret = avahi_entry_group_add_record(idata->buddy_icon_group, AVAHI_IF_UNSPEC, | 530 ret = avahi_entry_group_add_record(idata->buddy_icon_group, AVAHI_IF_UNSPEC, |
531 AVAHI_PROTO_INET, flags, svc_name, | 531 AVAHI_PROTO_INET, flags, svc_name, |
532 AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 120, avatar_data, avatar_len); | 532 AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 120, avatar_data, avatar_len); |
613 if (idata->buddy_icon_rec_browser != NULL) | 613 if (idata->buddy_icon_rec_browser != NULL) |
614 avahi_record_browser_free(idata->buddy_icon_rec_browser); | 614 avahi_record_browser_free(idata->buddy_icon_rec_browser); |
615 | 615 |
616 purple_debug_info("bonjour", "Retrieving buddy icon for '%s'.\n", buddy->name); | 616 purple_debug_info("bonjour", "Retrieving buddy icon for '%s'.\n", buddy->name); |
617 | 617 |
618 name = g_strdup_printf("%s." ICHAT_SERVICE "local", buddy->name); | 618 name = g_strdup_printf("%s." LINK_LOCAL_RECORD_NAME "local", buddy->name); |
619 idata->buddy_icon_rec_browser = avahi_record_browser_new(session_idata->client, AVAHI_IF_UNSPEC, | 619 idata->buddy_icon_rec_browser = avahi_record_browser_new(session_idata->client, AVAHI_IF_UNSPEC, |
620 AVAHI_PROTO_INET, name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 0, | 620 AVAHI_PROTO_INET, name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 0, |
621 _buddy_icon_record_cb, buddy); | 621 _buddy_icon_record_cb, buddy); |
622 g_free(name); | 622 g_free(name); |
623 | 623 |