aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-06-15 23:07:39 +0200
committerMario <mario@mariovavti.com>2019-06-15 23:07:39 +0200
commit3bc214e5449c7ce190a35ae6e70a1fb7ebe84962 (patch)
tree2687f7ec477ab98c2488d430ffcf79731a85e198
parenta26774b99e1cf3e69df4f527e2c4c4443dce63ad (diff)
parent43cec4398d0d035dd9446988134b814513a73080 (diff)
downloadvolse-hubzilla-3bc214e5449c7ce190a35ae6e70a1fb7ebe84962.tar.gz
volse-hubzilla-3bc214e5449c7ce190a35ae6e70a1fb7ebe84962.tar.bz2
volse-hubzilla-3bc214e5449c7ce190a35ae6e70a1fb7ebe84962.zip
Merge branch 'dev' into 'dev'
Add signatures processing for private messages See merge request hubzilla/core!1670
-rw-r--r--Zotlabs/Module/Mail.php9
-rwxr-xr-xinclude/items.php4
-rw-r--r--include/message.php5
-rwxr-xr-xview/tpl/mail_conv.tpl2
-rwxr-xr-xview/tpl/prv_message.tpl1
5 files changed, 15 insertions, 6 deletions
diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php
index 3202d38a5..7c344966b 100644
--- a/Zotlabs/Module/Mail.php
+++ b/Zotlabs/Module/Mail.php
@@ -25,6 +25,10 @@ class Mail extends \Zotlabs\Web\Controller {
$expires = ((x($_REQUEST,'expires')) ? datetime_convert(date_default_timezone_get(),'UTC', $_REQUEST['expires']) : NULL_DATE);
$raw = ((x($_REQUEST,'raw')) ? intval($_REQUEST['raw']) : 0);
$mimetype = ((x($_REQUEST,'mimetype')) ? notags(trim($_REQUEST['mimetype'])) : 'text/bbcode');
+
+ $sig = ((x($_REQUEST,'signature')) ? trim($_REQUEST['signature']) : '');
+ if(strpos($sig,'b64.') === 0)
+ $sig = base64_decode(str_replace('b64.', '', $sig));
if($preview) {
@@ -123,7 +127,7 @@ class Mail extends \Zotlabs\Web\Controller {
// We have a local_channel, let send_message use the session channel and save a lookup
- $ret = send_message(0, $recipient, $body, $subject, $replyto, $expires, $mimetype, $raw);
+ $ret = send_message(0, $recipient, $body, $subject, $replyto, $expires, $mimetype, $raw, $sig);
if($ret['success']) {
xchan_mail_query($ret['mail']);
@@ -396,8 +400,9 @@ class Mail extends \Zotlabs\Web\Controller {
'can_recall' => ($channel['channel_hash'] == $message['from_xchan']),
'is_recalled' => (intval($message['mail_recalled']) ? t('Message has been recalled.') : ''),
'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'], 'c'),
+ 'sig' => base64_encode($message['sig'])
);
-
+
$seen = $message['seen'];
}
diff --git a/include/items.php b/include/items.php
index 9ceb91519..0af119cc9 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1457,6 +1457,7 @@ function encode_mail($item,$extended = false) {
$x['to'] = encode_item_xchan($item['to']);
$x['raw'] = $item['mail_raw'];
$x['mimetype'] = $item['mail_mimetype'];
+ $x['sig'] = $item['sig'];
if($item['attach'])
$x['attach'] = json_decode($item['attach'],true);
@@ -1516,6 +1517,9 @@ function get_mail_elements($x) {
$arr['expires'] = datetime_convert('UTC','UTC',$x['expires']);
$arr['mail_flags'] = 0;
+
+ if(array_key_exists('sig',$x))
+ $arr['sig'] = $x['sig'];
if($x['flags'] && is_array($x['flags'])) {
if(in_array('recalled',$x['flags'])) {
diff --git a/include/message.php b/include/message.php
index 2486beb83..7d05b9ab7 100644
--- a/include/message.php
+++ b/include/message.php
@@ -19,7 +19,7 @@ function mail_prepare_binary($item) {
// send a private message
-function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $replyto = '', $expires = NULL_DATE, $mimetype = 'text/bbcode', $raw = false) {
+function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $replyto = '', $expires = NULL_DATE, $mimetype = 'text/bbcode', $raw = false, $sig = '') {
$ret = array('success' => false);
$is_reply = false;
@@ -175,8 +175,7 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep
$subject = str_rot47(base64url_encode($subject));
if(($body )&& (! $raw))
$body = str_rot47(base64url_encode($body));
-
- $sig = ''; // placeholder
+
$mimetype = ''; //placeholder
$r = q("INSERT INTO mail ( account_id, conv_guid, mail_obscured, channel_id, from_xchan, to_xchan, mail_mimetype, title, body, sig, attach, mid, parent_mid, created, expires, mail_isreply, mail_raw )
diff --git a/view/tpl/mail_conv.tpl b/view/tpl/mail_conv.tpl
index cd810e999..b0497fe99 100755
--- a/view/tpl/mail_conv.tpl
+++ b/view/tpl/mail_conv.tpl
@@ -1,4 +1,4 @@
-<div id="mail-{{$mail.id}}" class="mb-2 clearfix mail-conv-outside-wrapper">
+<div id="mail-{{$mail.id}}" class="mb-2 clearfix mail-conv-outside-wrapper"{{if $mail.sig}} data-sig="{{$mail.sig}}"{{/if}}>
<div class="mb-2 clearfix wall-item-head">
<div class="wall-item-info" >
<a href="{{$mail.from_url}}"><img class="wall-item-photo" src="{{$mail.from_photo}}" alt="{{$mail.from_name}}" /></a>
diff --git a/view/tpl/prv_message.tpl b/view/tpl/prv_message.tpl
index 59472f7d4..b8c81539d 100755
--- a/view/tpl/prv_message.tpl
+++ b/view/tpl/prv_message.tpl
@@ -11,6 +11,7 @@
<input type="hidden" id="inp-prvmail-expires" name="expires" value="{{$defexpire}}" />
<input type="hidden" name="media_str" id="jot-media" value="" />
<input type="hidden" name="preview" id="mail-preview" value="0" />
+ <input type="hidden" name="signature" id="mail-sig" value="" />
{{if $new}}
<div class="form-group">
<label for="recip">{{$to}}</label>