xmpp: Display current domainname and example user ID.

This commit is contained in:
James Valleroy 2015-08-30 21:14:51 -04:00
parent 162b28aafe
commit 19a6e24685
2 changed files with 13 additions and 3 deletions

View File

@ -31,6 +31,11 @@
any other <a href='http://xmpp.org/xmpp-software/clients/' target='_blank'>
XMPP client </a>.</p>
<p>Your XMPP server domain is set to <b>{{ status.domainname }}</b>. User IDs
will look like <i>username@{{ status.domainname }}</i>. You can setup your
domain on the system <a href="{% url 'config:index' %}">Configure</a>
page.</p>
<p><a href='/jwchat' target='_blank' class='btn btn-primary'> Launch web
client</a></p>

View File

@ -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