[ekiga] h323-endpoint: unregister the gatekeeper for real



commit 58a77503ca8b95fd680f01f593c4a61a99efc7f1
Author: VÃctor Manuel JÃquez Leal <vjaquez igalia com>
Date:   Fri Dec 21 18:06:14 2012 +0100

    h323-endpoint: unregister the gatekeeper for real
    
    Currently, unregistering an h323 account doesn't do anything, and when
    registering it again the message "Processing..." never changes. This
    patch fixes this bug. Now the unregistering happens for real and the
    re-registering is cleaner.
    
    Finally closes bug #690618.

 lib/engine/components/opal/h323-endpoint.cpp |   28 +++++++++++++++++++++----
 lib/engine/components/opal/h323-endpoint.h   |    1 +
 2 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/lib/engine/components/opal/h323-endpoint.cpp b/lib/engine/components/opal/h323-endpoint.cpp
index bfeb23d..99727ef 100644
--- a/lib/engine/components/opal/h323-endpoint.cpp
+++ b/lib/engine/components/opal/h323-endpoint.cpp
@@ -54,10 +54,12 @@ namespace Opal {
 
       subscriber (const Opal::Account & _account,
                   Opal::H323::EndPoint& _manager,
+                  bool _registering,
                   const PSafePtr<OpalPresentity> & _presentity)
         : PThread (1000, AutoDeleteThread),
         account (_account),
         manager (_manager),
+        registering (_registering),
         presentity (_presentity)
       {
         this->Resume ();
@@ -65,14 +67,23 @@ namespace Opal {
 
       void Main ()
         {
-          if (presentity && !presentity->IsOpen ())
-            presentity->Open ();
-          manager.Register (account);
+          if (registering) {
+            if (presentity && !presentity->IsOpen ())
+              presentity->Open ();
+            manager.Register (account);
+          } else {
+            manager.Unregister (account);
+
+            if (presentity && presentity->IsOpen ())
+              presentity->Close ();
+
+          }
         };
 
   private:
       const Opal::Account & account;
       Opal::H323::EndPoint& manager;
+      bool registering;
       const PSafePtr<OpalPresentity> & presentity;
     };
   };
@@ -285,7 +296,7 @@ Opal::H323::EndPoint::subscribe (const Opal::Account & account,
   if (account.get_protocol_name () != "H323")
     return false;
 
-  new subscriber (account, *this, presentity);
+  new subscriber (account, *this, true, presentity);
 
   return true;
 }
@@ -298,7 +309,7 @@ Opal::H323::EndPoint::unsubscribe (const Opal::Account & account,
   if (account.get_protocol_name () != "H323")
     return false;
 
-  new subscriber (account, *this, presentity);
+  new subscriber (account, *this, false, presentity);
 
   return true;
 }
@@ -368,6 +379,13 @@ Opal::H323::EndPoint::Register (const Opal::Account& account)
 }
 
 
+void
+Opal::H323::EndPoint::Unregister (const Opal::Account& account)
+{
+  RemoveGatekeeper (account.get_host ());
+}
+
+
 bool
 Opal::H323::EndPoint::UseGatekeeper (const PString & address,
                                      const PString & domain,
diff --git a/lib/engine/components/opal/h323-endpoint.h b/lib/engine/components/opal/h323-endpoint.h
index 61ac314..835d7fd 100644
--- a/lib/engine/components/opal/h323-endpoint.h
+++ b/lib/engine/components/opal/h323-endpoint.h
@@ -115,6 +115,7 @@ namespace Opal {
 
       /* OPAL methods */
       void Register (const Opal::Account & account);
+      void Unregister (const Opal::Account & account);
 
   private:
       bool UseGatekeeper (const PString & address = PString::Empty (),



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