Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5d8e7dc9

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID 5d8e7dc9826cbc3c5c2d988e420abdac2a0e22cd
  • Vorgänger fc640092
  • Nachfolger 81e922c2

FIX: uidvalidity für Emailordner mit speichern

Unterschiede anzeigen:

SL/IMAPClient.pm
88 88
      $self->{imap_client}->select($folder_string)
89 89
        or die "Could not select IMAP folder '$folder_string': $@\n";
90 90

  
91
      my $folder_uidvalidity = $self->{imap_client}->uidvalidity($folder_string)
92
        or die "Could not get UIDVALIDITY for folder '$folder_string': $@\n";
93

  
91 94
      my $msg_uids = $self->{imap_client}->messages
92 95
        or die "Could not get messages via IMAP: $@\n";
93 96

  
......
99 102
        WHERE ei.host_name = ?
100 103
          AND ei.user_name = ?
101 104
          AND ej.folder = ?
105
          AND ej.folder_uidvalidity = ?
102 106
SQL
103 107

  
104 108
      my $existing_uids = $dbh->selectall_hashref($query, 'uid', undef,
105
        $self->{hostname}, $self->{username}, $folder_string);
109
        $self->{hostname}, $self->{username}, $folder_string, $folder_uidvalidity);
106 110

  
107 111
      my @new_msg_uids = grep { !$existing_uids->{$_} } @$msg_uids;
108 112

  
......
114 118
        my $new_email_string = $self->{imap_client}->message_string($new_uid);
115 119
        my $email = Email::MIME->new($new_email_string);
116 120
        my $email_journal = $self->_create_email_journal(
117
          $email, $email_import, $new_uid, $folder_string
121
          $email, $email_import, $new_uid, $folder_string, $folder_uidvalidity
118 122
        );
119 123
        $email_journal->save();
120 124
      }
......
135 139
}
136 140

  
137 141
sub _create_email_journal {
138
  my ($self, $email, $email_import, $uid, $folder_path) = @_;
142
  my ($self, $email, $email_import, $uid, $folder_string, $folder_uidvalidity) = @_;
139 143

  
140 144
  my @email_parts = $email->parts; # get parts or self
141 145
  my $text_part = $email_parts[0];
......
167 171
  });
168 172

  
169 173
  my $email_journal = SL::DB::EmailJournal->new(
170
    email_import_id => $email_import->id,
171
    folder          => $folder_path,
172
    uid             => $uid,
173
    status          => 'imported',
174
    extended_status => '',
175
    from            => $email->header('From') || '',
176
    recipients      => $recipients,
177
    sent_on         => $date,
178
    subject         => $email->header('Subject') || '',
179
    body            => $body,
180
    headers         => $header_string,
181
    attachments     => \@attachments,
174
    email_import_id    => $email_import->id,
175
    folder             => $folder_string,
176
    folder_uidvalidity => $folder_uidvalidity,
177
    uid                => $uid,
178
    status             => 'imported',
179
    extended_status    => '',
180
    from               => $email->header('From') || '',
181
    recipients         => $recipients,
182
    sent_on            => $date,
183
    subject            => $email->header('Subject') || '',
184
    body               => $body,
185
    headers            => $header_string,
186
    attachments        => \@attachments,
182 187
  );
183 188

  
184 189
  return $email_journal;

Auch abrufbar als: Unified diff