Skip to content

Commit

Permalink
Get rid of version MoveSanity
Browse files Browse the repository at this point in the history
It was only NOT defined for the unittest config.
  • Loading branch information
kinke committed Aug 4, 2023
1 parent 4bc1e3f commit 6ecd824
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
2 changes: 0 additions & 2 deletions dub.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ lflags "-L/opt/homebrew/opt/openssl@3/lib" platform="osx"

configuration "default" {
targetType "library"
versions "MoveSanity"
}
# this config enables module symmetry.imap.grammar
configuration "with-grammar" {
dependency "pegged" version="*"
targetType "library"
targetPath "bin"
versions "MoveSanity"
}
configuration "unittest" {
targetPath "bin"
Expand Down
32 changes: 12 additions & 20 deletions source/symmetry/imap/request.d
Original file line number Diff line number Diff line change
Expand Up @@ -619,29 +619,21 @@ auto multiMove(Session session, string mesg, Mailbox mailbox) {
import std.exception : enforce;
import std.format : format;
import std.conv : to;
version (MoveSanity) {
auto t = session.imapTry!sendRequest(format!`UID MOVE %s %s`(mesg, mailbox.toString));
auto r = session.imapTry!responseMove(t);
if (r.status == ImapStatus.tryCreate) {
t = session.imapTry!sendRequest(format!`CREATE "%s"`(mailbox.toString));

auto t = session.imapTry!sendRequest(format!`UID MOVE %s %s`(mesg, mailbox.toString));
auto r = session.imapTry!responseMove(t);
if (r.status == ImapStatus.tryCreate) {
t = session.imapTry!sendRequest(format!`CREATE "%s"`(mailbox.toString));
session.imapTry!responseGeneric(t);
if (session.options.subscribe) {
t = session.imapTry!sendRequest(format!`SUBSCRIBE "%s"`(mailbox.toString));

Check warning on line 629 in source/symmetry/imap/request.d

View check run for this annotation

Codecov / codecov/patch

source/symmetry/imap/request.d#L623-L629

Added lines #L623 - L629 were not covered by tests
session.imapTry!responseGeneric(t);
if (session.options.subscribe) {
t = session.imapTry!sendRequest(format!`SUBSCRIBE "%s"`(mailbox.toString));
session.imapTry!responseGeneric(t);
}
t = session.imapTry!sendRequest(format!`UID MOVE %s %s`(mesg, mailbox.toString));
r = session.imapTry!responseMove(t);
}
enforce(r.status == ImapStatus.ok, "imap error when moving : " ~ r.to!string);
return r;
} else {
auto result = copy(session, mesg, mailbox);
enforce(result.status == ImapStatus.ok, format!"unable to copy message %s to %s as first stage of move:%s"(mesg, mailbox, result));
result = store(session, mesg, StoreMode.add, `\Deleted`);
// enforce(result.status == ImapStatus.ok, format!"unable to set deleted flags for message %s as second stage of move:%s"(mesg,result));
return result;
t = session.imapTry!sendRequest(format!`UID MOVE %s %s`(mesg, mailbox.toString));
r = session.imapTry!responseMove(t);

Check warning on line 633 in source/symmetry/imap/request.d

View check run for this annotation

Codecov / codecov/patch

source/symmetry/imap/request.d#L632-L633

Added lines #L632 - L633 were not covered by tests
}
assert(0);
enforce(r.status == ImapStatus.ok, "imap error when moving : " ~ r.to!string);
return r;

Check warning on line 636 in source/symmetry/imap/request.d

View check run for this annotation

Codecov / codecov/patch

source/symmetry/imap/request.d#L635-L636

Added lines #L635 - L636 were not covered by tests
}

// NOTE: the date string must follow the standard grammar taken from the RFC, without the
Expand Down

0 comments on commit 6ecd824

Please sign in to comment.