From 038ea0fe664980ed4dfed9ffb6ba2d8bb9df0858 Mon Sep 17 00:00:00 2001
From: Jefry Lagrange <jefry.reyes@gmail.com>
Date: Sat, 7 Apr 2012 00:56:44 -0400
Subject: [PATCH] minor fixes

---
 src/common/jingle_ft.py       | 24 ++++++++++--------------
 src/common/jingle_ftstates.py |  2 +-
 src/common/xmpp/protocol.py   |  2 +-
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/src/common/jingle_ft.py b/src/common/jingle_ft.py
index b5f7ed948e..1e05644098 100644
--- a/src/common/jingle_ft.py
+++ b/src/common/jingle_ft.py
@@ -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:
diff --git a/src/common/jingle_ftstates.py b/src/common/jingle_ftstates.py
index 72e5a48563..271f53927a 100644
--- a/src/common/jingle_ftstates.py
+++ b/src/common/jingle_ftstates.py
@@ -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(
diff --git a/src/common/xmpp/protocol.py b/src/common/xmpp/protocol.py
index 3a8f092a7d..60a17d256f 100644
--- a/src/common/xmpp/protocol.py
+++ b/src/common/xmpp/protocol.py
@@ -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
-- 
GitLab