From ad86cc24c843ee577df508ba4d03c34788bec991 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 23 Sep 2014 04:34:35 -0700 Subject: d* PM cont. --- include/diaspora.php | 11 ++++++++++- include/message.php | 2 -- include/notifier.php | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/diaspora.php b/include/diaspora.php index 74dad177a..c71d04fbe 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -2668,7 +2668,7 @@ function diaspora_send_mail($item,$owner,$contact) { $r = q("select * from conv where id = %d and uid = %d limit 1", intval($item['convid']), - intval($item['uid']) + intval($item['channel_id']) ); if(! count($r)) { @@ -2685,6 +2685,15 @@ function diaspora_send_mail($item,$owner,$contact) { 'participant_handles' => xmlify($cnv['recips']) ); + if(array_key_exists('mail_flags',$item) && ($item['mail_flags'] & MAIL_OBSCURED)) { + $key = get_config('system','prvkey'); +// if($item['title']) +// $item['title'] = crypto_unencapsulate(json_decode_plus($item['title']),$key); + if($item['body']) + $item['body'] = crypto_unencapsulate(json_decode_plus($item['body']),$key); + } + + $body = bb2diaspora($item['body']); $created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C'); diff --git a/include/message.php b/include/message.php index 6aba899f7..88cfb7ba2 100644 --- a/include/message.php +++ b/include/message.php @@ -284,9 +284,7 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) { $r[$k]['to'] = find_xchan_in_array($rr['to_xchan'],$c); $r[$k]['seen'] = (($rr['mail_flags'] & MAIL_SEEN) ? 1 : 0); if($r[$k]['mail_flags'] & MAIL_OBSCURED) { - logger('unencrypting'); $key = get_config('system','prvkey'); - if($r[$k]['title']) $r[$k]['title'] = crypto_unencapsulate(json_decode_plus($r[$k]['title']),$key); if($r[$k]['body']) diff --git a/include/notifier.php b/include/notifier.php index 47072415b..79a6886ad 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -158,7 +158,7 @@ function notifier_run($argv, $argc){ $message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1", intval($item_id) ); - if(! count($message)){ + if(! $message) { return; } xchan_mail_query($message[0]); -- cgit v1.2.3