Index: dk-filter/dk-filter.c
--- dk-filter/dk-filter.c.orig	2006-05-19 23:42:05 +0200
+++ dk-filter/dk-filter.c	2007-03-02 10:26:32 +0100
@@ -61,7 +61,7 @@
 
 /* libmilter includes */
 #ifndef DEBUG
-#include "libmilter/mfapi.h"
+#include "milter/mfapi.h"
 #endif /* !DEBUG */
 
 /* libdk includes */
@@ -2076,6 +2076,13 @@
 	dfc = cc->cctx_msg;
 	assert(dfc != NULL);
 
+	/* Determine the job ID for logging. */
+	if (dfc->mctx_jobid == 0 || strcmp(dfc->mctx_jobid, JOBIDUNKNOWN) == 0) {
+		char *jobid = smfi_getsymval(ctx, "i");
+		if (jobid != 0)
+			dfc->mctx_jobid = jobid;
+	}
+
 	/* get hostname; used in the X header and in new MIME boundaries */
 	hostname = smfi_getsymval(ctx, "j");
 	if (hostname == NULL)
