From: Magnus H. <leg...@us...> - 2008-10-16 18:10:43
|
Update of /cvsroot/emacs-jabber/tox In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv10829 Modified Files: jabber-tox.el Log Message: Add jingle-send-iq function. Correct rejection because of unsupported applications/transports. Index: jabber-tox.el =================================================================== RCS file: /cvsroot/emacs-jabber/tox/jabber-tox.el,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- jabber-tox.el 16 Oct 2008 17:55:45 -0000 1.12 +++ jabber-tox.el 16 Oct 2008 18:10:30 -0000 1.13 @@ -224,16 +224,19 @@ :test 'string= :key 'jabber-xml-get-xmlns)) (payload-types (jabber-xml-get-children audio-content 'payload-type))) + ;; There are very few reasons for which we should not send an + ;; acknowledgement here; see section 6.3.2 of XEP-0166. + ;; Notably, we might want to check that there is a presence + ;; subscription. + (jabber-send-iq jc from "result" () + nil nil nil nil id) + (cond ;; Make sure audio is in the list of contents. We can ;; negotiate away other content types later. ((null audio-content) - (jabber-send-iq-error jc from id - jingle - "cancel" - 'feature-not-implemented - nil - `((unsupported-content ((xmlns . ,jingle-error-ns))))) + (jingle-send-iq state-data "session-terminate" + '(reason () (unsupported-applications))) (list nil state-data)) ;; Make sure ICE is in the list of transports. @@ -241,12 +244,8 @@ (jabber-xml-get-children content 'transport) :test 'string= :key 'jabber-xml-get-xmlns)) - (jabber-send-iq-error jc from id - jingle - "cancel" - 'feature-not-implemented - nil - `((unsupported-transports ((xmlns . ,jingle-error-ns))))) + (jingle-send-iq state-data "session-terminate" + '(reason () (unsupported-transports))) (list nil state-data)) (t @@ -333,6 +332,34 @@ ) +(defun jingle-send-iq (state-data action payload) + "Send a Jingle IQ stanza from within a Jingle FSM. +STATE-DATA is the state data plist of the FSM. +ACTION is the value of the action attribute of the <jingle/> +element. +PAYLOAD is a list of XML elements to include as children +of the <jingle/> element. +The recipient and the SID are determined from STATE-DATA." + (let ((jc (plist-get state-data :jc)) + (jid (plist-get state-data :jid)) + (role (plist-get state-data :role)) + (sid (plist-get state-data :sid))) + (jabber-send-iq + jc jid "set" + `(jingle ((xmlns . ,jingle-ns) + (action . ,action) + (initiator + . ,(ecase role + (:initiator + (jabber-connection-jid jc)) + (:target + jid))) + (sid . ,sid)) + ,@payload) + ;; XXX: we probably want error checking, to see if our partner + ;; went offline. + nil nil nil nil))) + (add-to-list 'jabber-iq-set-xmlns-alist (cons jingle-ns 'jabber-jingle-incoming-iq)) (defun jabber-jingle-incoming-iq (jc iq) |