about summary refs log tree commit homepage
path: root/lib/PublicInbox/IMAPTracker.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/IMAPTracker.pm')
-rw-r--r--lib/PublicInbox/IMAPTracker.pm35
1 files changed, 12 insertions, 23 deletions
diff --git a/lib/PublicInbox/IMAPTracker.pm b/lib/PublicInbox/IMAPTracker.pm
index fe813582..5eb33cf7 100644
--- a/lib/PublicInbox/IMAPTracker.pm
+++ b/lib/PublicInbox/IMAPTracker.pm
@@ -39,20 +39,12 @@ sub dbh_new ($) {
         $dbh;
 }
 
-sub get_last ($;$) {
-        my ($self, $validity) = @_;
-        my $sth;
-        if (defined $validity) {
-                $sth = $self->{dbh}->prepare_cached(<<'', undef, 1);
-SELECT uid_validity, uid FROM imap_last WHERE url = ? AND uid_validity = ?
-
-                $sth->execute($self->{url}, $validity);
-        } else {
-                $sth = $self->{dbh}->prepare_cached(<<'', undef, 1);
+sub get_last ($) {
+        my ($self) = @_;
+        my $sth = $self->{dbh}->prepare_cached(<<'', undef, 1);
 SELECT uid_validity, uid FROM imap_last WHERE url = ?
 
-                $sth->execute($self->{url});
-        }
+        $sth->execute($self->{url});
         $sth->fetchrow_array;
 }
 
@@ -70,19 +62,16 @@ VALUES (?, ?, ?)
 }
 
 sub new {
-        my ($class, $url, $dbname) = @_;
+        my ($class, $url) = @_;
 
-        unless (defined($dbname)) {
-                # original name for compatibility with old setups:
-                $dbname = PublicInbox::Config->config_dir() . '/imap.sqlite3';
+        # original name for compatibility with old setups:
+        my $dbname = PublicInbox::Config->config_dir() . '/imap.sqlite3';
 
-                # use the new XDG-compliant name for new setups:
-                if (!-f $dbname) {
-                        $dbname = ($ENV{XDG_DATA_HOME} //
-                                        (($ENV{HOME} // '/nonexistent').
-                                         '/.local/share')) .
-                                '/public-inbox/imap.sqlite3';
-                }
+        # use the new XDG-compliant name for new setups:
+        if (!-f $dbname) {
+                $dbname = ($ENV{XDG_DATA_HOME} //
+                        (($ENV{HOME} // '/nonexistent').'/.local/share')) .
+                        '/public-inbox/imap.sqlite3';
         }
         if (!-f $dbname) {
                 require File::Path;