From d3b3bd1d9b82ccf279aa06850b7122045b10521d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 7 Aug 2017 18:15:36 +0100 Subject: [PATCH] Try without the pep dance --- src/freedombone-app-xmpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/freedombone-app-xmpp b/src/freedombone-app-xmpp index cfad1cc8..1ca05029 100755 --- a/src/freedombone-app-xmpp +++ b/src/freedombone-app-xmpp @@ -94,7 +94,7 @@ function xmpp_add_onion_address { if [ ${#onion_address} -eq 0 ]; then return fi - if ! grep "[\"${domain_name}\"] = \"${onion_address}\";" /etc/prosody/prosody.cfg.lua; then + if ! grep "${onion_address}" /etc/prosody/prosody.cfg.lua; then if grep -q "[\"${domain_name}\"]" /etc/prosody/prosody.cfg.lua; then sed -i "s|[\"${domain_name}\"].*|[\"${domain_name}\"] = \"${onion_address}\";|g" /etc/prosody/prosody.cfg.lua else @@ -138,14 +138,19 @@ function xmpp_remove_onion_address { if [ ${#domain_name} -eq 0 ]; then return fi + xmpp_changed= if grep -q "[\"${domain_name}\"]" /etc/prosody/prosody.cfg.lua; then sed -i "/[\"${domain_name}\"]/d" /etc/prosody/prosody.cfg.lua + xmpp_changed=1 fi if grep -q "= \"${domain_name}\";" /etc/prosody/prosody.cfg.lua; then sed -i "/= \"${domain_name}\";/d" /etc/prosody/prosody.cfg.lua + xmpp_changed=1 + fi + if [ $xmpp_changed ]; then + systemctl restart prosody fi - systemctl restart prosody } function xmpp_remove_onion_address_interactive { @@ -361,16 +366,6 @@ function update_prosody_modules { fi fi - # change to using pep rather than profile modules - if grep -q '"pep"' /etc/prosody/prosody.cfg.lua; then - # This strange dance seems to fix occasional breakage of PEP - # Is there a better solution? - sed -i 's|"pep"|"profile"|g' /etc/prosody/prosody.cfg.lua - systemctl restart prosody - sleep 4 - sed -i 's|"profile"|"pep"|g' /etc/prosody/prosody.cfg.lua - systemctl restart prosody - fi if ! grep -q '"vcard"' /etc/prosody/prosody.cfg.lua; then systemctl stop prosody sed -i '/"pep"/a "vcard";' /etc/prosody/prosody.cfg.lua