[telepathy-gabble/master] Send <unhold/> not <active/>

Will Thompson will.thompson at collabora.co.uk
Wed May 27 08:15:24 PDT 2009


The <ringing/>, <hold/>, and <mute/> states in jingle-rtp are
orthogonal. <hold/> and <mute/> have inverses, <unhold/> and <unmute/>;
<active/> cancels out all states. Previously, Gabble only ever sent
<hold/>, so using <active/> to unset it was okay. But if you hold and
unhold a call before answering it, the ringing state (which we now send)
shouldn't be removed (as it would be by sending <active/>).
---
 src/jingle-session.c               |    2 +-
 tests/twisted/jingle/hold-audio.py |   30 +++++++++++++++---------------
 tests/twisted/jingle/hold-av.py    |   36 ++++++++++++++++++------------------
 3 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/src/jingle-session.c b/src/jingle-session.c
index 267cbb0..414f21d 100644
--- a/src/jingle-session.c
+++ b/src/jingle-session.c
@@ -2040,7 +2040,7 @@ void
 gabble_jingle_session_send_held (GabbleJingleSession *sess,
     gboolean held)
 {
-  gabble_jingle_session_send_rtp_info (sess, (held ? "hold" : "active"));
+  gabble_jingle_session_send_rtp_info (sess, (held ? "hold" : "unhold"));
 }
 
 gboolean
diff --git a/tests/twisted/jingle/hold-audio.py b/tests/twisted/jingle/hold-audio.py
index 80b4ef1..7983bd1 100644
--- a/tests/twisted/jingle/hold-audio.py
+++ b/tests/twisted/jingle/hold-audio.py
@@ -53,7 +53,7 @@ def test(jp, q, bus, conn, stream):
     # These are 0- (for old dialects) or 1- (for new dialects) element lists
     # that can be splatted into expect_many with *
     hold_event = jp.rtp_info_event_list("hold")
-    active_event = jp.rtp_info_event_list("active")
+    unhold_event = jp.rtp_info_event_list("unhold")
     # ---- Test 1: GetHoldState returns unheld and unhold is a no-op ----
 
     hold_state = hold_iface.GetHoldState()
@@ -106,7 +106,7 @@ def test(jp, q, bus, conn, stream):
         EventPattern('dbus-return', method='HoldState', value=()),
         EventPattern('dbus-signal', signal='HoldStateChanged',
             args=[cs.HS_UNHELD, cs.HSR_REQUESTED]),
-        *active_event
+        *unhold_event
         )
 
     # ---- Test 5: GetHoldState returns False and unhold is a no-op ----
@@ -140,7 +140,7 @@ def test(jp, q, bus, conn, stream):
 
     # ---- Test 7: 3 parallel calls to unhold ----
 
-    q.forbid_events(active_event)
+    q.forbid_events(unhold_event)
 
     call_async(q, hold_iface, 'RequestHold', False)
     call_async(q, hold_iface, 'RequestHold', False)
@@ -155,14 +155,14 @@ def test(jp, q, bus, conn, stream):
     # Ensure that if Gabble sent the <active/> stanza too early it's already
     # arrived.
     sync_stream(q, stream)
-    q.unforbid_events(active_event)
+    q.unforbid_events(unhold_event)
 
     call_async(q, stream_handler, 'HoldState', False)
     q.expect_many(
         EventPattern('dbus-return', method='HoldState', value=()),
         EventPattern('dbus-signal', signal='HoldStateChanged',
             args=[cs.HS_UNHELD, cs.HSR_REQUESTED]),
-        *active_event
+        *unhold_event
         )
 
     # ---- Test 8: hold, then change our minds before s-e has responded ----
@@ -178,7 +178,7 @@ def test(jp, q, bus, conn, stream):
         *hold_event
         )
 
-    q.forbid_events(active_event)
+    q.forbid_events(unhold_event)
 
     call_async(q, hold_iface, 'RequestHold', False)
     q.expect_many(
@@ -190,7 +190,7 @@ def test(jp, q, bus, conn, stream):
         )
 
     sync_stream(q, stream)
-    q.unforbid_events(active_event)
+    q.unforbid_events(unhold_event)
 
     call_async(q, stream_handler, 'HoldState', True)
     q.expect('dbus-return', method='HoldState', value=())
@@ -200,7 +200,7 @@ def test(jp, q, bus, conn, stream):
         EventPattern('dbus-return', method='HoldState', value=()),
         EventPattern('dbus-signal', signal='HoldStateChanged',
             args=[cs.HS_UNHELD, cs.HSR_REQUESTED]),
