From 19a6e246857e0ceeb18597a7482b22c4fcb4952c Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sun, 30 Aug 2015 21:14:51 -0400 Subject: [PATCH] xmpp: Display current domainname and example user ID. --- plinth/modules/xmpp/templates/xmpp.html | 5 +++++ plinth/modules/xmpp/views.py | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/plinth/modules/xmpp/templates/xmpp.html b/plinth/modules/xmpp/templates/xmpp.html index 999b11dfa..00fe55bb2 100644 --- a/plinth/modules/xmpp/templates/xmpp.html +++ b/plinth/modules/xmpp/templates/xmpp.html @@ -31,6 +31,11 @@ any other XMPP client .

+

Your XMPP server domain is set to {{ status.domainname }}. User IDs + will look like username@{{ status.domainname }}. You can setup your + domain on the system Configure + page.

+

Launch web client

diff --git a/plinth/modules/xmpp/views.py b/plinth/modules/xmpp/views.py index c4d7f2f3b..c96eb7f2a 100644 --- a/plinth/modules/xmpp/views.py +++ b/plinth/modules/xmpp/views.py @@ -34,10 +34,14 @@ from plinth.modules import xmpp logger = logging.getLogger(__name__) +def get_domainname(): + """Return the domainname""" + fqdn = socket.getfqdn() + return '.'.join(fqdn.split('.')[1:]) + def before_install(): """Preseed debconf values before the packages are installed.""" - fqdn = socket.getfqdn() - domainname = '.'.join(fqdn.split('.')[1:]) + domainname = get_domainname() logger.info('XMPP service domainname - %s', domainname) actions.superuser_run('xmpp', ['pre-install', '--domainname', domainname]) @@ -74,7 +78,8 @@ def index(request): def get_status(): """Get the current settings.""" status = {'enabled': xmpp.is_enabled(), - 'is_running': xmpp.is_running()} + 'is_running': xmpp.is_running(), + 'domainname': get_domainname()} return status