[ekiga] Added a has_uri method to the base Ekiga::Presentity class and all its implementations



commit b12d092d71ce12af258432ebc7c108a84c2f7eca
Author: Snark <jpuydt gnome org>
Date:   Thu Nov 18 17:10:39 2010 +0100

    Added a has_uri method to the base Ekiga::Presentity class and all its implementations

 lib/engine/components/echo/echo-presentity.cpp     |    6 ++++++
 lib/engine/components/echo/echo-presentity.h       |    2 ++
 .../components/local-roster/local-presentity.cpp   |    5 +++++
 .../components/local-roster/local-presentity.h     |    1 +
 lib/engine/presence/presentity.h                   |    5 +++++
 lib/engine/presence/proxy-presentity.cpp           |    6 ++++++
 lib/engine/presence/proxy-presentity.h             |    2 ++
 lib/engine/presence/uri-presentity.cpp             |    6 ++++++
 lib/engine/presence/uri-presentity.h               |    2 ++
 plugins/loudmouth/loudmouth-presentity.cpp         |    6 ++++++
 plugins/loudmouth/loudmouth-presentity.h           |    2 ++
 plugins/resource-list/rl-entry-ref.cpp             |    6 ++++++
 plugins/resource-list/rl-entry-ref.h               |    2 ++
 plugins/resource-list/rl-entry.cpp                 |    6 ++++++
 plugins/resource-list/rl-entry.h                   |    2 ++
 plugins/resource-list/rl-presentity.cpp            |    6 ++++++
 plugins/resource-list/rl-presentity.h              |    2 ++
 17 files changed, 67 insertions(+), 0 deletions(-)
---
diff --git a/lib/engine/components/echo/echo-presentity.cpp b/lib/engine/components/echo/echo-presentity.cpp
index fe04e56..2722498 100644
--- a/lib/engine/components/echo/echo-presentity.cpp
+++ b/lib/engine/components/echo/echo-presentity.cpp
@@ -79,6 +79,12 @@ Echo::Presentity::get_uri () const
 }
 
 bool
+Echo::Presentity::has_uri (const std::string) const
+{
+  return false; // should be good enough
+}
+
+bool
 Echo::Presentity::populate_menu (Ekiga::MenuBuilder &)
 {
   return false; // FIXME?
diff --git a/lib/engine/components/echo/echo-presentity.h b/lib/engine/components/echo/echo-presentity.h
index 1fe2c61..248f2de 100644
--- a/lib/engine/components/echo/echo-presentity.h
+++ b/lib/engine/components/echo/echo-presentity.h
@@ -59,6 +59,8 @@ namespace Echo
 
     const std::string get_uri () const;
 
+    bool has_uri (const std::string uri) const;
+
     bool populate_menu (Ekiga::MenuBuilder &);
   };
 
diff --git a/lib/engine/components/local-roster/local-presentity.cpp b/lib/engine/components/local-roster/local-presentity.cpp
index 6749357..53a2908 100644
--- a/lib/engine/components/local-roster/local-presentity.cpp
+++ b/lib/engine/components/local-roster/local-presentity.cpp
@@ -183,6 +183,11 @@ Local::Presentity::get_uri () const
   return uri;
 }
 
+bool
+Local::Presentity::has_uri (const std::string uri) const
+{
+  return uri == get_uri ();
+}
 
 void
 Local::Presentity::set_presence (const std::string _presence)
diff --git a/lib/engine/components/local-roster/local-presentity.h b/lib/engine/components/local-roster/local-presentity.h
index 481224d..fcba57e 100644
--- a/lib/engine/components/local-roster/local-presentity.h
+++ b/lib/engine/components/local-roster/local-presentity.h
@@ -98,6 +98,7 @@ namespace Local
 
     const std::string get_uri () const;
 
