[ekiga] Restored Opal:Account's type properties



commit 6be79d67b3481d54512275bb3a9107a20fef5520
Author: Julien Puydt <jpuydt free fr>
Date:   Thu Jan 2 19:01:05 2014 +0100

    Restored Opal:Account's type properties

 lib/engine/components/opal/opal-account.cpp |   38 ++++++++++++++++++++++++---
 lib/engine/components/opal/opal-account.h   |    3 +-
 lib/engine/components/opal/opal-bank.cpp    |    4 +-
 3 files changed, 38 insertions(+), 7 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 5d38c7c..2c9d64e 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -77,7 +77,8 @@ canonize_uri (std::string uri)
 }
 
 xmlNodePtr
-Opal::Account::build_node(std::string name,
+Opal::Account::build_node(Opal::Account::Type typus,
+                         std::string name,
                          std::string host,
                          std::string user,
                          std::string auth_user,
@@ -110,6 +111,26 @@ Opal::Account::build_node(std::string name,
     xmlSetProp (node, BAD_CAST "timeout", BAD_CAST sstream.str ().c_str ());
   }
 
+  switch (typus) {
+
+  case Ekiga:
+    xmlSetProp (node, BAD_CAST "type", BAD_CAST "Ekiga");
+    break;
+
+  case DiamondCard:
+    xmlSetProp (node, BAD_CAST "type", BAD_CAST "DiamondCard");
+    break;
+
+  case H323:
+    xmlSetProp (node, BAD_CAST "type", BAD_CAST "H323");
+    break;
+
+  case SIP:
+  default:
+    xmlSetProp (node, BAD_CAST "type", BAD_CAST "SIP");
+    break;
+  }
+
   xmlNewChild(node, NULL, BAD_CAST "roster", NULL);
 
   return node;
@@ -241,7 +262,7 @@ Opal::Account::get_aor () const
 {
   std::stringstream str;
 
-  str << (protocol_name == "SIP" ? "sip:" : "h323:") << get_username ();
+  str << (get_protocol_name () == "SIP" ? "sip:" : "h323:") << get_username ();
 
   if (get_username ().find ("@") == string::npos)
     str << "@" << get_host ();
@@ -252,7 +273,16 @@ Opal::Account::get_aor () const
 const std::string
 Opal::Account::get_protocol_name () const
 {
-  return protocol_name;
+  std::string result = "SIP";
+  xmlChar* xml_str = xmlGetProp (node, BAD_CAST "type");
+
+  if (xml_str != NULL) {
+
+    result = (const char*)xml_str;
+    xmlFree (xml_str);
+  }
+
+  return result;
 }
 
 
@@ -1294,7 +1324,7 @@ Opal::Account::decide_type ()
     type = Account::Ekiga;
   else if (host == "sip.diamondcard.us")
     type = Account::DiamondCard;
-  else if (protocol_name == "SIP")
+  else if (get_protocol_name () == "SIP")
     type = Account::SIP;
   else
     type = Account::H323;
diff --git a/lib/engine/components/opal/opal-account.h b/lib/engine/components/opal/opal-account.h
index 7c929f0..e1c2d4d 100644
--- a/lib/engine/components/opal/opal-account.h
+++ b/lib/engine/components/opal/opal-account.h
@@ -75,7 +75,8 @@ public:
 
     typedef enum { Processing, Registered, Unregistered, RegistrationFailed, UnregistrationFailed } 
RegistrationState;
 
-    static xmlNodePtr build_node (std::string name,
+    static xmlNodePtr build_node (Opal::Account::Type typus,
+                                 std::string name,
                                  std::string host,
                                  std::string user,
                                  std::string auth_user,
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index 0038689..855a73c 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -286,7 +286,7 @@ Opal::Bank::on_new_account_form_submitted (bool submitted,
 
 
 void
-Opal::Bank::add (G_GNUC_UNUSED Account::Type acc_type,
+Opal::Bank::add (Account::Type acc_type,
                 std::string name,
                 std::string host,
                 std::string user,
@@ -295,7 +295,7 @@ Opal::Bank::add (G_GNUC_UNUSED Account::Type acc_type,
                 bool enabled,
                 unsigned timeout)
 {
-  xmlNodePtr child = Opal::Account::build_node (name, host, user, auth_user, password, enabled, timeout);
+  xmlNodePtr child = Opal::Account::build_node (acc_type, name, host, user, auth_user, password, enabled, 
timeout);
 
   xmlAddChild (node, child);
 


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