Skip to content
Snippets Groups Projects
Commit d000eeac authored by Bob Mottram's avatar Bob Mottram
Browse files

Remove from xmpp muc filtered words using unignore command

parent 227ef343
No related branches found
No related tags found
No related merge requests found
......@@ -6,8 +6,8 @@
#
# Freedom in the Cloud
#
# Removes an ignore rule for either an email address
# or text in the subject line
# Removes an ignore rule for either an email address or text in the
# subject line or from xmpp MUC filtered words
#
# License
# =======
......@@ -32,6 +32,7 @@ PROJECT_NAME='freedombone'
export TEXTDOMAIN=${PROJECT_NAME}-unignore
export TEXTDOMAINDIR="/usr/share/locale"
XMPP_CONFIG=/etc/prosody/prosody.cfg.lua
MYUSERNAME=$USER
EMAIL_ADDRESS=
SUBJECT_TEXT=
......@@ -96,6 +97,27 @@ if [ "$ALL_TEXT" ]; then
if grep -q "Ignore rule for words '$ALL_TEXT'" "$PM"; then
sed -i "/# Ignore rule for words '$ALL_TEXT'/,/# End of ignore words rule/d" "$PM"
fi
if [ -f "$XMPP_CONFIG" ]; then
if grep -q 'filter_words =' "$XMPP_CONFIG"; then
if ! grep -q 'filter_words = {}' "$XMPP_CONFIG"; then
curr_filter_words=$(grep 'filter_words =' "$XMPP_CONFIG")
if [ "$curr_filter_words" ]; then
if [[ "$curr_filter_words" == *",\"${ALL_TEXT}\""* ]]; then
sed -i "s|,\"${ALL_TEXT}\"||g" "$XMPP_CONFIG"
else
if [[ "$curr_filter_words" == *"\"${ALL_TEXT}\","* ]]; then
sed -i "s|\"${ALL_TEXT}\",||g" "$XMPP_CONFIG"
else
if [[ "$curr_filter_words" == *" \"${ALL_TEXT}\" "* ]]; then
sed -i "s| \"${ALL_TEXT}\" ||g" "$XMPP_CONFIG"
fi
fi
fi
fi
fi
fi
fi
fi
# unignore an email address
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment