Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time of bounce in history of a subscriber profile #536

Merged
merged 2 commits into from Jun 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 27 additions & 5 deletions public_html/lists/admin/processbounces.php
Expand Up @@ -203,24 +203,30 @@ function processImapBounce($link, $num, $header)
//# just say we did something, when actually we didn't
return true;
}
$bounceDateFormatted = date('Y-m-d H:i', $bounceDate);

Sql_Query(sprintf('insert into %s (date,header,data)
values("%s","%s","%s")',
$tables['bounce'],
date('Y-m-d H:i', $bounceDate),
$bounceDateFormatted,
addslashes($header),
addslashes($body)));

$bounceid = Sql_Insert_Id();

return processBounceData($bounceid, $msgid, $userid);
return processBounceData($bounceid, $msgid, $userid, $bounceDateFormatted);
}

function processBounceData($bounceid, $msgid, $userid)
function processBounceData($bounceid, $msgid, $userid, $bounceDate = null)
{
global $tables;
$useremailQ = Sql_fetch_row_query(sprintf('select email from %s where id = %d', $tables['user'], $userid));
$useremail = $useremailQ[0];

if ($bounceDate === null) {
$bounceDate = date('Y-m-d H:i', time());
}

if ($msgid === 'systemmessage' && !empty($userid)) {
Sql_Query(sprintf('update %s
set status = "bounced system message",
Expand All @@ -229,8 +235,24 @@ function processBounceData($bounceid, $msgid, $userid)
$tables['bounce'],
$userid, $bounceid));

##@@TODO use the date of the bounce, instead of "now" as processing may be different
Sql_Query(sprintf('insert into %s (user,message,bounce,time) values(%d,-1,%d,current_timestamp)',$tables['user_message_bounce'], $userid, $bounceid));
#Use the date of the bounce, instead of "now" as processing may be different
Sql_Query(sprintf('INSERT INTO %s
(
user,
message,
bounce,
time
)
VALUES
(
%d,
-1,
%d,
%s
)',
$tables['user_message_bounce'],
$userid, $bounceid, $bounceDate)
);
logEvent("$userid ".$GLOBALS['I18N']->get('system message bounced, user marked unconfirmed'));
addUserHistory($useremail, $GLOBALS['I18N']->get('Bounced system message'), '
<br/>' .$GLOBALS['I18N']->get('User marked unconfirmed')."
Expand Down