Skip to content

Commit a310f6b

Browse files
committed
4.3 Release
1 parent 488044e commit a310f6b

File tree

5 files changed

+23
-24
lines changed

5 files changed

+23
-24
lines changed

lib/Scot/Inbox/Config.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ sub build_config () {
6363
$mboxconf = {
6464
loginurl => $ENV{S4INBOX_GRAPH_LOGIN_URL},
6565
graphurl => $ENV{S4INBOX_GRAPH_GRAPH_URL},
66-
scot => $ENV{S4INBOX_GRAPH_SCOPE},
67-
tenet_id => $ENV{S4INBOX_GRAPH_TENENT_ID},
66+
scope => $ENV{S4INBOX_GRAPH_SCOPE},
67+
tenet_id => $ENV{S4INBOX_GRAPH_TENET_ID},
6868
client_id => $ENV{S4INBOX_GRAPH_CLIENT_ID},
6969
client_secret => $ENV{S4INBOX_GRAPH_CLIENT_SECRET},
7070
useraddress => $ENV{S4INBOX_GRAPH_USERADDRESS},

lib/Scot/Inbox/Imap.pm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,10 @@ sub inline_images ($self, $tree, $imgdb) {
512512
}
513513
}
514514

515+
sub delete_message ($self, @msgids) {
516+
$self->client->delete_message(\@msgids);
517+
}
518+
515519

516520
1;
517521

lib/Scot/Inbox/Msgraph.pm

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package Scot::Email::MSGraph;
1+
package Scot::Inbox::Msgraph;
22

33
use lib '../../../lib';
44
use strict;
@@ -30,7 +30,7 @@ has permitted_senders => sub ($self) { $self->config->{permitted_senders} };
3030

3131
sub get_access_token {
3232
my ($self) = @_;
33-
my $log = $self->env->log;
33+
my $log = $self->log;
3434

3535
my $url = join('',
3636
$self->loginurl,
@@ -59,7 +59,7 @@ sub get_access_token {
5959

6060
sub get_mail {
6161
my ($self, $start, $end) = @_;
62-
my $log = $self->env->log;
62+
my $log = $self->log;
6363
my $filter = '&$filter=';
6464

6565
if ( $self->bydate ) {
@@ -106,7 +106,6 @@ sub get_mail {
106106
my $cursor = Scot::Email::MSGraph::Cursor->new(
107107
ids => \@mids,
108108
msgraph => $self,
109-
env => $self->env,
110109
);
111110
}
112111

@@ -121,27 +120,27 @@ sub mark_message_read {
121120
);
122121
my $update = {isRead => 'TRUE' };
123122
$auth->{'Content-Type'} = "application/json";
124-
$self->env->log->debug("mark_read_url = ",{filter =>\&Dumper, value => $url});
125-
$self->env->log->debug("mark_read_json = ",{filter =>\&Dumper, value => $auth});
123+
$self->log->debug("mark_read_url = ",{filter =>\&Dumper, value => $url});
124+
$self->log->debug("mark_read_json = ",{filter =>\&Dumper, value => $auth});
126125
my $tx = $self->ua->patch($url => $auth => json => $update);
127126
my $result = $tx->result;
128127

129128
if ($result->is_error) {
130-
$self->env->log->error("ERROR updating isRead status!");
129+
$self->log->error("ERROR updating isRead status!");
131130
my $json = $result->json;
132-
$self->env->log->error({filter => \&Dumper, value => $json});
131+
$self->log->error({filter => \&Dumper, value => $json});
133132
return;
134133
}
135134

136-
$self->env->log->debug("$msgid isRead set to 1");
135+
$self->log->debug("$msgid isRead set to 1");
137136
return;
138137
}
139138

140139
sub build_message_id_list {
141140
my $self = shift;
142141
my $messages = shift;
143142
my @mids = ();
144-
my $log = $self->env->log;
143+
my $log = $self->log;
145144

146145
MSG:
147146
foreach my $m (@$messages) {
@@ -167,7 +166,7 @@ sub build_auth_token {
167166
sub get_message {
168167
my $self = shift;
169168
my $id = shift;
170-
my $log = $self->env->log;
169+
my $log = $self->log;
171170
my $url = join('',
172171
$self->graphurl,
173172
'/', $self->useraddress,
@@ -213,13 +212,13 @@ sub get_html_body {
213212
if ( $body->{contentType} eq "html" ) {
214213
return $body->{content};
215214
}
216-
$self->env->log->warn("No HTML body found!");
215+
$self->log->warn("No HTML body found!");
217216
return '';
218217
}
219218

220219
sub get_plain_body {
221220
my ($self, $url, $auth) = @_;
222-
my $log = $self->env->log;
221+
my $log = $self->log;
223222
$log->debug("attempting to get plain body");
224223
$auth->{Prefer} = 'outlook.body-content-type="text"';
225224
my $tx = $self->ua->get($url => $auth);
@@ -230,7 +229,7 @@ sub get_plain_body {
230229

231230
sub get_attachments {
232231
my ($self, $id) = @_;
233-
my $log = $self->env->log;
232+
my $log = $self->log;
234233
my $url = join('',
235234
$self->graphurl,
236235
'/messages/',$id,'/attachments');
@@ -270,7 +269,7 @@ sub get_mime {
270269
$url .= '/$value'; # will retrieve the mime version of the email
271270
$auth = $self->build_auth_token if (! defined $auth);
272271

273-
my $log = $self->env->log;
272+
my $log = $self->log;
274273
$log->debug("Getting MIME message with $url");
275274

276275
my $tx = $self->ua->get($url => $auth);
@@ -341,7 +340,7 @@ sub from_permitted_sender {
341340
my $self = shift;
342341
my $from = shift;
343342
my @oksenders = @{$self->permitted_senders};
344-
my $log = $self->env->log;
343+
my $log = $self->log;
345344

346345
# each permitted sender can be a regex,
347346
# a '*' match all wildcard, or and explicit

lib/Scot/Inbox/Msgraph/Cursor.pm

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ has ids => (
1414
}
1515
);
1616

17-
has env => (
18-
is => 'ro', isa => 'Scot::Env', required => 1
19-
);
20-
2117
has msgraph => (
22-
is => 'rw', isa => 'Scot::Email::MSGraph', required => 1
18+
is => 'rw', isa => 'Scot::Inbox::Msgraph', required => 1
2319
);
2420

2521
sub count {

lib/Scot/Inbox/Processor.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ sub delete ($self) {
106106
$log->logdie("Failed to create $class, unable to process inbox");
107107
}
108108

109-
my $cursor = $client->get_mail;
109+
my $cursor = $client->get_before_cursor;
110110
my $count = $cursor->count;
111111
my $index = 0;
112112
my $target = $config->{scot_queue};

0 commit comments

Comments
 (0)