From 15bc7f666ca2f73a6317b086e9f626885dc52263 Mon Sep 17 00:00:00 2001 From: ebullient Date: Wed, 11 Jun 2003 20:41:39 +0000 Subject: [PATCH] align cases so they're easier to find.. {} and comments for the bigger blocks git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5005 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_general.php | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/functions/imap_general.php b/functions/imap_general.php index eb044690..7d2f8ae8 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -113,7 +113,13 @@ function sqimap_read_data_list ($imap_stream, $tag_uid, $handle_errors, &$respon $char = $read{0}; switch ($char) { - case $tag{0}: + case '+': + default: + $read = sqimap_fgets($imap_stream); + break; + + case $tag{0}: + { /* get the command */ $arg = ''; $i = strlen($tag)+1; @@ -125,15 +131,15 @@ function sqimap_read_data_list ($imap_stream, $tag_uid, $handle_errors, &$respon if ($arg && $found_tag==$tag) { switch ($arg) { - case 'OK': - case 'BAD': - case 'NO': - case 'BYE': - case 'PREAUTH': + case 'OK': + case 'BAD': + case 'NO': + case 'BYE': + case 'PREAUTH': $response = $arg; $message = trim(substr($read,$i+strlen($arg))); break 3; - default: + default: /* this shouldn't happen */ $response = $arg; $message = trim(substr($read,$i+strlen($arg))); @@ -145,7 +151,10 @@ function sqimap_read_data_list ($imap_stream, $tag_uid, $handle_errors, &$respon $read = sqimap_fgets($imap_stream); break; } - case '*': + } // end case $tag{0} + + case '*': + { if (preg_match('/^\*\s\d+\sFETCH/',$read)) { /* check for literal */ $s = substr($read,-3); @@ -209,20 +218,19 @@ function sqimap_read_data_list ($imap_stream, $tag_uid, $handle_errors, &$respon break 1; } break; - case '+': - $read = sqimap_fgets($imap_stream); - break; - default: - $read = sqimap_fgets($imap_stream); - break; - } + } // end case '*' + } // end switch } + + /* Set $resultlist array */ if (!empty($data)) { $resultlist[] = $data; } elseif (empty($resultlist)) { $resultlist[] = array(); } + + /* Return result or handle errors */ if ($handle_errors == false) { return( $resultlist ); } -- 2.25.1