ekiga r6232 - in trunk: . lib/engine/presence/skel lib/engine/protocol/skel src/endpoints src/gui



Author: dsandras
Date: Sun Apr 27 16:03:45 2008
New Revision: 6232
URL: http://svn.gnome.org/viewvc/ekiga?rev=6232&view=rev

Log:
Moved the registration mechanism from the GMManager to the respective
CallManager's with the signal being relayed to the CallCore. At a
later stage, we should have an Accounts component in the engine and
those signals should be placed there.


Modified:
   trunk/ChangeLog
   trunk/lib/engine/presence/skel/presence-core.cpp
   trunk/lib/engine/presence/skel/presence-core.h
   trunk/lib/engine/protocol/skel/call-core.cpp
   trunk/lib/engine/protocol/skel/call-core.h
   trunk/lib/engine/protocol/skel/call-manager.h
   trunk/src/endpoints/h323.cpp
   trunk/src/endpoints/manager.cpp
   trunk/src/endpoints/manager.h
   trunk/src/endpoints/sip.cpp
   trunk/src/gui/accounts.cpp
   trunk/src/gui/main.cpp

Modified: trunk/lib/engine/presence/skel/presence-core.cpp
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.cpp	(original)
+++ trunk/lib/engine/presence/skel/presence-core.cpp	Sun Apr 27 16:03:45 2008
@@ -60,7 +60,8 @@
 }
 
 
-void Ekiga::PresencePublisher::on_registration_event (std::string /*aor*/,
+void Ekiga::PresencePublisher::on_registration_event (Ekiga::CallManager & /*manager*/,
+                                                      std::string /*aor*/,
                                                       Ekiga::CallCore::RegistrationState state,
                                                       std::string /*info*/,
                                                       Ekiga::PersonalDetails & details)

Modified: trunk/lib/engine/presence/skel/presence-core.h
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.h	(original)
+++ trunk/lib/engine/presence/skel/presence-core.h	Sun Apr 27 16:03:45 2008
@@ -110,7 +110,8 @@
 
   private:
     void on_personal_details_updated (PersonalDetails & details);
-    void on_registration_event (std::string aor,
+    void on_registration_event (Ekiga::CallManager & /*manager*/,
+                                std::string aor,
                                 Ekiga::CallCore::RegistrationState state,
                                 std::string /*info*/,
                                 Ekiga::PersonalDetails & details);

Modified: trunk/lib/engine/protocol/skel/call-core.cpp
==============================================================================
--- trunk/lib/engine/protocol/skel/call-core.cpp	(original)
+++ trunk/lib/engine/protocol/skel/call-core.cpp	Sun Apr 27 16:03:45 2008
@@ -58,6 +58,7 @@
   manager.new_chat.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_new_chat), &manager));
 
   manager.mwi_event.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_mwi_event), &manager));
+  manager.registration_event.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_registration_event), &manager));
 }
 
 
@@ -222,3 +223,9 @@
 {
   mwi_event.emit (*manager, account, info);
 }
+
+
+void CallCore::on_registration_event (std::string account, Ekiga::CallCore::RegistrationState state, std::string info, CallManager *manager)
+{
+  registration_event.emit (*manager, account, state, info);
+}

Modified: trunk/lib/engine/protocol/skel/call-core.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call-core.h	(original)
+++ trunk/lib/engine/protocol/skel/call-core.h	Sun Apr 27 16:03:45 2008
@@ -170,14 +170,13 @@
       sigc::signal<void, CallManager &, std::string, std::string> new_chat;
 
 
-      /*** MWI ***/
+      /*** Accounts ***/
+      // TODO Should move too
       sigc::signal<void, CallManager &, std::string, std::string> mwi_event;
 
-
-      /*** Accounts ***/
-      /* TODO should move out of here */
       typedef enum { Processing, Registered, Unregistered, RegistrationFailed, UnregistrationFailed } RegistrationState;
-      sigc::signal<void, std::string, Ekiga::CallCore::RegistrationState, std::string> registration_event;
+      sigc::signal<void, CallManager &, std::string, Ekiga::CallCore::RegistrationState, std::string> registration_event;
+
 
   private:
       void on_new_call (Call *call, CallManager *manager);
@@ -199,6 +198,7 @@
       void on_new_chat (std::string, std::string, CallManager *manager);
 
       void on_mwi_event (std::string, std::string, CallManager *manager);
+      void on_registration_event (std::string, Ekiga::CallCore::RegistrationState, std::string, CallManager *manager);
 
       std::set<CallManager *> managers;
     };

