Available users now have a greater priority on nickname completion. fixed #1560

This commit is contained in:
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 2010-07-01 22:51:19 +00:00
parent 432bab0b6b
commit 2d90ee68ea
3 changed files with 15 additions and 1 deletions

View file

@ -9,6 +9,7 @@ http://codingteam.net/project/poezio/roadmap
- Server on /join command can be omitted
- /query command can now take a message in parameters
- logs are now save in $XDG_DATA_HOME and this can be configured
- Available users now have a greater priority on nickname completion
* Poezio 0.6.1 - 13 Jun 2010
- Enable tracebacks

View file

@ -232,7 +232,16 @@ class Gui(object):
"""
Called when Tab is pressed, complete the nickname in the input
"""
self.window.input.auto_completion(self.current_room().users)
def compare_users(a, b):
"""
Used to sort users by their availability
"""
if a.show == b.show:
return 0
if a.show is None:
return -1
return 1
self.window.input.auto_completion(sorted(self.current_room().users, compare_users))
def rotate_rooms_right(self, args=None):
"""

View file

@ -57,3 +57,7 @@ class User(object):
if datetime.now() - delta > self.last_talked:
return False
return True
def __repr__(self):
return "<user.User object nick:%s show:%s(%s) status:%s affiliation:%s>"\
% (self.nick, self.show, type(self.show), self.status, self.affiliation)