Index: mailhandler.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mailhandler/mailhandler.module,v
retrieving revision 1.94
diff -u -u -r1.94 mailhandler.module
--- mailhandler.module	23 Oct 2007 02:08:28 -0000	1.94
+++ mailhandler.module	18 Jan 2008 07:54:35 -0000
@@ -1,18 +1,6 @@
 <?php
 // $Id: mailhandler.module,v 1.94 2007/10/23 02:08:28 weitzman Exp $
 
-// IMAP Primary MIME types.
-define('MAILHANDLER_MIME_TEXT', 0);
-define('MAILHANDLER_MIME_MULTIPART', 1);
-define('MAILHANDLER_MIME_MESSAGE', 2);
-define('MAILHANDLER_MIME_APPLICATION', 3);
-define('MAILHANDLER_MIME_AUDIO', 4);
-define('MAILHANDLER_MIME_IMAGE', 5);
-define('MAILHANDLER_MIME_VIDEO', 6);
-define('MAILHANDLER_MIME_OTHER', 7);
-define('MAILHANDLER_MIME_BASE64', 3);
-define('MAILHANDLER_MIME_QUOTED_PRINTABLE', 4);
-
 /**
  * Retrieve all msgs from a given mailbox and process them.
  */
@@ -412,17 +400,17 @@
         $part_number = '1';
       }
       $text = imap_fetchbody($stream, $msg_number, $part_number);
-      if ($structure->encoding == MAILHANDLER_MIME_BASE64) {
+      if ($structure->encoding == ENCBASE64) {
         return drupal_convert_to_utf8(imap_base64($text), $encoding);
       }
-      else if ($structure->encoding == MAILHANDLER_MIME_QUOTED_PRINTABLE) {
+      else if ($structure->encoding == ENCQUOTEDPRINTABLE) {
         return drupal_convert_to_utf8(quoted_printable_decode($text), $encoding);
       }
       else {
         return drupal_convert_to_utf8($text, $encoding);
       }
     }
-    if ($structure->type == MAILHANDLER_MIME_MULTIPART) { /* multipart */
+    if ($structure->type == TYPEMULTIPART) { /* multipart */
       while (list($index, $sub_structure) = each ($structure->parts)) {
         if ($part_number) {
           $prefix = $part_number .'.';
@@ -464,7 +452,7 @@
   }
 
   // Recurse into multipart messages.
-  if ($structure->type == MAILHANDLER_MIME_MULTIPART) {
+  if ($structure->type == TYPEMULTIPART) {
     // Restrict recursion depth.
     if ($depth >= $max_depth) {
       watchdog('mailhandler', t('Maximum recursion depths met in mailhander_get_structure_part for
@@ -511,7 +499,7 @@
   }
 
   // Handle Content-Disposition parameters for non-text types.
-  if ($structure->type != MAILHANDLER_MIME_TEXT && $structure->ifdparameters) {
+  if ($structure->type != TYPETEXT && $structure->ifdparameters) {
     foreach ($structure->dparameters as $parameter) {
       switch (strtoupper($parameter->attribute)) {
         case 'NAME':
@@ -533,15 +521,15 @@
   }
 
   // convert text attachment to UTF-8.
-  if ($structure->type == MAILHANDLER_MIME_TEXT) {
+  if ($structure->type == TYPETEXT) {
     $part->data = imap_utf8($part->data);
   }
   else {
     // If not text then decode as necessary
-    if ($structure->encoding == MAILHANDLER_MIME_BASE64) {
+    if ($structure->encoding == ENCBASE64) {
       $part->data = imap_base64($part->data);
     }
-    else if ($structure->encoding == MAILHANDLER_MIME_QUOTED_PRINTABLE) {
+    else if ($structure->encoding == ENCQUOTEDPRINTABLE) {
       $part->data = quoted_printable_decode($part->data);
     }
   }
