summaryrefslogtreecommitdiffstats
path: root/lib/App
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App')
-rw-r--r--lib/App/ImapNotify/ImapClient.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/App/ImapNotify/ImapClient.pm b/lib/App/ImapNotify/ImapClient.pm
index ae91c78..c57204f 100644
--- a/lib/App/ImapNotify/ImapClient.pm
+++ b/lib/App/ImapNotify/ImapClient.pm
@@ -77,7 +77,7 @@ method _login() {
croak "Server doesn't support AUTH=PLAIN";
}
- my $response = $self->send_command("login $self->{config}->{username} $self->{config}->{password}");
+ my $response = $self->send_command("login $self->{config}->{username} $self->{config}->{password}", "login $self->{config}->{username} [...]");
return if not defined $response;
confess "No capabilities found in response: '".$response->[0]."'" unless $response->[0] =~ m/^OK \[(.*)\].*$/;
@@ -97,12 +97,14 @@ method select($mailbox) {
}
-method send_command($command) {
+method send_command($command, $log_command = undef) {
my $id = "CMD-".$self->{command_counter}++;
chomp($command);
- $self->writeline("$id $command\r\n");
+ $log_command = $command if !defined $log_command;
+
+ $self->writeline("$id $command\r\n", "$id $log_command");
my @lines;
@@ -164,8 +166,8 @@ method handle_fetch($first_line) {
}
}
-method writeline($line) {
- $log->tracef("%s >> %s", $self->{log_id}, $line =~ s/\r\n$//r);
+method writeline($line, $log_line) {
+ $log->tracef("%s >> %s", $self->{log_id}, $log_line);
return $self->{deps}->{sock}->writeline($line);
}