[ekiga] CallCore: Blacklisted calls have to be rejected during the setup phase.



commit 9c5cbe20245e817dc619822ba629afee5a057973
Author: Damien Sandras <dsandras seconix com>
Date:   Sun Oct 11 16:31:00 2015 +0200

    CallCore: Blacklisted calls have to be rejected during the setup phase.
    
    This is the only way to have decent feedback in the GUI.

 lib/engine/protocol/call-core.cpp |   29 ++++++++++++++++-------------
 lib/engine/protocol/call-core.h   |    3 ++-
 2 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/lib/engine/protocol/call-core.cpp b/lib/engine/protocol/call-core.cpp
index f4c01c5..196b620 100644
--- a/lib/engine/protocol/call-core.cpp
+++ b/lib/engine/protocol/call-core.cpp
@@ -164,17 +164,29 @@ CallCore::set_codecs (Ekiga::CodecList & codecs)
 
 void CallCore::add_call (const boost::shared_ptr<Call> & call)
 {
-  Ekiga::FriendOrFoe::Identification id = iff->decide ("call", call->get_remote_uri ());
-
   calls.add_object (call);
 
   // Relay signals
   calls.add_connection (call, call->ringing.connect (boost::bind (boost::ref (ringing_call), _1)));
+  calls.add_connection (call, call->setup.connect (boost::bind (&CallCore::on_setup_call, this, _1)));
   calls.add_connection (call, call->missed.connect (boost::bind (&CallCore::on_missed_call, this, _1)));
   calls.add_connection (call, call->cleared.connect (boost::bind (boost::ref (cleared_call), _1, _2)));
+  calls.add_connection (call, call->established.connect (boost::bind (boost::ref (established_call), _1)));
+  calls.add_connection (call, call->held.connect (boost::bind (boost::ref (held_call), _1)));
+  calls.add_connection (call, call->retrieved.connect (boost::bind (boost::ref (retrieved_call), _1)));
+  calls.add_connection (call, call->stream_opened.connect (boost::bind (boost::ref (stream_opened), _1, _2, 
_3, _4)));
+  calls.add_connection (call, call->stream_closed.connect (boost::bind (boost::ref (stream_closed), _1, _2, 
_3, _4)));
+  calls.add_connection (call, call->stream_paused.connect (boost::bind (boost::ref (stream_paused), _1, _2, 
_3)));
+  calls.add_connection (call, call->stream_resumed.connect (boost::bind (boost::ref (stream_resumed), _1, 
_2, _3)));
+
   calls.object_removed.connect (boost::bind (boost::ref (removed_call), _1));
 
   created_call (call);
+}
+
+void CallCore::on_setup_call (const boost::shared_ptr<Call> call)
+{
+  Ekiga::FriendOrFoe::Identification id = iff->decide ("call", call->get_remote_uri ());
 
   // Reject call
   if (id == Ekiga::FriendOrFoe::Foe) {
@@ -182,19 +194,10 @@ void CallCore::add_call (const boost::shared_ptr<Call> & call)
     return;
   }
 
-  // Or other signal relays
-  calls.add_connection (call, call->setup.connect (boost::bind (boost::ref (setup_call), _1)));
-  calls.add_connection (call, call->established.connect (boost::bind (boost::ref (established_call), _1)));
-  calls.add_connection (call, call->held.connect (boost::bind (boost::ref (held_call), _1)));
-  calls.add_connection (call, call->retrieved.connect (boost::bind (boost::ref (retrieved_call), _1)));
-  calls.add_connection (call, call->stream_opened.connect (boost::bind (boost::ref (stream_opened), _1, _2, 
_3, _4)));
-  calls.add_connection (call, call->stream_closed.connect (boost::bind (boost::ref (stream_closed), _1, _2, 
_3, _4)));
-  calls.add_connection (call, call->stream_paused.connect (boost::bind (boost::ref (stream_paused), _1, _2, 
_3)));
-  calls.add_connection (call, call->stream_resumed.connect (boost::bind (boost::ref (stream_resumed), _1, 
_2, _3)));
+  setup_call (call);
 }
 
-
-void CallCore::on_missed_call (const boost::shared_ptr<Call> & call)
+void CallCore::on_missed_call (const boost::shared_ptr<Call> call)
 {
   boost::shared_ptr<Ekiga::NotificationCore> _notification_core = notification_core.lock ();
   if (_notification_core) {
diff --git a/lib/engine/protocol/call-core.h b/lib/engine/protocol/call-core.h
index 88f7f22..8563c9d 100644
--- a/lib/engine/protocol/call-core.h
+++ b/lib/engine/protocol/call-core.h
@@ -192,7 +192,8 @@ namespace Ekiga
 
   private:
 
-      void on_missed_call (const boost::shared_ptr<Call> & call);
+      void on_setup_call (const boost::shared_ptr<Call> call);
+      void on_missed_call (const boost::shared_ptr<Call> call);
 
       boost::shared_ptr<Ekiga::FriendOrFoe> iff;
       boost::weak_ptr<Ekiga::NotificationCore> notification_core;


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