more work on mail flags
This commit is contained in:
@@ -145,8 +145,7 @@ function mail_content(&$a) {
|
||||
if(! intval(argv(2)))
|
||||
return;
|
||||
$cmd = argv(1);
|
||||
$r = q("update mail set mail_flags = mail_flags | %d where id = %d and channel_id = %d",
|
||||
intval(MAIL_RECALLED),
|
||||
$r = q("update mail set mail_recalled = 1 where id = %d and channel_id = %d",
|
||||
intval(argv(2)),
|
||||
intval(local_channel())
|
||||
);
|
||||
@@ -312,7 +311,7 @@ function mail_content(&$a) {
|
||||
'delete' => t('Delete message'),
|
||||
'recall' => t('Recall message'),
|
||||
'can_recall' => (($channel['channel_hash'] == $message['from_xchan']) ? true : false),
|
||||
'is_recalled' => (($message['mail_flags'] & MAIL_RECALLED) ? t('Message has been recalled.') : ''),
|
||||
'is_recalled' => (intval($message['mail_recalled']) ? t('Message has been recalled.') : ''),
|
||||
'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'),
|
||||
);
|
||||
|
||||
|
||||
@@ -78,9 +78,8 @@ function manage_content(&$a) {
|
||||
$channels[$x]['intros'] = intval($intr[0]['total']);
|
||||
|
||||
|
||||
$mails = q("SELECT count(id) as total from mail WHERE channel_id = %d AND not (mail_flags & %d)>0 and from_xchan != '%s' ",
|
||||
$mails = q("SELECT count(id) as total from mail WHERE channel_id = %d AND mail_seen = 0 and from_xchan != '%s' ",
|
||||
intval($channels[$x]['channel_id']),
|
||||
intval(MAIL_SEEN),
|
||||
dbesc($channels[$x]['channel_hash'])
|
||||
);
|
||||
|
||||
|
||||
15
mod/ping.php
15
mod/ping.php
@@ -163,10 +163,8 @@ function ping_init(&$a) {
|
||||
);
|
||||
break;
|
||||
case 'messages':
|
||||
$r = q("update mail set mail_flags = ( mail_flags | %d ) where channel_id = %d and not (mail_flags & %d) > 0",
|
||||
intval(MAIL_SEEN),
|
||||
intval(local_channel()),
|
||||
intval(MAIL_SEEN)
|
||||
$r = q("update mail set mail_seen = 1 where mail_seen = 0 and channel_id = %d ",
|
||||
intval(local_channel())
|
||||
);
|
||||
break;
|
||||
case 'all_events':
|
||||
@@ -244,11 +242,9 @@ function ping_init(&$a) {
|
||||
if(argc() > 1 && argv(1) === 'messages') {
|
||||
$channel = $a->get_channel();
|
||||
$t = q("select mail.*, xchan.* from mail left join xchan on xchan_hash = from_xchan
|
||||
where channel_id = %d and not ( mail_flags & %d ) > 0 and not (mail_flags & %d ) > 0
|
||||
where channel_id = %d and mail_seen = 0 and mail_deleted = 0
|
||||
and from_xchan != '%s' order by created desc limit 50",
|
||||
intval(local_channel()),
|
||||
intval(MAIL_SEEN),
|
||||
intval(MAIL_DELETED),
|
||||
dbesc($channel['channel_hash'])
|
||||
);
|
||||
|
||||
@@ -260,7 +256,7 @@ function ping_init(&$a) {
|
||||
'url' => $zz['xchan_url'],
|
||||
'photo' => $zz['xchan_photo_s'],
|
||||
'when' => relative_date($zz['created']),
|
||||
'hclass' => (($zz['mail_flags'] & MAIL_SEEN) ? 'notify-seen' : 'notify-unseen'),
|
||||
'hclass' => (intval($zz['mail_seen']) ? 'notify-seen' : 'notify-unseen'),
|
||||
'message' => t('sent you a private message'),
|
||||
);
|
||||
}
|
||||
@@ -420,9 +416,8 @@ function ping_init(&$a) {
|
||||
|
||||
if($vnotify & VNOTIFY_MAIL) {
|
||||
$mails = q("SELECT count(id) as total from mail
|
||||
WHERE channel_id = %d AND not (mail_flags & %d) > 0 and from_xchan != '%s' ",
|
||||
WHERE channel_id = %d AND mail_seen = 0 and from_xchan != '%s' ",
|
||||
intval(local_channel()),
|
||||
intval(MAIL_SEEN),
|
||||
dbesc($channel['channel_hash'])
|
||||
);
|
||||
if($mails)
|
||||
|
||||
Reference in New Issue
Block a user