summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui.py11
-rw-r--r--src/user.py4
2 files changed, 14 insertions, 1 deletions
diff --git a/src/gui.py b/src/gui.py
index 9e4fe8ed..bff9c3be 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 da403b51..82a50dda 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 "<user.User object nick:%s show:%s(%s) status:%s affiliation:%s>"\
+ % (self.nick, self.show, type(self.show), self.status, self.affiliation)