From abe8c0ab7143abbf41b756fb4593e8ea1f86b413 Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 19 Apr 2012 00:20:03 +0200 Subject: [PATCH] Add a show_roster_jids option --- data/default_config.cfg | 6 ++++++ doc/en/configure.txt | 5 +++++ src/windows.py | 4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/data/default_config.cfg b/data/default_config.cfg index 59655f99..2c5f0d81 100644 --- a/data/default_config.cfg +++ b/data/default_config.cfg @@ -215,6 +215,12 @@ use_tab_nicks = true # the @) when displaying the MUC tab name. show_muc_jid = true +# If this option is set to false, the roster will not show the contact JIDs +# when that is possible. +# e.g. instead of: toto (toto@example.org) (2) +# poezio will only show: toto (2) +show_roster_jids = true + # The terminal can beep on various event. Put the event you want in a list # (separated by spaces). # The events can be diff --git a/doc/en/configure.txt b/doc/en/configure.txt index e4cb11a8..36a49206 100644 --- a/doc/en/configure.txt +++ b/doc/en/configure.txt @@ -269,6 +269,11 @@ section of this documentation. jid. E.g. if you have poezio@muc.poezio.eu, it will be displayed as `poezio`. This will be used only if use_tab_nicks is set to true. +*show_roster_jids*:: true + + Set this to false if you want to hide the JIDs in the roster (and keep only + the contact names). If there is no contact name, the JID will still be + displayed. *beep_on*:: highlight private diff --git a/src/windows.py b/src/windows.py index fe4d16ce..802a6230 100644 --- a/src/windows.py +++ b/src/windows.py @@ -1628,7 +1628,9 @@ class RosterWin(Win): presence = resource.presence nb = ' (%s)' % (contact.get_nb_resources(),) color = RosterWin.color_show[presence]() - if contact.name: + if config.getl('show_roster_jids', 'true') == 'false' and contact.name: + display_name = '%s %s' % (contact.name, nb[1:]) + elif contact.name: display_name = '%s (%s)%s' % (contact.name, contact.bare_jid, nb,) else: