Browse Source

Fix client sorting bug

wip
Maurizio Porrato 11 years ago
parent
commit
546c723995
  1. 17
      frn/clienttracker.py

17
frn/clienttracker.py

@ -18,16 +18,17 @@ def client_cmp(a, b):
except:
tb = CLIENTS_ORDER.index('Gateway')
if ta < tb:
return -1
r = -1
elif ta > tb:
return 1
r = 1
else:
if a.ON < b.ON:
return -1
r = -1
elif a.ON > b.ON:
return 1
r = 1
else:
return 0
r = 0
return r
class ClientTracker(object):
@ -116,11 +117,13 @@ class ClientTracker(object):
self._clientData[clientId] = client
net = client.user.NT
nc = self._net.get(net, [])
ni = 0
ni = None
for i, c in enumerate(nc):
if client_cmp(client.user, self._clientData[c]) > 0:
if client_cmp(client.user, self._clientData[c].user) < 0:
ni = i
break
if ni is None:
ni = len(nc)
nc.insert(ni, clientId)
self._net[net] = nc
if clientId in self._mute:

Loading…
Cancel
Save