diff --git a/CHANGELOG b/CHANGELOG index f060a50e3dd9c51187da79eea195e7f2695193cf..05a4255343c606e858f07689e1fad844fd3d75d4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/src/gui.py b/src/gui.py index 9e4fe8edda1dad3220a58d2657aec270d8dd6d71..bff9c3be24ca5797e47f0ed9fc6972c3cb977fb9 100644 --- a/src/gui.py +++ b/src/gui.py @@ -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): """ diff --git a/src/user.py b/src/user.py index da403b51fd15c575f8df1415cc91f8f5cadbb63a..82a50ddad06c3f08b90c2317576749733e360de4 100644 --- a/src/user.py +++ b/src/user.py @@ -57,3 +57,7 @@ class User(object): if datetime.now() - delta > self.last_talked: return False return True + + def __repr__(self): + return ""\ + % (self.nick, self.show, type(self.show), self.status, self.affiliation)