[ekiga] Made the LDAP source propose to add an ekiga.net book only when it hasn't one already
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Made the LDAP source propose to add an ekiga.net book only when it hasn't one already
- Date: Fri, 11 Feb 2011 08:12:26 +0000 (UTC)
commit 3b19809791fdebeacd5be76bb75ba6bdf92156b0
Author: Snark <jpuydt gnome org>
Date: Fri Feb 11 09:14:07 2011 +0100
Made the LDAP source propose to add an ekiga.net book only when it hasn't one already
Fixes bug #641957 -- except for bug #642089!
plugins/ldap/ldap-book.cpp | 22 ++++++++++++++++++++++
plugins/ldap/ldap-book.h | 4 ++++
plugins/ldap/ldap-source.cpp | 19 +++++++++++++++++--
plugins/ldap/ldap-source.h | 2 ++
4 files changed, 45 insertions(+), 2 deletions(-)
---
diff --git a/plugins/ldap/ldap-book.cpp b/plugins/ldap/ldap-book.cpp
index db82292..9234207 100644
--- a/plugins/ldap/ldap-book.cpp
+++ b/plugins/ldap/ldap-book.cpp
@@ -50,6 +50,8 @@
#include "ldap-book.h"
#include "robust-xml.h"
+#define EKIGA_NET_URI "ldap://ekiga.net:389"
+
/* little helper function... can probably be made more complete */
static const std::string
fix_to_utf8 (const std::string str)
@@ -333,6 +335,10 @@ OPENLDAP::Book::Book (Ekiga::ServiceCore &_core,
trigger_saving ();
}
OPENLDAP::BookInfoParse (bookinfo);
+ if (bookinfo.uri_host == EKIGA_NET_URI)
+ I_am_an_ekiga_net_book = true;
+ else
+ I_am_an_ekiga_net_book = false;
}
OPENLDAP::Book::Book (Ekiga::ServiceCore &_core,
@@ -366,12 +372,22 @@ OPENLDAP::Book::Book (Ekiga::ServiceCore &_core,
BAD_CAST robust_xmlEscape (node->doc,
bookinfo.password).c_str ());
OPENLDAP::BookInfoParse (bookinfo);
+ if (bookinfo.uri_host == EKIGA_NET_URI)
+ I_am_an_ekiga_net_book = true;
+ else
+ I_am_an_ekiga_net_book = false;
}
OPENLDAP::Book::~Book ()
{
}
+bool
+OPENLDAP::Book::is_ekiga_net_book () const
+{
+ return I_am_an_ekiga_net_book;
+}
+
void
OPENLDAP::BookInfoParse (struct BookInfo &info)
{
@@ -1116,6 +1132,12 @@ OPENLDAP::Book::on_edit_form_submitted (bool submitted,
robust_xmlNodeSetContent (node, &authcID_node, "authcID", bookinfo.authcID);
robust_xmlNodeSetContent (node, &password_node, "password", bookinfo.password);
+
+ if (bookinfo.uri_host == EKIGA_NET_URI)
+ I_am_an_ekiga_net_book = true;
+ else
+ I_am_an_ekiga_net_book = false;
+
updated ();
trigger_saving ();
}
diff --git a/plugins/ldap/ldap-book.h b/plugins/ldap/ldap-book.h
index bb1ea09..87ff983 100644
--- a/plugins/ldap/ldap-book.h
+++ b/plugins/ldap/ldap-book.h
@@ -126,6 +126,8 @@ namespace OPENLDAP
boost::signal0<void> trigger_saving;
+ bool is_ekiga_net_book () const;
+
/* public for access from C */
void on_sasl_form_submitted (bool, Ekiga::Form &);
Ekiga::FormBuilder *saslform;
@@ -160,6 +162,8 @@ namespace OPENLDAP
std::string status;
std::string search_filter;
+
+ bool I_am_an_ekiga_net_book;
};
typedef boost::shared_ptr<Book> BookPtr;
diff --git a/plugins/ldap/ldap-source.cpp b/plugins/ldap/ldap-source.cpp
index 2da1c06..8a7923a 100644
--- a/plugins/ldap/ldap-source.cpp
+++ b/plugins/ldap/ldap-source.cpp
@@ -129,8 +129,11 @@ OPENLDAP::Source::populate_menu (Ekiga::MenuBuilder &builder)
{
builder.add_action ("add", _("Add an LDAP Address Book"),
boost::bind (&OPENLDAP::Source::new_book, this));
- builder.add_action ("add", _("Add the Ekiga.net Directory"),
- boost::bind (&OPENLDAP::Source::new_ekiga_net_book, this));
+ if (!has_ekiga_net_book ()) {
+
+ builder.add_action ("add", _("Add the Ekiga.net Directory"),
+ boost::bind (&OPENLDAP::Source::new_ekiga_net_book, this));
+ }
return true;
}
@@ -206,6 +209,18 @@ OPENLDAP::Source::save ()
xmlFree (buffer);
}
+bool
+OPENLDAP::Source::has_ekiga_net_book () const
+{
+ bool result = false;
+ for (const_iterator iter = begin ();
+ iter != end () && !result;
+ ++iter)
+ result = (*iter)->is_ekiga_net_book ();
+
+ return result;
+}
+
void
OPENLDAP::Source::migrate_from_3_0_0 ()
{
diff --git a/plugins/ldap/ldap-source.h b/plugins/ldap/ldap-source.h
index c94015c..56d0afb 100644
--- a/plugins/ldap/ldap-source.h
+++ b/plugins/ldap/ldap-source.h
@@ -93,6 +93,8 @@ namespace OPENLDAP
void on_new_book_form_submitted (bool submitted,
Ekiga::Form &result);
+
+ bool has_ekiga_net_book () const;
gboolean should_add_ekiga_net_book;
void migrate_from_3_0_0 ();
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]