ejabberd: Rename xmpp to ejabberd

This commit is contained in:
Swapnil Gupta 2017-01-06 01:56:33 +05:30 committed by James Valleroy
parent d84b02adcf
commit 7a9554cbf7
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 17 additions and 36 deletions

View File

@ -16,7 +16,7 @@
#
"""
Plinth module to configure XMPP server
Plinth module to configure ejabberd server
"""
from django.urls import reverse_lazy
@ -41,7 +41,7 @@ managed_services = ['ejabberd']
managed_packages = ['ejabberd']
title = _('Chat Server \n (XMPP)')
title = _('Chat Server \n (ejabberd)')
description = [
_('XMPP is an open and standardized communication protocol. Here '
@ -58,9 +58,9 @@ logger = logging.getLogger(__name__)
def init():
"""Initialize the XMPP module"""
"""Initialize the ejabberd module"""
menu = cfg.main_menu.get('apps:index')
menu.add_urlname(title, 'glyphicon-comment', 'xmpp:index')
menu.add_urlname(title, 'glyphicon-comment', 'ejabberd:index')
global service
setup_helper = globals()['setup_helper']
@ -80,12 +80,12 @@ def init():
def setup(helper, old_version=None):
"""Install and configure the module."""
domainname = get_domainname()
logger.info('XMPP service domainname - %s', domainname)
logger.info('ejabberd service domainname - %s', domainname)
helper.call('pre', actions.superuser_run, 'xmpp',
helper.call('pre', actions.superuser_run, 'ejabberd',
['pre-install', '--domainname', domainname])
helper.install(managed_packages)
helper.call('post', actions.superuser_run, 'xmpp', ['setup'])
helper.call('post', actions.superuser_run, 'ejabberd', ['setup'])
global service
if service is None:
service = service_module.Service(
@ -98,16 +98,15 @@ def setup(helper, old_version=None):
def add_shortcut():
frontpage.add_shortcut('xmpp', title,
frontpage.add_shortcut('ejabberd', title,
details=description,
configure_url=reverse_lazy('xmpp:index'),
configure_url=reverse_lazy('ejabberd:index'),
login_required=True)
def is_enabled():
"""Return whether the module is enabled."""
return (action_utils.service_is_enabled('ejabberd') and
action_utils.webserver_is_enabled('jwchat-plinth'))
return (action_utils.service_is_enabled('ejabberd'))
def get_domainname():
@ -118,14 +117,14 @@ def get_domainname():
def enable():
"""Enable the module."""
actions.superuser_run('xmpp', ['enable'])
actions.superuser_run('ejabberd', ['enable'])
add_shortcut()
def disable():
"""Enable the module."""
actions.superuser_run('xmpp', ['disable'])
frontpage.remove_shortcut('xmpp')
actions.superuser_run('ejabberd', ['disable'])
frontpage.remove_shortcut('ejabberd')
def on_pre_hostname_change(sender, old_hostname, new_hostname, **kwargs):
@ -135,7 +134,7 @@ def on_pre_hostname_change(sender, old_hostname, new_hostname, **kwargs):
del sender # Unused
del kwargs # Unused
actions.superuser_run('xmpp',
actions.superuser_run('ejabberd',
['pre-change-hostname',
'--old-hostname', old_hostname,
'--new-hostname', new_hostname])
@ -146,7 +145,7 @@ def on_post_hostname_change(sender, old_hostname, new_hostname, **kwargs):
del sender # Unused
del kwargs # Unused
actions.superuser_run('xmpp',
actions.superuser_run('ejabberd',
['change-hostname',
'--old-hostname', old_hostname,
'--new-hostname', new_hostname],
@ -159,7 +158,7 @@ def on_domainname_change(sender, old_domainname, new_domainname, **kwargs):
del old_domainname # Unused
del kwargs # Unused
actions.superuser_run('xmpp',
actions.superuser_run('ejabberd',
['change-domainname',
'--domainname', new_domainname],
async=True)

View File

@ -56,7 +56,7 @@ logger = logging.getLogger(__name__)
def init():
"""Initialize the XMPP module"""
menu = cfg.main_menu.get('apps:index')
menu.add_urlname(title, 'glyphicon-comment', 'xmpp:index')
menu.add_urlname(title, 'glyphicon-comment', 'jsxc:index')
global service
setup_helper = globals()['setup_helper']
@ -68,24 +68,6 @@ def init():
add_shortcut()
def setup(helper, old_version=None):
"""Install and configure the module."""
domainname = get_domainname()
logger.info('XMPP service domainname - %s', domainname)
helper.call('pre', actions.superuser_run, 'xmpp',
['pre-install', '--domainname', domainname])
helper.install(managed_packages)
helper.call('post', actions.superuser_run, 'xmpp', ['setup'])
global service
if service is None:
service = service_module.Service(
'jsxc', title, ports=['http', 'https'], is_external=True,
is_enabled=is_enabled, enable=enable, disable=disable)
helper.call('post', service.notify_enabled, None, True)
helper.call('post', add_shortcut)
def add_shortcut():
frontpage.add_shortcut('jsxc', _('Chat Client \n (jsxc)'),
url=reverse_lazy('xmpp:jsxc'),