changeset 2:c828b0fd4a6e

fix missing line to store changed labels
author Charlie Root
date Fri, 05 Jan 2018 14:17:23 -0500
parents 5821049f1791
children f6fe4b6ae66a
files plugins/thunderbird_labels/thunderbird_labels.php
diffstat 1 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/thunderbird_labels/thunderbird_labels.php	Thu Jan 04 16:23:36 2018 -0500
+++ b/plugins/thunderbird_labels/thunderbird_labels.php	Fri Jan 05 14:17:23 2018 -0500
@@ -207,7 +207,8 @@
 	// save prefs after modified in UI  
 	public function prefs_save($args)
 	{
-		if ($args['section'] != 'thunderbird_labels')
+	  rcube::write_log('lab','saving: '.print_r($args,true));
+	if ($args['section'] != 'thunderbird_labels')
 		  return $args;
 
 		
@@ -232,6 +233,7 @@
 		  for ($i = 1; $i <= $max_id; $i++) {
 		    $tb_lab_prefs[$i] = rcube_utils::get_input_value('tb_label_custom_labels'.$i, rcube_utils::INPUT_POST);
 		  }
+		  $args['prefs']['tb_label_custom_labels'] = $tb_lab_prefs;
 		}
 	
 		return $args;
@@ -267,7 +269,7 @@
 	
 	public function read_single_flags($args)
 	{
-		#rcube::write_log($this->name, print_r(($args['object']), true));
+		rcube::write_log($this->name, print_r(($args['object']), true));
 		if (!isset($args['object'])) {
 				return;
 		}
@@ -282,7 +284,7 @@
 				if (preg_match('/^\$?label/', $flag))
 				{
 					$flag_no = preg_replace('/^\$?label/', '', $flag);
-					#rcube::write_log($this->name, "Single message Flag: ".$flag." Flag_no:".$flag_no);
+					rcube::write_log($this->name, "Single message Flag: ".$flag." Flag_no:".$flag_no);
 					$this->message_tb_labels[] = (int)$flag_no;
 				}
 			}
@@ -296,7 +298,7 @@
 	*/
 	public function color_headers($p)
 	{
-		#rcube::write_log($this->name, print_r($p, true));
+		rcube::write_log($this->name, print_r($p, true));
 		# -- always write array, even when empty
 		$p['content'] .= '<script type="text/javascript">
 		var tb_labels_for_message = ['.join(',', $this->message_tb_labels).'];
@@ -306,7 +308,7 @@
 	
 	public function read_flags($args)
 	{
-		#rcube::write_log($this->name, print_r($args, true));
+		rcube::write_log($this->name, print_r($args, true));
 		// add color information for all messages
 		// dont loop over all messages if we dont have any highlights or no msgs
 		if (!isset($args['messages']) or !is_array($args['messages'])) {
@@ -316,7 +318,7 @@
 		// loop over all messages and add $LabelX info to the extra_flags
 		foreach($args['messages'] as $message)
 		{
-			#rcube::write_log($this->name, print_r($message->flags, true));
+			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))
 			foreach ($message->flags as $flagname => $flagvalue)
@@ -326,7 +328,7 @@
 				if (preg_match('/^\$?label/', $flag))
 				{
 					$flag_no = preg_replace('/^\$?label/', '', $flag);
-					#rcube::write_log($this->name, "Flag:".$flag." Flag_no:".$flag_no);
+					rcube::write_log($this->name, "Flag:".$flag." Flag_no:".$flag_no);
 					$message->list_flags['extra_flags']['tb_labels'][] = (int)$flag_no;
 				}
 			}
@@ -337,7 +339,7 @@
 	// set flags in IMAP server
 	function set_flags()
 	{
-		#rcube::write_log($this->name, print_r($_GET, true));
+		rcube::write_log($this->name, print_r($_GET, true));
 
 		$imap = $this->rc->imap;
 		$cbox = rcube_utils::get_input_value('_cur', rcube_utils::INPUT_GET);
@@ -350,8 +352,8 @@
 		
 		$imap->conn->flags = array_merge($imap->conn->flags, $this->add_tb_flags);
 		
-		#rcube::write_log($this->name, print_r($flag_uids, true));
-		#rcube::write_log($this->name, print_r($unflag_uids, true));
+		rcube::write_log($this->name, print_r($flag_uids, true));
+		rcube::write_log($this->name, print_r($unflag_uids, true));
 
 		if (!is_array($unflag_uids)
 			|| !is_array($flag_uids))