+    bool has_uri (const std::string uri) const;
 
     /**
      * This will set a new presence string
diff --git a/lib/engine/presence/presentity.h b/lib/engine/presence/presentity.h
index 0a3a972..42dda66 100644
--- a/lib/engine/presence/presentity.h
+++ b/lib/engine/presence/presentity.h
@@ -79,6 +79,11 @@ namespace Ekiga
      * @return The Presentity's set of groups.
      */
     virtual const std::set<std::string> get_groups () const = 0;
+
+    /** Returns whether the Presentity has this uri.
+     * @return Whether the Presentity has this uri.
+     */
+    virtual bool has_uri (const std::string uri) const = 0;
   };
 
   typedef boost::shared_ptr<Presentity> PresentityPtr;
diff --git a/lib/engine/presence/proxy-presentity.cpp b/lib/engine/presence/proxy-presentity.cpp
index 09e57aa..d8d18a3 100644
--- a/lib/engine/presence/proxy-presentity.cpp
+++ b/lib/engine/presence/proxy-presentity.cpp
@@ -71,6 +71,12 @@ Ekiga::ProxyPresentity::get_groups () const
 }
 
 bool
+Ekiga::ProxyPresentity::has_uri (const std::string uri) const
+{
+  return presentity.has_uri (uri);
+}
+
+bool
 Ekiga::ProxyPresentity::populate_menu (Ekiga::MenuBuilder &builder)
 {
   return presentity.populate_menu (builder);
diff --git a/lib/engine/presence/proxy-presentity.h b/lib/engine/presence/proxy-presentity.h
index b4d10a9..301133c 100644
--- a/lib/engine/presence/proxy-presentity.h
+++ b/lib/engine/presence/proxy-presentity.h
@@ -82,6 +82,8 @@ namespace Ekiga
 
     const std::set<std::string> get_groups () const;
 
+    bool has_uri (const std::string uri) const;
+
     /** Populates the given Ekiga::MenuBuilder with the actions.
      * @param: A MenuBuilder.
      */
diff --git a/lib/engine/presence/uri-presentity.cpp b/lib/engine/presence/uri-presentity.cpp
index 2e10925..b10e471 100644
--- a/lib/engine/presence/uri-presentity.cpp
+++ b/lib/engine/presence/uri-presentity.cpp
@@ -95,6 +95,12 @@ Ekiga::URIPresentity::get_uri () const
 }
 
 bool
+Ekiga::URIPresentity::has_uri (const std::string uri_) const
+{
+  return uri == uri_;
+}
+
+bool
 Ekiga::URIPresentity::populate_menu (Ekiga::MenuBuilder &builder)
 {
   boost::shared_ptr<Ekiga::PresenceCore> presence_core = core.get<Ekiga::PresenceCore> ("presence-core");
diff --git a/lib/engine/presence/uri-presentity.h b/lib/engine/presence/uri-presentity.h
index b2520d7..6300a70 100644
--- a/lib/engine/presence/uri-presentity.h
+++ b/lib/engine/presence/uri-presentity.h
@@ -86,6 +86,8 @@ namespace Ekiga
 
     const std::set<std::string> get_groups () const;
 
+    bool has_uri (const std::string uri_) const;
+
     const std::string get_uri () const;
 
     /** Populates the given Ekiga::MenuBuilder with the actions.
diff --git a/plugins/loudmouth/loudmouth-presentity.cpp b/plugins/loudmouth/loudmouth-presentity.cpp
index 0dcb5a2..526e0e1 100644
--- a/plugins/loudmouth/loudmouth-presentity.cpp
+++ b/plugins/loudmouth/loudmouth-presentity.cpp
@@ -71,6 +71,12 @@ LM::Presentity::get_name () const
   return result;
 }
 
+bool
+LM::Presentity::has_uri (const std::string uri) const
+{
+  return get_jid () == uri; // FIXME: this isn't 100% exact : if our jid is "foo server/resource", then we also have "foo server" as uri!
+}
+
 const std::string
 LM::Presentity::get_presence () const
 {
diff --git a/plugins/loudmouth/loudmouth-presentity.h b/plugins/loudmouth/loudmouth-presentity.h
index a50def4..97c9df7 100644
--- a/plugins/loudmouth/loudmouth-presentity.h
+++ b/plugins/loudmouth/loudmouth-presentity.h
@@ -61,6 +61,8 @@ namespace LM
 
     const std::set<std::string> get_groups () const;
 
+    bool has_uri (const std::string uri) const;
+
     bool populate_menu (Ekiga::MenuBuilder& builder);
 
     /* special presentity stuff */
diff --git a/plugins/resource-list/rl-entry-ref.cpp b/plugins/resource-list/rl-entry-ref.cpp
index 7cd7f47..cba9a8b 100644
--- a/plugins/resource-list/rl-entry-ref.cpp
+++ b/plugins/resource-list/rl-entry-ref.cpp
@@ -123,6 +123,12 @@ RL::EntryRef::get_name () const
 }
 
 bool
