[ekiga] Added a has_uri method to the base Ekiga::Contact class and all its implementations
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Added a has_uri method to the base Ekiga::Contact class and all its implementations
- Date: Thu, 18 Nov 2010 14:40:09 +0000 (UTC)
commit 9206bf0cee5bd9cdc4444bd1ed96a47883a30918
Author: Julien Puydt <jpuydt gnome org>
Date: Thu Nov 18 15:33:17 2010 +0100
Added a has_uri method to the base Ekiga::Contact class and all its implementations
lib/engine/addressbook/contact.h | 7 +++++++
.../components/call-history/history-contact.cpp | 6 ++++++
.../components/call-history/history-contact.h | 2 ++
plugins/evolution/evolution-contact.cpp | 10 ++++++++++
plugins/evolution/evolution-contact.h | 2 ++
plugins/kab/kab-contact.cpp | 15 +++++++++++++++
plugins/kab/kab-contact.h | 2 +-
plugins/ldap/ldap-contact.cpp | 15 +++++++++++++++
plugins/ldap/ldap-contact.h | 2 ++
9 files changed, 60 insertions(+), 1 deletions(-)
---
diff --git a/lib/engine/addressbook/contact.h b/lib/engine/addressbook/contact.h
index 7c5a30b..d0c1ffa 100644
--- a/lib/engine/addressbook/contact.h
+++ b/lib/engine/addressbook/contact.h
@@ -69,6 +69,13 @@ namespace Ekiga
* @return The name of the Ekiga::Contact.
*/
virtual const std::string get_name () const = 0;
+
+ /** Returns whether that Ekiga::Contact corresponds to this uri.
+ * This function is purely virtual and should be implemented by the
+ * Ekiga::Contact descendant.
+ * @return whether that Ekiga::Contact corresponds to this uri.
+ */
+ virtual bool has_uri (const std::string uri) const = 0;
};
diff --git a/lib/engine/components/call-history/history-contact.cpp b/lib/engine/components/call-history/history-contact.cpp
index 587c388..6d6c683 100644
--- a/lib/engine/components/call-history/history-contact.cpp
+++ b/lib/engine/components/call-history/history-contact.cpp
@@ -155,6 +155,12 @@ History::Contact::get_name () const
return name;
}
+bool
+History::Contact::has_uri (const std::string uri_) const
+{
+ return uri == uri_;
+}
+
const std::set<std::string>
History::Contact::get_groups () const
{
diff --git a/lib/engine/components/call-history/history-contact.h b/lib/engine/components/call-history/history-contact.h
index 557fefb..0245a91 100644
--- a/lib/engine/components/call-history/history-contact.h
+++ b/lib/engine/components/call-history/history-contact.h
@@ -81,6 +81,8 @@ namespace History
const std::string get_name () const;
+ bool has_uri (const std::string uri_) const;
+
const std::set<std::string> get_groups () const;
bool populate_menu (Ekiga::MenuBuilder &builder);
diff --git a/plugins/evolution/evolution-contact.cpp b/plugins/evolution/evolution-contact.cpp
index 2a968fb..fbb3276 100644
--- a/plugins/evolution/evolution-contact.cpp
+++ b/plugins/evolution/evolution-contact.cpp
@@ -93,6 +93,16 @@ Evolution::Contact::get_name () const
return name;
}
+bool
+Evolution::Contact::has_uri (const std::string uri) const
+{
+ return (get_attribute_value (ATTR_HOME) == uri
+ || get_attribute_value (ATTR_CELL) == uri
+ || get_attribute_value (ATTR_WORK) == uri
+ || get_attribute_value (ATTR_PAGER) == uri
+ || get_attribute_value (ATTR_VIDEO) == uri);
+}
+
void
Evolution::Contact::update_econtact (EContact *_econtact)
{
diff --git a/plugins/evolution/evolution-contact.h b/plugins/evolution/evolution-contact.h
index 3fc695c..addb4f1 100644
--- a/plugins/evolution/evolution-contact.h
+++ b/plugins/evolution/evolution-contact.h
@@ -67,6 +67,8 @@ namespace Evolution
const std::string get_name () const;
+ bool has_uri (const std::string uri) const;
+
bool populate_menu (Ekiga::MenuBuilder &builder);
void update_econtact (EContact *econtact);
diff --git a/plugins/kab/kab-contact.cpp b/plugins/kab/kab-contact.cpp
index 4a1c722..78ea2c6 100644
--- a/plugins/kab/kab-contact.cpp
+++ b/plugins/kab/kab-contact.cpp
@@ -66,6 +66,21 @@ KAB::Contact::get_name () const
}
bool
+KAB::Contact::has_uri (const std::string uri) const
+{
+ bool result = false;
+ KABC::PhoneNumber::List phoneNumbers = addressee.phoneNumbers ();
+ for (KABC::PhoneNumber::List::const_iterator iter = phoneNumbers.begin ();
+ !result && iter != phoneNumbers.end ();
+ iter++) {
+
+ result = uri == (*iter).number ().toUtf8 ().constData ();
+ }
+
+ return result;
+}
+
+bool
KAB::Contact::populate_menu (Ekiga::MenuBuilder &builder)
{
bool result = false;
diff --git a/plugins/kab/kab-contact.h b/plugins/kab/kab-contact.h
index 4b5c2c7..96e78ab 100644
--- a/plugins/kab/kab-contact.h
+++ b/plugins/kab/kab-contact.h
@@ -63,7 +63,7 @@ namespace KAB
const std::string get_name () const;
- const std::map<std::string, std::string> get_uris () const;
+ bool has_uri (const std::string uri) const;
bool populate_menu (Ekiga::MenuBuilder &builder);
diff --git a/plugins/ldap/ldap-contact.cpp b/plugins/ldap/ldap-contact.cpp
index 6054b20..ab8c80c 100644
--- a/plugins/ldap/ldap-contact.cpp
+++ b/plugins/ldap/ldap-contact.cpp
@@ -69,6 +69,21 @@ OPENLDAP::Contact::get_name () const
}
bool
+OPENLDAP::Contact::has_uri (const std::string uri) const
+{
+ bool result = false;
+
+ for (std::map<std::string, std::string>::const_iterator iter = uris.begin ();
+ !result && iter != uris.end ();
+ iter++) {
+
+ result = (uri == iter->second);
+ }
+
+ return result;
+}
+
+bool
OPENLDAP::Contact::populate_menu (Ekiga::MenuBuilder &builder)
{
boost::shared_ptr<Ekiga::ContactCore> contact_core = core.get<Ekiga::ContactCore> ("contact-core");
diff --git a/plugins/ldap/ldap-contact.h b/plugins/ldap/ldap-contact.h
index 660b2fc..a197c47 100644
--- a/plugins/ldap/ldap-contact.h
+++ b/plugins/ldap/ldap-contact.h
@@ -62,6 +62,8 @@ namespace OPENLDAP
const std::string get_name () const;
+ bool has_uri (const std::string uri) const;
+
bool populate_menu (Ekiga::MenuBuilder &builder);
private:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]