Пример #1
0
void
Avahi::PresencePublisher::publish (G_GNUC_UNUSED const Ekiga::PersonalDetails& details_)
{
  if (group != NULL) {

    Ekiga::CallManager::InterfaceList interfaces;
    AvahiStringList* txt_record = NULL;
    int ret;

    txt_record = prepare_txt_record ();
    for (Ekiga::CallCore::const_iterator iter = call_core.begin ();
	 iter != call_core.end ();
	 ++iter) {

      Ekiga::CallManager::InterfaceList ints = (*iter)->get_interfaces ();
      interfaces.insert (interfaces.begin (), ints.begin (), ints.end ());

    }

    for (Ekiga::CallManager::InterfaceList::const_iterator iter = interfaces.begin ();
	 iter != interfaces.end ();
	 ++iter) {

      gchar *typ = NULL;

      typ = g_strdup_printf ("_%s._%s",
			     iter->voip_protocol.c_str (),
			     iter->protocol.c_str ());

      /* FIXME: no collision checking here */
      ret =
	avahi_entry_group_update_service_txt_strlst (group, AVAHI_IF_UNSPEC,
						     AVAHI_PROTO_UNSPEC,
						     (AvahiPublishFlags)0,
						     name, typ, NULL,
						     txt_record);

      g_free (typ);
    }

    avahi_string_list_free (txt_record);
  }
}
Пример #2
0
void
Avahi::PresencePublisher::add_services ()
{
  Ekiga::CallManager::InterfaceList interfaces;
  AvahiStringList* txt_record = NULL;

  for (Ekiga::CallCore::iterator iter = call_core.begin ();
       iter != call_core.end ();
       ++iter) {

    Ekiga::CallManager::InterfaceList ints = (*iter)->get_interfaces ();
    interfaces.insert (interfaces.begin (), ints.begin (), ints.end ());

  }

  txt_record = prepare_txt_record ();

  for (Ekiga::CallManager::InterfaceList::const_iterator iter = interfaces.begin ();
       iter != interfaces.end ();
       ++iter) {

    gchar *typ = NULL;

    typ = g_strdup_printf ("_%s._%s",
			   iter->voip_protocol.c_str (),
			   iter->protocol.c_str ());

    /* FIXME: no collision checking here */
    avahi_entry_group_add_service_strlst (group, AVAHI_IF_UNSPEC,
					  AVAHI_PROTO_UNSPEC,
					  (AvahiPublishFlags)0,
					  name, typ,
					  NULL, NULL,
					  iter->port, txt_record);

    g_free (typ);
  }
  avahi_string_list_free (txt_record);
  avahi_entry_group_commit (group);
}