WIP mime parsing

This commit is contained in:
Dominik Schürmann
2015-08-10 14:35:15 +02:00
parent 7004d129a8
commit dbaf7070ea
8 changed files with 610 additions and 42 deletions

View File

@@ -36,6 +36,7 @@ import org.sufficientlysecure.keychain.operations.EditKeyOperation;
import org.sufficientlysecure.keychain.operations.ExportOperation;
import org.sufficientlysecure.keychain.operations.ImportOperation;
import org.sufficientlysecure.keychain.operations.KeybaseVerificationOperation;
import org.sufficientlysecure.keychain.operations.MimeParsingOperation;
import org.sufficientlysecure.keychain.operations.PromoteKeyOperation;
import org.sufficientlysecure.keychain.operations.RevokeOperation;
import org.sufficientlysecure.keychain.operations.SignEncryptOperation;
@@ -137,6 +138,9 @@ public class KeychainService extends Service implements Progressable {
} else if (inputParcel instanceof KeybaseVerificationParcel) {
op = new KeybaseVerificationOperation(outerThis, new ProviderHelper(outerThis),
outerThis);
} else if (inputParcel instanceof MimeParsingParcel) {
op = new MimeParsingOperation(outerThis, new ProviderHelper(outerThis),
outerThis);
} else {
throw new AssertionError("Unrecognized input parcel in KeychainService!");
}

View File

@@ -0,0 +1,73 @@
/*
* Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.sufficientlysecure.keychain.service;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
public class MimeParsingParcel implements Parcelable {
private Uri mInputUri;
private Uri mOutputUri;
public MimeParsingParcel() {
}
public MimeParsingParcel(Uri inputUri, Uri outputUri) {
mInputUri = inputUri;
mOutputUri = outputUri;
}
MimeParsingParcel(Parcel source) {
// we do all of those here, so the PgpSignEncryptInput class doesn't have to be parcelable
mInputUri = source.readParcelable(getClass().getClassLoader());
mOutputUri = source.readParcelable(getClass().getClassLoader());
}
public Uri getInputUri() {
return mInputUri;
}
public Uri getOutputUri() {
return mOutputUri;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(mInputUri, 0);
dest.writeParcelable(mOutputUri, 0);
}
public static final Creator<MimeParsingParcel> CREATOR = new Creator<MimeParsingParcel>() {
public MimeParsingParcel createFromParcel(final Parcel source) {
return new MimeParsingParcel(source);
}
public MimeParsingParcel[] newArray(final int size) {
return new MimeParsingParcel[size];
}
};
}