]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/maildaemon.php
Take token field out of foreign_link
[quix0rs-gnu-social.git] / scripts / maildaemon.php
index 3f5402becb37113067e7767b6b2b65794549eb6a..91c257adb451fd468af1a5da305beee297580c27 100755 (executable)
@@ -317,10 +317,16 @@ class MailerDaemon
         } else if ($parsed->ctype_primary == 'text'
             && $parsed->ctype_secondary=='plain') {
             $msg = $parsed->body;
+            if(strtolower($parsed->ctype_parameters['charset']) != "utf-8"){
+                $msg = utf8_encode($msg);
+            }
         }else if(!empty($parsed->body)){
-            $attachment = tmpfile();
-            fwrite($attachment, $parsed->body);
-            $attachments[] = $attachment;
+            if(common_config('attachments', 'uploads')){
+                //only save attachments if uploads are enabled
+                $attachment = tmpfile();
+                fwrite($attachment, $parsed->body);
+                $attachments[] = $attachment;
+            }
         }
     }
 
@@ -379,5 +385,7 @@ class MailerDaemon
     }
 }
 
-$md = new MailerDaemon();
-$md->handle_message('php://stdin');
+if (common_config('emailpost', 'enabled')) {
+    $md = new MailerDaemon();
+    $md->handle_message('php://stdin');
+}