Modified: trunk/lib/engine/protocol/skel/call-manager.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call-manager.h	(original)
+++ trunk/lib/engine/protocol/skel/call-manager.h	Sun Apr 27 16:03:45 2008
@@ -156,15 +156,22 @@
 
 
       /*
-       * MESSAGE WAITING INDICATION
+       * ACCOUNT INDICATIONS
        */
 
-      /** This signal is emitted when a chat conversation should be initiated
+      /** This signal is emitted when there is a new message waiting indication
        * @param: account is the voicemail account
        *         mwi is the message waiting indication
        */
       sigc::signal<void, std::string, std::string> mwi_event;
 
+      /** This signal is emitted when there is a new registration event
+       * @param: account is the voicemail account
+       *         state is the state
+       *         info contains information about the registration status
+       */
+      sigc::signal<void, std::string, Ekiga::CallCore::RegistrationState, std::string> registration_event;
+
   private :
       std::string uri_type;
     };

Modified: trunk/src/endpoints/h323.cpp
==============================================================================
--- trunk/src/endpoints/h323.cpp	(original)
+++ trunk/src/endpoints/h323.cpp	Sun Apr 27 16:03:45 2008
@@ -128,9 +128,13 @@
 
     H323EndPoint::RemoveGatekeeper (0);
 
-    /* Signal the OpalManager */
-    endpoint.OnRegistering (aor, true);
-
+    /* Signal */
+    /*
+    runtime.run_in_main (sigc::bind (registration_event.make_slot (), 
+                                     aor,
+                                     Ekiga::CallCore::Processing,
+                                     std::string ()));
+*/ //TODO
     if (!authUserName.IsEmpty ()) {
       SetLocalUserName (authUserName);
       AddAliasName (endpoint.GetDefaultDisplayName ());
@@ -174,12 +178,23 @@
       else
 	info = _("Failed");
 
-      /* Signal the OpalManager */
-      endpoint.OnRegistrationFailed (aor, true, info);
+      /* Signal */
+      /*
+      runtime.run_in_main (sigc::bind (registration_event.make_slot (), 
+                                       aor, 
+                                       Ekiga::CallCore::RegistrationFailed,
+                                       info));
+                                       */
     }
     else {
-      /* Signal the OpalManager */
-      endpoint.OnRegistered (aor, true);
+
+      /* Signal */
+      /*
+      runtime.run_in_main (sigc::bind (registration_event.make_slot (), 
+                                       aor,
+                                       Ekiga::CallCore::Registered,
+                                       std::string ()));
+                                       */
     }
   }
   else if (unregister && IsRegisteredWithGatekeeper (host)) {
@@ -187,8 +202,13 @@
     H323EndPoint::RemoveGatekeeper (0);
     RemoveAliasName (authUserName);
 
-    /* Signal the OpalManager */
-    endpoint.OnRegistered (aor, false);
+    /* Signal */
+    /*
+    runtime.run_in_main (sigc::bind (registration_event.make_slot (), 
+                                     aor,
+                                     Ekiga::CallCore::Unregistered,
+                                     std::string ()));
+                                     */
   }
 }
 

Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp	(original)
+++ trunk/src/endpoints/manager.cpp	Sun Apr 27 16:03:45 2008
@@ -655,42 +655,6 @@
   return TRUE;
 }
 
