diff --git a/src/freedombone-unignore b/src/freedombone-unignore index 8f01bd89d0bdacd55913fe2660cb44ea88c96aeb..6e3b3aacfd85c39033bcf6fa9016705f8c72818e 100755 --- a/src/freedombone-unignore +++ b/src/freedombone-unignore @@ -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