X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/45ff291908a431109c67c04807993f654089e24d..44ddf331cb00ccefe35abe9ae882579fd291070d:/procmail/msgid-index

diff --git a/procmail/msgid-index b/procmail/msgid-index
index 102dacc..caccf83 100644
--- a/procmail/msgid-index
+++ b/procmail/msgid-index
@@ -14,10 +14,9 @@ DATA="$FROM,$NL$ORIGINAL_TO,$NL$SUBJECT,$NL$MSGID"
 INCLUDERC=$PMDIR/sql-escape
 
 QUERY="insert into messages (sender, recipient, subject, msgid, filename, dest) values (
-  $DATA, '\\'$THISLOGFILE_REL\\'', '\\'\$DESTFILE\\'');
-       select * from messages where filename = '\\'$THISLOGFILE_REL\\''"
-TRAP="$TRAP; case \"$($DO_QUERY '$QUERY')\" in '') 
-      echo 'msgid-index: failed to insert reference into database';; esac"
+  $DATA, '$THISLOGFILE_REL', '\$DESTFILE');"
+TRAP="$TRAP; OUT=\"$(echo \"$QUERY\" | $DO_QUERY 2>&1)\";
+      [ -n \"\$OUT\" ] && echo \"msgid-index: failed to insert reference into database: \$OUT\""
 
 QUERY
 DATA