-        *active_event
+        *unhold_event
         )
 
     hold_state = hold_iface.GetHoldState()
@@ -231,7 +231,7 @@ def test(jp, q, bus, conn, stream):
 
     # Check that Gabble doesn't send another <hold/>, or send <active/> before
     # we change our minds.
-    q.forbid_events(active_event + hold_event)
+    q.forbid_events(unhold_event + hold_event)
 
     call_async(q, hold_iface, 'RequestHold', False)
     q.expect_many(
@@ -260,13 +260,13 @@ def test(jp, q, bus, conn, stream):
     assert hold_state[0] == cs.HS_HELD, hold_state
 
     sync_stream(q, stream)
-    q.unforbid_events(active_event + hold_event)
+    q.unforbid_events(unhold_event + hold_event)
 
     # ---- Test 10: attempting to unhold fails ----
 
     # Check that Gabble doesn't send another <hold/>, or send <active/> even
     # though unholding fails.
-    q.forbid_events(active_event + hold_event)
+    q.forbid_events(unhold_event + hold_event)
 
     call_async(q, hold_iface, 'RequestHold', False)
     q.expect_many(
@@ -285,11 +285,11 @@ def test(jp, q, bus, conn, stream):
         )
 
     sync_stream(q, stream)
-    q.unforbid_events(active_event + hold_event)
+    q.unforbid_events(unhold_event + hold_event)
 
     # ---- Test 11: when we successfully unhold, the peer gets <active/> ---
 
-    q.forbid_events(active_event)
+    q.forbid_events(unhold_event)
 
     call_async(q, hold_iface, 'RequestHold', False)
     q.expect_many(
@@ -302,14 +302,14 @@ def test(jp, q, bus, conn, stream):
     # Ensure that if Gabble sent the <active/> stanza too early it's already
     # arrived.
     sync_stream(q, stream)
-    q.unforbid_events(active_event)
+    q.unforbid_events(unhold_event)
 
     call_async(q, stream_handler, 'HoldState', False)
     q.expect_many(
         EventPattern('dbus-return', method='HoldState', value=()),
         EventPattern('dbus-signal', signal='HoldStateChanged',
             args=[cs.HS_UNHELD, cs.HSR_REQUESTED]),
-        *active_event
+        *unhold_event
         )
 
     # ---- The end ----
diff --git a/tests/twisted/jingle/hold-av.py b/tests/twisted/jingle/hold-av.py
index 47521a9..1556b4b 100644
--- a/tests/twisted/jingle/hold-av.py
+++ b/tests/twisted/jingle/hold-av.py
@@ -83,7 +83,7 @@ def test(jp, q, bus, conn, stream):
     # These are 0- (for old dialects) or 1- (for new dialects) element lists
     # that can be splatted into expect_many with *
     hold_event = jp.rtp_info_event_list("hold")
-    active_event = jp.rtp_info_event_list("active")
+    unhold_event = jp.rtp_info_event_list("unhold")
 
     # ---- Test 1: GetHoldState returns unheld and unhold is a no-op ----
 
@@ -123,7 +123,7 @@ def test(jp, q, bus, conn, stream):
 
     # ---- Test 4: successful unhold ----
 
-    q.forbid_events(active_event)
+    q.forbid_events(unhold_event)
 
     call_async(q, hold_iface, 'RequestHold', False)
     q.expect_many(
@@ -134,7 +134,7 @@ def test(jp, q, bus, conn, stream):
         )
 
     sync_stream(q, stream)
-    q.unforbid_events(active_event)
+    q.unforbid_events(unhold_event)
 
     call_async(q, audio_stream_handler, 'HoldState', False)
     call_async(q, video_stream_handler, 'HoldState', False)
@@ -142,7 +142,7 @@ def test(jp, q, bus, conn, stream):
         EventPattern('dbus-return', method='HoldState', value=()),
         EventPattern('dbus-signal', signal='HoldStateChanged',
             args=[cs.HS_UNHELD, cs.HSR_REQUESTED]),
-        *active_event
+        *unhold_event
         )
 
     # ---- Test 5: GetHoldState returns False and unhold is a no-op ----
@@ -177,7 +177,7 @@ def test(jp, q, bus, conn, stream):
 
     # ---- Test 7: 3 parallel calls to unhold ----
 
-    q.forbid_events(active_event)
+    q.forbid_events(unhold_event)
 
     call_async(q, hold_iface, 'RequestHold', False)
     call_async(q, hold_iface, 'RequestHold', False)
@@ -190,7 +190,7 @@ def test(jp, q, bus, conn, stream):
         )
 
     sync_stream(q, stream)
