From 28d790717f78bb7a24d0b4d953bdb4a938b673fb Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 15 Feb 2012 20:05:38 +0100 Subject: [PATCH] Add an option to configure the max nick length --- src/windows.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/windows.py b/src/windows.py index 1b833290..68518086 100644 --- a/src/windows.py +++ b/src/windows.py @@ -47,7 +47,10 @@ g_lock = RLock() LINES_NB_LIMIT = 4096 -def truncate_nick(nick, size=25): +def truncate_nick(nick, size=None): + size = size or config.get('max_nick_length', 25) + if size < 1: + size = 1 if nick and len(nick) >= size: return nick[:size]+'…' return nick