[ekiga] Revert "Accounts/Contacts: Uniformised the way we add & edit."



commit 0f36e7a32bdad5a1ba23734b624c33ef50375955
Author: Damien Sandras <dsandras seconix com>
Date:   Mon Nov 2 19:07:32 2015 +0100

    Revert "Accounts/Contacts: Uniformised the way we add & edit."
    
    This is more confusing than useful. People receive a SIP address and
    should use the SIP address where possible.
    
    This reverts commit d5166acb3dd4faf8ae4b6b3d34757d11baaabc28.

 lib/engine/components/opal/opal-account.cpp    |   27 +++++++++-------------
 lib/engine/components/opal/opal-bank.cpp       |    4 +-
 lib/engine/components/opal/opal-presentity.cpp |   29 +++++------------------
 lib/engine/components/opal/opal-presentity.h   |    2 -
 4 files changed, 20 insertions(+), 42 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index b413a5c..28a0085 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -222,8 +222,12 @@ Opal::Account::Account (Opal::Bank & _bank,
   }
 
   /* Actor stuff */
-  add_action (Ekiga::ActionPtr (new Ekiga::Action ("add-contact", _("Add Contact"),
+
+  /* Translators: Example: Add ekiga.net Contact */
+  char *text = g_strdup_printf (_("A_dd %s Contact"), get_host ().c_str ());
+  add_action (Ekiga::ActionPtr (new Ekiga::Action ("add-contact", text,
                                                    boost::bind (&Opal::Account::add_contact, this))));
+  g_free (text);
   add_action (Ekiga::ActionPtr (new Ekiga::Action ("edit-account", _("_Edit"),
                                                    boost::bind (&Opal::Account::edit, this))));
   add_action (Ekiga::ActionPtr (new Ekiga::Action ("remove-account", _("_Remove"),
@@ -700,7 +704,7 @@ Opal::Account::edit ()
   case Opal::Account::Ekiga:
     request->hidden ("name", get_name ());
     request->hidden ("host", get_host ());
-    request->text ("user", _("_Username"), get_username (), _("jon"),
+    request->text ("user", _("_User"), get_username (), _("jon"),
                    Ekiga::FormVisitor::STANDARD, false, false);
     request->hidden ("authentication_user", get_authentication_username ());
     request->text ("password", _("_Password"), get_password (), _("1234"),
@@ -726,7 +730,7 @@ Opal::Account::edit ()
                    Ekiga::FormVisitor::STANDARD, false, false);
     request->text ("host", _("_Gatekeeper"), get_host (), _("ekiga.net"),
                    Ekiga::FormVisitor::STANDARD, false, false);
-    request->text ("user", _("_Username"), get_username (), _("jon"),
+    request->text ("user", _("_User"), get_username (), _("jon"),
                    Ekiga::FormVisitor::STANDARD, false, false);
     request->text ("password", _("_Password"), get_password (), _("1234"),
                    Ekiga::FormVisitor::PASSWORD, false, false);
@@ -739,7 +743,7 @@ Opal::Account::edit ()
                    Ekiga::FormVisitor::STANDARD, false, false);
     request->text ("host", _("_Registrar"), get_host (), _("ekiga.net"),
                    Ekiga::FormVisitor::STANDARD, false, false);
-    request->text ("user", _("_Username"), get_username (), _("jon"),
+    request->text ("user", _("_User"), get_username (), _("jon"),
                    Ekiga::FormVisitor::STANDARD, false, false);
     /* Translators:
      * SIP knows two usernames: The name for the client ("User") and the name
@@ -888,12 +892,8 @@ Opal::Account::add_contact ()
   request->text ("name", _("_Name"), std::string (), _("John Doe"),
                  Ekiga::FormVisitor::STANDARD, false, false);
 
-  if (type == Opal::Account::Ekiga)
-    request->text ("user", _("_Username"), std::string (), _("jon"),
-                   Ekiga::FormVisitor::STANDARD, false, false);
-  else
-    request->text ("uri", _("_URI"), "sip:", "sip:john doe ekiga net",
-                   Ekiga::FormVisitor::URI, false, false);
+  request->text ("uri", _("_URI"), "sip:", "sip:john doe ekiga net",
+                 Ekiga::FormVisitor::URI, false, false);
 
   request->editable_list ("groups",
                           _("Groups"),
@@ -914,12 +914,7 @@ Opal::Account::on_add_contact_form_submitted (bool submitted,
   std::string uri;
   const std::list<std::string> groups = result.editable_list ("groups");
 
-  if (type == Opal::Account::Ekiga) {
-    uri = result.text ("user");
-    uri += "@ekiga.net";
-  }
-  else
-    uri = result.text ("uri");
+  uri = result.text ("uri");
   uri = canonize_uri (uri);
 
   if (!is_supported_uri (uri)) {
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index adf6585..e9161e8 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -202,7 +202,7 @@ Opal::Bank::new_account (Account::Type acc_type,
                    Ekiga::FormVisitor::STANDARD, false, false);
     request->text ("host", _("_Gatekeeper"), std::string (), _("h323.ekiga.net"),
                    Ekiga::FormVisitor::STANDARD, false, false);
-    request->text ("user", _("_Username"), username, _("jon"),
+    request->text ("user", _("_User"), username, _("jon"),
                    Ekiga::FormVisitor::STANDARD, false, false);
     request->hidden ("authentication_user", username);
     request->text ("password", _("_Password"), password, _("1234"),
@@ -217,7 +217,7 @@ Opal::Bank::new_account (Account::Type acc_type,
                    Ekiga::FormVisitor::STANDARD, false, false);
     request->text ("host", _("_Registrar"), std::string (), _("ekiga.net"),
                    Ekiga::FormVisitor::STANDARD, false, false);
-    request->text ("user", _("_Username"), username, _("jon"),
+    request->text ("user", _("_User"), username, _("jon"),
                    Ekiga::FormVisitor::STANDARD, false, false);
     request->text ("authentication_user", _("_Login"), std::string (), _("jon.doe"),
                    Ekiga::FormVisitor::STANDARD, true, true);
diff --git a/lib/engine/components/opal/opal-presentity.cpp b/lib/engine/components/opal/opal-presentity.cpp
index e9c3079..b877c08 100644
--- a/lib/engine/components/opal/opal-presentity.cpp
+++ b/lib/engine/components/opal/opal-presentity.cpp
@@ -35,7 +35,6 @@
 #include <algorithm>
 #include <set>
 #include <glib/gi18n.h>
-#include <boost/algorithm/string.hpp>
 
 #include "form-request-simple.h"
 #include "robust-xml.h"
@@ -124,8 +123,6 @@ Opal::Presentity::Presentity (const Opal::Account & account_,
   node(node_),
   presence("unknown")
 {
-  if (get_uri ().find ("@ekiga.net"))
-    type = Opal::Presentity::Ekiga;
 }
 
 
@@ -285,19 +282,11 @@ Opal::Presentity::edit_presentity ()
                  _("John Doe"),
                  Ekiga::FormVisitor::STANDARD,
                  false, false);
-  if (type == Opal::Presentity::Ekiga) {
-    std::string user = get_uri ();
-    boost::replace_all (user, "sip:", "");
-    boost::replace_all (user, "@ekiga.net", "");
-    request->text ("user", _("_Username"), user, _("jon"),
-                   Ekiga::FormVisitor::STANDARD, false, false);
-  }
-  else
-    request->text ("uri", _("URI"),
-                   get_uri (),
-                   _("sip:username ekiga net"),
-                   Ekiga::FormVisitor::URI,
-                   false, false);
+  request->text ("uri", _("URI"),
+                 get_uri (),
+                 _("sip:username ekiga net"),
+                 Ekiga::FormVisitor::URI,
+                 false, false);
 
   request->editable_list ("groups", _("Groups"),
                         get_groups (), existing_groups ());
@@ -329,12 +318,8 @@ Opal::Presentity::edit_presentity_form_submitted (bool submitted,
     error = _("You did not provide a valid address");
     return false;
   }
-  if (type == Opal::Presentity::Ekiga) {
-    new_uri = result.text ("user");
-    new_uri += "@ekiga.net";
-  }
-  else
-    new_uri = canonize_uri (new_uri);
+
+  new_uri = canonize_uri (new_uri);
 
   for (xmlNodePtr child = node->children ;
        child != NULL ;
diff --git a/lib/engine/components/opal/opal-presentity.h b/lib/engine/components/opal/opal-presentity.h
index d312fed..d29498e 100644
--- a/lib/engine/components/opal/opal-presentity.h
+++ b/lib/engine/components/opal/opal-presentity.h
@@ -63,7 +63,6 @@ namespace Opal
       public Ekiga::DynamicObject<Presentity>
   {
   public:
-    typedef enum { SIP, Ekiga, DiamondCard, H323 } Type;
 
     /* build a node describing a valid presentity, which the caller
      * will then use to create a valid instance using the ctor */
@@ -143,7 +142,6 @@ namespace Opal
 
     std::string presence;
     std::string status;
-    Type type;
   };
 
   typedef boost::shared_ptr<Presentity> PresentityPtr;


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