Exemplo n.º 1
0
const std::list<std::string>
LM::HeapRoster::existing_groups () const
{
  std::list<std::string> result;

  {
    lm_existing_groups_helper helper;
    visit_presentities (boost::ref (helper));
    result = helper.groups;
  }
  result.push_back (_("Family"));
  result.push_back (_("Friend"));
  /* Translator: http://www.ietf.org/rfc/rfc4480.txt proposes several
     relationships between you and your contact; associate means
     someone who is at the same "level" than you.
  */
  result.push_back (_("Associate"));
  /* Translator: http://www.ietf.org/rfc/rfc4480.txt proposes several
     relationships between you and your contact; assistant means
     someone who is at a lower "level" than you.
  */
  result.push_back (_("Assistant"));
  /* Translator: http://www.ietf.org/rfc/rfc4480.txt proposes several
     relationships between you and your contact; supervisor means
     someone who is at a higher "level" than you.
  */
  result.push_back (_("Supervisor"));
  /* Translator: http://www.ietf.org/rfc/rfc4480.txt proposes several
     relationships between you and your contact; self means yourself.
  */
  result.push_back (_("Self"));

  return result;
}
Exemplo n.º 2
0
void
Local::Heap::push_presence (const std::string uri,
			    const std::string presence)
{
  push_presence_helper helper(uri, presence);

  visit_presentities (sigc::mem_fun (helper, &push_presence_helper::test));
}
Exemplo n.º 3
0
void
Local::Heap::push_status (const std::string uri,
			  const std::string status)
{
  push_status_helper helper(uri, status);

  visit_presentities (sigc::mem_fun (helper, &push_status_helper::test));
}
Exemplo n.º 4
0
void
Local::Heap::push_status (const std::string uri,
			  const std::string status)
{
  push_status_helper helper(uri, status);

  visit_presentities (boost::ref (helper));
}
Exemplo n.º 5
0
void
Local::Heap::push_presence (const std::string uri,
			    const std::string presence)
{
  push_presence_helper helper(uri, presence);

  visit_presentities (boost::ref (helper));
}
Exemplo n.º 6
0
bool
Local::Heap::has_presentity_with_uri (const std::string uri)
{
  has_presentity_with_uri_helper helper(uri);

  visit_presentities (sigc::mem_fun (helper, &has_presentity_with_uri_helper::test));

  return helper.found;
}
Exemplo n.º 7
0
bool
Local::Heap::has_presentity_with_uri (const std::string uri)
{
  has_presentity_with_uri_helper helper(uri);

  visit_presentities (boost::ref (helper));

  return helper.found;
}
Exemplo n.º 8
0
void
Local::Heap::rename_group_form_submitted (std::string old_name,
					  bool submitted,
					  Ekiga::Form& result)
{
  if (!submitted)
    return;

  const std::string new_name = result.text ("name");

  if ( !new_name.empty () && new_name != old_name) {

    rename_group_form_submitted_helper helper (old_name, new_name);
    visit_presentities (sigc::mem_fun (helper, &rename_group_form_submitted_helper::rename_group));
  }
}
Exemplo n.º 9
0
const std::set<std::string>
Local::Heap::existing_groups ()
{
  std::set<std::string> result;

  {
    existing_groups_helper helper;

    visit_presentities (sigc::mem_fun (helper, &existing_groups_helper::test));
    result = helper.groups;
  }

  result.insert (_("Family"));
  result.insert (_("Friend"));
  /* Translator: http://www.ietf.org/rfc/rfc4480.txt proposes several
     relationships between you and your contact; associate means
     someone who is at the same "level" than you.
  */
  result.insert (_("Associate"));
  /* Translator: http://www.ietf.org/rfc/rfc4480.txt proposes several
     relationships between you and your contact; assistant means
     someone who is at a lower "level" than you.
  */
  result.insert (_("Assistant"));
  /* Translator: http://www.ietf.org/rfc/rfc4480.txt proposes several
     relationships between you and your contact; supervisor means
     someone who is at a higher "level" than you.
  */
  result.insert (_("Supervisor"));
  /* Translator: http://www.ietf.org/rfc/rfc4480.txt proposes several
     relationships between you and your contact; self means yourself.
  */
  result.insert (_("Self"));

  return result;
}
Exemplo n.º 10
0
void
Avahi::Heap::ResolverCallback (AvahiServiceResolver * /*resolver*/,
			       AvahiIfIndex /*interface*/,
			       AvahiProtocol /*protocol*/,
			       AvahiResolverEvent event,
			       const char * name_,
			       const char * typ,
			       const char * /*domain*/,
			       const char* host_name,
			       const AvahiAddress */*address*/,
			       uint16_t port,
			       AvahiStringList *txt,
			       AvahiLookupResultFlags flags)
{
  std::string name;
  std::string software;
  std::string presence;
  std::string note;
  gchar *url = NULL;
  AvahiStringList *txt_tmp = NULL;

  // filter out seeing ourselves
  // FIXME: doesn't it hide other people on the same box too?
  if (flags & AVAHI_LOOKUP_RESULT_LOCAL) {

    avahi_service_resolver_free (resolver);
    resolver = NULL;
#if DEBUG
    std::cout << __PRETTY_FUNCTION__ << " LOCAL RESULT" << std::endl;
#endif
    return;
  }

  switch (event) {

  case AVAHI_RESOLVER_FOUND:
  {
#if DEBUG
    std::cout << __PRETTY_FUNCTION__ << " AVAHI_RESOLVER_FOUND" << std::endl;
#endif

    name = name_;
    for (txt_tmp = txt;  txt_tmp != NULL; txt_tmp = txt_tmp->next) {

      char *ckey = NULL;
      char *cvalue = NULL;
      size_t valsize;
      if (avahi_string_list_get_pair (txt_tmp, &ckey, &cvalue, &valsize) >= 0) {

	if (ckey != NULL && cvalue != NULL) {

	  std::string key (ckey);
	  std::string value (cvalue);
	  if (key == "presence")
	    presence = value;
	  else if (key == "status")  // interoperability with older versions
	    note = value;
	  else if (key == "note")
	    note = value;
	  else if (key == "software")
	    software = value;
	}
	if (ckey != NULL) free (ckey);
	if (cvalue != NULL) free (cvalue);
      }
    }

    resolver_callback_helper helper(name);
    visit_presentities (boost::ref (helper));
    if (helper.found_presentity ()) {

      /* known contact has been updated */
      presence_received (helper.found_presentity ()->get_uri (), presence);
      note_received (helper.found_presentity ()->get_uri (), note);
    }
    else {

      /* ok, this is a new contact */
      gchar** broken = NULL;
      broken = g_strsplit_set (typ, "._", 0);
      boost::shared_ptr<Ekiga::PresenceCore> presence_core = core.get<Ekiga::PresenceCore> ("presence-core");
      if (broken != NULL && broken[0] != NULL && broken[1] != NULL) {

	std::list<std::string> groups;

	groups.push_back (_("Neighbours"));
	url = g_strdup_printf ("%s:neighbour@%s:%d", broken[1], host_name, port);
	boost::shared_ptr<Avahi::Presentity> presentity = Avahi::Presentity::create (presence_core, name, url, groups);
	note_received (url, note);
	presence_received (url, presence);
	add_presentity (presentity);
	g_free (url);
      }
      g_strfreev (broken);
    }
  }
    break;
  case AVAHI_RESOLVER_FAILURE:

#if DEBUG
    std::cout << __PRETTY_FUNCTION__ << " AVAHI_RESOLVER_FAILURE" << std::endl;
#endif
    avahi_service_resolver_free (resolver);
    resolver = NULL;
    break;
  default:
    /* shouldn't happen */
#if DEBUG
    std::cout << __PRETTY_FUNCTION__ << " SHOULDN'T HAPPEN" << std::endl;
#endif
    break;
  }
}