fix: rewrote dovecot sql query management
This commit is contained in:
parent
cf5cb8c29c
commit
c2548833ed
@ -75,13 +75,15 @@ sub createDSN
|
|||||||
|
|
||||||
sub updateTransactionWithRecipientInfo
|
sub updateTransactionWithRecipientInfo
|
||||||
{
|
{
|
||||||
my ($self, $transaction, $sth) = @_;
|
my ($self, $transaction, $rcpt_row) = @_;
|
||||||
|
|
||||||
return unless $sth->rows == 1;
|
return 0 unless defined($rcpt_row);
|
||||||
|
return 0 unless defined($rcpt_row->{username});
|
||||||
|
return 0 unless defined($rcpt_row->{dovecot_server});
|
||||||
|
|
||||||
my $row = $sth->fetchrow_hashref;
|
|
||||||
my $dovecot_server = $row->{dovecot_server};
|
my $dovecot_server = $rcpt_row->{dovecot_server};
|
||||||
my $username = $row->{username};
|
my $username = $rcpt_row->{username};
|
||||||
|
|
||||||
my $result = $self->{fetch_dovecot_details_sth}->execute($dovecot_server);
|
my $result = $self->{fetch_dovecot_details_sth}->execute($dovecot_server);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
@ -96,7 +98,7 @@ sub updateTransactionWithRecipientInfo
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = $self->{fetch_dovecot_details_sth}->fetchrow_hashref();
|
my $row = $self->{fetch_dovecot_details_sth}->fetchrow_hashref();
|
||||||
|
|
||||||
my $hostname = $row->{hostname};
|
my $hostname = $row->{hostname};
|
||||||
my $port = $row->{port};
|
my $port = $row->{port};
|
||||||
@ -135,7 +137,7 @@ sub hook_rcpt {
|
|||||||
if ($self->{rcpt_sth}->rows == 1)
|
if ($self->{rcpt_sth}->rows == 1)
|
||||||
{
|
{
|
||||||
$self->log(LOGDEBUG, " found recipient in database");
|
$self->log(LOGDEBUG, " found recipient in database");
|
||||||
my $ret = $self->updateTransactionWithRecipientInfo($transaction, $self->{rcpt_sth});
|
my $ret = $self->updateTransactionWithRecipientInfo($transaction, $self->{rcpt_sth}->fetchrow_hashref );
|
||||||
|
|
||||||
if (!$ret)
|
if (!$ret)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user