-void
-GMManager::OnRegistered (const PString & aor,
-                         bool wasRegistering)
-{
-  if (call_core)
-    runtime.run_in_main (sigc::bind (call_core->registration_event.make_slot (), 
-                                     std::string ((const char *) aor), 
-                                     wasRegistering ? Ekiga::CallCore::Registered : Ekiga::CallCore::Unregistered,
-                                     std::string ()));
-}
-
-
-void
-GMManager::OnRegistering (const PString & aor,
-                         G_GNUC_UNUSED bool isRegistering)
-{
-  if (call_core)
-    runtime.run_in_main (sigc::bind (call_core->registration_event.make_slot (), 
-                                     std::string ((const char *) aor), 
-                                     Ekiga::CallCore::Processing,
-                                     std::string ()));
-}
-
-
-void
-GMManager::OnRegistrationFailed (const PString & aor,
-                                 bool wasRegistering,
-                                 std::string info)
-{
-  if (call_core)
-    runtime.run_in_main (sigc::bind (call_core->registration_event.make_slot (), 
-                                     std::string ((const char *) aor), 
-                                     wasRegistering ? Ekiga::CallCore::RegistrationFailed : Ekiga::CallCore::UnregistrationFailed,
-                                     info));
-}
-
 
 void GMManager::GetAllowedFormats (OpalMediaFormatList & full_list)
 {

Modified: trunk/src/endpoints/manager.h
==============================================================================
--- trunk/src/endpoints/manager.h	(original)
+++ trunk/src/endpoints/manager.h	Sun Apr 27 16:03:45 2008
@@ -260,18 +260,6 @@
   virtual void OnClosedMediaStream (const OpalMediaStream &);
 
 
- protected:
-
-  void OnRegistering (const PString & aor,
-                      bool isRegistering);
-
-  void OnRegistered (const PString & aor,
-                     bool wasRegistering);
-
-  void OnRegistrationFailed (const PString & aor,
-                             bool wasRegistering,
-                             std::string info);
-
  private:
   void GetAllowedFormats (OpalMediaFormatList & full_list);
 

Modified: trunk/src/endpoints/sip.cpp
==============================================================================
--- trunk/src/endpoints/sip.cpp	(original)
+++ trunk/src/endpoints/sip.cpp	Sun Apr 27 16:03:45 2008
@@ -407,14 +407,17 @@
     else
       strm << aor;
 
-    /* Signal the OpalManager */
-    endpoint.OnRegistering (strm.str (), true); // TODO we could directly emit the signal from here
+    /* Signal */
+    runtime.run_in_main (sigc::bind (registration_event.make_slot (), 
+                                     aor,
+                                     Ekiga::CallCore::Processing,
+                                     std::string ()));
 
     /* Trigger registering */
     result = SIPEndPoint::Register (PString::Empty (), aor, authUserName, password, PString::Empty (), expires);
 
     if (!result) 
-      endpoint.OnRegistrationFailed (aor, true, _("Failed"));
+      OnRegistrationFailed (_aor, SIP_PDU::MaxStatusCode, true);
   }
   else if (unregister && IsRegistered (aor)) {
 
@@ -451,9 +454,6 @@
       aors.remove (strm.str ());
   }
 
-  /* Signal the OpalManager */
-  endpoint.OnRegistered (strm.str (), was_registering); // TODO we could directly emit the signal from here
-
   if (loc != string::npos) {
 
     server = aor.substr (loc+1);
@@ -489,6 +489,12 @@
     SIPSubscribe::SubscribeType t = SIPSubscribe::MessageSummary;
     Subscribe (t, 3600, aor);
   }
+
+  /* Signal */
+  runtime.run_in_main (sigc::bind (registration_event.make_slot (), 
+                                   strm.str (),
+                                   was_registering ? Ekiga::CallCore::Registered : Ekiga::CallCore::Unregistered,
+                                   std::string ()));
 }
 
 
@@ -701,9 +707,6 @@
     break;
 
   case SIP_PDU::MaxStatusCode:
-    info = _("Max status code");
-    break;
-
   default:
     info = _("Failed");
 
@@ -717,11 +720,14 @@
     break;
   }
 
-  /* Signal the OpalManager */
-  endpoint.OnRegistrationFailed (strm.str ().c_str (), wasRegistering, info);
-
   /* Signal the SIP Endpoint */
   SIPEndPoint::OnRegistrationFailed (strm.str ().c_str (), r, wasRegistering);
+
+  /* Signal */
+  runtime.run_in_main (sigc::bind (registration_event.make_slot (), 
+                                   aor, 
+                                   wasRegistering ? Ekiga::CallCore::RegistrationFailed : Ekiga::CallCore::UnregistrationFailed,
+                                   info));
 }
 
 

Modified: trunk/src/gui/accounts.cpp
==============================================================================
--- trunk/src/gui/accounts.cpp	(original)
+++ trunk/src/gui/accounts.cpp	Sun Apr 27 16:03:45 2008
@@ -791,7 +791,8 @@
 }
 
 /* Engine callbacks */
-static void on_registration_event_cb (std::string aor,
+static void on_registration_event_cb (Ekiga::CallManager & /*manager*/,
+                                      std::string aor,
                                       Ekiga::CallCore::RegistrationState state,
                                       std::string info,
                                       gpointer window)

Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp	(original)
+++ trunk/src/gui/main.cpp	Sun Apr 27 16:03:45 2008
@@ -582,7 +582,8 @@
 }
 
 
-static void on_registration_event_cb (std::string aor,
+static void on_registration_event_cb (Ekiga::CallManager & /*manager*/,
+                                      std::string aor,
                                       Ekiga::CallCore::RegistrationState state,
                                       G_GNUC_UNUSED std::string info,
                                       gpointer window)



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