Skip to content

Commit

Permalink
Move the startid back correctly if a conversation is too new to archive.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jul 20, 2009
1 parent 627365a commit 7a1e9f7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions archive_jabber.pl
Expand Up @@ -254,8 +254,9 @@ sub signal_catcher {
my $lastwith = '';
my $alias = undef;
my $thisxmppuseralias = $xmppuseralias;

my $startmsgid = undef;
my $newestmsgid = 0;

$startid = undef;

while (my @row = $sth->fetchrow_array()) {
Expand All @@ -271,6 +272,8 @@ sub signal_catcher {
}
}

$startmsgid = $msgid if (not defined $startmsgid);

if (not defined $startids{$with}) {
dbgprint("Flushing new per-user startid for '$with'\n");
if (not flush_startid($with, 0)) {
Expand All @@ -281,7 +284,7 @@ sub signal_catcher {
if ( (time() - make_timestamp($utc, 'UTC')) < $gaptime ) {
dbgprint("timestamp '$utc' is less than $gaptime seconds old.\n");
if ((not defined $startid) or ($msgid < $startid)) {
$startid = ($msgid-1);
$startid = ($startmsgid-1);
dbgprint("forcing global startid to $startid\n");
}
# trash this conversation, it might still be ongoing.
Expand Down Expand Up @@ -311,6 +314,8 @@ sub signal_catcher {
$outid = $coll_id;
$writing = 1;

$startmsgid = $msgid;

my $person = $with;
my ($fullalias,$short) = get_nickname($with);

Expand Down

0 comments on commit 7a1e9f7

Please sign in to comment.