Mercurial > hg > rc1
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 19:49706603be30 | 20:c3a974bdb435 |
|---|---|
| 328 // loop over all messages and add $LabelX info to the extra_flags | 328 // loop over all messages and add $LabelX info to the extra_flags |
| 329 foreach($args['messages'] as $message) | 329 foreach($args['messages'] as $message) |
| 330 { | 330 { |
| 331 #rcube::write_log($this->name, print_r($message->flags, true)); | 331 #rcube::write_log($this->name, print_r($message->flags, true)); |
| 332 $message->list_flags['extra_flags']['tb_labels'] = array(); # always set extra_flags, needed for javascript later! | 332 $message->list_flags['extra_flags']['tb_labels'] = array(); # always set extra_flags, needed for javascript later! |
| 333 if (is_array($message->flags)) | 333 $message->list_flags['extra_flags']['tb_parms'] = array(); |
| 334 foreach ($message->flags as $flagname => $flagvalue) | 334 foreach ($message->flags as $flagname => $flagvalue) |
| 335 { | 335 { |
| 336 $flag = is_numeric("$flagvalue")? $flagname:$flagvalue;// for compatibility with < 0.5.4 | 336 $flag = is_numeric("$flagvalue")? $flagname:$flagvalue;// for compatibility with < 0.5.4 |
| 337 $flag = strtolower($flag); | 337 $flag = strtolower($flag); |
| 338 if (preg_match('/^\$?label/', $flag)) | 338 if (preg_match('/^\$?label/', $flag)) |
| 339 { | 339 { |
| 340 $flag_no = preg_replace('/^\$?label/', '', $flag); | 340 $flag_no = preg_replace('/^\$?label/', '', $flag); |
| 341 rcube::write_log($this->name, "Flag:".$flag." Flag_no:".$flag_no); | 341 rcube::write_log($this->name, "Flag:".$flag." Flag_no:".$flag_no); |
| 342 $message->list_flags['extra_flags']['tb_labels'][] = (int)$flag_no; | 342 if ($ppos = strpos($flag_no,'_') > -1) { |
| 343 // We have a flag parameter value... | |
| 344 $message->list_flags['extra_flags']['tb_lparms'][]=array( | |
| 345 'number' => substr($flag_no,0,$ppos), | |
| 346 'parm' => substr($flag_no,$ppos+1)); | |
| 347 } | |
| 348 else { | |
| 349 $message->list_flags['extra_flags']['tb_labels'][] = (int)$flag_no; | |
| 350 } | |
| 343 } | 351 } |
| 344 } | 352 } |
| 345 } | 353 } |
| 346 return($args); | 354 return($args); |
| 347 } | 355 } |
