annotate src/plugins/plugin_xep_0260.py @ 1567:268fda4236ca

plugins XE0166, XEP-0234, XEP-0260, XEP-0261: renamed session key managing other peer's jid to "peer_jid" instead of "to_jid"
author Goffi <goffi@goffi.org>
date Sun, 08 Nov 2015 14:44:33 +0100
parents dcce63810733
children 37d4be4a9fed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1560
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/python
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
3
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # SAT plugin for Jingle (XEP-0260)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Jérôme Poisson (goffi@goffi.org)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
6
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # (at your option) any later version.
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
11
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
16
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
19
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
20 from sat.core.i18n import _
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
21 from sat.core.log import getLogger
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
22 log = getLogger(__name__)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
23 from sat.core import exceptions
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
24 from wokkel import disco, iwokkel
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
25 from zope.interface import implements
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
26 from twisted.words.xish import domish
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
27 from twisted.words.protocols.jabber import jid
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
28 from twisted.internet import defer
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
29 import uuid
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
30
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
31 try:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
32 from twisted.words.protocols.xmlstream import XMPPHandler
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
33 except ImportError:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
34 from wokkel.subprotocols import XMPPHandler
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
35
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
36
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
37 NS_JINGLE_S5B = 'urn:xmpp:jingle:transports:s5b:1'
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
38
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
39 PLUGIN_INFO = {
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
40 "name": "Jingle SOCKS5 Bytestreams",
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
41 "import_name": "XEP-0260",
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
42 "type": "XEP",
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
43 "protocols": ["XEP-0260"],
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
44 "dependencies": ["XEP-0166", "XEP-0065"],
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
45 "main": "XEP_0260",
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
46 "handler": "yes",
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
47 "description": _("""Implementation of Jingle SOCKS5 Bytestreams""")
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
48 }
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
49
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
50
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
51 class XEP_0260(object):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
52 # TODO: udp handling
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
53
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
54 def __init__(self, host):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
55 log.info(_("plugin Jingle SOCKS5 Bytestreams"))
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
56 self.host = host
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
57 self._j = host.plugins["XEP-0166"] # shortcut to access jingle
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
58 self._s5b = host.plugins["XEP-0065"] # and socks5 bytestream
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
59 self._j.registerTransport(NS_JINGLE_S5B, self._j.TRANSPORT_STREAMING, self, 100)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
60
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
61 def getHandler(self, profile):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
62 return XEP_0260_handler()
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
63
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
64 def _parseCandidates(self, transport_elt):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
65 """Parse <candidate> elements
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
66
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
67 @param transport_elt(domish.Element): parent <transport> element
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
68 @return (list[plugin_xep_0065.Candidate): list of parsed candidates
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
69 """
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
70 candidates = []
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
71 for candidate_elt in transport_elt.elements(NS_JINGLE_S5B, 'candidate'):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
72 try:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
73 cid = candidate_elt['cid']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
74 host = candidate_elt['host']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
75 jid_= jid.JID(candidate_elt['jid'])
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
76 port = int(candidate_elt.getAttribute('port', 1080))
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
77 priority = int(candidate_elt['priority'])
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
78 type_ = candidate_elt.getAttribute('type', self._s5b.TYPE_DIRECT)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
79 except (KeyError, ValueError):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
80 raise exceptions.DataError()
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
81 candidate = self._s5b.Candidate(host, port, type_, priority, jid_, cid)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
82 candidates.append(candidate)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
83 # self._s5b.registerCandidate(candidate)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
84 return candidates
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
85
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
86 def _buildCandidates(self, session, candidates, sid, session_hash, client, mode=None):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
87 """Build <transport> element with candidates
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
88
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
89 @param session(dict): jingle session data
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
90 @param candidates(iterator[plugin_xep_0065.Candidate]): iterator of candidates to add
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
91 @param sid(unicode): transport stream id
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
92 @param client: %(doc_client)s
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
93 @param mode(str, None): 'tcp' or 'udp', or None to have no attribute
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
94 @return (domish.Element): parent <transport> element where <candidate> elements must be added
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
95 """
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
96 proxy = next((candidate for candidate in candidates if candidate.type == self._s5b.TYPE_PROXY), None)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
97 transport_elt = domish.Element((NS_JINGLE_S5B, "transport"))
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
98 transport_elt['sid'] = sid
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
99 if proxy is not None:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
100 transport_elt['dstaddr'] = session_hash
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
101 if mode is not None:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
102 transport_elt['mode'] = 'tcp' # XXX: we only manage tcp for now
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
103
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
104 for candidate in candidates:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
105 log.debug(u"Adding candidate: {}".format(candidate))
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
106 candidate_elt = transport_elt.addElement('candidate', NS_JINGLE_S5B)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
107 if candidate.id is None:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
108 candidate.id = unicode(uuid.uuid4())
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
109 candidate_elt['cid'] = candidate.id
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
110 candidate_elt['host'] = candidate.host
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
111 candidate_elt['jid'] = candidate.jid.full()
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
112 candidate_elt['port'] = unicode(candidate.port)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
113 candidate_elt['priority'] = unicode(candidate.priority)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
114 candidate_elt['type'] = candidate.type
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
115 return transport_elt
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
116
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
117 @defer.inlineCallbacks
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
118 def jingleSessionInit(self, session, content_name, profile):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
119 client = self.host.getClient(profile)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
120 content_data = session['contents'][content_name]
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
121 transport_data = content_data['transport_data']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
122 sid = transport_data['sid'] = unicode(uuid.uuid4())
1567
268fda4236ca plugins XE0166, XEP-0234, XEP-0260, XEP-0261: renamed session key managing other peer's jid to "peer_jid" instead of "to_jid"
Goffi <goffi@goffi.org>
parents: 1560
diff changeset
123 session_hash = transport_data['session_hash'] = self._s5b.getSessionHash(client.jid, session['peer_jid'], sid)
1560
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
124 candidates = transport_data['candidates'] = yield self._s5b.getCandidates(profile)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
125 mode = 'tcp' # XXX: we only manage tcp for now
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
126 transport_elt = self._buildCandidates(session, candidates, sid, session_hash, client, mode)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
127
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
128 defer.returnValue(transport_elt)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
129
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
130 def _foundPeerCandidate(self, candidate, session, transport_data, content_name, client):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
131 """Called when the best candidate from other peer is found
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
132
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
133 @param candidate(XEP_0065.Candidate, None): selected candidate,
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
134 or None if no candidate is accessible
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
135 @param session(dict): session data
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
136 @param transport_data(dict): transport data
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
137 @param content_name(dict): name of the current content
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
138 @param client(unicode): %(doc_client)s
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
139 """
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
140
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
141 transport_data['best_candidate'] = candidate
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
142 # we need to disconnect all non selected candidates before removing them
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
143 for c in transport_data['peer_candidates']:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
144 if c is None or c is candidate:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
145 continue
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
146 c.discard()
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
147 del transport_data['peer_candidates']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
148 iq_elt, transport_elt = self._j.buildAction(self._j.A_TRANSPORT_INFO, session, content_name, client.profile)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
149 if candidate is None:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
150 log.warning(u"Can't connect to any peer candidate")
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
151 candidate_elt = transport_elt.addElement('candidate-error')
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
152 else:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
153 log.info(u"Found best peer candidate: {}".format(unicode(candidate)))
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
154 candidate_elt = transport_elt.addElement('candidate-used')
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
155 candidate_elt['cid'] = candidate.id
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
156 iq_elt.send() # TODO: check result stanza
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
157 content_data = session['contents'][content_name]
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
158 self._checkCandidates(session, content_data, transport_data, client)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
159
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
160 def _checkCandidates(self, session, content_data, transport_data, client):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
161 """Called when a candidate has been choosed
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
162
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
163 if we have both candidates, we select one, or fallback to an other transport
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
164 @param session(dict): session data
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
165 @param content_data(dict): content data
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
166 @param transport_data(dict): transport data
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
167 @param client(unicode): %(doc_client)s
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
168 """
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
169 try:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
170 best_candidate = transport_data['best_candidate']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
171 except KeyError:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
172 # we have not our best candidate yet
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
173 return
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
174 try:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
175 peer_best_candidate = transport_data['peer_best_candidate']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
176 except KeyError:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
177 # we have not peer best candidate yet
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
178 return
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
179
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
180 # at this point we have both candidates, it's time to choose one
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
181 if best_candidate is None or peer_best_candidate is None:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
182 choosed_candidate = best_candidate or peer_best_candidate
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
183 else:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
184 if best_candidate.priority == peer_best_candidate.priority:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
185 # same priority, we choose initiator one according to XEP-0260 §2.4 #4
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
186 log.debug(u"Candidates have same priority, we choose the initiator one")
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
187 if session['initiator'] == client.jid:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
188 choosed_candidate = best_candidate
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
189 else:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
190 choosed_candidate = peer_best_candidate
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
191 else:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
192 choosed_candidate = max(best_candidate, peer_best_candidate, key=lambda c:c.priority)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
193
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
194 if choosed_candidate is None:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
195 log.warning(u"Socks5 negociation failed, we need to fallback to IBB")
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
196 else:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
197 if choosed_candidate==best_candidate:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
198 who = u'our'
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
199 else:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
200 who = u'other peer'
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
201 best_candidate.discard()
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
202
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
203 log.info(u"Socks5 negociation successful, {who} candidate will be used: {candidate}".format(
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
204 who = who,
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
205 candidate = choosed_candidate))
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
206 del transport_data['best_candidate']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
207 del transport_data['peer_best_candidate']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
208 if content_data['senders'] == session['role']:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
209 # we can now start the file transfer
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
210 choosed_candidate.startTransfer(transport_data['session_hash'])
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
211
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
212 @defer.inlineCallbacks
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
213 def jingleHandler(self, action, session, content_name, transport_elt, profile):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
214 client = self.host.getClient(profile)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
215 content_data = session['contents'][content_name]
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
216 transport_data = content_data['transport_data']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
217
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
218 if action in (self._j.A_ACCEPTED_ACK,):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
219 pass
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
220
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
221 elif action == self._j.A_SESSION_ACCEPT:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
222 # initiator side, we select a candidate in the ones sent by responder
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
223 assert 'peer_candidates' not in transport_data
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
224 transport_data['peer_candidates'] = self._parseCandidates(transport_elt)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
225
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
226 # elif action == self._j.A_START:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
227 elif action == self._j.A_START:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
228 session_hash = transport_data['session_hash']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
229 peer_candidates = transport_data['peer_candidates']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
230 file_obj = content_data['file_obj']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
231 stream_d = self._s5b.registerHash(session_hash, file_obj, profile)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
232 args = [session, content_name, profile]
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
233 stream_d.addCallbacks(self._streamCb, self._streamEb, args, None, args)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
234 d = self._s5b.getBestCandidate(peer_candidates, session_hash, profile)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
235 d.addCallback(self._foundPeerCandidate, session, transport_data, content_name, client)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
236
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
237 elif action == self._j.A_SESSION_INITIATE:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
238 # responder side, we select a candidate in the ones sent by initiator
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
239 # and we give our candidates
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
240 assert 'peer_candidates' not in transport_data
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
241 sid = transport_data['sid'] = transport_elt['sid']
1567
268fda4236ca plugins XE0166, XEP-0234, XEP-0260, XEP-0261: renamed session key managing other peer's jid to "peer_jid" instead of "to_jid"
Goffi <goffi@goffi.org>
parents: 1560
diff changeset
242 session_hash = transport_data['session_hash'] = self._s5b.getSessionHash(session['peer_jid'], client.jid, sid)
1560
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
243 peer_candidates = transport_data['peer_candidates'] = self._parseCandidates(transport_elt)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
244 file_obj = content_data['file_obj']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
245 stream_d = self._s5b.registerHash(session_hash, file_obj, profile)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
246 args = [session, content_name, profile]
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
247 stream_d.addCallbacks(self._streamCb, self._streamEb, args, None, args)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
248 d = self._s5b.getBestCandidate(peer_candidates, session_hash, profile)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
249 d.addCallback(self._foundPeerCandidate, session, transport_data, content_name, client)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
250 candidates = yield self._s5b.getCandidates(profile)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
251 # we remove duplicate candidates
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
252 candidates = [candidate for candidate in candidates if candidate not in peer_candidates]
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
253
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
254 transport_data['candidates'] = candidates
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
255 # we can now build a new <transport> element with our candidates
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
256 transport_elt = self._buildCandidates(session, candidates, sid, session_hash, client)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
257
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
258 elif action == self._j.A_TRANSPORT_INFO:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
259 # other peer gave us its choosed candidate
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
260 try:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
261 candidate_elt = transport_elt.elements(NS_JINGLE_S5B, 'candidate-used').next()
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
262 except StopIteration:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
263 try:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
264 candidate_elt = transport_elt.elements(NS_JINGLE_S5B, 'candidate-error').next()
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
265 except StopIteration:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
266 log.warning(u"Unexpected transport element: {}".format(transport_elt.toXml()))
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
267 raise exceptions.DataError
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
268 else:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
269 # candidate-error, no candidate worked
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
270 transport_data['peer_best_candidate'] = None
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
271 else:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
272 # candidate-used, one candidate was choosed
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
273 try:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
274 cid = candidate_elt.attributes['cid']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
275 except KeyError:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
276 log.warning(u"No cid found in <candidate-used>")
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
277 raise exceptions.DataError
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
278 try:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
279 candidate = (c for c in transport_data['candidates'] if c.id == cid).next()
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
280 except StopIteration:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
281 log.warning(u"Given cid doesn't correspond to any known candidate !")
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
282 raise exceptions.DataError # TODO: send an error to other peer, and use better exception
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
283 except KeyError:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
284 # a transport-info can also be intentionaly sent too early by other peer
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
285 # but there is little probability
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
286 log.error(u'"candidates" key doesn\'t exists in transport_data, it should at this point')
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
287 raise exceptions.InternalError
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
288 # at this point we have the candidate choosed by other peer
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
289 transport_data['peer_best_candidate'] = candidate
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
290 log.info(u"Other peer best candidate: {}".format(candidate))
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
291
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
292 del transport_data['candidates']
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
293 self._checkCandidates(session, content_data, transport_data, client)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
294
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
295 else:
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
296 log.warning(u"FIXME: unmanaged action {}".format(action))
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
297
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
298 defer.returnValue(transport_elt)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
299
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
300 def _streamCb(self, dummy, session, content_name, profile):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
301 self._j.contentTerminate(session, content_name, profile=profile)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
302
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
303 def _streamEb(self, failure, session, content_name, profile):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
304 log.warning(u"Error while streaming through s5b: {}".format(failure))
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
305 self._j.contentTerminate(session, content_name, reason=self._j.REASON_FAILED_TRANSPORT, profile=profile)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
306
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
307
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
308 class XEP_0260_handler(XMPPHandler):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
309 implements(iwokkel.IDisco)
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
310
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
311 def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
312 return [disco.DiscoFeature(NS_JINGLE_S5B)]
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
313
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
314 def getDiscoItems(self, requestor, target, nodeIdentifier=''):
dcce63810733 plugin XEP-0260: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
315 return []