From e82294aa2f82fe23719cb4e50efa8c180526480d Mon Sep 17 00:00:00 2001 From: Amin Ben Ramdhane Date: Thu, 28 Apr 2022 16:23:20 +0100 Subject: [PATCH] xmppc: 2.0.0 --- xmppc/Makefile | 6 +++--- xmppc/files/etc/config/xmpp | 20 ++++++++++++++------ xmppc/files/etc/init.d/xmppc | 22 ++++++++-------------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/xmppc/Makefile b/xmppc/Makefile index 7c11f2e0c..8c679ebd5 100755 --- a/xmppc/Makefile +++ b/xmppc/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xmppc -PKG_VERSION:=1.0.3 +PKG_VERSION:=2.0.0 -PKG_SOURCE_VERSION:=4a09b8689d67dcbf3fd1b7e80e53816b7cd12614 +PKG_SOURCE_VERSION:=5311b96747e54ee4eda5a77c30d34754f927fde6 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/xmppc.git @@ -29,7 +29,7 @@ define Package/$(PKG_NAME) CATEGORY:=Utilities SUBMENU:=TRx69 TITLE:=BBF xmpp Client - DEPENDS:=+libuci +libubox +libstrophe +libbbf_api +libubus + DEPENDS:=+libuci +libubox +libstrophe +libubus endef define Package/$(PKG_NAME)/description diff --git a/xmppc/files/etc/config/xmpp b/xmppc/files/etc/config/xmpp index d429aa149..ced9a0417 100644 --- a/xmppc/files/etc/config/xmpp +++ b/xmppc/files/etc/config/xmpp @@ -1,13 +1,11 @@ config xmpp 'xmpp' - option enable '0' - option id '0' + option conn_req_connection 'connection_1' option allowed_jid '' #Log levels: Critical=0, Warning=1, Notice=2, Info=3, Debug=4 option loglevel '3' -config connection - option xmpp_id '1' +config connection 'connection_1' option enable '0' option username '' option password '' @@ -21,9 +19,19 @@ config connection option retry_max_interval '1' option serveralgorithm 'DNS-SRV' -config connection_server - option con_id '1' +config connection_server 'connection_1_srv_1' + option con_name 'connection_1' option enable '0' + option priority '0' + option weight '-1' + option port '5222' + option server_address '' + +config connection_server 'connection_1_srv_2' + option con_name 'connection_1' + option enable '0' + option priority '0' + option weight '-1' option port '5222' option server_address '' diff --git a/xmppc/files/etc/init.d/xmppc b/xmppc/files/etc/init.d/xmppc index 4824c95ae..87a28e633 100755 --- a/xmppc/files/etc/init.d/xmppc +++ b/xmppc/files/etc/init.d/xmppc @@ -7,20 +7,13 @@ USE_PROCD=1 PROG="/usr/sbin/xmppc" start_service() { - local xmpp_enable=`uci -q get xmpp.xmpp.enable` - local xmpp_id=`uci -q get xmpp.xmpp.id` - if ([ "$xmpp_enable" = "1" ] && [ "$xmpp_id" != "0" ]); then - local con=`uci show xmpp | grep "xmpp.@connection.*xmpp_id=\'$xmpp_id\'" | cut -d "." -f 2` - local con_srv=`uci show xmpp | grep "xmpp.@connection.*con_id=\'$xmpp_id\'" | cut -d "." -f 2` - local serveralgorithm=`uci get xmpp.$con.serveralgorithm` - local con_enable=`uci -q get xmpp.$con.enable` - local srv_enable=`uci -q get xmpp.$con_srv.enable` - if ([ "$serveralgorithm" = "DNS-SRV" ] && [ "$con_enable" = "1" ]) || ([ "$serveralgorithm" = "ServerTable" ] && [ "$con_enable" = "1" ] && [ "$srv_enable" = "1" ]); then - procd_open_instance xmppc - procd_set_param command "$PROG" - procd_set_param respawn "3" "7" "0" - procd_close_instance - fi + local con_name=$(uci -q get xmpp.xmpp.conn_req_connection) + local con_enable=$(uci -q get xmpp.$con_name.enable) + if [ "$con_enable" == "1" ]; then + procd_open_instance + procd_set_param command "$PROG" + procd_set_param respawn "3" "7" "0" + procd_close_instance fi } @@ -29,6 +22,7 @@ boot() { } reload_service() { + logger -p crit -t "xmppc" "reloading service()" stop start }