fix bad refactoring

This commit is contained in:
Jefry Lagrange 2011-12-22 21:52:37 -05:00
parent 78e7361bf2
commit c9f2176ccb
2 changed files with 13 additions and 13 deletions

View File

@ -376,13 +376,13 @@ class JingleFileTransfer(JingleContent):
self.state = STATE_TRANSFERING self.state = STATE_TRANSFERING
# It tells wether we start the transfer as client or server # It tells wether we start the transfer as client or server
type = None mode = None
if self.isOurCandUsed(): if self.isOurCandUsed():
type = 'client' mode = 'client'
streamhost_used = self.nominated_cand['our-cand'] streamhost_used = self.nominated_cand['our-cand']
else: else:
type = 'server' mode = 'server'
streamhost_used = self.nominated_cand['peer-cand'] streamhost_used = self.nominated_cand['peer-cand']
if streamhost_used['type'] == 'proxy': if streamhost_used['type'] == 'proxy':
@ -445,7 +445,7 @@ class JingleFileTransfer(JingleContent):
else: else:
jid = gajim.get_jid_without_resource(self.session.ourjid) jid = gajim.get_jid_without_resource(self.session.ourjid)
gajim.socks5queue.send_file(self.file_props, gajim.socks5queue.send_file(self.file_props,
self.session.connection.name, type) self.session.connection.name, mode)
def get_content(desc): def get_content(desc):
return JingleFileTransfer return JingleFileTransfer

View File

@ -309,10 +309,10 @@ class SocksQueue:
result = reader.write_next() result = reader.write_next()
self.process_result(result, reader) self.process_result(result, reader)
def send_file(self, file_props, account, type): def send_file(self, file_props, account, mode):
for key in self.senders.keys(): for key in self.senders.keys():
if file_props['name'] in key and file_props['sid'] in key \ if file_props['name'] in key and file_props['sid'] in key \
and self.senders[key].type == type: and self.senders[key].mode == mode:
log.info("socks5: sending file") log.info("socks5: sending file")
sender = self.senders[key] sender = self.senders[key]
@ -570,7 +570,7 @@ class Socks5:
self.pollend() self.pollend()
else: else:
if self.type == 'client': if self.mode == 'client':
self.queue.reconnect_client(self, self.streamhost) self.queue.reconnect_client(self, self.streamhost)
def open_file_for_reading(self): def open_file_for_reading(self):
@ -1088,7 +1088,7 @@ class Socks5Server(Socks5):
Socks5.__init__(self, idlequeue, host, port, initiator, target, sid) Socks5.__init__(self, idlequeue, host, port, initiator, target, sid)
self.type = 'server' self.mode = 'server'
def main(self): def main(self):
""" """
@ -1191,7 +1191,7 @@ class Socks5Client(Socks5):
Socks5.__init__(self, idlequeue, host, port, initiator, target, sid) Socks5.__init__(self, idlequeue, host, port, initiator, target, sid)
self.type = 'client' self.mode = 'client'
def main(self, timeout=0): def main(self, timeout=0):
""" """
@ -1338,7 +1338,7 @@ class Socks5SenderClient(Socks5Client, Socks5Sender):
def __init__(self, idlequeue, sock_hash, parent,_sock, host=None, def __init__(self, idlequeue, sock_hash, parent,_sock, host=None,
port=None, fingerprint = None, connected=True, file_props={}): port=None, fingerprint = None, connected=True, file_props={}):
Socks5.__init__(self, idlequeue, host, port, None, None, Socks5Client.__init__(self, idlequeue, host, port, None, None,
file_props['sid']) file_props['sid'])
Socks5Sender.__init__(self,idlequeue, sock_hash, parent,_sock, Socks5Sender.__init__(self,idlequeue, sock_hash, parent,_sock,
@ -1353,7 +1353,7 @@ class Socks5SenderServer(Socks5Server, Socks5Sender):
def __init__(self, idlequeue, sock_hash, parent,_sock, host=None, def __init__(self, idlequeue, sock_hash, parent,_sock, host=None,
port=None, fingerprint = None, connected=True, file_props={}): port=None, fingerprint = None, connected=True, file_props={}):
Socks5.__init__(self, idlequeue, host, port, None, None, Socks5Server.__init__(self, idlequeue, host, port, None, None,
file_props['sid']) file_props['sid'])
Socks5Sender.__init__(self,idlequeue, sock_hash, parent, _sock, Socks5Sender.__init__(self,idlequeue, sock_hash, parent, _sock,
@ -1365,7 +1365,7 @@ class Socks5ReceiverClient(Socks5Client, Socks5Receiver):
def __init__(self, idlequeue, streamhost, sid, file_props = None, def __init__(self, idlequeue, streamhost, sid, file_props = None,
fingerprint=None): fingerprint=None):
Socks5.__init__(self, idlequeue, streamhost['host'], Socks5Client.__init__(self, idlequeue, streamhost['host'],
int(streamhost['port']), streamhost['initiator'], int(streamhost['port']), streamhost['initiator'],
streamhost['target'], sid) streamhost['target'], sid)
@ -1380,7 +1380,7 @@ class Socks5ReceiverServer(Socks5Server, Socks5Receiver):
def __init__(self, idlequeue, streamhost, sid, file_props = None, def __init__(self, idlequeue, streamhost, sid, file_props = None,
fingerprint=None): fingerprint=None):
Socks5.__init__(self, idlequeue, streamhost['host'], Socks5Server.__init__(self, idlequeue, streamhost['host'],
int(streamhost['port']), streamhost['initiator'], int(streamhost['port']), streamhost['initiator'],
streamhost['target'], sid) streamhost['target'], sid)