Skip to content
Snippets Groups Projects
Commit 038ea0fe authored by zimio's avatar zimio
Browse files

minor fixes

parent 026e5b44
No related branches found
No related tags found
No related merge requests found
...@@ -33,17 +33,16 @@ log = logging.getLogger('gajim.c.jingle_ft') ...@@ -33,17 +33,16 @@ log = logging.getLogger('gajim.c.jingle_ft')
STATE_NOT_STARTED = 0 STATE_NOT_STARTED = 0
STATE_INITIALIZED = 1 STATE_INITIALIZED = 1
STATE_ACCEPTED = 2
# We send the candidates and we are waiting for a reply # 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 # 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 # We have sent and received the candidates
# This also includes any candidate-error received or sent # This also includes any candidate-error received or sent
STATE_CAND_SENT_AND_RECEIVED = 5 STATE_CAND_SENT_AND_RECEIVED = 4
STATE_TRANSPORT_REPLACE = 6 STATE_TRANSPORT_REPLACE = 5
# We are transfering the file # We are transfering the file
STATE_TRANSFERING = 7 STATE_TRANSFERING = 6
class JingleFileTransfer(JingleContent): class JingleFileTransfer(JingleContent):
...@@ -264,11 +263,9 @@ class JingleFileTransfer(JingleContent): ...@@ -264,11 +263,9 @@ class JingleFileTransfer(JingleContent):
def __transport_setup(self, stanza=None, content=None, error=None, def __transport_setup(self, stanza=None, content=None, error=None,
action=None): action=None):
# Sets up a few transport specific things for the file transfer # 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: if self.transport.type == TransportType.IBB:
# No action required, just set the state to transfering
self.state = STATE_TRANSFERING self.state = STATE_TRANSFERING
...@@ -283,15 +280,14 @@ class JingleFileTransfer(JingleContent): ...@@ -283,15 +280,14 @@ class JingleFileTransfer(JingleContent):
'sendCand' : True} 'sendCand' : True}
self.nominated_cand['our-cand'] = streamhost self.nominated_cand['our-cand'] = streamhost
if self.state == STATE_CAND_RECEIVED: self.__sendCand(args)
self.__state_changed(STATE_CAND_SENT_AND_RECEIVED, args)
else:
self.__state_changed(STATE_CAND_SENT, args)
def _on_connect_error(self, sid): def _on_connect_error(self, sid):
log.info('connect error, sid=' + sid) log.info('connect error, sid=' + sid)
args = {'candError' : True} args = {'candError' : True}
self.__sendCand(args)
def __sendCand(self, args):
if self.state == STATE_CAND_RECEIVED: if self.state == STATE_CAND_RECEIVED:
self.__state_changed(STATE_CAND_SENT_AND_RECEIVED, args) self.__state_changed(STATE_CAND_SENT_AND_RECEIVED, args)
else: else:
......
...@@ -37,12 +37,12 @@ class StateInitialized(JingleFileTransferStates): ...@@ -37,12 +37,12 @@ class StateInitialized(JingleFileTransferStates):
''' '''
def action(self, args=None): def action(self, args=None):
self.jft._listen_host()
if self.jft.weinitiate: if self.jft.weinitiate:
# update connection's fileprops # update connection's fileprops
self.jft.session.connection.files_props[self.jft.file_props['sid']] = \ self.jft.session.connection.files_props[self.jft.file_props['sid']] = \
self.jft.file_props self.jft.file_props
# Listen on configured port for file transfer # Listen on configured port for file transfer
self.jft._listen_host() # TODO: Rename this to listen_host()
else: else:
# Add file_props to the queue # Add file_props to the queue
if not gajim.socks5queue.get_file_props( if not gajim.socks5queue.get_file_props(
......
...@@ -90,7 +90,7 @@ NS_JINGLE_ERRORS = 'urn:xmpp:jingle:errors:1' # XEP-0166 ...@@ -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 = 'urn:xmpp:jingle:apps:rtp:1' # XEP-0167
NS_JINGLE_RTP_AUDIO = 'urn:xmpp:jingle:apps:rtp:audio' # 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_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_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_RAW_UDP = 'urn:xmpp:jingle:transports:raw-udp:1' # XEP-0177
NS_JINGLE_ICE_UDP = 'urn:xmpp:jingle:transports:ice-udp:1' # XEP-0176 NS_JINGLE_ICE_UDP = 'urn:xmpp:jingle:transports:ice-udp:1' # XEP-0176
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment