Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(IMAPSession): add support for moveMessagesOpeation to java library #1749

Merged
merged 1 commit into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/java/com/libmailcore/IMAPMoveMessagesOperation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.libmailcore;

import java.util.Map;

/** Operation to move IMAP messages. */
public class IMAPMoveMessagesOperation extends IMAPOperation {
/**
Returns a map of the UIDs of the messages in the source folder to the UIDs of
the messages in the destination folder.
*/
public native Map<Long,Long> uidMapping();
}
3 changes: 3 additions & 0 deletions src/java/com/libmailcore/IMAPSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ public IMAPAppendMessageOperation appendMessageOperation(String folder, byte[] m
/** Returns an operation to copy messages to a folder. */
public native IMAPCopyMessagesOperation copyMessagesOperation(String folder, IndexSet uids, String destFolder);

/** Returns an operation to move messages to a folder. */
public native IMAPMoveMessagesOperation moveMessagesOperation(String folder, IndexSet uids, String destFolder);

/** Returns an operation to expunge messages after they've been marked as deleted. */
public native IMAPOperation expungeOperation(String folder);

Expand Down
22 changes: 22 additions & 0 deletions src/java/native/com_libmailcore_IMAPMoveMessagesOperation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "com_libmailcore_IMAPMoveMessagesOperation.h"

#include "MCBaseTypes.h"
#include "JavaHandle.h"
#include "TypesUtils.h"
#include "MCIMAPMoveMessagesOperation.h"

using namespace mailcore;

#define nativeType IMAPMoveMessagesOperation
#define javaType nativeType

JNIEXPORT jobject JNICALL Java_com_libmailcore_IMAPMoveMessagesOperation_uidMapping
(JNIEnv * env, jobject obj)
{
MC_POOL_BEGIN;
jobject result = MC_JAVA_BRIDGE_GET(uidMapping);
MC_POOL_END;
return result;
}

MC_JAVA_BRIDGE
23 changes: 23 additions & 0 deletions src/java/native/com_libmailcore_IMAPMoveMessagesOperation.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/java/native/com_libmailcore_IMAPSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,16 @@ JNIEXPORT jobject JNICALL Java_com_libmailcore_IMAPSession_copyMessagesOperation
return result;
}

JNIEXPORT jobject JNICALL Java_com_libmailcore_IMAPSession_moveMessagesOperation
(JNIEnv * env, jobject obj, jstring sourcePath, jobject uids, jstring destPath)
{
MC_POOL_BEGIN;
jobject result = MC_TO_JAVA(MC_JAVA_NATIVE_INSTANCE->moveMessagesOperation(MC_FROM_JAVA(String, sourcePath),
MC_FROM_JAVA(IndexSet, uids), MC_FROM_JAVA(String, destPath)));
MC_POOL_END;
return result;
}

JNIEXPORT jobject JNICALL Java_com_libmailcore_IMAPSession_expungeOperation
(JNIEnv * env, jobject obj, jstring path)
{
Expand Down
8 changes: 8 additions & 0 deletions src/java/native/com_libmailcore_IMAPSession.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.