From: Magnus H. <leg...@us...> - 2008-11-03 23:54:08
|
Update of /cvsroot/emacs-jabber/tox In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20956 Modified Files: jabber-tox.el tox-marshal.list tox-session.c tox-session.xml Log Message: New signal, new-active-candidate-pair Index: jabber-tox.el =================================================================== RCS file: /cvsroot/emacs-jabber/tox/jabber-tox.el,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- jabber-tox.el 29 Oct 2008 23:50:35 -0000 1.21 +++ jabber-tox.el 3 Nov 2008 23:53:51 -0000 1.22 @@ -119,6 +119,15 @@ (fsm-send-sync fsm (list :state-changed state direction))))) + ;; And about active candidate pairs. + (dbus-register-signal :session tox-name tox-session tox-session-interface + "NewActiveCandidatePair" + (lexical-let ((fsm fsm)) + (lambda (native-candidate remote-candidate) + (fsm-send-sync + fsm + (list :new-active-candidate-pair + native-candidate remote-candidate))))) (fsm-debug-output "Waiting") state-data)) @@ -293,15 +302,23 @@ '((reason () (media-error)))) (list nil state-data)))))))))) -(define-state jingle :wait-for-codec-intersection +(define-state jingle :pending (fsm state-data event callback) -;; ;; Good enough, provisionally accept. -;; (jabber-send-iq jc from "result" () -;; nil nil nil nil id) -;; (list :pending state-data))))))) - - ) + (case (car-safe event) + (:state-changed + (let ((state (car (assq (second event) + '((0 . :disconnected) + (1 . :connecting) + (2 . :connected))))) + (direction (car (assq (third event) + '((1 . :send-only) + (2 . :receive-only) + (3 . :send-and-receive)))))) + (fsm-debug-output "Got :state-changed; new state %s, new direction %s" + state direction) + ;; Still, not sure what we should do here... + )))) (defun jingle-send-iq (state-data action payload) "Send a Jingle IQ stanza from within a Jingle FSM. Index: tox-session.xml =================================================================== RCS file: /cvsroot/emacs-jabber/tox/tox-session.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- tox-session.xml 29 Oct 2008 23:50:35 -0000 1.3 +++ tox-session.xml 3 Nov 2008 23:53:52 -0000 1.4 @@ -81,5 +81,10 @@ <arg name='direction' type='y'/> </signal> + <signal name="NewActiveCandidatePair"> + <arg name="nativeCandidateId" type="s"/> + <arg name="removeCandidateId" type="s"/> + </signal> + </interface> </node> Index: tox-marshal.list =================================================================== RCS file: /cvsroot/emacs-jabber/tox/tox-marshal.list,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tox-marshal.list 29 Oct 2008 23:50:35 -0000 1.2 +++ tox-marshal.list 3 Nov 2008 23:53:52 -0000 1.3 @@ -1,2 +1,3 @@ VOID:BOXED VOID:UCHAR,UCHAR +VOID:STRING,STRING Index: tox-session.c =================================================================== RCS file: /cvsroot/emacs-jabber/tox/tox-session.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- tox-session.c 29 Oct 2008 23:50:35 -0000 1.5 +++ tox-session.c 3 Nov 2008 23:53:52 -0000 1.6 @@ -38,6 +38,7 @@ NEW_NATIVE_CANDIDATE, NATIVE_CANDIDATES_PREPARED, STATE_CHANGED, + NEW_ACTIVE_CANDIDATE_PAIR, LAST_SIGNAL }; @@ -55,6 +56,7 @@ static void tox_session_native_candidates_prepared(FarsightStream *stream, gpointer user_data); static void tox_session_new_native_candidate(FarsightStream *stream, gchar *candidate_id, ToxSession *self); static void tox_session_state_changed(FarsightStream *stream, gint state, gint direction, ToxSession *self); +static void tox_session_new_active_candidate_pair(FarsightStream *stream, gchar *native_candidate_id, gchar *remote_candidate_id, ToxSession *self); void tox_session_init(ToxSession *obj) @@ -163,6 +165,18 @@ G_TYPE_UCHAR, G_TYPE_UCHAR); + signals[NEW_ACTIVE_CANDIDATE_PAIR] = + g_signal_new("new-active-candidate-pair", + G_OBJECT_CLASS_TYPE(klass), + G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, + 0, + NULL, NULL, + tox_marshal_VOID__STRING_STRING, + G_TYPE_NONE, + 2, + G_TYPE_STRING, + G_TYPE_STRING); + dbus_g_object_type_install_info(TOX_TYPE_SESSION, &dbus_glib_tox_session_object_info); parent_class = g_type_class_peek_parent (klass); @@ -205,10 +219,15 @@ (GCallback)tox_session_new_native_candidate, (gpointer)self); g_signal_connect(self->priv->stream, "native-candidates-prepared", (GCallback)tox_session_native_candidates_prepared, (gpointer)self); - g_signal_connect(self->priv->stream, "state-changed", - (GCallback)tox_session_state_changed, (gpointer)self); /* but we can't actually do it until we have a pipeline. so, we'll call stream_done when we do. */ + + /* Other signals we want to forward */ + g_signal_connect(self->priv->stream, "state-changed", + (GCallback)tox_session_state_changed, (gpointer)self); + g_signal_connect(self->priv->stream, "new-active-candidate-pair", + (GCallback)tox_session_new_active_candidate_pair, (gpointer)self); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, property_id, pspec); @@ -725,3 +744,9 @@ { g_signal_emit(self, signals[STATE_CHANGED], 0, state, direction); } + +static void +tox_session_new_active_candidate_pair(FarsightStream *stream, gchar *native_candidate_id, gchar *remote_candidate_id, ToxSession *self) +{ + g_signal_emit(self, signals[NEW_ACTIVE_CANDIDATE_PAIR], 0, native_candidate_id, remote_candidate_id); +} |