aboutsummaryrefslogtreecommitdiffstats
path: root/mod/message.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/message.php')
-rw-r--r--mod/message.php64
1 files changed, 52 insertions, 12 deletions
diff --git a/mod/message.php b/mod/message.php
index 98a1067ed..f5a60b73b 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -9,13 +9,20 @@ require_once('include/Contact.php');
function message_aside(&$a) {
- $a->set_widget('newmessage',replace_macros(get_markup_template('message_side.tpl'), array(
+ $a->set_widget('msgaside',replace_macros(get_markup_template('message_side.tpl'), array(
'$tabs'=> array(),
+
+ '$check'=>array(
+ 'label' => t('Check Mail'),
+ 'url' => $a->get_baseurl(true) . '/message',
+ 'sel' => (argv(1) == ''),
+ ),
'$new'=>array(
'label' => t('New Message'),
'url' => $a->get_baseurl(true) . '/message/new',
'sel'=> (argv(1) == 'new'),
)
+
)));
}
@@ -41,7 +48,7 @@ function message_post(&$a) {
$ret = zot_finger($rstr,$channel);
- if(! $ret) {
+ if(! $ret['success']) {
notice( t('Unable to lookup recipient.') . EOL);
return;
}
@@ -160,9 +167,10 @@ function item_redir_and_replace_images($body, $images, $cid) {
$newbody = '';
for($i = 0; $i < count($images); $i++) {
- $search = '/\[url\=(.*?)\]\[!#saved_image' . $i . '#!\]\[\/url\]' . '/is';
- $replace = '[url=' . z_path() . '/redir/' . $cid
- . '?f=1&url=' . '$1' . '][!#saved_image' . $i . '#!][/url]' ;
+ $search = '/\[zrl\=(.*?)\]\[!#saved_image' . $i . '#!\]\[\/zrl\]' . '/is';
+//FIXME
+ $replace = '[zrl=' . z_path() . '/redir/' . $cid
+ . '?f=1&url=' . '$1' . '][!#saved_image' . $i . '#!][/zrl]' ;
$img_end = strpos($origbody, '[!#saved_image' . $i . '#!][/url]') + strlen('[!#saved_image' . $i . '#!][/url]');
$process_part = substr($origbody, 0, $img_end);
@@ -198,6 +206,7 @@ function message_content(&$a) {
}
$channel = $a->get_channel();
+ head_set_icon($channel['xchan_photo_s']);
$tpl = get_markup_template('mail_head.tpl');
$header = replace_macros($tpl, array(
@@ -240,7 +249,7 @@ function message_content(&$a) {
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
- '$nickname' => $channel['channel_addr'],
+ '$nickname' => $channel['channel_address'],
'$linkurl' => t('Please enter a link URL:')
));
@@ -284,6 +293,7 @@ function message_content(&$a) {
'$select' => $select,
'$parent' => '',
'$upload' => t('Upload photo'),
+ '$attach' => t('Attach file'),
'$insert' => t('Insert web link'),
'$wait' => t('Please wait'),
'$submit' => t('Submit')
@@ -362,10 +372,39 @@ function message_content(&$a) {
foreach($messages as $message) {
-// FIXME
-// $extracted = item_extract_images($message['body']);
-// if($extracted['images'])
-// $message['body'] = item_redir_and_replace_images($extracted['body'], $extracted['images'], $message['contact-id']);
+ $s = $arr = '';
+
+ if($message['attach'])
+ $arr = json_decode_plus($message['attach']);
+ if($arr) {
+ $s .= '<div class="body-attach">';
+ foreach($arr as $r) {
+ $matches = false;
+ $icon = '';
+ $icontype = substr($r['type'],0,strpos($r['type'],'/'));
+
+ switch($icontype) {
+ case 'video':
+ case 'audio':
+ case 'image':
+ case 'text':
+ $icon = '<div class="attachtype icon s22 type-' . $icontype . '"></div>';
+ break;
+ default:
+ $icon = '<div class="attachtype icon s22 type-unkn"></div>';
+ break;
+ }
+
+ $title = htmlentities($r['title'], ENT_COMPAT,'UTF-8');
+ if(! $title)
+ $title = t('unknown.???');
+ $title .= ' ' . $r['length'] . ' ' . t('bytes');
+
+ $url = $a->get_baseurl() . '/magic?f=&hash=' . $message['from_xchan'] . '&dest=' . $r['href'] . '/' . $r['revision'];
+ $s .= '<a href="' . $url . '" title="' . $title . '" class="attachlink" >' . $icon . '</a>';
+ }
+ $s .= '<div class="clear"></div></div>';
+ }
$mails[] = array(
'id' => $message['id'],
@@ -376,7 +415,7 @@ function message_content(&$a) {
'to_url' => chanlink_hash($message['to_xchan']),
'to_photo' => $message['to']['xchan_photo_m'],
'subject' => $message['title'],
- 'body' => smilies(bbcode($message['body'])),
+ 'body' => smilies(bbcode($message['body']) . $s),
'delete' => t('Delete message'),
'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'),
);
@@ -392,7 +431,7 @@ function message_content(&$a) {
// FIXME - move this HTML to template
$select = $message[$recp]['xchan_name'] . '<input type="hidden" name="messageto" value="' . $message[$recp]['xchan_hash'] . '" />';
- $parent = '<input type="hidden" name="replyto" value="' . $message['parent_uri'] . '" />';
+ $parent = '<input type="hidden" name="replyto" value="' . $message['parent_mid'] . '" />';
$tpl = get_markup_template('mail_display.tpl');
$o = replace_macros($tpl, array(
@@ -416,6 +455,7 @@ function message_content(&$a) {
'$select' => $select,
'$parent' => $parent,
'$upload' => t('Upload photo'),
+ '$attach' => t('Attach file'),
'$insert' => t('Insert web link'),
'$submit' => t('Submit'),
'$wait' => t('Please wait')