Fixes #2303 (add user_list_sort option)

This commit is contained in:
mathieui 2012-02-14 11:49:09 +01:00
parent 0f5ba0a711
commit b89cd8fd83
2 changed files with 18 additions and 3 deletions

View file

@ -198,6 +198,12 @@ vertical_tab_list_size = 20
vertical_tab_list_sort = desc
# Show the user list at the bottom when in a MUC
# (useful when you want to look at the bottom of the screen only)
# possible values: desc, asc
user_list_sort = desc
# The nick of people who join, part, change their status, etc. in a MUC will
# be displayed using their nick color if true.
display_user_color_in_join_part = false

View file

@ -222,15 +222,24 @@ class UserList(Win):
log.debug('Refresh: %s',self.__class__.__name__)
with g_lock:
self._win.erase()
y = 0
users = sorted(users)
if config.get('user_list_sort', 'desc').lower() == 'asc':
y, x = self._win.getmaxyx()
y -= 1
users = sorted(users, reverse=True)
else:
y = 0
users = sorted(users)
if self.pos >= len(users) and self.pos != 0:
self.pos = len(users)-1
for user in users[self.pos:]:
self.draw_role_affiliation(y, user)
self.draw_status_chatstate(y, user)
self.addstr(y, 2, user.nick[:self.width-2], to_curses_attr(user.color))
y += 1
if config.get('user_list_sort', 'desc').lower() == 'asc':
y -= 1
else:
y += 1
if y == self.height:
break
# draw indicators of position in the list