From 0b0225e28659e2e36ac706059a16097b58b93bb0 Mon Sep 17 00:00:00 2001 From: indiri69 Date: Wed, 14 Aug 2002 16:22:31 +0000 Subject: [PATCH] Added function to find a given entity type git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3303 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mime.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/functions/mime.php b/functions/mime.php index cc44fd61..74153d77 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -193,6 +193,23 @@ function mime_print_body_lines ($imap_stream, $id, $ent_id, $encoding) { /* -[ END MIME DECODING ]----------------------------------------------------------- */ +/* findDisplayEntity + * Checks to see if $message contains content of type $type0/$type1 + * returns the first entity number it finds of that type, or NULL if + * none is found. Takes optional argument $start to allow the caller + * to continue where they left off + */ +function findDisplayEntity($message, $type0, $type1, $start=0) { + if ($message) { + for ($i = $start;isset($message->entities[$i]); $i++) { + $entity = $message->entities[$i]; + if ($entity->type0 == $type0 && $entity->type1 == $type1) { + return $i; + } + } + } + return NULL; +} // This is here for debugging purposese. It will print out a list // of all the entity IDs that are in the $message object. @@ -1586,4 +1603,4 @@ function magicHTML($body, $id, $message, $mailbox = 'INBOX'){ return $trusted; } -?> \ No newline at end of file +?> -- 2.25.1