[ekiga] jabber/XMPP: added an "existing_groups" method to LM::HeapRoster



commit 4ab746c67bc2b3a6c37dcf191b835d56f7ff825e
Author: Julien Puydt <jpuydt free fr>
Date:   Sat Oct 27 10:09:01 2012 +0200

    jabber/XMPP: added an "existing_groups" method to LM::HeapRoster

 plugins/loudmouth/loudmouth-heap-roster.cpp |   50 +++++++++++++++++++++++++++
 plugins/loudmouth/loudmouth-heap-roster.h   |    2 +
 2 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/plugins/loudmouth/loudmouth-heap-roster.cpp b/plugins/loudmouth/loudmouth-heap-roster.cpp
index 4f69d35..fd250c3 100644
--- a/plugins/loudmouth/loudmouth-heap-roster.cpp
+++ b/plugins/loudmouth/loudmouth-heap-roster.cpp
@@ -403,3 +403,53 @@ LM::HeapRoster::on_chat_requested (PresentityPtr presentity)
 {
   dialect->open_chat (presentity);
 }
+
+struct existing_groups_helper
+{
+  std::set<std::string> groups;
+
+  bool operator() (Ekiga::PresentityPtr presentity)
+  {
+    const std::set<std::string> presentity_groups = presentity->get_groups ();
+
+    groups.insert (presentity_groups.begin (),
+		   presentity_groups.end ());
+
+    return true;
+  }
+};
+
+const std::set<std::string>
+LM::HeapRoster::existing_groups () const
+{
+  std::set<std::string> result;
+
+  {
+    existing_groups_helper helper;
+    visit_presentities (boost::ref (helper));
+    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;
+}
diff --git a/plugins/loudmouth/loudmouth-heap-roster.h b/plugins/loudmouth/loudmouth-heap-roster.h
index 1416fc6..7b01f88 100644
--- a/plugins/loudmouth/loudmouth-heap-roster.h
+++ b/plugins/loudmouth/loudmouth-heap-roster.h
@@ -119,6 +119,8 @@ namespace LM
 
     LmHandlerResult message_handler_roster (LmMessage* message);
     LmHandlerResult message_handler_muc (LmMessage* message);
+
+    const std::set<std::string> existing_groups () const;
   };
 
   typedef boost::shared_ptr<HeapRoster> HeapRosterPtr;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]