tag and mention handling in private mail (which required refactoring the bbcode cleanup stuff in mod_item)

This commit is contained in:
zotlabs
2016-12-13 20:01:38 -08:00
parent 8e400e9e40
commit 0394a3e939
5 changed files with 76 additions and 78 deletions

View File

@@ -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