+RL::EntryRef::has_uri (const std::string uri) const
+{
+  return uri == get_uri ();
+}
+
+bool
 RL::EntryRef::populate_menu (Ekiga::MenuBuilder& builder)
 {
   bool populated = false;
diff --git a/plugins/resource-list/rl-entry-ref.h b/plugins/resource-list/rl-entry-ref.h
index 52a5922..d72bc62 100644
--- a/plugins/resource-list/rl-entry-ref.h
+++ b/plugins/resource-list/rl-entry-ref.h
@@ -82,6 +82,8 @@ namespace RL {
     const std::set<std::string> get_groups () const
     { return groups; }
 
+    bool has_uri (const std::string uri) const;
+
     bool populate_menu (Ekiga::MenuBuilder& builder);
 
   private:
diff --git a/plugins/resource-list/rl-entry.cpp b/plugins/resource-list/rl-entry.cpp
index eef7421..8db0486 100644
--- a/plugins/resource-list/rl-entry.cpp
+++ b/plugins/resource-list/rl-entry.cpp
@@ -145,6 +145,12 @@ RL::Entry::get_name () const
 }
 
 bool
+RL::Entry::has_uri (const std::string uri) const
+{
+  return get_uri () == uri;
+}
+
+bool
 RL::Entry::populate_menu (Ekiga::MenuBuilder& builder)
 {
   bool populated = false;
diff --git a/plugins/resource-list/rl-entry.h b/plugins/resource-list/rl-entry.h
index 03cd2d7..94c740e 100644
--- a/plugins/resource-list/rl-entry.h
+++ b/plugins/resource-list/rl-entry.h
@@ -82,6 +82,8 @@ namespace RL {
     const std::set<std::string> get_groups () const
     { return groups; }
 
+    bool has_uri (const std::string uri) const;
+
     bool populate_menu (Ekiga::MenuBuilder& builder);
 
   private:
diff --git a/plugins/resource-list/rl-presentity.cpp b/plugins/resource-list/rl-presentity.cpp
index ee4bbe6..a3175c1 100644
--- a/plugins/resource-list/rl-presentity.cpp
+++ b/plugins/resource-list/rl-presentity.cpp
@@ -191,6 +191,12 @@ RL::Presentity::set_status (const std::string _status)
 
 
 bool
+RL::Presentity::has_uri (const std::string uri) const
+{
+  return uri == get_uri ();
+}
+
+bool
 RL::Presentity::populate_menu (Ekiga::MenuBuilder &builder)
 {
   bool populated = false;
diff --git a/plugins/resource-list/rl-presentity.h b/plugins/resource-list/rl-presentity.h
index 20db41f..0836877 100644
--- a/plugins/resource-list/rl-presentity.h
+++ b/plugins/resource-list/rl-presentity.h
@@ -71,6 +71,8 @@ namespace RL
 
     const std::string get_uri () const;
 
+    bool has_uri (const std::string uri) const;
+
     void set_presence (const std::string _presence);
 
     void set_status (const std::string _status);



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