T1371: Use rcube_mime::decode_address_list() instead of (invalid) regex
.. to extract invitation sender email. Fixes T1371.
This commit is contained in:
parent
a9f51f2d4d
commit
eeeec754f9
1 changed files with 6 additions and 3 deletions
|
@ -59,7 +59,6 @@ class libcalendaring extends rcube_plugin
|
|||
);
|
||||
|
||||
private static $instance;
|
||||
private static $email_regex = '/([a-z0-9][a-z0-9\-\.\+\_]*@[^&@"\'.][^@&"\']*\\.([^\\x00-\\x40\\x5b-\\x60\\x7b-\\x7f]{2,}|xn--[a-z0-9]{2,}))/';
|
||||
|
||||
private $mail_ical_parser;
|
||||
|
||||
|
@ -1350,13 +1349,16 @@ class libcalendaring extends rcube_plugin
|
|||
$this->mail_ical_parser->mime_id = $mime_id;
|
||||
|
||||
// store the message's sender address for comparisons
|
||||
$this->mail_ical_parser->sender = preg_match(self::$email_regex, $this->ical_message->headers->from, $m) ? $m[1] : '';
|
||||
$from = rcube_mime::decode_address_list($this->ical_message->headers->from, 1, true, null, true);
|
||||
$this->mail_ical_parser->sender = !empty($from) ? $from[1] : '';
|
||||
|
||||
if (!empty($this->mail_ical_parser->sender)) {
|
||||
foreach ($this->mail_ical_parser->objects as $i => $object) {
|
||||
$this->mail_ical_parser->objects[$i]['_sender'] = $this->mail_ical_parser->sender;
|
||||
$this->mail_ical_parser->objects[$i]['_sender_utf'] = rcube_utils::idn_to_utf8($this->mail_ical_parser->sender);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1405,7 +1407,8 @@ class libcalendaring extends rcube_plugin
|
|||
$object['_method'] = $parser->method;
|
||||
|
||||
// store the message's sender address for comparisons
|
||||
$object['_sender'] = preg_match(self::$email_regex, $headers->from, $m) ? $m[1] : '';
|
||||
$from = rcube_mime::decode_address_list($headers->from, 1, true, null, true);
|
||||
$object['_sender'] = !empty($from) ? $from[1] : '';
|
||||
$object['_sender_utf'] = rcube_utils::idn_to_utf8($object['_sender']);
|
||||
|
||||
// check if this is an instance of a recurring event/task
|
||||
|
|
Loading…
Add table
Reference in a new issue