diff --git a/android/Ext/.classpath b/android/Ext/.classpath new file mode 100644 index 0000000..a4763d1 --- /dev/null +++ b/android/Ext/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/android/Ext/.project b/android/Ext/.project new file mode 100644 index 0000000..d34d32c --- /dev/null +++ b/android/Ext/.project @@ -0,0 +1,33 @@ + + + Ext + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/android/Ext/AndroidManifest.xml b/android/Ext/AndroidManifest.xml new file mode 100644 index 0000000..4f50ac8 --- /dev/null +++ b/android/Ext/AndroidManifest.xml @@ -0,0 +1,17 @@ + + + + + + + + \ No newline at end of file diff --git a/android/Ext/bin/AndroidManifest.xml b/android/Ext/bin/AndroidManifest.xml new file mode 100644 index 0000000..4f50ac8 --- /dev/null +++ b/android/Ext/bin/AndroidManifest.xml @@ -0,0 +1,17 @@ + + + + + + + + \ No newline at end of file diff --git a/android/Ext/bin/R.txt b/android/Ext/bin/R.txt new file mode 100644 index 0000000..637d9e8 --- /dev/null +++ b/android/Ext/bin/R.txt @@ -0,0 +1,4 @@ +int drawable ic_launcher 0x7f020000 +int string app_name 0x7f030000 +int style AppBaseTheme 0x7f040000 +int style AppTheme 0x7f040001 diff --git a/android/Ext/bin/classes/org/json/README b/android/Ext/bin/classes/org/json/README new file mode 100755 index 0000000..b77c71a --- /dev/null +++ b/android/Ext/bin/classes/org/json/README @@ -0,0 +1,68 @@ +JSON in Java [package org.json] + +Douglas Crockford +douglas@crockford.com + +2011-02-02 + + +JSON is a light-weight, language independent, data interchange format. +See http://www.JSON.org/ + +The files in this package implement JSON encoders/decoders in Java. +It also includes the capability to convert between JSON and XML, HTTP +headers, Cookies, and CDL. + +This is a reference implementation. There is a large number of JSON packages +in Java. Perhaps someday the Java community will standardize on one. Until +then, choose carefully. + +The license includes this restriction: "The software shall be used for good, +not evil." If your conscience cannot live with that, then choose a different +package. + +The package compiles on Java 1.2 thru Java 1.4. + + +JSONObject.java: The JSONObject can parse text from a String or a JSONTokener +to produce a map-like object. The object provides methods for manipulating its +contents, and for producing a JSON compliant object serialization. + +JSONArray.java: The JSONObject can parse text from a String or a JSONTokener +to produce a vector-like object. The object provides methods for manipulating +its contents, and for producing a JSON compliant array serialization. + +JSONTokener.java: The JSONTokener breaks a text into a sequence of individual +tokens. It can be constructed from a String, Reader, or InputStream. + +JSONException.java: The JSONException is the standard exception type thrown +by this package. + + +JSONString.java: The JSONString interface requires a toJSONString method, +allowing an object to provide its own serialization. + +JSONStringer.java: The JSONStringer provides a convenient facility for +building JSON strings. + +JSONWriter.java: The JSONWriter provides a convenient facility for building +JSON text through a writer. + + +CDL.java: CDL provides support for converting between JSON and comma +delimited lists. + +Cookie.java: Cookie provides support for converting between JSON and cookies. + +CookieList.java: CookieList provides support for converting between JSON and +cookie lists. + +HTTP.java: HTTP provides support for converting between JSON and HTTP headers. + +HTTPTokener.java: HTTPTokener extends JSONTokener for parsing HTTP headers. + +XML.java: XML provides support for converting between JSON and XML. + +JSONML.java: JSONML provides support for converting between JSONML and XML. + +XMLTokener.java: XMLTokener extends JSONTokener for parsing XML text. diff --git a/android/Ext/bin/res/drawable-hdpi/ic_launcher.png b/android/Ext/bin/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..efa7c5f Binary files /dev/null and b/android/Ext/bin/res/drawable-hdpi/ic_launcher.png differ diff --git a/android/Ext/bin/res/drawable-mdpi/ic_launcher.png b/android/Ext/bin/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..ec27f2e Binary files /dev/null and b/android/Ext/bin/res/drawable-mdpi/ic_launcher.png differ diff --git a/android/Ext/bin/res/drawable-xhdpi/ic_launcher.png b/android/Ext/bin/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..92fc57d Binary files /dev/null and b/android/Ext/bin/res/drawable-xhdpi/ic_launcher.png differ diff --git a/android/Ext/bin/res/drawable-xxhdpi/ic_launcher.png b/android/Ext/bin/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..b6f8f4e Binary files /dev/null and b/android/Ext/bin/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/android/Ext/gen/com/example/ext/BuildConfig.java b/android/Ext/gen/com/example/ext/BuildConfig.java new file mode 100644 index 0000000..0ca546e --- /dev/null +++ b/android/Ext/gen/com/example/ext/BuildConfig.java @@ -0,0 +1,6 @@ +/** Automatically generated file. DO NOT MODIFY */ +package com.example.ext; + +public final class BuildConfig { + public final static boolean DEBUG = true; +} \ No newline at end of file diff --git a/android/Ext/gen/com/example/ext/R.java b/android/Ext/gen/com/example/ext/R.java new file mode 100644 index 0000000..1f05951 --- /dev/null +++ b/android/Ext/gen/com/example/ext/R.java @@ -0,0 +1,47 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package com.example.ext; + +public final class R { + public static final class attr { + } + public static final class drawable { + public static int ic_launcher=0x7f020000; + } + public static final class string { + public static int app_name=0x7f030000; + } + public static final class style { + /** + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + + + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + + + Base application theme for API 11+. This theme completely replaces + AppBaseTheme from res/values/styles.xml on API 11+ devices. + + API 11 theme customizations can go here. + + Base application theme for API 14+. This theme completely replaces + AppBaseTheme from BOTH res/values/styles.xml and + res/values-v11/styles.xml on API 14+ devices. + + API 14 theme customizations can go here. + */ + public static int AppBaseTheme=0x7f040000; + /** Application theme. + All customizations that are NOT specific to a particular API-level can go here. + */ + public static int AppTheme=0x7f040001; + } +} diff --git a/android/Ext/ic_launcher-web.png b/android/Ext/ic_launcher-web.png new file mode 100644 index 0000000..a18cbb4 Binary files /dev/null and b/android/Ext/ic_launcher-web.png differ diff --git a/android/Ext/proguard-project.txt b/android/Ext/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/android/Ext/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/android/Ext/project.properties b/android/Ext/project.properties new file mode 100644 index 0000000..484dab0 --- /dev/null +++ b/android/Ext/project.properties @@ -0,0 +1,15 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-17 +android.library=true diff --git a/android/Ext/res/drawable-hdpi/ic_launcher.png b/android/Ext/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..288b665 Binary files /dev/null and b/android/Ext/res/drawable-hdpi/ic_launcher.png differ diff --git a/android/Ext/res/drawable-mdpi/ic_launcher.png b/android/Ext/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..6ae570b Binary files /dev/null and b/android/Ext/res/drawable-mdpi/ic_launcher.png differ diff --git a/android/Ext/res/drawable-xhdpi/ic_launcher.png b/android/Ext/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..d4fb7cd Binary files /dev/null and b/android/Ext/res/drawable-xhdpi/ic_launcher.png differ diff --git a/android/Ext/res/drawable-xxhdpi/ic_launcher.png b/android/Ext/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..85a6081 Binary files /dev/null and b/android/Ext/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/android/Ext/res/values-v11/styles.xml b/android/Ext/res/values-v11/styles.xml new file mode 100644 index 0000000..541752f --- /dev/null +++ b/android/Ext/res/values-v11/styles.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/android/Ext/res/values-v14/styles.xml b/android/Ext/res/values-v14/styles.xml new file mode 100644 index 0000000..f20e015 --- /dev/null +++ b/android/Ext/res/values-v14/styles.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/android/Ext/res/values/strings.xml b/android/Ext/res/values/strings.xml new file mode 100644 index 0000000..ffb2ef9 --- /dev/null +++ b/android/Ext/res/values/strings.xml @@ -0,0 +1,5 @@ + + + Ext + + \ No newline at end of file diff --git a/android/Ext/res/values/styles.xml b/android/Ext/res/values/styles.xml new file mode 100644 index 0000000..4a10ca4 --- /dev/null +++ b/android/Ext/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + + + \ No newline at end of file diff --git a/android/Ext/src/com b/android/Ext/src/com new file mode 120000 index 0000000..3ca57d4 --- /dev/null +++ b/android/Ext/src/com @@ -0,0 +1 @@ +../../../java/ext/jordanzimmerman/src/com \ No newline at end of file diff --git a/android/Ext/src/org/bc b/android/Ext/src/org/bc new file mode 120000 index 0000000..6c8198f --- /dev/null +++ b/android/Ext/src/org/bc @@ -0,0 +1 @@ +../../../../java/ext/bouncycastle/src/org/bc \ No newline at end of file diff --git a/android/Ext/src/org/json b/android/Ext/src/org/json new file mode 120000 index 0000000..2e0f2d8 --- /dev/null +++ b/android/Ext/src/org/json @@ -0,0 +1 @@ +../../../../java/ext/json/src/org/json \ No newline at end of file diff --git a/android/Mailiverse/.classpath b/android/Mailiverse/.classpath new file mode 100644 index 0000000..a4763d1 --- /dev/null +++ b/android/Mailiverse/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/android/Mailiverse/.cproject b/android/Mailiverse/.cproject new file mode 100644 index 0000000..4dd89c3 --- /dev/null +++ b/android/Mailiverse/.cproject @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/Mailiverse/.project b/android/Mailiverse/.project new file mode 100644 index 0000000..534b0d2 --- /dev/null +++ b/android/Mailiverse/.project @@ -0,0 +1,97 @@ + + + Mailiverse + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?children? + ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|\|| + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + ndk-build + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/android/Mailiverse/AndroidManifest.xml b/android/Mailiverse/AndroidManifest.xml new file mode 100644 index 0000000..fbb11b8 --- /dev/null +++ b/android/Mailiverse/AndroidManifest.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/Mailiverse/bin/AndroidManifest.xml b/android/Mailiverse/bin/AndroidManifest.xml new file mode 100644 index 0000000..fbb11b8 --- /dev/null +++ b/android/Mailiverse/bin/AndroidManifest.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/Mailiverse/bin/R.txt b/android/Mailiverse/bin/R.txt new file mode 100644 index 0000000..9c4636e --- /dev/null +++ b/android/Mailiverse/bin/R.txt @@ -0,0 +1,113 @@ +int anim back_enter 0x7f040000 +int anim back_leave 0x7f040001 +int anim forward_enter 0x7f040002 +int anim forward_leave 0x7f040003 +int attr behindOffset 0x7f010003 +int attr behindScrollScale 0x7f010005 +int attr behindWidth 0x7f010004 +int attr fadeDegree 0x7f01000b +int attr fadeEnabled 0x7f01000a +int attr mode 0x7f010000 +int attr selectorDrawable 0x7f01000d +int attr selectorEnabled 0x7f01000c +int attr shadowDrawable 0x7f010008 +int attr shadowWidth 0x7f010009 +int attr touchModeAbove 0x7f010006 +int attr touchModeBehind 0x7f010007 +int attr viewAbove 0x7f010001 +int attr viewBehind 0x7f010002 +int dimen activity_horizontal_margin 0x7f080000 +int dimen activity_vertical_margin 0x7f080001 +int drawable ic_launcher 0x7f020000 +int drawable spiral_galaxy_bg 0x7f020001 +int id LinearLayout1 0x7f070017 +int id LinearLayout2 0x7f070010 +int id RelativeLayout1 0x7f070012 +int id action_forgot_password 0x7f070027 +int id action_settings 0x7f070026 +int id conversationBackButton 0x7f070006 +int id conversationBrief 0x7f070016 +int id conversationCheck 0x7f070011 +int id conversationDate 0x7f070013 +int id conversationList 0x7f070019 +int id conversationName 0x7f070014 +int id conversationSubject 0x7f070015 +int id email 0x7f07000c +int id folderList 0x7f070023 +int id folderName 0x7f07001a +int id folderQuantity 0x7f07001b +int id folderRevealButton 0x7f070018 +int id fullscreen 0x7f070003 +int id left 0x7f070000 +int id login 0x7f07000e +int id login_background 0x7f070008 +int id login_form 0x7f07000b +int id login_status 0x7f070009 +int id login_status_message 0x7f07000a +int id mailAuthor 0x7f07001d +int id mailBody 0x7f070020 +int id mailDate 0x7f07001e +int id mailList 0x7f070007 +int id mailRecipients 0x7f07001f +int id mailSubject 0x7f07001c +int id mails 0x7f070005 +int id margin 0x7f070002 +int id menu_settings 0x7f070025 +int id password 0x7f07000d +int id revealLogout 0x7f070021 +int id revealUserName 0x7f070022 +int id right 0x7f070001 +int id selected_view 0x7f070004 +int id sign_in_button 0x7f07000f +int id slidingmenumain 0x7f070024 +int layout activity_conversation 0x7f030000 +int layout activity_login 0x7f030001 +int layout activity_main 0x7f030002 +int layout conversation_item 0x7f030003 +int layout folder 0x7f030004 +int layout folder_item 0x7f030005 +int layout mail_header_item 0x7f030006 +int layout mail_item 0x7f030007 +int layout reveal_folders 0x7f030008 +int layout slidingmenumain 0x7f030009 +int menu activity_conversation 0x7f090000 +int menu activity_folder 0x7f090001 +int menu activity_main 0x7f090002 +int menu conversation 0x7f090003 +int menu login 0x7f090004 +int string action_forgot_password 0x7f05000c +int string action_settings 0x7f050006 +int string action_sign_in_register 0x7f05000a +int string action_sign_in_short 0x7f05000b +int string app_name 0x7f050000 +int string error_field_required 0x7f050011 +int string error_incorrect_password 0x7f050010 +int string error_invalid_email 0x7f05000e +int string error_invalid_password 0x7f05000f +int string hello_world 0x7f050001 +int string login_progress_signing_in 0x7f05000d +int string menu_settings 0x7f050002 +int string prompt_email 0x7f050008 +int string prompt_password 0x7f050009 +int string title_activity_conversation 0x7f050005 +int string title_activity_folder 0x7f050003 +int string title_activity_login 0x7f050007 +int string title_activity_main 0x7f050004 +int style AppBaseTheme 0x7f060000 +int style AppTheme 0x7f060001 +int style LoginFormContainer 0x7f060002 +int[] styleable SlidingMenu { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d } +int styleable SlidingMenu_behindOffset 3 +int styleable SlidingMenu_behindScrollScale 5 +int styleable SlidingMenu_behindWidth 4 +int styleable SlidingMenu_fadeDegree 11 +int styleable SlidingMenu_fadeEnabled 10 +int styleable SlidingMenu_mode 0 +int styleable SlidingMenu_selectorDrawable 13 +int styleable SlidingMenu_selectorEnabled 12 +int styleable SlidingMenu_shadowDrawable 8 +int styleable SlidingMenu_shadowWidth 9 +int styleable SlidingMenu_touchModeAbove 6 +int styleable SlidingMenu_touchModeBehind 7 +int styleable SlidingMenu_viewAbove 1 +int styleable SlidingMenu_viewBehind 2 diff --git a/android/Mailiverse/bin/classes/mail/client/model/Original.java.no b/android/Mailiverse/bin/classes/mail/client/model/Original.java.no new file mode 100644 index 0000000..19c37eb --- /dev/null +++ b/android/Mailiverse/bin/classes/mail/client/model/Original.java.no @@ -0,0 +1,145 @@ +package mail.client.core; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Properties; + +import javax.mail.BodyPart; +import javax.mail.MessagingException; +import javax.mail.Session; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; + +import com.sun.mail.util.BASE64DecoderStream; + +import core.util.Arrays; +import core.util.LogNull; +import core.util.LogNull; +import core.util.Pair; +import core.util.Streams; +import core.util.Triple; + +public class Original +{ + static LogNull log = new LogNull(Original.class); + + String path; + boolean loaded; + + Exception exception; + byte[] data; + + public Original (String path) + { + this.path = path; + } + + public String getPath () + { + return path; + } + + public void setData (byte[] data) + { + this.data = data; + this.loaded = true; + } + + public boolean hasData () + { + return data!=null; + } + + public String getDataAsString () throws UnsupportedEncodingException + { + return new String(data); + } + + public boolean isLoaded () + { + return loaded; + } + + public boolean hasException() + { + return exception!=null; + } + + public void setException(Exception exception) + { + this.exception = exception; + this.loaded = true; + } + + public Exception getException() + { + return exception; + } + + List attachments; + + public void loadAttachments (Attachments attachments) throws Exception + { + log.debug("loadAttachments a ", data.length, " "+ new Date()); + + Session s = Session.getDefaultInstance(new Properties()); + MimeMessage message = new MimeMessage(s, new ByteArrayInputStream(data)); + + log.debug("loadAttachments b ", new Date()); + List> contents = new ArrayList>(); + contents.add(new Triple(message.getDisposition(), message.getContentID(), message.getContent())); + while (contents.size() > 0) + { + log.debug("loadAttachments c ", new Date()); + + Triple p = contents.get(0); + contents.remove(0); + + String disposition = p.first; + String id = p.second; + Object content = p.third; + + if (content instanceof InputStream) + { + String attachmentId = Attachment.getAttachmentId(disposition, id); + + Attachment attachment = attachments.getAttachment(attachmentId); + if (attachment != null) + { + attachment.setData (Streams.readFullyBytes((InputStream)content)); + } + } + else + if (content instanceof MimeMultipart) + { + MimeMultipart m = (MimeMultipart)content; + for (int i=0; i( + Arrays.firstOrNull(b.getHeader("Content-Disposition")), + Arrays.firstOrNull(b.getHeader("Content-Id")), + b.getContent() + ) + ); + } + } + } + + log.debug("loadAttachments d ", new Date()); + attachments.setLoaded(true); + } + + public List getAttachments () + { + log.debug("getAttachments", new Date()); + return attachments; + } +} diff --git a/android/Mailiverse/bin/jarlist.cache b/android/Mailiverse/bin/jarlist.cache new file mode 100644 index 0000000..47db516 --- /dev/null +++ b/android/Mailiverse/bin/jarlist.cache @@ -0,0 +1,6 @@ +# cache for current jar dependecy. DO NOT EDIT. +# format is +# Encoding is UTF-8 +1361137686000 385677 b9c504522d97f64025c387493d3989e52bc617bd /Users/tprepscius/Projects/mailiverse/android/Ext/libs/android-support-v4.jar +1360712012000 385677 b9c504522d97f64025c387493d3989e52bc617bd /Users/tprepscius/Projects/mailiverse/android/SlidingMenu/library/libs/android-support-v4.jar +1361130143000 385677 b9c504522d97f64025c387493d3989e52bc617bd /Users/tprepscius/Projects/mailiverse/android/Mailiverse/libs/android-support-v4.jar diff --git a/android/Mailiverse/bin/res/drawable-hdpi/ic_launcher.png b/android/Mailiverse/bin/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..efa7c5f Binary files /dev/null and b/android/Mailiverse/bin/res/drawable-hdpi/ic_launcher.png differ diff --git a/android/Mailiverse/bin/res/drawable-mdpi/ic_launcher.png b/android/Mailiverse/bin/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..ec27f2e Binary files /dev/null and b/android/Mailiverse/bin/res/drawable-mdpi/ic_launcher.png differ diff --git a/android/Mailiverse/bin/res/drawable-xhdpi/ic_launcher.png b/android/Mailiverse/bin/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..92fc57d Binary files /dev/null and b/android/Mailiverse/bin/res/drawable-xhdpi/ic_launcher.png differ diff --git a/android/Mailiverse/bin/res/drawable-xxhdpi/ic_launcher.png b/android/Mailiverse/bin/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..b6f8f4e Binary files /dev/null and b/android/Mailiverse/bin/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/android/Mailiverse/gen/com/benith/mailiverse/BuildConfig.java b/android/Mailiverse/gen/com/benith/mailiverse/BuildConfig.java new file mode 100644 index 0000000..37c137c --- /dev/null +++ b/android/Mailiverse/gen/com/benith/mailiverse/BuildConfig.java @@ -0,0 +1,6 @@ +/** Automatically generated file. DO NOT MODIFY */ +package com.benith.mailiverse; + +public final class BuildConfig { + public final static boolean DEBUG = true; +} \ No newline at end of file diff --git a/android/Mailiverse/gen/com/benith/mailiverse/R.java b/android/Mailiverse/gen/com/benith/mailiverse/R.java new file mode 100644 index 0000000..70a18d9 --- /dev/null +++ b/android/Mailiverse/gen/com/benith/mailiverse/R.java @@ -0,0 +1,517 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package com.benith.mailiverse; + +public final class R { + public static final class anim { + public static final int back_enter=0x7f040000; + public static final int back_leave=0x7f040001; + public static final int forward_enter=0x7f040002; + public static final int forward_leave=0x7f040003; + } + public static final class attr { + /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int behindOffset=0x7f010003; + /**

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int behindScrollScale=0x7f010005; + /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int behindWidth=0x7f010004; + /**

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int fadeDegree=0x7f01000b; + /**

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int fadeEnabled=0x7f01000a; + /**

Must be one of the following constant values.

+ ++++ + + +
ConstantValueDescription
left0
right1
+ */ + public static final int mode=0x7f010000; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static final int selectorDrawable=0x7f01000d; + /**

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int selectorEnabled=0x7f01000c; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static final int shadowDrawable=0x7f010008; + /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int shadowWidth=0x7f010009; + /**

Must be one of the following constant values.

+ ++++ + + +
ConstantValueDescription
margin0
fullscreen1
+ */ + public static final int touchModeAbove=0x7f010006; + /**

Must be one of the following constant values.

+ ++++ + + +
ConstantValueDescription
margin0
fullscreen1
+ */ + public static final int touchModeBehind=0x7f010007; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static final int viewAbove=0x7f010001; + /**

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + */ + public static final int viewBehind=0x7f010002; + } + public static final class dimen { + /** Default screen margins, per the Android Design guidelines. + + Customize dimensions originally defined in res/values/dimens.xml (such as + screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. + + */ + public static final int activity_horizontal_margin=0x7f080000; + public static final int activity_vertical_margin=0x7f080001; + } + public static final class drawable { + public static final int ic_launcher=0x7f020000; + public static final int spiral_galaxy_bg=0x7f020001; + } + public static final class id { + public static final int LinearLayout1=0x7f070017; + public static final int LinearLayout2=0x7f070010; + public static final int RelativeLayout1=0x7f070012; + public static final int action_forgot_password=0x7f070027; + public static final int action_settings=0x7f070026; + public static final int conversationBackButton=0x7f070006; + public static final int conversationBrief=0x7f070016; + public static final int conversationCheck=0x7f070011; + public static final int conversationDate=0x7f070013; + public static final int conversationList=0x7f070019; + public static final int conversationName=0x7f070014; + public static final int conversationSubject=0x7f070015; + public static final int email=0x7f07000c; + public static final int folderList=0x7f070023; + public static final int folderName=0x7f07001a; + public static final int folderQuantity=0x7f07001b; + public static final int folderRevealButton=0x7f070018; + public static final int fullscreen=0x7f070003; + public static final int left=0x7f070000; + public static final int login=0x7f07000e; + public static final int login_background=0x7f070008; + public static final int login_form=0x7f07000b; + public static final int login_status=0x7f070009; + public static final int login_status_message=0x7f07000a; + public static final int mailAuthor=0x7f07001d; + public static final int mailBody=0x7f070020; + public static final int mailDate=0x7f07001e; + public static final int mailList=0x7f070007; + public static final int mailRecipients=0x7f07001f; + public static final int mailSubject=0x7f07001c; + public static final int mails=0x7f070005; + public static final int margin=0x7f070002; + public static final int menu_settings=0x7f070025; + public static final int password=0x7f07000d; + public static final int revealLogout=0x7f070021; + public static final int revealUserName=0x7f070022; + public static final int right=0x7f070001; + public static final int selected_view=0x7f070004; + public static final int sign_in_button=0x7f07000f; + public static final int slidingmenumain=0x7f070024; + } + public static final class layout { + public static final int activity_conversation=0x7f030000; + public static final int activity_login=0x7f030001; + public static final int activity_main=0x7f030002; + public static final int conversation_item=0x7f030003; + public static final int folder=0x7f030004; + public static final int folder_item=0x7f030005; + public static final int mail_header_item=0x7f030006; + public static final int mail_item=0x7f030007; + public static final int reveal_folders=0x7f030008; + public static final int slidingmenumain=0x7f030009; + } + public static final class menu { + public static final int activity_conversation=0x7f090000; + public static final int activity_folder=0x7f090001; + public static final int activity_main=0x7f090002; + public static final int conversation=0x7f090003; + public static final int login=0x7f090004; + } + public static final class string { + public static final int action_forgot_password=0x7f05000c; + public static final int action_settings=0x7f050006; + public static final int action_sign_in_register=0x7f05000a; + public static final int action_sign_in_short=0x7f05000b; + public static final int app_name=0x7f050000; + public static final int error_field_required=0x7f050011; + public static final int error_incorrect_password=0x7f050010; + public static final int error_invalid_email=0x7f05000e; + public static final int error_invalid_password=0x7f05000f; + public static final int hello_world=0x7f050001; + public static final int login_progress_signing_in=0x7f05000d; + public static final int menu_settings=0x7f050002; + /** Strings related to login + */ + public static final int prompt_email=0x7f050008; + public static final int prompt_password=0x7f050009; + public static final int title_activity_conversation=0x7f050005; + public static final int title_activity_folder=0x7f050003; + public static final int title_activity_login=0x7f050007; + public static final int title_activity_main=0x7f050004; + } + public static final class style { + /** + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + + + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + + + Base application theme for API 11+. This theme completely replaces + AppBaseTheme from res/values/styles.xml on API 11+ devices. + + API 11 theme customizations can go here. + + Base application theme for API 14+. This theme completely replaces + AppBaseTheme from BOTH res/values/styles.xml and + res/values-v11/styles.xml on API 14+ devices. + + API 14 theme customizations can go here. + + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + + + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + + + Base application theme for API 11+. This theme completely replaces + AppBaseTheme from res/values/styles.xml on API 11+ devices. + + API 11 theme customizations can go here. + + Base application theme for API 14+. This theme completely replaces + AppBaseTheme from BOTH res/values/styles.xml and + res/values-v11/styles.xml on API 14+ devices. + + API 14 theme customizations can go here. + */ + public static final int AppBaseTheme=0x7f060000; + /** Application theme. + All customizations that are NOT specific to a particular API-level can go here. + Application theme. + All customizations that are NOT specific to a particular API-level can go here. + */ + public static final int AppTheme=0x7f060001; + public static final int LoginFormContainer=0x7f060002; + } + public static final class styleable { + /** Attributes that can be used with a SlidingMenu. +

Includes the following attributes:

+ + + + + + + + + + + + + + + + + + +
AttributeDescription
{@link #SlidingMenu_behindOffset com.benith.mailiverse:behindOffset}
{@link #SlidingMenu_behindScrollScale com.benith.mailiverse:behindScrollScale}
{@link #SlidingMenu_behindWidth com.benith.mailiverse:behindWidth}
{@link #SlidingMenu_fadeDegree com.benith.mailiverse:fadeDegree}
{@link #SlidingMenu_fadeEnabled com.benith.mailiverse:fadeEnabled}
{@link #SlidingMenu_mode com.benith.mailiverse:mode}
{@link #SlidingMenu_selectorDrawable com.benith.mailiverse:selectorDrawable}
{@link #SlidingMenu_selectorEnabled com.benith.mailiverse:selectorEnabled}
{@link #SlidingMenu_shadowDrawable com.benith.mailiverse:shadowDrawable}
{@link #SlidingMenu_shadowWidth com.benith.mailiverse:shadowWidth}
{@link #SlidingMenu_touchModeAbove com.benith.mailiverse:touchModeAbove}
{@link #SlidingMenu_touchModeBehind com.benith.mailiverse:touchModeBehind}
{@link #SlidingMenu_viewAbove com.benith.mailiverse:viewAbove}
{@link #SlidingMenu_viewBehind com.benith.mailiverse:viewBehind}
+ @see #SlidingMenu_behindOffset + @see #SlidingMenu_behindScrollScale + @see #SlidingMenu_behindWidth + @see #SlidingMenu_fadeDegree + @see #SlidingMenu_fadeEnabled + @see #SlidingMenu_mode + @see #SlidingMenu_selectorDrawable + @see #SlidingMenu_selectorEnabled + @see #SlidingMenu_shadowDrawable + @see #SlidingMenu_shadowWidth + @see #SlidingMenu_touchModeAbove + @see #SlidingMenu_touchModeBehind + @see #SlidingMenu_viewAbove + @see #SlidingMenu_viewBehind + */ + public static final int[] SlidingMenu = { + 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, + 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, + 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, + 0x7f01000c, 0x7f01000d + }; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#behindOffset} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:behindOffset + */ + public static final int SlidingMenu_behindOffset = 3; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#behindScrollScale} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:behindScrollScale + */ + public static final int SlidingMenu_behindScrollScale = 5; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#behindWidth} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:behindWidth + */ + public static final int SlidingMenu_behindWidth = 4; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#fadeDegree} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:fadeDegree + */ + public static final int SlidingMenu_fadeDegree = 11; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#fadeEnabled} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:fadeEnabled + */ + public static final int SlidingMenu_fadeEnabled = 10; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#mode} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be one of the following constant values.

+ ++++ + + +
ConstantValueDescription
left0
right1
+ @attr name android:mode + */ + public static final int SlidingMenu_mode = 0; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#selectorDrawable} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:selectorDrawable + */ + public static final int SlidingMenu_selectorDrawable = 13; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#selectorEnabled} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:selectorEnabled + */ + public static final int SlidingMenu_selectorEnabled = 12; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#shadowDrawable} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:shadowDrawable + */ + public static final int SlidingMenu_shadowDrawable = 8; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#shadowWidth} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". +Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), +in (inches), mm (millimeters). +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name android:shadowWidth + */ + public static final int SlidingMenu_shadowWidth = 9; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#touchModeAbove} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be one of the following constant values.

+ ++++ + + +
ConstantValueDescription
margin0
fullscreen1
+ @attr name android:touchModeAbove + */ + public static final int SlidingMenu_touchModeAbove = 6; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#touchModeBehind} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be one of the following constant values.

+ ++++ + + +
ConstantValueDescription
margin0
fullscreen1
+ @attr name android:touchModeBehind + */ + public static final int SlidingMenu_touchModeBehind = 7; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#viewAbove} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:viewAbove + */ + public static final int SlidingMenu_viewAbove = 1; + /** +

This symbol is the offset where the {@link com.benith.mailiverse.R.attr#viewBehind} + attribute's value can be found in the {@link #SlidingMenu} array. + + +

Must be a reference to another resource, in the form "@[+][package:]type:name" +or to a theme attribute in the form "?[package:][type:]name". + @attr name android:viewBehind + */ + public static final int SlidingMenu_viewBehind = 2; + }; +} diff --git a/android/Mailiverse/gen/com/example/ext/R.java b/android/Mailiverse/gen/com/example/ext/R.java new file mode 100644 index 0000000..485f99f --- /dev/null +++ b/android/Mailiverse/gen/com/example/ext/R.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ +package com.example.ext; + +public final class R { + public static final class style { + public static final int AppBaseTheme = 0x7f060000; + public static final int AppTheme = 0x7f060001; + } + public static final class string { + public static final int app_name = 0x7f050000; + } + public static final class drawable { + public static final int ic_launcher = 0x7f020000; + } +} diff --git a/android/Mailiverse/ic_launcher-web.png b/android/Mailiverse/ic_launcher-web.png new file mode 100644 index 0000000..26415e8 Binary files /dev/null and b/android/Mailiverse/ic_launcher-web.png differ diff --git a/android/Mailiverse/jni/Android.mk b/android/Mailiverse/jni/Android.mk new file mode 100644 index 0000000..78be240 --- /dev/null +++ b/android/Mailiverse/jni/Android.mk @@ -0,0 +1,11 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := Mailiverse +LOCAL_SRC_FILES := \ + Mailiverse.cpp \ + core_crypt_PBEPlatformNative.c \ + sha256.c + +include $(BUILD_SHARED_LIBRARY) diff --git a/android/Mailiverse/jni/Application.mk b/android/Mailiverse/jni/Application.mk new file mode 100644 index 0000000..a252a72 --- /dev/null +++ b/android/Mailiverse/jni/Application.mk @@ -0,0 +1 @@ +APP_ABI := all diff --git a/android/Mailiverse/jni/Mailiverse.cpp b/android/Mailiverse/jni/Mailiverse.cpp new file mode 100644 index 0000000..6434c66 --- /dev/null +++ b/android/Mailiverse/jni/Mailiverse.cpp @@ -0,0 +1 @@ +#include diff --git a/android/Mailiverse/jni/core_crypt_PBEPlatformNative.c b/android/Mailiverse/jni/core_crypt_PBEPlatformNative.c new file mode 100644 index 0000000..894fa44 --- /dev/null +++ b/android/Mailiverse/jni/core_crypt_PBEPlatformNative.c @@ -0,0 +1,30 @@ +#include "core_crypt_PBEPlatformNative.h" + +// downloaded from https://github.com/johanns/PBKDF256/tree/master/ext/core +#include "sha256.h" +#include + +JNIEXPORT jbyteArray JNICALL Java_core_crypt_PBEPlatformNative_generate + (JNIEnv *jenv, jclass jclazz, jstring jpassword, jbyteArray jsalt, jint jiterations, jint jkeyLengthBits) +{ + jboolean isCopy; + const char *password = (*jenv)->GetStringUTFChars(jenv, jpassword, 0); + jbyte *salt = (*jenv)->GetByteArrayElements (jenv, jsalt, &isCopy); + jint saltLength = (*jenv)->GetArrayLength(jenv, jsalt); + + int keyLengthBytes = jkeyLengthBits/8; + unsigned char *out = malloc(keyLengthBytes); + + const uint8_t *ucSalt = (const uint8_t *)salt; + const uint8_t *ucPassword = (const uint8_t *)password; + uint64_t u64Iterations = (uint64_t)jiterations; + s_PBKDF2_SHA256 (password, strlen(password), ucSalt, saltLength, u64Iterations, out, keyLengthBytes); + + jbyteArray jout = (*jenv)->NewByteArray (jenv, keyLengthBytes); + (*jenv)->SetByteArrayRegion (jenv, jout, 0, keyLengthBytes, out); + free (out); + + (*jenv)->ReleaseByteArrayElements (jenv, jsalt, salt, isCopy); + + return jout; +} diff --git a/android/Mailiverse/jni/core_crypt_PBEPlatformNative.h b/android/Mailiverse/jni/core_crypt_PBEPlatformNative.h new file mode 100644 index 0000000..c6ca36e --- /dev/null +++ b/android/Mailiverse/jni/core_crypt_PBEPlatformNative.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class core_crypt_PBEPlatform */ + +#ifndef _Included_core_crypt_PBEPlatform +#define _Included_core_crypt_PBEPlatform +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: core_crypt_PBEPlatform + * Method: generate + * Signature: (Ljava/lang/String;[BII)[B + */ +JNIEXPORT jbyteArray JNICALL Java_core_crypt_PBEPlatformNative_generate + (JNIEnv *, jclass, jstring, jbyteArray, jint, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/android/Mailiverse/jni/scrypt_platform.h b/android/Mailiverse/jni/scrypt_platform.h new file mode 100644 index 0000000..ef07f35 --- /dev/null +++ b/android/Mailiverse/jni/scrypt_platform.h @@ -0,0 +1,4 @@ +#ifndef _SCRYPT_PLATFORM_H_ +#define _SCRYPT_PLATFORM_H_ + +#endif /* !_SCRYPT_PLATFORM_H_ */ diff --git a/android/Mailiverse/jni/sha256.c b/android/Mailiverse/jni/sha256.c new file mode 100644 index 0000000..ecfecb9 --- /dev/null +++ b/android/Mailiverse/jni/sha256.c @@ -0,0 +1,421 @@ +/*- + * + * WOOOHOOO!!! + * + * Sept. 25th 2012: Appending prefix to function prototypes to avoid collision with + * OpenSSL methods when requiring openssl module in Ruby which causes the VM to crash! + * +-*/ + +/*- + * Copyright 2005,2007,2009 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include "scrypt_platform.h" + +#include + +#include +#include + +#include "sysendian.h" + +#include "sha256.h" + +/* + * Encode a length len/4 vector of (uint32_t) into a length len vector of + * (unsigned char) in big-endian form. Assumes len is a multiple of 4. + */ +static void +be32enc_vect(unsigned char *dst, const uint32_t *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 4; i++) + be32enc(dst + i * 4, src[i]); +} + +/* + * Decode a big-endian length len vector of (unsigned char) into a length + * len/4 vector of (uint32_t). Assumes len is a multiple of 4. + */ +static void +be32dec_vect(uint32_t *dst, const unsigned char *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 4; i++) + dst[i] = be32dec(src + i * 4); +} + +/* Elementary functions used by SHA256 */ +#define Ch(x, y, z) ((x & (y ^ z)) ^ z) +#define Maj(x, y, z) ((x & (y | z)) | (y & z)) +#define SHR(x, n) (x >> n) +#define ROTR(x, n) ((x >> n) | (x << (32 - n))) +#define S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) +#define S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) +#define s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3)) +#define s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10)) + +/* SHA256 round function */ +#define RND(a, b, c, d, e, f, g, h, k) \ + t0 = h + S1(e) + Ch(e, f, g) + k; \ + t1 = S0(a) + Maj(a, b, c); \ + d += t0; \ + h = t0 + t1; + +/* Adjusted round function for rotating state */ +#define RNDr(S, W, i, k) \ + RND(S[(64 - i) % 8], S[(65 - i) % 8], \ + S[(66 - i) % 8], S[(67 - i) % 8], \ + S[(68 - i) % 8], S[(69 - i) % 8], \ + S[(70 - i) % 8], S[(71 - i) % 8], \ + W[i] + k) + +/* + * SHA256 block compression function. The 256-bit state is transformed via + * the 512-bit input block to produce a new state. + */ +static void +SHA256_Transform(uint32_t * state, const unsigned char block[64]) +{ + uint32_t W[64]; + uint32_t S[8]; + uint32_t t0, t1; + int i; + + /* 1. Prepare message schedule W. */ + be32dec_vect(W, block, 64); + for (i = 16; i < 64; i++) + W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; + + /* 2. Initialize working variables. */ + memcpy(S, state, 32); + + /* 3. Mix. */ + RNDr(S, W, 0, 0x428a2f98); + RNDr(S, W, 1, 0x71374491); + RNDr(S, W, 2, 0xb5c0fbcf); + RNDr(S, W, 3, 0xe9b5dba5); + RNDr(S, W, 4, 0x3956c25b); + RNDr(S, W, 5, 0x59f111f1); + RNDr(S, W, 6, 0x923f82a4); + RNDr(S, W, 7, 0xab1c5ed5); + RNDr(S, W, 8, 0xd807aa98); + RNDr(S, W, 9, 0x12835b01); + RNDr(S, W, 10, 0x243185be); + RNDr(S, W, 11, 0x550c7dc3); + RNDr(S, W, 12, 0x72be5d74); + RNDr(S, W, 13, 0x80deb1fe); + RNDr(S, W, 14, 0x9bdc06a7); + RNDr(S, W, 15, 0xc19bf174); + RNDr(S, W, 16, 0xe49b69c1); + RNDr(S, W, 17, 0xefbe4786); + RNDr(S, W, 18, 0x0fc19dc6); + RNDr(S, W, 19, 0x240ca1cc); + RNDr(S, W, 20, 0x2de92c6f); + RNDr(S, W, 21, 0x4a7484aa); + RNDr(S, W, 22, 0x5cb0a9dc); + RNDr(S, W, 23, 0x76f988da); + RNDr(S, W, 24, 0x983e5152); + RNDr(S, W, 25, 0xa831c66d); + RNDr(S, W, 26, 0xb00327c8); + RNDr(S, W, 27, 0xbf597fc7); + RNDr(S, W, 28, 0xc6e00bf3); + RNDr(S, W, 29, 0xd5a79147); + RNDr(S, W, 30, 0x06ca6351); + RNDr(S, W, 31, 0x14292967); + RNDr(S, W, 32, 0x27b70a85); + RNDr(S, W, 33, 0x2e1b2138); + RNDr(S, W, 34, 0x4d2c6dfc); + RNDr(S, W, 35, 0x53380d13); + RNDr(S, W, 36, 0x650a7354); + RNDr(S, W, 37, 0x766a0abb); + RNDr(S, W, 38, 0x81c2c92e); + RNDr(S, W, 39, 0x92722c85); + RNDr(S, W, 40, 0xa2bfe8a1); + RNDr(S, W, 41, 0xa81a664b); + RNDr(S, W, 42, 0xc24b8b70); + RNDr(S, W, 43, 0xc76c51a3); + RNDr(S, W, 44, 0xd192e819); + RNDr(S, W, 45, 0xd6990624); + RNDr(S, W, 46, 0xf40e3585); + RNDr(S, W, 47, 0x106aa070); + RNDr(S, W, 48, 0x19a4c116); + RNDr(S, W, 49, 0x1e376c08); + RNDr(S, W, 50, 0x2748774c); + RNDr(S, W, 51, 0x34b0bcb5); + RNDr(S, W, 52, 0x391c0cb3); + RNDr(S, W, 53, 0x4ed8aa4a); + RNDr(S, W, 54, 0x5b9cca4f); + RNDr(S, W, 55, 0x682e6ff3); + RNDr(S, W, 56, 0x748f82ee); + RNDr(S, W, 57, 0x78a5636f); + RNDr(S, W, 58, 0x84c87814); + RNDr(S, W, 59, 0x8cc70208); + RNDr(S, W, 60, 0x90befffa); + RNDr(S, W, 61, 0xa4506ceb); + RNDr(S, W, 62, 0xbef9a3f7); + RNDr(S, W, 63, 0xc67178f2); + + /* 4. Mix local working variables into global state */ + for (i = 0; i < 8; i++) + state[i] += S[i]; + + /* Clean the stack. */ + memset(W, 0, 256); + memset(S, 0, 32); + t0 = t1 = 0; +} + +static unsigned char PAD[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* Add padding and terminating bit-count. */ +static void +SHA256_Pad(SHA256_CTX * ctx) +{ + unsigned char len[8]; + uint32_t r, plen; + + /* + * Convert length to a vector of bytes -- we do this now rather + * than later because the length will change after we pad. + */ + be32enc_vect(len, ctx->count, 8); + + /* Add 1--64 bytes so that the resulting length is 56 mod 64 */ + r = (ctx->count[1] >> 3) & 0x3f; + plen = (r < 56) ? (56 - r) : (120 - r); + s_SHA256_Update(ctx, PAD, (size_t)plen); + + /* Add the terminating bit-count */ + s_SHA256_Update(ctx, len, 8); +} + +/* SHA-256 initialization. Begins a SHA-256 operation. */ +void +s_SHA256_Init(SHA256_CTX * ctx) +{ + + /* Zero bits processed so far */ + ctx->count[0] = ctx->count[1] = 0; + + /* Magic initialization constants */ + ctx->state[0] = 0x6A09E667; + ctx->state[1] = 0xBB67AE85; + ctx->state[2] = 0x3C6EF372; + ctx->state[3] = 0xA54FF53A; + ctx->state[4] = 0x510E527F; + ctx->state[5] = 0x9B05688C; + ctx->state[6] = 0x1F83D9AB; + ctx->state[7] = 0x5BE0CD19; +} + +/* Add bytes into the hash */ +void +s_SHA256_Update(SHA256_CTX * ctx, const void *in, size_t len) +{ + uint32_t bitlen[2]; + uint32_t r; + const unsigned char *src = in; + + /* Number of bytes left in the buffer from previous updates */ + r = (ctx->count[1] >> 3) & 0x3f; + + /* Convert the length into a number of bits */ + bitlen[1] = ((uint32_t)len) << 3; + bitlen[0] = (uint32_t)(len >> 29); + + /* Update number of bits */ + if ((ctx->count[1] += bitlen[1]) < bitlen[1]) + ctx->count[0]++; + ctx->count[0] += bitlen[0]; + + /* Handle the case where we don't need to perform any transforms */ + if (len < 64 - r) { + memcpy(&ctx->buf[r], src, len); + return; + } + + /* Finish the current block */ + memcpy(&ctx->buf[r], src, 64 - r); + SHA256_Transform(ctx->state, ctx->buf); + src += 64 - r; + len -= 64 - r; + + /* Perform complete blocks */ + while (len >= 64) { + SHA256_Transform(ctx->state, src); + src += 64; + len -= 64; + } + + /* Copy left over data into buffer */ + memcpy(ctx->buf, src, len); +} + +/* + * SHA-256 finalization. Pads the input data, exports the hash value, + * and clears the context state. + */ +void +s_SHA256_Final(unsigned char digest[32], SHA256_CTX * ctx) +{ + + /* Add padding */ + SHA256_Pad(ctx); + + /* Write the hash */ + be32enc_vect(digest, ctx->state, 32); + + /* Clear the context state */ + memset((void *)ctx, 0, sizeof(*ctx)); +} + +/* Initialize an HMAC-SHA256 operation with the given key. */ +void +s_HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * _K, size_t Klen) +{ + unsigned char pad[64]; + unsigned char khash[32]; + const unsigned char * K = _K; + size_t i; + + /* If Klen > 64, the key is really SHA256(K). */ + if (Klen > 64) { + s_SHA256_Init(&ctx->ictx); + s_SHA256_Update(&ctx->ictx, K, Klen); + s_SHA256_Final(khash, &ctx->ictx); + K = khash; + Klen = 32; + } + + /* Inner SHA256 operation is SHA256(K xor [block of 0x36] || data). */ + s_SHA256_Init(&ctx->ictx); + memset(pad, 0x36, 64); + for (i = 0; i < Klen; i++) + pad[i] ^= K[i]; + s_SHA256_Update(&ctx->ictx, pad, 64); + + /* Outer SHA256 operation is SHA256(K xor [block of 0x5c] || hash). */ + s_SHA256_Init(&ctx->octx); + memset(pad, 0x5c, 64); + for (i = 0; i < Klen; i++) + pad[i] ^= K[i]; + s_SHA256_Update(&ctx->octx, pad, 64); + + /* Clean the stack. */ + memset(khash, 0, 32); +} + +/* Add bytes to the HMAC-SHA256 operation. */ +void +s_HMAC_SHA256_Update(HMAC_SHA256_CTX * ctx, const void *in, size_t len) +{ + + /* Feed data to the inner SHA256 operation. */ + s_SHA256_Update(&ctx->ictx, in, len); +} + +/* Finish an HMAC-SHA256 operation. */ +void +s_HMAC_SHA256_Final(unsigned char digest[32], HMAC_SHA256_CTX * ctx) +{ + unsigned char ihash[32]; + + /* Finish the inner SHA256 operation. */ + s_SHA256_Final(ihash, &ctx->ictx); + + /* Feed the inner hash to the outer SHA256 operation. */ + s_SHA256_Update(&ctx->octx, ihash, 32); + + /* Finish the outer SHA256 operation. */ + s_SHA256_Final(digest, &ctx->octx); + + /* Clean the stack. */ + memset(ihash, 0, 32); +} + +/** + * s_PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): + * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and + * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1). + */ +void +s_PBKDF2_SHA256(const uint8_t * passwd, size_t passwdlen, const uint8_t * salt, + size_t saltlen, uint64_t c, uint8_t * buf, size_t dkLen) +{ + HMAC_SHA256_CTX PShctx, hctx; + size_t i; + uint8_t ivec[4]; + uint8_t U[32]; + uint8_t T[32]; + uint64_t j; + int k; + size_t clen; + + /* Compute HMAC state after processing P and S. */ + s_HMAC_SHA256_Init(&PShctx, passwd, passwdlen); + s_HMAC_SHA256_Update(&PShctx, salt, saltlen); + + /* Iterate through the blocks. */ + for (i = 0; i * 32 < dkLen; i++) { + /* Generate INT(i + 1). */ + be32enc(ivec, (uint32_t)(i + 1)); + + /* Compute U_1 = PRF(P, S || INT(i)). */ + memcpy(&hctx, &PShctx, sizeof(HMAC_SHA256_CTX)); + s_HMAC_SHA256_Update(&hctx, ivec, 4); + s_HMAC_SHA256_Final(U, &hctx); + + /* T_i = U_1 ... */ + memcpy(T, U, 32); + + for (j = 2; j <= c; j++) { + /* Compute U_j. */ + s_HMAC_SHA256_Init(&hctx, passwd, passwdlen); + s_HMAC_SHA256_Update(&hctx, U, 32); + s_HMAC_SHA256_Final(U, &hctx); + + /* ... xor U_j ... */ + for (k = 0; k < 32; k++) + T[k] ^= U[k]; + } + + /* Copy as many bytes as necessary into buf. */ + clen = dkLen - i * 32; + if (clen > 32) + clen = 32; + memcpy(&buf[i * 32], T, clen); + } + + /* Clean PShctx, since we never called _Final on it. */ + memset(&PShctx, 0, sizeof(HMAC_SHA256_CTX)); +} diff --git a/android/Mailiverse/jni/sha256.h b/android/Mailiverse/jni/sha256.h new file mode 100644 index 0000000..b614c99 --- /dev/null +++ b/android/Mailiverse/jni/sha256.h @@ -0,0 +1,71 @@ +/*- + * + * WOOOHOOO!!! + * + * Sept. 25th 2012: Appending prefix to function prototypes to avoid collision with + * OpenSSL methods when requiring openssl module in Ruby which causes the VM to crash! + * +-*/ + +/*- + * Copyright 2005,2007,2009 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libmd/sha256.h,v 1.2 2006/01/17 15:35:56 phk Exp $ + */ + +#ifndef _SHA256_H_ +#define _SHA256_H_ + +#include + +#include + +typedef struct SHA256Context { + uint32_t state[8]; + uint32_t count[2]; + unsigned char buf[64]; +} SHA256_CTX; + +typedef struct HMAC_SHA256Context { + SHA256_CTX ictx; + SHA256_CTX octx; +} HMAC_SHA256_CTX; + +void s_SHA256_Init(SHA256_CTX *); +void s_SHA256_Update(SHA256_CTX *, const void *, size_t); +void s_SHA256_Final(unsigned char [32], SHA256_CTX *); +void s_HMAC_SHA256_Init(HMAC_SHA256_CTX *, const void *, size_t); +void s_HMAC_SHA256_Update(HMAC_SHA256_CTX *, const void *, size_t); +void s_HMAC_SHA256_Final(unsigned char [32], HMAC_SHA256_CTX *); + +/** + * s_PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): + * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and + * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1). + */ +void s_PBKDF2_SHA256(const uint8_t *, size_t, const uint8_t *, size_t, + uint64_t, uint8_t *, size_t); + +#endif /* !_SHA256_H_ */ diff --git a/android/Mailiverse/jni/sysendian.h b/android/Mailiverse/jni/sysendian.h new file mode 100644 index 0000000..62ef31a --- /dev/null +++ b/android/Mailiverse/jni/sysendian.h @@ -0,0 +1,140 @@ +/*- + * Copyright 2007-2009 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file was originally written by Colin Percival as part of the Tarsnap + * online backup system. + */ +#ifndef _SYSENDIAN_H_ +#define _SYSENDIAN_H_ + +#include "scrypt_platform.h" + +/* If we don't have be64enc, the we have isn't usable. */ +#if !HAVE_DECL_BE64ENC +#undef HAVE_SYS_ENDIAN_H +#endif + +#ifdef HAVE_SYS_ENDIAN_H + +#include + +#else + +#include + +static inline uint32_t +be32dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + + return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) + + ((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24)); +} + +static inline void +be32enc(void *pp, uint32_t x) +{ + uint8_t * p = (uint8_t *)pp; + + p[3] = x & 0xff; + p[2] = (x >> 8) & 0xff; + p[1] = (x >> 16) & 0xff; + p[0] = (x >> 24) & 0xff; +} + +static inline uint64_t +be64dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + + return ((uint64_t)(p[7]) + ((uint64_t)(p[6]) << 8) + + ((uint64_t)(p[5]) << 16) + ((uint64_t)(p[4]) << 24) + + ((uint64_t)(p[3]) << 32) + ((uint64_t)(p[2]) << 40) + + ((uint64_t)(p[1]) << 48) + ((uint64_t)(p[0]) << 56)); +} + +static inline void +be64enc(void *pp, uint64_t x) +{ + uint8_t * p = (uint8_t *)pp; + + p[7] = x & 0xff; + p[6] = (x >> 8) & 0xff; + p[5] = (x >> 16) & 0xff; + p[4] = (x >> 24) & 0xff; + p[3] = (x >> 32) & 0xff; + p[2] = (x >> 40) & 0xff; + p[1] = (x >> 48) & 0xff; + p[0] = (x >> 56) & 0xff; +} + +static inline uint32_t +le32dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + + return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) + + ((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24)); +} + +static inline void +le32enc(void *pp, uint32_t x) +{ + uint8_t * p = (uint8_t *)pp; + + p[0] = x & 0xff; + p[1] = (x >> 8) & 0xff; + p[2] = (x >> 16) & 0xff; + p[3] = (x >> 24) & 0xff; +} + +static inline uint64_t +le64dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + + return ((uint64_t)(p[0]) + ((uint64_t)(p[1]) << 8) + + ((uint64_t)(p[2]) << 16) + ((uint64_t)(p[3]) << 24) + + ((uint64_t)(p[4]) << 32) + ((uint64_t)(p[5]) << 40) + + ((uint64_t)(p[6]) << 48) + ((uint64_t)(p[7]) << 56)); +} + +static inline void +le64enc(void *pp, uint64_t x) +{ + uint8_t * p = (uint8_t *)pp; + + p[0] = x & 0xff; + p[1] = (x >> 8) & 0xff; + p[2] = (x >> 16) & 0xff; + p[3] = (x >> 24) & 0xff; + p[4] = (x >> 32) & 0xff; + p[5] = (x >> 40) & 0xff; + p[6] = (x >> 48) & 0xff; + p[7] = (x >> 56) & 0xff; +} +#endif /* !HAVE_SYS_ENDIAN_H */ + +#endif /* !_SYSENDIAN_H_ */ diff --git a/android/Mailiverse/lint.xml b/android/Mailiverse/lint.xml new file mode 100644 index 0000000..ee0eead --- /dev/null +++ b/android/Mailiverse/lint.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/android/Mailiverse/proguard-project.txt b/android/Mailiverse/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/android/Mailiverse/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/android/Mailiverse/project.properties b/android/Mailiverse/project.properties new file mode 100644 index 0000000..7d57dff --- /dev/null +++ b/android/Mailiverse/project.properties @@ -0,0 +1,16 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-17 +android.library.reference.1=../SlidingMenu/library +android.library.reference.2=../Ext diff --git a/android/Mailiverse/res/anim/back_enter.xml b/android/Mailiverse/res/anim/back_enter.xml new file mode 100644 index 0000000..c2f3fa1 --- /dev/null +++ b/android/Mailiverse/res/anim/back_enter.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/android/Mailiverse/res/anim/back_leave.xml b/android/Mailiverse/res/anim/back_leave.xml new file mode 100644 index 0000000..bebb134 --- /dev/null +++ b/android/Mailiverse/res/anim/back_leave.xml @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/android/Mailiverse/res/anim/forward_enter.xml b/android/Mailiverse/res/anim/forward_enter.xml new file mode 100644 index 0000000..793934b --- /dev/null +++ b/android/Mailiverse/res/anim/forward_enter.xml @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/android/Mailiverse/res/anim/forward_leave.xml b/android/Mailiverse/res/anim/forward_leave.xml new file mode 100644 index 0000000..dd71c52 --- /dev/null +++ b/android/Mailiverse/res/anim/forward_leave.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/android/Mailiverse/res/drawable-hdpi/ic_launcher.png b/android/Mailiverse/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..288b665 Binary files /dev/null and b/android/Mailiverse/res/drawable-hdpi/ic_launcher.png differ diff --git a/android/Mailiverse/res/drawable-hdpi/spiral_galaxy_bg.jpg b/android/Mailiverse/res/drawable-hdpi/spiral_galaxy_bg.jpg new file mode 100644 index 0000000..7f674ff Binary files /dev/null and b/android/Mailiverse/res/drawable-hdpi/spiral_galaxy_bg.jpg differ diff --git a/android/Mailiverse/res/drawable-mdpi/ic_launcher.png b/android/Mailiverse/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..6ae570b Binary files /dev/null and b/android/Mailiverse/res/drawable-mdpi/ic_launcher.png differ diff --git a/android/Mailiverse/res/drawable-mdpi/spiral_galaxy_bg.jpg b/android/Mailiverse/res/drawable-mdpi/spiral_galaxy_bg.jpg new file mode 100644 index 0000000..7f674ff Binary files /dev/null and b/android/Mailiverse/res/drawable-mdpi/spiral_galaxy_bg.jpg differ diff --git a/android/Mailiverse/res/drawable-xhdpi/ic_launcher.png b/android/Mailiverse/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..d4fb7cd Binary files /dev/null and b/android/Mailiverse/res/drawable-xhdpi/ic_launcher.png differ diff --git a/android/Mailiverse/res/drawable-xhdpi/spiral_galaxy_bg.jpg b/android/Mailiverse/res/drawable-xhdpi/spiral_galaxy_bg.jpg new file mode 100644 index 0000000..7f674ff Binary files /dev/null and b/android/Mailiverse/res/drawable-xhdpi/spiral_galaxy_bg.jpg differ diff --git a/android/Mailiverse/res/drawable-xxhdpi/ic_launcher.png b/android/Mailiverse/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..85a6081 Binary files /dev/null and b/android/Mailiverse/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/android/Mailiverse/res/drawable-xxhdpi/spiral_galaxy_bg.jpg b/android/Mailiverse/res/drawable-xxhdpi/spiral_galaxy_bg.jpg new file mode 100644 index 0000000..7f674ff Binary files /dev/null and b/android/Mailiverse/res/drawable-xxhdpi/spiral_galaxy_bg.jpg differ diff --git a/android/Mailiverse/res/layout/activity_conversation.xml b/android/Mailiverse/res/layout/activity_conversation.xml new file mode 100644 index 0000000..2fbf21f --- /dev/null +++ b/android/Mailiverse/res/layout/activity_conversation.xml @@ -0,0 +1,28 @@ + + + + +