aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-02-27 20:38:33 -0800
committerfriendica <info@friendica.com>2013-02-27 20:38:33 -0800
commit8275f14cea622b4c5d82fba43859a1ca729c10a7 (patch)
treecc434e62a2379ddd94470daaa0ebe27c0e0eae3b
parent5612716cff11039c64e1dba46bde5795f6b65c5c (diff)
downloadvolse-hubzilla-8275f14cea622b4c5d82fba43859a1ca729c10a7.tar.gz
volse-hubzilla-8275f14cea622b4c5d82fba43859a1ca729c10a7.tar.bz2
volse-hubzilla-8275f14cea622b4c5d82fba43859a1ca729c10a7.zip
mail recall - just set mail_flags = mail_flags & MAIL_RECALLED and tell the notifier. We'll need a special button for this. Also should probably report whether it was seen or not. Will do that another day.
-rw-r--r--boot.php1
-rwxr-xr-xinclude/items.php15
-rw-r--r--include/zot.php11
3 files changed, 26 insertions, 1 deletions
diff --git a/boot.php b/boot.php
index 567242d90..e46c8cd48 100644
--- a/boot.php
+++ b/boot.php
@@ -224,6 +224,7 @@ define ( 'MAIL_DELETED', 0x0001);
define ( 'MAIL_REPLIED', 0x0002);
define ( 'MAIL_ISREPLY', 0x0004);
define ( 'MAIL_SEEN', 0x0008);
+define ( 'MAIL_RECALLED', 0x0010);
define ( 'ATTACH_FLAG_DIR', 0x0001);
diff --git a/include/items.php b/include/items.php
index 5947e4912..3154ae5d5 100755
--- a/include/items.php
+++ b/include/items.php
@@ -773,6 +773,12 @@ function encode_mail($item) {
$x['from'] = encode_item_xchan($item['from']);
$x['to'] = encode_item_xchan($item['to']);
+ if($item['mail_flags'] & MAIL_RECALLED) {
+ $x['flags'] = 'recalled';
+ $x['title'] = '';
+ $x['body'] = '';
+ }
+
return $x;
}
@@ -786,6 +792,15 @@ function get_mail_elements($x) {
$arr['created'] = datetime_convert('UTC','UTC',$x['created']);
+ $arr['mail_flags'] = 0;
+
+ if($x['flags'] && is_array($x['flags'])) {
+ if(in_array('recalled',$x['flags'])) {
+ $arr['mail_flags'] &= MAIL_RECALLED;
+ }
+ }
+
+
if($arr['created'] > datetime_convert())
$arr['created'] = datetime_convert();
diff --git a/include/zot.php b/include/zot.php
index 60fec9316..b72e966bf 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -999,7 +999,16 @@ function process_mail_delivery($sender,$arr,$deliveries) {
intval($channel['channel_id'])
);
if($r) {
- logger('duplicate mail received');
+ if($arr['mail_flags'] & MAIL_RECALLED) {
+ $x = q("delete from mail where id = %d and channel_id = %d limit 1",
+ intval($r[0]['id']),
+ intval($channel['channel_id'])
+ );
+ logger('mail_recalled');
+ }
+ else {
+ logger('duplicate mail received');
+ }
continue;
}
else {