xmpp: optimize xmpp uci map

This commit is contained in:
Suvendhu Hansa 2025-04-14 20:41:24 +05:30 committed by Vivek Dutta
parent 4ee9169771
commit c1fe6b05a6
3 changed files with 11 additions and 29 deletions

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=xmppc
PKG_VERSION:=2.2.12
PKG_VERSION:=2.2.13
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/xmppc.git
PKG_SOURCE_VERSION:=8a494c51bff8190bf78636220115c003b0b34a51
PKG_SOURCE_VERSION:=5dc59fec17f9259ce40959b3fc0fc344322d5435
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View file

@ -1,5 +1,5 @@
config xmpp 'xmpp'
#Log levels: Critical=0, Warning=1, Notice=2, Info=3, Debug=4
option loglevel '3'
option loglevel '2'

View file

@ -6,7 +6,13 @@ STOP=10
USE_PROCD=1
PROG="/usr/sbin/xmppc"
stop_service() {
start_service() {
procd_open_instance
procd_set_param command "$PROG"
procd_close_instance
}
reload_service() {
xmpp_running="$(ubus call service list '{"name":"xmppc"}' | jq ".xmppc.instances.instance1.running")"
if [ "${xmpp_running}" = "true" ]; then
procd_send_signal xmppc '*' SIGKILL
@ -16,31 +22,7 @@ stop_service() {
uci -q -c /var/state delete xmppc.conn_status
uci -q -c /var/state commit xmppc
fi
}
start_service() {
local con_name=$(uci -q get xmpp.xmpp.conn_req_connection)
local con_enable=$(uci -q get xmpp."${con_name}".enable)
if [ ! -f "/var/state/xmppc" ]; then
touch "/var/state/xmppc"
fi
uci -q -c /var/state set xmppc.global='global'
uci -q -c /var/state set xmppc.global.last_change="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
uci -q -c /var/state commit xmppc
procd_open_instance
if [ "$con_enable" = "1" ]; then
procd_set_param command "$PROG"
fi
procd_close_instance
}
reload_service() {
logger -p crit -t "xmppc" "reloading service()"
stop
start
start
}
service_triggers()