diff options
author | Wave <tuscanhobbit@users.noreply.github.com> | 2015-10-19 10:28:17 +0200 |
---|---|---|
committer | Wave <tuscanhobbit@users.noreply.github.com> | 2015-10-19 10:28:17 +0200 |
commit | 3e9b6a330d157ac8aa4831b57d33ec495345a9c7 (patch) | |
tree | 8c2539297a17b3f1409536b94dd4558c5a32bd08 /mod/dreport.php | |
parent | 319b02a757ced679d0eaf141cc40db585fa6f84b (diff) | |
parent | b54c4df74dd370c74d5822cdd00e0cf1ff52493f (diff) | |
download | volse-hubzilla-3e9b6a330d157ac8aa4831b57d33ec495345a9c7.tar.gz volse-hubzilla-3e9b6a330d157ac8aa4831b57d33ec495345a9c7.tar.bz2 volse-hubzilla-3e9b6a330d157ac8aa4831b57d33ec495345a9c7.zip |
Merge pull request #1 from redmatrix/master
Update to latest hubzilla
Diffstat (limited to 'mod/dreport.php')
-rw-r--r-- | mod/dreport.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/mod/dreport.php b/mod/dreport.php index 31a6274c8..c320bf0e6 100644 --- a/mod/dreport.php +++ b/mod/dreport.php @@ -7,14 +7,44 @@ function dreport_content(&$a) { return; } + $table = 'item'; + $channel = $a->get_channel(); $mid = ((argc() > 1) ? argv(1) : ''); + if($mid === 'mail') { + $table = 'mail'; + $mid = ((argc() > 2) ? argv(2) : ''); + } + + if(! $mid) { notice( t('Invalid message') . EOL); return; } + + switch($table) { + case 'item': + $i = q("select id from item where mid = '%s' and author_xchan = '%s' ", + dbesc($mid), + dbesc($channel['channel_hash']) + ); + break; + case 'mail': + $i = q("select id from mail where mid = '%s' and from_xchan = '%s'", + dbesc($mid), + dbesc($channel['channel_hash']) + ); + break; + default: + break; + } + + if(! $i) { + notice( t('Permission denied') . EOL); + return; + } $r = q("select * from dreport where dreport_xchan = '%s' and dreport_mid = '%s'", dbesc($channel['channel_hash']), @@ -33,6 +63,11 @@ function dreport_content(&$a) { for($x = 0; $x < count($r); $x++ ) { $r[$x]['name'] = escape_tags(substr($r[$x]['dreport_recip'],strpos($r[$x]['dreport_recip'],' '))); + // This has two purposes: 1. make the delivery report strings translateable, and + // 2. assign an ordering to item delivery results so we can group them and provide + // a readable report with more interesting events listed toward the top and lesser + // interesting items towards the bottom + switch($r[$x]['dreport_result']) { case 'channel sync processed': $r[$x]['gravity'] = 0; @@ -61,6 +96,18 @@ function dreport_content(&$a) { $r[$x]['dreport_result'] = t('permission denied'); $r[$x]['gravity'] = 6; break; + case 'recipient not found': + $r[$x]['dreport_result'] = t('recipient not found'); + break; + case 'mail recalled': + $r[$x]['dreport_result'] = t('mail recalled'); + break; + case 'duplicate mail received': + $r[$x]['dreport_result'] = t('duplicate mail received'); + break; + case 'mail delivered': + $r[$x]['dreport_result'] = t('mail delivered'); + break; default: $r[$x]['gravity'] = 1; break; |