[ekiga] Added a skeleton of the method to migrate the opal accounts off gconf



commit 9ad6e080283f0c5b05062731e647b239ca4c6da8
Author: Julien Puydt <jpuydt free fr>
Date:   Sun Jan 12 14:01:55 2014 +0100

    Added a skeleton of the method to migrate the opal accounts off gconf

 lib/engine/components/opal/opal-bank.cpp |   38 ++++++++++++++++++++++++++++++
 lib/engine/components/opal/opal-bank.h   |    4 +++
 2 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index 905b2cc..82d5080 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -456,3 +456,41 @@ Opal::Bank::existing_groups () const
 
   return result;
 }
+
+void
+Opal::Bank::migrate_from_gconf (const std::list<std::string> old)
+{
+  xmlDoc* doc = xmlNewDoc (BAD_CAST "1.0");
+  xmlNodePtr node = xmlNewDocNode (doc, NULL, BAD_CAST "accounts", NULL);
+  xmlDocSetRootElement (doc, node);
+
+  for (std::list<std::string>::const_iterator iter = old.begin ();
+       iter != old.end ();
+       ++iter) {
+
+    Opal::Account::Type acc_type;
+    std::string name;
+    std::string host;
+    std::string user;
+    std::string auth_user;
+    std::string password;
+    bool enabled;
+    unsigned timeout;
+
+    // FIXME: here we need dirty strtok code to analyze the string in *iter
+
+    xmlNodePtr child = Opal::Account::build_node (acc_type, name, host, user, auth_user, password, enabled, 
timeout);
+
+    xmlAddChild (node, child);
+  }
+
+  xmlChar* buffer = NULL;
+  int doc_size = 0;
+  Ekiga::Settings* settings = new Ekiga::Settings (PROTOCOLS_SCHEMA);
+
+  xmlDocDumpMemory (doc, &buffer, &doc_size);
+  settings->set_string ("accounts", (const char*)buffer);
+  
+  delete settings;
+  xmlFreeDoc (doc);
+}
diff --git a/lib/engine/components/opal/opal-bank.h b/lib/engine/components/opal/opal-bank.h
index bee474c..0269d8c 100644
--- a/lib/engine/components/opal/opal-bank.h
+++ b/lib/engine/components/opal/opal-bank.h
@@ -119,6 +119,10 @@ public:
 
     const std::set<std::string> existing_groups () const;
 
+
+    // FIXME: only here for the transition off gconf
+    static void migrate_from_gconf (const std::list<std::string> old);
+
 private:
     bool is_call_manager_ready;
 


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