Make XMPP work with service framework

- This allows firewall to manage ports automatically
This commit is contained in:
Sunil Mohan Adapa 2014-04-18 12:55:32 +05:30
parent f7dd63c0a6
commit f77ceedc94
5 changed files with 38 additions and 0 deletions

View File

@ -32,6 +32,7 @@ install: default apache-install freedombox-setup-install
cp -a sudoers.d $(DESTDIR)/etc/sudoers.d
cp -a *.py modules templates $(DESTDIR)$(PYDIR)/
cp share/init.d/plinth $(DESTDIR)/etc/init.d
cp -a lib/* $(DESTDIR)/usr/lib
install plinth $(DESTDIR)/usr/bin/
mkdir -p $(DESTDIR)/var/lib/plinth/cherrypy_sessions $(DESTDIR)/var/log/plinth $(DESTDIR)/var/run
mkdir -p $(DESTDIR)/var/lib/plinth/data

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>XMPP (Jabber) web client</short>
<description>Extensible Messaging and Presence Protocol (XMPP) web client protocol allows web based chat clients such as JWChat to connect to the XMPP (Jabber) server. This is also know as the Bidirectional-streams Over Synchronous HTTP (BOSH) protocol. Enable this if you run an XMPP (Jabber) server and you wish web clients to connect to your server.</description>
<port protocol="tcp" port="5280"/>
</service>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>XMPP (Jabber) client</short>
<description>Extensible Messaging and Presence Protocol (XMPP) client connection protocol allows XMPP (Jabber) clients such as Empathy, Pidgin, Kopete and Jitsi to connect to an XMPP (Jabber) server. Enable this if you run an XMPP (Jabber) server and you wish clients to be able to connect to the server and communicate with each other.</description>
<port protocol="tcp" port="5222"/>
</service>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>XMPP (Jabber) server</short>
<description>Extensible Messaging and Presence Protocol (XMPP) server connection protocols allows multiple XMPP (Jabber) servers to work in a fedrated fashion. Users on one server will be able to see the presence of and communicate with users on another servers. Enable this if you run an XMPP (Jabber) server and you wish users on your server to communicate with users on other XMPP servers.</description>
<port protocol="tcp" port="5269"/>
</service>

View File

@ -5,6 +5,7 @@ from plugin_mount import PagePlugin, FormPlugin
import cfg
from forms import Form
import actions
import service
from util import Message
class xmpp(PagePlugin):
@ -15,6 +16,24 @@ class xmpp(PagePlugin):
self.register_page("services.xmpp.register")
cfg.html_root.services.menu.add_item("XMPP", "icon-comment", "/services/xmpp", 40)
self.client_service = service.Service(
'xmpp-client', _('Chat Server - client connections'), enabled=True)
self.server_service = service.Service(
'xmpp-server', _('Chat Server - server connections'), enabled=True)
self.bosh_service = service.Service(
'xmpp-bosh', _('Chat Server - web interface'), enabled=True)
# XXX: This is not correct. This essentially triggers firewall
# to enable XMPP ports. This happen on every start of
# Plinth. XMPP should be an option to be enabled on Plinth. If
# and when the user enables the following notifications must
# sent. If XMPP has be on by default in FreedomBox, then
# initial setup process that sets up XMPP also must open the
# firewall ports by default.
self.client_service.notify_enabled(self, enabled=True)
self.server_service.notify_enabled(self, enabled=True)
self.bosh_service.notify_enabled(self, enabled=True)
@cherrypy.expose
@require()
def index(self, **kwargs):