Skip to content

Commit

Permalink
Split out address generation
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Jan 16, 2015
1 parent a3664b6 commit 64c4ea0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
6 changes: 6 additions & 0 deletions imp/lib/Ajax/Queue.php
Expand Up @@ -459,6 +459,12 @@ public function message(IMP_Indices $indices, array $opts = array())
);
$msg = (object)$show_msg->showMessage();

foreach (array('from', 'to', 'cc', 'bcc') as $val) {
if ($tmp = $show_msg->getAddressHeader($val)) {
$msg->$val = $tmp;
}
}

$subject = $show_msg->getSubject();
$msg->subject = $subject['subject'];
if (!$subject['subject'] !== $subject['title']) {
Expand Down
11 changes: 0 additions & 11 deletions imp/lib/Contents/Message.php
Expand Up @@ -116,13 +116,9 @@ public function __construct(IMP_Indices $indices, $peek = false)
* - download: (string) The URL for the download all action.
* - label: (string) The attachment label.
* - list: (array) Attachment information.
* - bcc: (array) The Bcc addresses.
* - cc: (array) The CC addresses.
* - from: (array) The From addresses.
* - md: (array) Metadata.
* - msgtext: (string) The text of the message.
* - onepart: (boolean) True if message only contains one part.
* - to: (array) The To addresses.
*
* @throws IMP_Exception
*/
Expand All @@ -132,13 +128,6 @@ public function showMessage()

$result = array();

/* Build From/To/Cc/Bcc. */
foreach (array('from', 'to', 'cc', 'bcc') as $val) {
if ($tmp = $this->getAddressHeader($val)) {
$result[$val] = $tmp;
}
}

// Create message text and attachment list.
$result['msgtext'] = '';
$part_info = $this->part_info;
Expand Down
10 changes: 7 additions & 3 deletions imp/lib/Dynamic/Message.php
Expand Up @@ -83,12 +83,16 @@ protected function _init()

/* Need to be dynamically added, since formatting needs to be applied
* via javascript. */
foreach (array('from', 'to', 'cc', 'bcc', 'log') as $val) {
if (!empty($msg_res[$val])) {
$js_vars['ImpMessage.' . $val] = $msg_res[$val];
foreach (array('from', 'to', 'cc', 'bcc') as $val) {
if ($tmp = $show_msg->getAddressHeader($val)) {
$js_vars['ImpMessage.' . $val] = $tmp;
}
}

if (isset($msg_res['log'])) {
$js_vars['ImpMessage.log'] = $msg_res['log'];
}

$list_info = $show_msg->contents->getListInformation();
if (!empty($list_info['exists'])) {
$js_vars['ImpMessage.reply_list'] = true;
Expand Down

0 comments on commit 64c4ea0

Please sign in to comment.