From 0394a3e93957b5bb6574ca95e290e414ed049404 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 13 Dec 2016 20:01:38 -0800 Subject: tag and mention handling in private mail (which required refactoring the bbcode cleanup stuff in mod_item) --- include/message.php | 54 ++++++++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 32 deletions(-) (limited to 'include/message.php') diff --git a/include/message.php b/include/message.php index 95d8d9720..bde07afd8 100644 --- a/include/message.php +++ b/include/message.php @@ -16,6 +16,28 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep $a = get_app(); $observer_hash = get_observer_hash(); + + if($uid) { + $r = q("select * from channel where channel_id = %d limit 1", + intval($uid) + ); + if($r) + $channel = $r[0]; + } + else { + $channel = App::get_channel(); + } + + if(! $channel) { + $ret['message'] = t('Unable to determine sender.'); + return $ret; + } + + + $body = cleanup_bbcode($body); + $results = linkify_tags($a, $body, $uid); + + if(preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",((strpos($body,'[/crypt]')) ? $_POST['media_str'] : $body),$match)) $attaches = $match[1]; @@ -43,22 +65,6 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep $jattach = (($attachments) ? json_encode($attachments) : ''); - if($preview) { - - - - - - - - - - - } - - - - if(! $recipient) { $ret['message'] = t('No recipient provided.'); return $ret; @@ -67,22 +73,6 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep if(! strlen($subject)) $subject = t('[no subject]'); - if($uid) { - $r = q("select * from channel where channel_id = %d limit 1", - intval($uid) - ); - if($r) - $channel = $r[0]; - } - else { - $channel = App::get_channel(); - } - - if(! $channel) { - $ret['message'] = t('Unable to determine sender.'); - return $ret; - } - // look for any existing conversation structure -- cgit v1.2.3