Skip to content

Commit

Permalink
add support for moveMessagesOperation to java library (#1749)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz authored and dinhvh committed Jun 18, 2018
1 parent 7c1c1f8 commit 6e035e8
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 0 deletions.
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.

0 comments on commit 6e035e8

Please sign in to comment.