-    q.unforbid_events(active_event)
+    q.unforbid_events(unhold_event)
 
     call_async(q, audio_stream_handler, 'HoldState', False)
     call_async(q, video_stream_handler, 'HoldState', False)
@@ -198,7 +198,7 @@ def test(jp, q, bus, conn, stream):
         EventPattern('dbus-return', method='HoldState', value=()),
         EventPattern('dbus-signal', signal='HoldStateChanged',
             args=[cs.HS_UNHELD, cs.HSR_REQUESTED]),
-        *active_event
+        *unhold_event
         )
 
     # ---- Test 8: hold, then change our minds before s-e has responded ----
@@ -215,7 +215,7 @@ def test(jp, q, bus, conn, stream):
         )
 
     # Gabble can't send Active until s-e confirms it has the resources
-    q.forbid_events(active_event)
+    q.forbid_events(unhold_event)
 
     call_async(q, hold_iface, 'RequestHold', False)
     q.expect_many(
@@ -229,14 +229,14 @@ def test(jp, q, bus, conn, stream):
     call_async(q, audio_stream_handler, 'HoldState', False)
 
     sync_stream(q, stream)
-    q.unforbid_events(active_event)
+    q.unforbid_events(unhold_event)
 
     call_async(q, video_stream_handler, 'HoldState', False)
     q.expect_many(
         EventPattern('dbus-return', method='HoldState', value=()),
         EventPattern('dbus-signal', signal='HoldStateChanged',
             args=[cs.HS_UNHELD, cs.HSR_REQUESTED]),
-        *active_event
+        *unhold_event
         )
 
     hold_state = hold_iface.GetHoldState()
@@ -263,7 +263,7 @@ def test(jp, q, bus, conn, stream):
 
     # Actually do test 9
 
-    q.forbid_events(hold_event + active_event)
+    q.forbid_events(hold_event + unhold_event)
 
     hold_state = hold_iface.GetHoldState()
     assert hold_state[0] == cs.HS_HELD, hold_state
@@ -292,14 +292,14 @@ def test(jp, q, bus, conn, stream):
         )
 
     sync_stream(q, stream)
-    q.unforbid_events(hold_event + active_event)
+    q.unforbid_events(hold_event + unhold_event)
 
     hold_state = hold_iface.GetHoldState()
     assert hold_state[0] == cs.HS_HELD, hold_state
 
     # ---- Test 10: attempting to unhold fails (both streams) ----
 
-    q.forbid_events(hold_event + active_event)
+    q.forbid_events(hold_event + unhold_event)
 
     call_async(q, hold_iface, 'RequestHold', False)
     q.expect_many(
@@ -319,11 +319,11 @@ def test(jp, q, bus, conn, stream):
         )
 
     sync_stream(q, stream)
-    q.unforbid_events(hold_event + active_event)
+    q.unforbid_events(hold_event + unhold_event)
 
     # ---- Test 11: attempting to unhold fails (first stream) ----
 
-    q.forbid_events(hold_event + active_event)
+    q.forbid_events(hold_event + unhold_event)
 
     call_async(q, hold_iface, 'RequestHold', False)
     q.expect_many(
@@ -342,11 +342,11 @@ def test(jp, q, bus, conn, stream):
         )
 
     sync_stream(q, stream)
-    q.unforbid_events(hold_event + active_event)
+    q.unforbid_events(hold_event + unhold_event)
 
     # ---- Test 12: attempting to unhold partially fails, so roll back ----
 
-    q.forbid_events(hold_event + active_event)
+    q.forbid_events(hold_event + unhold_event)
 
     call_async(q, hold_iface, 'RequestHold', False)
     q.expect_many(
@@ -377,7 +377,7 @@ def test(jp, q, bus, conn, stream):
         )
 
     sync_stream(q, stream)
-    q.unforbid_events(hold_event + active_event)
+    q.unforbid_events(hold_event + unhold_event)
 
     # ---- Test 13: while the call's on hold, we add a new stream ---
     # We shouldn't go off hold locally as a result, and the new StreamHandler
-- 
1.5.6.5




More information about the telepathy-commits mailing list