Mercurial > hg > rc1
changeset 31:b2d0a9781472
add whitelisting
author | Charlie Root |
---|---|
date | Tue, 13 Mar 2018 13:01:26 -0400 |
parents | 7498e7cacd71 |
children | f8b3ac77e951 |
files | plugins/thunderbird_labels/thunderbird_labels.php |
diffstat | 1 files changed, 26 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/thunderbird_labels/thunderbird_labels.php Tue Mar 13 12:59:17 2018 -0400 +++ b/plugins/thunderbird_labels/thunderbird_labels.php Tue Mar 13 13:01:26 2018 -0400 @@ -45,6 +45,9 @@ $this->add_hook('message_load', array($this, 'read_single_flags')); $this->add_hook('template_object_messageheaders', array($this, 'color_headers')); $this->add_hook('render_page', array($this, 'tblabelpopup')); + $this->add_hook('message_outgoing_headers', array($this, 'whiteMessage')); + # The above hook is described as 'Depracated', but no alternative for + # non-intrusive access to the headers is available $this->include_stylesheet($this->local_skin_path() . '/tb_label.css'); $this->name = get_class($this); @@ -64,7 +67,6 @@ # Afeter ul.appendnd -- inside menu.show on 307 # 567? Yes -- that's calling 'hide', but overriding # doesn't fix :-( - #rcube::write_log('lab','add_button'); $this->add_button( array( #'command' => 'plugin.thunderbird_labels.rcm_tb_label_submenu', @@ -87,6 +89,7 @@ // JS function "set_flags" => PHP function "set_flags" $this->register_action('plugin.thunderbird_labels.set_flags', array($this, 'set_flags')); + rcube::write_log('lab','set_flags registered'); if (method_exists($this, 'require_plugin') && in_array('contextmenu', $this->rc->config->get('plugins')) @@ -325,7 +328,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; } } @@ -547,5 +550,26 @@ #rcube::write_log('lab',"tblp $out"); $this->rc->output->add_footer($out); } + + public static function whiteMessage($data) { + require_once 'Mail/RFC822.php'; + $hdrs = $data['headers']; + $to = $hdrs['To']; + $cc = $hdrs['Cc']; + $addrs = Mail_RFC822::parseAddressList($to); + if ($cc) { + foreach (Mail_RFC822::parseAddressList($cc) as $addr) { + $addrs[]=$addr; + } + } + #rcube::write_log('lab',"cc: ".print_r($cca,true)); + $wp = popen("/usr/local/bin/makeWhite.sh >>/var/log/white.log 2>&1",'w'); + foreach ($addrs as $addr) { + fwrite($wp,$addr->mailbox.'@'.$addr->host."\n"); + } + fclose($wp); + return $data; + } + }