parent
148db88343
commit
e7536c0679
|
@ -351,7 +351,7 @@ class Connection:
|
||||||
prs.getReason(), prs.getActor(), prs.getStatusCode(),
|
prs.getReason(), prs.getActor(), prs.getStatusCode(),
|
||||||
prs.getNewNick()))
|
prs.getNewNick()))
|
||||||
else:
|
else:
|
||||||
self.dispatch('ERROR_ANSWER', (prs.getFrom().getStripped(), errmsg,
|
self.dispatch('ERROR_ANSWER', ('', prs.getFrom().getStripped(), errmsg,
|
||||||
errcode))
|
errcode))
|
||||||
if not ptype or ptype == 'unavailable':
|
if not ptype or ptype == 'unavailable':
|
||||||
jid = prs.getFrom()
|
jid = prs.getFrom()
|
||||||
|
@ -861,7 +861,8 @@ class Connection:
|
||||||
errmsg = iq_obj.getError()
|
errmsg = iq_obj.getError()
|
||||||
errcode = iq_obj.getErrorCode()
|
errcode = iq_obj.getErrorCode()
|
||||||
jid_from = str(iq_obj.getFrom())
|
jid_from = str(iq_obj.getFrom())
|
||||||
self.dispatch('ERROR_ANSWER', (jid_from, errmsg, errcode))
|
id = str(iq_obj.getID())
|
||||||
|
self.dispatch('ERROR_ANSWER', (id, jid_from, errmsg, errcode))
|
||||||
|
|
||||||
def _StanzaArrivedCB(self, con, obj):
|
def _StanzaArrivedCB(self, con, obj):
|
||||||
self.last_incoming = time.time()
|
self.last_incoming = time.time()
|
||||||
|
|
|
@ -47,6 +47,8 @@ class SocksQueue:
|
||||||
if self.listener == None:
|
if self.listener == None:
|
||||||
self.listener = Socks5Listener(host, port)
|
self.listener = Socks5Listener(host, port)
|
||||||
self.listener.bind()
|
self.listener.bind()
|
||||||
|
if self.listener.started is False:
|
||||||
|
return None
|
||||||
self.connected += 1
|
self.connected += 1
|
||||||
return self.listener
|
return self.listener
|
||||||
|
|
||||||
|
@ -84,8 +86,7 @@ class SocksQueue:
|
||||||
if not self.files_props.has_key(account):
|
if not self.files_props.has_key(account):
|
||||||
self.files_props[account] = {}
|
self.files_props[account] = {}
|
||||||
self.files_props[account][id] = file_props
|
self.files_props[account][id] = file_props
|
||||||
|
def get_file_props(self, account, sid):
|
||||||
def get_file_props(self, account, id):
|
|
||||||
if self.files_props.has_key(account):
|
if self.files_props.has_key(account):
|
||||||
fl_props = self.files_props[account]
|
fl_props = self.files_props[account]
|
||||||
if fl_props.has_key(id):
|
if fl_props.has_key(id):
|
||||||
|
@ -276,7 +277,6 @@ class Socks5:
|
||||||
def _get_request_buff(self, msg, command = 0x01):
|
def _get_request_buff(self, msg, command = 0x01):
|
||||||
''' Connect request by domain name,
|
''' Connect request by domain name,
|
||||||
sid sha, instead of domain name (jep 0096) '''
|
sid sha, instead of domain name (jep 0096) '''
|
||||||
#~ msg = self._get_sha1_auth()
|
|
||||||
buff = struct.pack('!BBBBB%dsBB' % len(msg), \
|
buff = struct.pack('!BBBBB%dsBB' % len(msg), \
|
||||||
0x05, command, 0x00, 0x03, len(msg), msg, 0, 0)
|
0x05, command, 0x00, 0x03, len(msg), msg, 0, 0)
|
||||||
return buff
|
return buff
|
||||||
|
@ -337,11 +337,13 @@ class Socks5Sender(Socks5):
|
||||||
self.state = 4
|
self.state = 4
|
||||||
self.fd.close()
|
self.fd.close()
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
|
self.file_props['error'] = -1
|
||||||
return -1
|
return -1
|
||||||
self.size += lenn
|
self.size += lenn
|
||||||
self.file_props['received-len'] = self.size
|
self.file_props['received-len'] = self.size
|
||||||
if self.size == int(self.file_props['size']):
|
if self.size == int(self.file_props['size']):
|
||||||
self.state = 4
|
self.state = 4
|
||||||
|
self.file_props['error'] = 0
|
||||||
self.fd.close()
|
self.fd.close()
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
return -1
|
return -1
|
||||||
|
@ -370,6 +372,7 @@ class Socks5Sender(Socks5):
|
||||||
file_props['started'] = True
|
file_props['started'] = True
|
||||||
file_props['completed'] = False
|
file_props['completed'] = False
|
||||||
file_props['paused'] = False
|
file_props['paused'] = False
|
||||||
|
file_props['received-len'] = 0
|
||||||
self.pauses = 0
|
self.pauses = 0
|
||||||
self.file_props = file_props
|
self.file_props = file_props
|
||||||
self.size = 0
|
self.size = 0
|
||||||
|
@ -428,12 +431,15 @@ class Socks5Listener:
|
||||||
self._sock = None
|
self._sock = None
|
||||||
|
|
||||||
def bind(self):
|
def bind(self):
|
||||||
self._serv=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
try:
|
||||||
self._serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
self._serv=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
self._serv.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
|
self._serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
self._serv.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
self._serv.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
|
||||||
self._serv.bind((self.host, self.port))
|
self._serv.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||||
self._serv.listen(socket.SOMAXCONN)
|
self._serv.bind((self.host, self.port))
|
||||||
|
self._serv.listen(socket.SOMAXCONN)
|
||||||
|
except Exception, (errno, errstr):
|
||||||
|
return None
|
||||||
self._serv.setblocking(False)
|
self._serv.setblocking(False)
|
||||||
self.started = True
|
self.started = True
|
||||||
|
|
||||||
|
@ -460,7 +466,8 @@ class Socks5Receiver(Socks5):
|
||||||
self.queue_idx = -1
|
self.queue_idx = -1
|
||||||
self.queue = None
|
self.queue = None
|
||||||
self.file_props = file_props
|
self.file_props = file_props
|
||||||
self.file_props['started'] = True
|
self.file_props['started'] = True
|
||||||
|
self.connected = False
|
||||||
if file_props:
|
if file_props:
|
||||||
file_props['disconnect_cb'] = self.disconnect
|
file_props['disconnect_cb'] = self.disconnect
|
||||||
file_props['error'] = 0
|
file_props['error'] = 0
|
||||||
|
|
14
src/gajim.py
14
src/gajim.py
|
@ -198,8 +198,18 @@ class Interface:
|
||||||
dialogs.InformationDialog(data[0], data[1]).get_response()
|
dialogs.InformationDialog(data[0], data[1]).get_response()
|
||||||
|
|
||||||
def handle_event_error_answer(self, account, array):
|
def handle_event_error_answer(self, account, array):
|
||||||
#('ERROR_ANSWER', account, (jid_from. errmsg, errcode))
|
id, jid_from, errmsg, errcode = array
|
||||||
jid_from = array[0]
|
if str(errcode) == '403' and id:
|
||||||
|
ft = self.windows['file_transfers']
|
||||||
|
if ft.files_props['s'].has_key(id):
|
||||||
|
file_props = ft.files_props['s'][id]
|
||||||
|
file_props['error'] = -1
|
||||||
|
if file_props.has_key('disconnect_cb') and \
|
||||||
|
file_props['disconnect_cb'] is not None:
|
||||||
|
file_props['disconnect_cb']()
|
||||||
|
self.handle_event_file_rcv_completed(account, file_props)
|
||||||
|
return
|
||||||
|
#('ERROR_ANSWER', account, (id, jid_from. errmsg, errcode))
|
||||||
if jid_from in self.windows[account]['gc']:
|
if jid_from in self.windows[account]['gc']:
|
||||||
self.windows[account]['gc'][jid_from].print_conversation(
|
self.windows[account]['gc'][jid_from].print_conversation(
|
||||||
'Error %s: %s' % (array[2], array[1]), jid_from)
|
'Error %s: %s' % (array[2], array[1]), jid_from)
|
||||||
|
|
Loading…
Reference in New Issue