diff -up evolution-2.28.0/plugins/tnef-attachments/tnef-plugin.c.tnef-filepath evolution-2.28.0/plugins/tnef-attachments/tnef-plugin.c
--- evolution-2.28.0/plugins/tnef-attachments/tnef-plugin.c.tnef-filepath	2009-11-13 13:37:43.000000000 +0100
+++ evolution-2.28.0/plugins/tnef-attachments/tnef-plugin.c	2009-11-13 13:46:44.000000000 +0100
@@ -55,12 +55,11 @@
 gint verbose = 0;
 gint saveRTF = 0;
 gint saveintermediate = 0;
-gchar *filepath = NULL;
 gboolean loaded = FALSE;
-void processTnef(TNEFStruct *tnef);
-void saveVCalendar(TNEFStruct *tnef);
-void saveVCard(TNEFStruct *tnef);
-void saveVTask(TNEFStruct *tnef);
+void processTnef(TNEFStruct *tnef, char *tmpdir);
+void saveVCalendar(TNEFStruct *tnef, char *tmpdir);
+void saveVCard(TNEFStruct *tnef, char *tmpdir);
+void saveVTask(TNEFStruct *tnef, char *tmpdir);
 
 void org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t);
 
@@ -92,8 +91,6 @@ org_gnome_format_tnef(gpointer ep, EMFor
 	if (tmpdir == NULL)
 		return;
 
-	filepath = tmpdir;
-
 	name = g_build_filename(tmpdir, ".evo-attachment.tnef", NULL);
 
 	out = camel_stream_fs_new_with_name(name, O_RDWR|O_CREAT, 0666);
@@ -115,7 +112,7 @@ org_gnome_format_tnef(gpointer ep, EMFor
         if (TNEFParseFile(name, &tnef) == -1) {
             printf("ERROR processing file\n");
         }
-	processTnef(&tnef);
+	processTnef(&tnef, tmpdir);
 
         TNEFFree(&tnef);
 	/* Extraction done */
@@ -208,7 +205,7 @@ e_plugin_lib_enable(EPluginLib *ep, gint
     return 0;
 }
 
-void processTnef(TNEFStruct *tnef) {
+void processTnef(TNEFStruct *tnef, char *tmpdir) {
     variableLength *filename;
     variableLength *filedata;
     Attachment *p;
@@ -218,19 +215,21 @@ void processTnef(TNEFStruct *tnef) {
     gint i, count;
     gint foundCal=0;
 
+    g_assert (tmpdir != NULL);
+
     FILE *fptr;
 
     /* First see if this requires special processing. */
     /* ie: it's a Contact Card, Task, or Meeting request (vCal/vCard) */
     if (tnef->messageClass[0] != 0)  {
         if (strcmp(tnef->messageClass, "IPM.Contact") == 0) {
-            saveVCard(tnef);
+            saveVCard(tnef, tmpdir);
         }
         if (strcmp(tnef->messageClass, "IPM.Task") == 0) {
-            saveVTask(tnef);
+            saveVTask(tnef, tmpdir);
         }
         if (strcmp(tnef->messageClass, "IPM.Appointment") == 0) {
-            saveVCalendar(tnef);
+            saveVCalendar(tnef, tmpdir);
             foundCal = 1;
         }
     }
@@ -240,7 +239,7 @@ void processTnef(TNEFStruct *tnef) {
         if (strcmp(filename->data, "IPM.Appointment") == 0) {
              /* If it's "indicated" twice, we don't want to save 2 calendar entries. */
             if (foundCal == 0) {
-                saveVCalendar(tnef);
+                saveVCalendar(tnef, tmpdir);
             }
         }
     }
@@ -253,11 +252,7 @@ void processTnef(TNEFStruct *tnef) {
                     != MAPI_UNDEFINED) {
                 variableLength buf;
                 if ((buf.data = (gchar *) DecompressRTF(filename, &buf.size)) != NULL) {
-                    if (filepath == NULL) {
-                        sprintf(ifilename, "%s.rtf", tnef->subject.data);
-                    } else {
-                        sprintf(ifilename, "%s/%s.rtf", filepath, tnef->subject.data);
-                    }
+                    sprintf(ifilename, "%s/%s.rtf", tmpdir, tnef->subject.data);
                     for (i=0; i<strlen(ifilename); i++)
                         if (ifilename[i] == ' ')
                             ifilename[i] = '_';
@@ -313,7 +308,7 @@ void processTnef(TNEFStruct *tnef) {
                     emb_tnef.Debug = tnef->Debug;
                     if (TNEFParseMemory((guchar *) filedata->data+16,
                              filedata->size-16, i&emb_tnef) != -1) {
-                        processTnef(&emb_tnef);
+                        processTnef(&emb_tnef, tmpdir);
                         RealAttachment = 0;
                     }
                     TNEFFree(&emb_tnef);
@@ -328,7 +323,7 @@ void processTnef(TNEFStruct *tnef) {
                     emb_tnef.Debug = tnef->Debug;
                     if (TNEFParseMemory((guchar *) filedata->data,
                             filedata->size, &emb_tnef) != -1) {
-                        processTnef(&emb_tnef);
+                        processTnef(&emb_tnef, tmpdir);
                         RealAttachment = 0;
                     }
                     TNEFFree(&emb_tnef);
@@ -352,11 +347,7 @@ void processTnef(TNEFStruct *tnef) {
                     sprintf(tmpname, "file_%03i.dat", count);
                     filename->data = tmpname;
                 }
-                if (filepath == NULL) {
-                    sprintf(ifilename, "%s", filename->data);
-                } else {
-                    sprintf(ifilename, "%s/%s", filepath, filename->data);
-                }
+                sprintf(ifilename, "%s/%s", tmpdir, filename->data);
                 for (i=0; i<strlen(ifilename); i++)
                     if (ifilename[i] == ' ')
                         ifilename[i] = '_';
@@ -383,7 +374,7 @@ void processTnef(TNEFStruct *tnef) {
     } /* while p!= null */
 }
 
-void saveVCard(TNEFStruct *tnef) {
+void saveVCard(TNEFStruct *tnef, char *tmpdir) {
     gchar ifilename[512];
     FILE *fptr;
     variableLength *vl;
@@ -391,34 +382,20 @@ void saveVCard(TNEFStruct *tnef) {
     dtr thedate;
     gint boolean, i;
 
+    g_assert (tmpdir != NULL);
+
     if ((vl = MAPIFindProperty(&(tnef->MapiProperties), PROP_TAG(PT_STRING8, PR_DISPLAY_NAME))) == MAPI_UNDEFINED) {
         if ((vl=MAPIFindProperty(&(tnef->MapiProperties), PROP_TAG(PT_STRING8, PR_COMPANY_NAME))) == MAPI_UNDEFINED) {
             if (tnef->subject.size > 0) {
-                if (filepath == NULL) {
-                    sprintf(ifilename, "%s.vcard", tnef->subject.data);
-                } else {
-                    sprintf(ifilename, "%s/%s.vcard", filepath, tnef->subject.data);
-                }
+                sprintf(ifilename, "%s/%s.vcard", tmpdir, tnef->subject.data);
             } else {
-                if (filepath == NULL) {
-                    sprintf(ifilename, "unknown.vcard");
-                } else {
-                    sprintf(ifilename, "%s/unknown.vcard", filepath);
-                }
+                sprintf(ifilename, "%s/unknown.vcard", tmpdir);
             }
         } else {
-            if (filepath == NULL) {
-                sprintf(ifilename, "%s.vcard", vl->data);
-            } else {
-                sprintf(ifilename, "%s/%s.vcard", filepath, vl->data);
-            }
+            sprintf(ifilename, "%s/%s.vcard", tmpdir, vl->data);
         }
     } else {
-        if (filepath == NULL) {
-            sprintf(ifilename, "%s.vcard", vl->data);
-        } else {
-            sprintf(ifilename, "%s/%s.vcard", filepath, vl->data);
-        }
+        sprintf(ifilename, "%s/%s.vcard", tmpdir, vl->data);
     }
     for (i=0; i<strlen(ifilename); i++)
         if (ifilename[i] == ' ')
@@ -862,7 +839,7 @@ void printRrule(FILE *fptr, gchar *recur
     fprintf(fptr, "\n");
 }
 
-void saveVCalendar(TNEFStruct *tnef) {
+void saveVCalendar(TNEFStruct *tnef, char *tmpdir) {
     gchar ifilename[256];
     variableLength *filename;
     gchar *charptr, *charptr2;
@@ -872,11 +849,9 @@ void saveVCalendar(TNEFStruct *tnef) {
     DDWORD ddword_val;
     dtr thedate;
 
-    if (filepath == NULL) {
-        sprintf(ifilename, "calendar.vcf");
-    } else {
-        sprintf(ifilename, "%s/calendar.vcf", filepath);
-    }
+    g_assert (tmpdir != NULL);
+
+    sprintf(ifilename, "%s/calendar.vcf", tmpdir);
     printf("%s\n", ifilename);
 
     if ((fptr = fopen(ifilename, "wb"))==NULL) {
@@ -1118,7 +1093,7 @@ void saveVCalendar(TNEFStruct *tnef) {
     }
 }
 
-void saveVTask(TNEFStruct *tnef) {
+void saveVTask(TNEFStruct *tnef, char *tmpdir) {
     variableLength *vl;
     variableLength *filename;
     gint index,i;
@@ -1129,6 +1104,8 @@ void saveVTask(TNEFStruct *tnef) {
     DDWORD *ddword_ptr;
     DDWORD ddword_val;
 
+    g_assert (tmpdir != NULL);
+
     vl = MAPIFindProperty(&(tnef->MapiProperties), PROP_TAG(PT_STRING8, PR_CONVERSATION_TOPIC));
 
     if (vl == MAPI_UNDEFINED) {
@@ -1139,11 +1116,7 @@ void saveVTask(TNEFStruct *tnef) {
     while (vl->data[index] == ' ')
             vl->data[index--] = 0;
 
-    if (filepath == NULL) {
-        sprintf(ifilename, "%s.vcf", vl->data);
-    } else {
-        sprintf(ifilename, "%s/%s.vcf", filepath, vl->data);
-    }
+    sprintf(ifilename, "%s/%s.vcf", tmpdir, vl->data);
     for (i=0; i<strlen(ifilename); i++)
         if (ifilename[i] == ' ')
             ifilename[i] = '_';
