diff plugins/thunderbird_labels/thunderbird_labels.php @ 20:c3a974bdb435

a bit further on flag+parm
author Charlie Root
date Tue, 16 Jan 2018 13:09:08 -0500
parents 49706603be30
children 678dcc5152a8
line wrap: on
line diff
--- a/plugins/thunderbird_labels/thunderbird_labels.php	Mon Jan 15 10:29:29 2018 -0500
+++ b/plugins/thunderbird_labels/thunderbird_labels.php	Tue Jan 16 13:09:08 2018 -0500
@@ -330,7 +330,7 @@
 		{
 			#rcube::write_log($this->name, print_r($message->flags, true));
 			$message->list_flags['extra_flags']['tb_labels'] = array(); # always set extra_flags, needed for javascript later!
-			if (is_array($message->flags))
+			$message->list_flags['extra_flags']['tb_parms'] = array();
 			foreach ($message->flags as $flagname => $flagvalue)
 			{
 				$flag = is_numeric("$flagvalue")? $flagname:$flagvalue;// for compatibility with < 0.5.4
@@ -339,7 +339,15 @@
 				{
 					$flag_no = preg_replace('/^\$?label/', '', $flag);
 					rcube::write_log($this->name, "Flag:".$flag." Flag_no:".$flag_no);
-					$message->list_flags['extra_flags']['tb_labels'][] = (int)$flag_no;
+					if ($ppos = strpos($flag_no,'_') > -1) {
+					  // We have a flag parameter value...
+					  $message->list_flags['extra_flags']['tb_lparms'][]=array(
+                                         'number' => substr($flag_no,0,$ppos),
+					 'parm' => substr($flag_no,$ppos+1));
+					}
+					else {
+					  $message->list_flags['extra_flags']['tb_labels'][] = (int)$flag_no;
+					}
 				}
 			}
 		}