From d51af9b3c4312400b7a01a9bcd7d2921dd3c8740 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 3 Jun 2016 20:43:05 +0100 Subject: [PATCH] Add message archive management to prosody --- src/freedombone | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/freedombone b/src/freedombone index b53c01e3..4c6d7689 100755 --- a/src/freedombone +++ b/src/freedombone @@ -6934,10 +6934,37 @@ function install_tox_client { echo 'install_tox_client' >> $COMPLETION_FILE } +function update_prosody_modules { + if [ ! -d $INSTALL_DIR/prosody-modules ]; then + return + fi + if [ ! -d /usr/lib/prosody ]; then + return + fi + + cd $INSTALL_DIR/prosody-modules + hg pull + hg update + + # support onion addresses + if [ -f $INSTALL_DIR/prosody-modules/mod_onions/mod_onions.lua ]; then + cp $INSTALL_DIR/prosody-modules/mod_onions/mod_onions.lua /usr/lib/prosody/modules/mod_onions.lua + fi + + # message archive management + # https://modules.prosody.im/mod_mam.html + if [ -d cp $INSTALL_DIR/prosody-modules/mod_mam ]; then + cp $INSTALL_DIR/prosody-modules/mod_mam/*.lua /usr/lib/prosody/modules + fi +} + function install_xmpp { if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then return fi + + update_prosody_modules + if grep -Fxq "install_xmpp" $COMPLETION_FILE; then return fi @@ -6958,7 +6985,7 @@ function install_xmpp { fi # install the onions module - cp $INSTALL_DIR/prosody-modules/mod_onions/mod_onions.lua /usr/lib/prosody/modules/mod_onions.lua + update_prosody_modules if [ ! -f /usr/lib/prosody/modules/mod_onions.lua ]; then echo $'mod_onions.lua could not be copied to the prosody modules directory' exit 63952 @@ -7001,6 +7028,7 @@ function install_xmpp { echo ' "tls"; -- Enable mod_tls' >> /etc/prosody/conf.avail/xmpp.cfg.lua echo ' "saslauth"; -- Enable mod_saslauth' >> /etc/prosody/conf.avail/xmpp.cfg.lua echo ' "onions"; -- Enable chat via onion service' >> /etc/prosody/conf.avail/xmpp.cfg.lua + echo ' "mam"; -- Message archive management' >> /etc/prosody/conf.avail/xmpp.cfg.lua echo '}' >> /etc/prosody/conf.avail/xmpp.cfg.lua echo '' >> /etc/prosody/conf.avail/xmpp.cfg.lua echo 'c2s_require_encryption = true' >> /etc/prosody/conf.avail/xmpp.cfg.lua