[ekiga/jp-opal-roster: 22/33] Opal::Account: cleaned how the 'type' is handled
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/jp-opal-roster: 22/33] Opal::Account: cleaned how the 'type' is handled
- Date: Tue, 12 Nov 2013 22:06:42 +0000 (UTC)
commit d9848a4cde3f5415addf2d435cd6a2ff204193a7
Author: Julien Puydt <jpuydt free fr>
Date: Sat Oct 26 18:05:19 2013 +0200
Opal::Account: cleaned how the 'type' is handled
In addition, editing the account also sets the type correctly!
lib/engine/components/opal/opal-account.cpp | 30 +++++++++++++++++---------
lib/engine/components/opal/opal-account.h | 5 ++-
2 files changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 664483e..055428a 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -59,8 +59,7 @@
#include "sip-endpoint.h"
xmlNodePtr
-Opal::Account::build_node(Opal::Account::Type t,
- std::string name,
+Opal::Account::build_node(std::string name,
std::string host,
std::string user,
std::string auth_user,
@@ -122,15 +121,7 @@ Opal::Account::Account (boost::shared_ptr<Opal::Sip::EndPoint> _sip_endpoint,
failed_registration_already_notified = false;
dead = false;
- const std::string host = get_host ();
- if (host == "ekiga.net")
- type = Account::Ekiga;
- else if (host == "sip.diamondcard.us")
- type = Account::DiamondCard;
- else if (protocol_name == "SIP")
- type = Account::SIP;
- else
- type = Account::H323;
+ decide_type ();
if (type != Account::H323) {
@@ -685,6 +676,8 @@ Opal::Account::on_edit_form_submitted (bool submitted,
}
}
+ decide_type ();
+
if (should_enable)
enable ();
else if (should_disable)
@@ -1185,3 +1178,18 @@ Opal::Account::rename_group_form_submitted (std::string old_name,
visit_presentities (boost::ref (helper));
}
}
+
+void
+Opal::Account::decide_type ()
+{
+ const std::string host = get_host ();
+
+ if (host == "ekiga.net")
+ type = Account::Ekiga;
+ else if (host == "sip.diamondcard.us")
+ type = Account::DiamondCard;
+ else if (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 452703a..6cb1a65 100644
--- a/lib/engine/components/opal/opal-account.h
+++ b/lib/engine/components/opal/opal-account.h
@@ -75,8 +75,7 @@ public:
typedef enum { Processing, Registered, Unregistered, RegistrationFailed, UnregistrationFailed }
RegistrationState;
- static xmlNodePtr build_node (Type t,
- std::string name,
+ static xmlNodePtr build_node (std::string name,
std::string host,
std::string user,
std::string auth_user,
@@ -194,6 +193,8 @@ public:
private:
+ void decide_type ();
+
void on_edit_form_submitted (bool submitted,
Ekiga::Form &result);
void on_consult (const std::string url);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]