From 05d25dc6cb43ebe7824296e71123bf4c05afba00 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@freedombone.net>
Date: Thu, 5 Jul 2018 18:52:00 +0100
Subject: [PATCH] Add notification account as an xmpp admin

---
 src/freedombone-app-xmpp     | 3 +--
 src/freedombone-notification | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/freedombone-app-xmpp b/src/freedombone-app-xmpp
index fe549d5c4..b17160bb3 100755
--- a/src/freedombone-app-xmpp
+++ b/src/freedombone-app-xmpp
@@ -781,7 +781,6 @@ function xmpp_modules {
       echo '  "http";';
       echo '  "http_upload";';
       echo '  "websocket";';
-      echo '  "post_msg";';
       echo '  "throttle_presence"; -- Reduce battery and bandwidth usage';
       echo '  "filter_chatstates"; -- Reduce battery and bandwidth usage';
       echo '};'; } >> "$filename"
@@ -834,7 +833,7 @@ function xmpp_onion_addresses {
 }
 
 function xmpp_create_config {
-    echo "admins = { \"$MY_USERNAME@$DEFAULT_DOMAIN_NAME\" }" > /etc/prosody/prosody.cfg.lua
+    echo "admins = { \"$MY_USERNAME@$DEFAULT_DOMAIN_NAME\", \"notification@$DEFAULT_DOMAIN_NAME\" }" > /etc/prosody/prosody.cfg.lua
     echo 'plugin_paths = { "/var/lib/prosody/prosody-modules" }' >> /etc/prosody/prosody.cfg.lua
     echo '' >> /etc/prosody/prosody.cfg.lua
     xmpp_modules /etc/prosody/prosody.cfg.lua
diff --git a/src/freedombone-notification b/src/freedombone-notification
index 5cd7ce0dc..efad375cc 100755
--- a/src/freedombone-notification
+++ b/src/freedombone-notification
@@ -89,7 +89,7 @@ if [ -d /etc/prosody ]; then
           echo 'tojid = sys.argv[1]';
           echo 'data = sys.stdin.readlines()';
           echo "msg = ' '.join(data)";
-          echo "username = 'notification@$HOSTNAME'";
+          echo "username = 'notification@$HOSTNAME/announce/online'";
           echo "password = '$notification_user_password'";
           echo 'jid=xmpp.protocol.JID(username)';
           echo 'cl=xmpp.Client(jid.getDomain(),debug=[])';
@@ -100,7 +100,7 @@ if [ -d /etc/prosody ]; then
           echo 'if not auth:';
           echo '    sys.exit()';
           echo 'id=cl.send(xmpp.protocol.Message(tojid, msg))';
-          echo 'time.sleep(2)';
+          echo 'time.sleep(1)';
           echo 'cl.disconnect()'; } > /tmp/xsend
         chmod +x /tmp/xsend
 
-- 
GitLab