[ekiga/ds-gtk-application] Accounts: Added registration transition status.



commit eac8c09f739ab3be86b3d8337927569d7d2bf2c2
Author: Damien Sandras <dsandras seconix com>
Date:   Sun Oct 26 14:06:01 2014 +0100

    Accounts: Added registration transition status.
    
    This is required by most account types.
    It will also allow a visual representation of the registration status
    (if any) in the roster.

 lib/engine/account/account.h                |   16 ++++++++++++++++
 lib/engine/components/opal/opal-account.cpp |    9 ++++++++-
 lib/engine/components/opal/opal-account.h   |    4 ++--
 3 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/lib/engine/account/account.h b/lib/engine/account/account.h
index 93a1b91..8265be3 100644
--- a/lib/engine/account/account.h
+++ b/lib/engine/account/account.h
@@ -57,6 +57,14 @@ namespace Ekiga
   {
   public:
 
+    /* Not all accounts have a notion of registration. However,
+     * in that case, Registered will stand for "Active", and
+     * Unregistered for "Inactive".
+     *
+     * Not all accounts need to go through all states.
+     */
+    typedef enum { Processing, Registered, Unregistered, RegistrationFailed, UnregistrationFailed } 
RegistrationState;
+
     /** The destructor.
      */
     virtual ~Account () { }
@@ -78,6 +86,14 @@ namespace Ekiga
     virtual const std::string get_status () const = 0;
 
 
+    /** Returns the registration state of the Ekiga::Account.
+     * This function is purely virtual and should be implemented by the
+     * Ekiga::Account descendant.
+     * @return The status of the Ekiga::Account
+     */
+    virtual RegistrationState get_state () const = 0;
+
+
     /** Returns a boolean indicating whether the account is enabled.
      *
      * @return Whether the account is enabled
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index e5296ad..495a4f4 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -295,6 +295,12 @@ Opal::Account::get_status () const
   return result;
 }
 
+Ekiga::Account::RegistrationState
+Opal::Account::get_state () const
+{
+  return state;
+}
+
 const std::string
 Opal::Account::get_aor () const
 {
@@ -503,6 +509,7 @@ Opal::Account::disable ()
   // Translators: this is a state, not an action, i.e. it should be read as
   // "(you are) unregistered", and not as "(you have been) unregistered"
   status = _("Unregistered");
+  state = Unregistered;
 
   updated ();
   trigger_saving ();
@@ -914,7 +921,7 @@ Opal::Account::unfetch (const std::string uri) const
 
 
 void
-Opal::Account::handle_registration_event (RegistrationState state_,
+Opal::Account::handle_registration_event (Ekiga::Account::RegistrationState state_,
                                          const std::string info) const
 {
   switch (state_) {
diff --git a/lib/engine/components/opal/opal-account.h b/lib/engine/components/opal/opal-account.h
index fb630f6..37af923 100644
--- a/lib/engine/components/opal/opal-account.h
+++ b/lib/engine/components/opal/opal-account.h
@@ -75,8 +75,6 @@ public:
 
     typedef enum { SIP, Ekiga, DiamondCard, H323 } Type;
 
-    typedef enum { Processing, Registered, Unregistered, RegistrationFailed, UnregistrationFailed } 
RegistrationState;
-
     static xmlNodePtr build_node (Opal::Account::Type typus,
                                  std::string name,
                                  std::string host,
@@ -101,6 +99,8 @@ public:
 
     const std::string get_status () const;
 
+    Ekiga::Account::RegistrationState get_state () const;
+
     const std::string get_aor () const;
 
     Type get_type () const;


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