minor fixes

This commit is contained in:
Jefry Lagrange 2012-04-07 00:56:44 -04:00
parent 026e5b44f1
commit 038ea0fe66
3 changed files with 12 additions and 16 deletions

View File

@ -33,17 +33,16 @@ log = logging.getLogger('gajim.c.jingle_ft')
STATE_NOT_STARTED = 0
STATE_INITIALIZED = 1
STATE_ACCEPTED = 2
# We send the candidates and we are waiting for a reply
STATE_CAND_SENT = 3
STATE_CAND_SENT = 2
# We received the candidates and we are waiting to reply
STATE_CAND_RECEIVED = 4
STATE_CAND_RECEIVED = 3
# We have sent and received the candidates
# This also includes any candidate-error received or sent
STATE_CAND_SENT_AND_RECEIVED = 5
STATE_TRANSPORT_REPLACE = 6
STATE_CAND_SENT_AND_RECEIVED = 4
STATE_TRANSPORT_REPLACE = 5
# We are transfering the file
STATE_TRANSFERING = 7
STATE_TRANSFERING = 6
class JingleFileTransfer(JingleContent):
@ -264,11 +263,9 @@ class JingleFileTransfer(JingleContent):
def __transport_setup(self, stanza=None, content=None, error=None,
action=None):
# Sets up a few transport specific things for the file transfer
# TODO: Do this inside of a state class
if self.transport.type == TransportType.SOCKS5:
self._listen_host()
if self.transport.type == TransportType.IBB:
# No action required, just set the state to transfering
self.state = STATE_TRANSFERING
@ -283,15 +280,14 @@ class JingleFileTransfer(JingleContent):
'sendCand' : True}
self.nominated_cand['our-cand'] = streamhost
if self.state == STATE_CAND_RECEIVED:
self.__state_changed(STATE_CAND_SENT_AND_RECEIVED, args)
else:
self.__state_changed(STATE_CAND_SENT, args)
self.__sendCand(args)
def _on_connect_error(self, sid):
log.info('connect error, sid=' + sid)
args = {'candError' : True}
self.__sendCand(args)
def __sendCand(self, args):
if self.state == STATE_CAND_RECEIVED:
self.__state_changed(STATE_CAND_SENT_AND_RECEIVED, args)
else:

View File

@ -37,12 +37,12 @@ class StateInitialized(JingleFileTransferStates):
'''
def action(self, args=None):
self.jft._listen_host()
if self.jft.weinitiate:
# update connection's fileprops
self.jft.session.connection.files_props[self.jft.file_props['sid']] = \
self.jft.file_props
# Listen on configured port for file transfer
self.jft._listen_host() # TODO: Rename this to listen_host()
else:
# Add file_props to the queue
if not gajim.socks5queue.get_file_props(

View File

@ -90,7 +90,7 @@ NS_JINGLE_ERRORS = 'urn:xmpp:jingle:errors:1' # XEP-0166
NS_JINGLE_RTP = 'urn:xmpp:jingle:apps:rtp:1' # XEP-0167
NS_JINGLE_RTP_AUDIO = 'urn:xmpp:jingle:apps:rtp:audio' # XEP-0167
NS_JINGLE_RTP_VIDEO = 'urn:xmpp:jingle:apps:rtp:video' # XEP-0167
NS_JINGLE_FILE_TRANSFER ='urn:xmpp:jingle:apps:file-transfer:1' # XEP-0234
NS_JINGLE_FILE_TRANSFER ='urn:xmpp:jingle:apps:file-transfer:3' # XEP-0234
NS_JINGLE_XTLS='urn:xmpp:jingle:security:xtls:0' # XTLS: EXPERIMENTAL security layer of jingle
NS_JINGLE_RAW_UDP = 'urn:xmpp:jingle:transports:raw-udp:1' # XEP-0177
NS_JINGLE_ICE_UDP = 'urn:xmpp:jingle:transports:ice-udp:1' # XEP-0176