----- Original Message ----- 
From: "Cor Bosman" <[email protected]>
To: "Roland Liebl" <[email protected]>
Sent: Monday, June 01, 2009 9:31 AM
Subject: Re: [RCD] Plugin WIKI page


> Hi Roland,  a tip concerning your limit recipients plugin. Check out 
> function imap->decode_address_list().
> You can feed it a ['header']['from'] and it will return an array of  valid 
> recipients. Much cleaner than what you do now.
>
> I had to find that myself as well..unfortunately the docs dont mention 
> such handy functions.
>
> Cor
>
>
>

Thanks for the hint. Next update of limit_recipients will do the check by 
...

  function check_recipients($args){

    $rcmail = rcmail::get_instance();

    $recipients = 
count($rcmail->imap->decode_address_list($args['headers']['To'])) +
                  
count($rcmail->imap->decode_address_list($args['headers']['Cc'])) 
+
                  
count($rcmail->imap->decode_address_list($args['headers']['Bcc']));

    if($recipients > $rcmail->config->get('limit_recipients')){
      if($rcmail->config->get('limit_recipients_log')){
        $this->log("Limit Recipients: " . $recipients . " > " . 
$rcmail->config->get('limit_recipients') . " --> " . $_SESSION['username'] . 
" --> IP: " . $this->getVisitorIP());
      }
      $this->add_texts('localization/');
      
$rcmail->output->command('display_message',sprintf(rcube_label('limit_recipients_msg','limit_recipients'),$rcmail->config->get('limit_recipients')),'error');
      $rcmail->output->send('iframe');
    }

    return $args;

  } 


_______________________________________________
List info: http://lists.roundcube.net/dev/

Reply via email to