adds the build scripts, removes some remaining unremoved files which I thought I removed last time

This commit is contained in:
Timothy Prepscius 2013-08-09 16:31:05 -04:00
parent 4346eae92c
commit f66eb18558
39 changed files with 482 additions and 708 deletions

2
.gitignore vendored
View File

@ -1,4 +1,5 @@
lib/ lib/
xcuserdata
# Compiled source # # Compiled source #
################### ###################
@ -23,7 +24,6 @@ lib/
# git has its own built in compression methods # git has its own built in compression methods
*.7z *.7z
*.dmg *.dmg
*.gz
*.iso *.iso
*.rar *.rar
*.tar *.tar

1
build/clean-demos3 Executable file
View File

@ -0,0 +1 @@
s3cmd del --recursive s3://USER.YOUR_ACCOUNT/Cache

7
build/compile-web Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
V=`date "+%Y%m%d_%H%M%S"`
./compile-web-html $V prod
./compile-web-js $V prod

68
build/compile-web-html Executable file
View File

@ -0,0 +1,68 @@
#!/bin/bash
V=$1
M=$2
dst=../gwt/war
cmn_src=../web/common
client_src=../web/client
signup_src=../web/signup
refill_src=../web/refill
delete_src=../web/delete
mobile_large=../web/mobile_large
mobile_small=../web/mobile_small
learnmore=../web/learnmore
function replaceStrings() {
echo $1 $M
sed -i '' -f replace_html.sed $1
sed -i '' -f replace_html_$M.sed $1
sed -i '' -e s/__VERSION__/$V/g $1
sed -i '' -e s/__THIS_YEAR__/2013/g $1
}
echo Compiling CSS/JS
rm -rf $dst/rev
mkdir -p $dst/rev/$V
cat $cmn_src/*.css $client_src/*.css > $dst/rev/$V/client.css
cat $cmn_src/*.js $client_src/*.js > $dst/rev/$V/client.js
cat $cmn_src/*.css $signup_src/*.css > $dst/rev/$V/signup.css
cat $cmn_src/*.js $signup_src/*.js > $dst/rev/$V/signup.js
cat $cmn_src/*.css $refill_src/*.css > $dst/rev/$V/refill.css
cat $cmn_src/*.js $refill_src/*.js > $dst/rev/$V/refill.js
cat $cmn_src/*.css $delete_src/*.css > $dst/rev/$V/delete.css
cat $cmn_src/*.js $delete_src/*.js > $dst/rev/$V/delete.js
cat $cmn_src/*.js $client_src/*.js $mobile_large/*.js > $dst/rev/$V/mobile_large.js
cat $cmn_src/*.css $client_src/*.css $mobile_large/*.css > $dst/rev/$V/mobile_large.css
cat $cmn_src/*.js $client_src/*.js $mobile_small/*.js > $dst/rev/$V/mobile_small.js
cat $cmn_src/*.css $client_src/*.css $mobile_small/*.css > $dst/rev/$V/mobile_small.css
cat $cmn_src/*.css $learnmore/*.css > $dst/rev/$V/learnmore.css
echo Copying
cp $client_src/index.html $dst/index.html
cp $signup_src/signup.html $dst/signup.html
cp $refill_src/refill.html $dst/refill.html
cp $delete_src/delete.html $dst/delete.html
cp $mobile_large/mobile_large.html $dst/mobile_large.html
cp $mobile_small/mobile_small.html $dst/mobile_small.html
cp $learnmore/learnmore.html $dst/learnmore.html
cp $learnmore/technical.html $dst/technical.html
cp $signup_src/DropboxAuthorized.html $dst/DropboxAuthorized.html
echo Replacing Strings
replaceStrings $dst/index.html
replaceStrings $dst/signup.html
replaceStrings $dst/refill.html
replaceStrings $dst/delete.html
replaceStrings $dst/mobile_large.html
replaceStrings $dst/mobile_small.html
replaceStrings $dst/learnmore.html
replaceStrings $dst/technical.html
replaceStrings $dst/DropboxAuthorized.html

20
build/compile-web-js Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
V=$1
M=$2
dst=../gwt/war
function replaceStrings() {
sed -i '' -f replace_js_$M.sed $1
sed -i '' -e s/__VERSION__/$V/g $1
sed -i '' -e s/__THIS_YEAR__/2013/g $1
}
echo Replacing Strings
replaceStrings $dst/rev/$V/client.js
replaceStrings $dst/rev/$V/signup.js
replaceStrings $dst/rev/$V/refill.js
replaceStrings $dst/rev/$V/delete.js
replaceStrings $dst/rev/$V/mobile_large.js
replaceStrings $dst/rev/$V/mobile_small.js

7
build/dev-compile-web Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
V=`date "+%Y%m%d_%H%M%S"`
./compile-web-html $V dev
./compile-web-js $V dev

3
build/doWeb Executable file
View File

@ -0,0 +1,3 @@
./dev-compile-web && open -a Google\ Chrome --args --disable-web-security http://white:8000/index.html

8
build/export Executable file
View File

@ -0,0 +1,8 @@
rm exported/KeyStreamServer.jar
ant -buildfile exportScripts/KeyStreamServer.xml
rm exported/MailStreamServer.jar
ant -buildfile exportScripts/MailStreamServer.xml
rm exported/Tools.jar
ant -buildfile exportScripts/Tools.xml

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project Mailiverse.App.Client">
<!--this file was created by Eclipse Runnable JAR Export Wizard-->
<!--ANT 1.7 is required -->
<target name="create_run_jar">
<jar destfile="/Users/tprepscius/Projects/mailiverse/build/exported/Client.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="app.client.ClientGUI"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/app/client/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/core/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/bouncycastle/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/annotations-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-ant.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-ha.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-tribes.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/ecj-3.7.2.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/el-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jasper-el.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jasper.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jsp-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/servlet-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-coyote.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-dbcp.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-es.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-fr.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-ja.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-jdbc.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-util.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/jordanzimmerman/bin"/>
<fileset dir="/Users/tprepscius/projects/mailiverse/java/ext/json/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/apache-mina-2.0.4/dist/mina-core-2.0.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/aws-java-sdk-1.3.9.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/dropbox-java-sdk-1.3.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/javamail-1.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/activation-1.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/slf4j-api-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/slf4j-simple-1.3.1.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/apache/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/mysql-connector-java-3.1.14-bin.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/client/lib/javamail-1.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/client/lib/mina-core-2.0.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/client/lib/slf4j-api-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/client/lib/slf4j-simple-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/client/lib/dropbox-java-sdk-1.3.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/client/lib/aws-java-sdk-1.3.9.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/client/lib/httpclient-4.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/client/lib/httpcore-4.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/client/lib/json_simple-1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/client/lib/commons-logging-1.1.1.jar"/>
</jar>
</target>
</project>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project Mailiverse.Core">
<!--this file was created by Eclipse Runnable JAR Export Wizard-->
<!--ANT 1.7 is required -->
<target name="create_run_jar">
<jar destfile="/Users/tprepscius/Projects/mailiverse/build/exported/KeyStreamServer.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="key.streamserver.KeyStreamServerMain"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/core/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/bouncycastle/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/annotations-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-ant.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-ha.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-tribes.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/ecj-3.7.2.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/el-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jasper-el.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jasper.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jsp-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/servlet-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-coyote.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-dbcp.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-es.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-fr.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-ja.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-jdbc.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-util.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/jordanzimmerman/bin"/>
<fileset dir="/Users/tprepscius/projects/mailiverse/java/ext/json/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/dropbox-java-sdk-1.3.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/aws-java-sdk.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/javamail-1.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/activation-1.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/slf4j-api-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/slf4j-simple-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/mysql-connector-java-3.1.14-bin.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/mina-core-2.0.4.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/apache/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/commons-codec-1.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/commons-logging-1.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/httpclient-4.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/httpcore-4.1.jar"/>
</jar>
</target>
</project>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project Mailiverse.Core">
<!--this file was created by Eclipse Runnable JAR Export Wizard-->
<!--ANT 1.7 is required -->
<target name="create_run_jar">
<jar destfile="/Users/tprepscius/Projects/mailiverse/build/exported/MailStreamServer.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="mail.streamserver.MailStreamServerMain"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/core/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/bouncycastle/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/annotations-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-ant.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-ha.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-tribes.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/ecj-3.7.2.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/el-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jasper-el.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jasper.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jsp-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/servlet-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-coyote.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-dbcp.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-es.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-fr.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-ja.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-jdbc.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-util.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/jordanzimmerman/bin"/>
<fileset dir="/Users/tprepscius/projects/mailiverse/java/ext/json/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/dropbox-java-sdk-1.3.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/aws-java-sdk.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/javamail-1.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/activation-1.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/slf4j-api-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/slf4j-simple-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/mysql-connector-java-3.1.14-bin.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/mina-core-2.0.4.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/apache/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/commons-codec-1.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/commons-logging-1.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/httpclient-4.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/httpcore-4.1.jar"/>
</jar>
</target>
</project>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project Mailiverse.App.Service">
<!--this file was created by Eclipse Runnable JAR Export Wizard-->
<!--ANT 1.7 is required -->
<target name="create_run_jar">
<jar destfile="/Users/tprepscius/Projects/mailiverse/build/exported/Service.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="ServiceAppletRunnable"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/app/service/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/core/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/bouncycastle/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/annotations-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-ant.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-ha.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-tribes.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/ecj-3.7.2.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/el-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jasper-el.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jasper.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jsp-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/servlet-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-coyote.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-dbcp.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-es.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-fr.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-ja.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-jdbc.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-util.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/jordanzimmerman/bin"/>
<fileset dir="/Users/tprepscius/projects/mailiverse/java/ext/json/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/dropbox-java-sdk-1.3.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/javamail-1.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/activation-1.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/slf4j-api-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/slf4j-simple-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/mysql-connector-java-3.1.14-bin.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/mina-core-2.0.4.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/apache/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/aws-java-sdk.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/service/lib/plugin.jar"/>
</jar>
</target>
</project>

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project Mailiverse.App-Setup">
<!--this file was created by Eclipse Runnable JAR Export Wizard-->
<!--ANT 1.7 is required -->
<target name="create_run_jar">
<jar destfile="/Users/tprepscius/Projects/mailiverse/build/exported/Setup.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="app.setup.SetupGUI"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="/Users/tprepscius/Projects/mailiverse/app/Setup/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/core/Lib/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/annotations-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/catalina-ant.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/catalina-ha.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/catalina-tribes.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/catalina.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/ecj-3.7.2.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/el-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/jasper-el.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/jasper.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/jsp-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/servlet-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/tomcat-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/tomcat-coyote.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/tomcat-dbcp.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/tomcat-i18n-es.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/tomcat-i18n-fr.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/tomcat-i18n-ja.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/tomcat-jdbc.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7.0.27/lib/tomcat-util.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/core/BouncyCastle/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/core/Lib/lib/gson-2.2.2.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/mail/Core/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Core/lib/aws-java-sdk-1.3.9.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Core/lib/commons-codec-1.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Core/lib/commons-logging-1.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Core/lib/dropbox-java-sdk-1.3.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Core/lib/httpclient-4.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Core/lib/httpcore-4.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Core/lib/json_simple-1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Core/lib/log4j-1.2.15.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/key/Client/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/core/SRP-Client/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/core/SRP/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/core/SRP-External/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/core/Client/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/key/Core/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Core/lib/javamail-1.4.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/mail/Client/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Client/lib/aws-java-sdk-1.3.9.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Client/lib/commons-logging-1.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Client/lib/dropbox-java-sdk-1.3.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/mail/Client/lib/javamail-1.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/app/Setup/forms-1.3.0.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/app/Core/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/app/Setup/lib/aws-java-sdk-1.3.9.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/app/Setup/lib/dropbox-java-sdk-1.3.jar"/>
</jar>
</target>
</project>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project Mailiverse.App.Tools">
<!--this file was created by Eclipse Runnable JAR Export Wizard-->
<!--ANT 1.7 is required -->
<target name="create_run_jar">
<jar destfile="/Users/tprepscius/Projects/mailiverse/build/exported/Tools.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="app.tools.Main"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/app/tools/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/core/bin"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/bouncycastle/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/annotations-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-ant.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-ha.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina-tribes.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/catalina.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/ecj-3.7.2.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/el-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jasper-el.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jasper.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/jsp-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/servlet-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-api.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-coyote.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-dbcp.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-es.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-fr.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-i18n-ja.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-jdbc.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/apache-tomcat-7/lib/tomcat-util.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/jordanzimmerman/bin"/>
<fileset dir="/Users/tprepscius/projects/mailiverse/java/ext/json/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/dropbox-java-sdk-1.3.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/aws-java-sdk.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/javamail-1.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/activation-1.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/slf4j-api-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/slf4j-simple-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/mysql-connector-java-3.1.14-bin.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/mina-core-2.0.4.jar"/>
<fileset dir="/Users/tprepscius/Projects/mailiverse/java/ext/apache/bin"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/commons-codec-1.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/commons-logging-1.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/httpclient-4.1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/httpcore-4.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/core/lib/JavaPNS_2.2.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/tools/lib/dropbox-java-sdk-1.3.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/tools/lib/json_simple-1.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/tools/lib/log4j-1.2.15.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/tools/lib/mysql-connector-java-3.1.14-bin.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/tools/lib/slf4j-api-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/tools/lib/slf4j-simple-1.3.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/tools/lib/JavaPNS_2.2.jar"/>
<zipfileset excludes="META-INF/*.SF" src="/Users/tprepscius/Projects/mailiverse/java/app/tools/lib/bcprov-jdk15on-148.jar"/>
</jar>
</target>
</project>

2
build/exportTools Executable file
View File

@ -0,0 +1,2 @@
rm exported/Tools.jar
ant -buildfile exportScripts/Tools.xml

27
build/replace_html.sed Normal file
View File

@ -0,0 +1,27 @@
/<LINK_SCRIPTS>/ {
r ../web/common/Link.Scripts.html
d
}
/<LINK_META>/ {
r ../web/common/Link.Meta.html
d
}
/<LINK_GWT>/ {
r ../web/common/Link.GWT.html
d
}
/<LINK_SCRIPTS_SAVEAS>/ {
r ../web/common/Link.Scripts.SaveAs.html
d
}
/<LINK_TEST_BROWSER>/ {
r ../web/common/Link.TestBrowser.html
d
}

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,6 @@
/<LINK_DISABLE_DURING_BETA>/ {
r ../web/common/Link.DisableDuringBeta.html
d
}

6
build/replace_js_dev.sed Normal file
View File

@ -0,0 +1,6 @@
/<LINK_CONSTANTS>/ {
r ../web/common/Link.ConstantsDev.html
d
}

View File

@ -0,0 +1,4 @@
/<LINK_CONSTANTS>/ {
r ../web/common/Link.ConstantsProd.html
d
}

View File

@ -1,9 +0,0 @@
/**
* Author: Timothy Prepscius
* License: GPLv3 Affero + keep my name in the code!
*/
package org.timepedia.exporter.client;
public @interface Export
{
}

View File

@ -1,10 +0,0 @@
/**
* Author: Timothy Prepscius
* License: GPLv3 Affero + keep my name in the code!
*/
package org.timepedia.exporter.client;
public interface Exportable
{
}

View File

@ -1,10 +0,0 @@
/**
* Author: Timothy Prepscius
* License: GPLv3 Affero + keep my name in the code!
*/
package org.timepedia.exporter.client;
public @interface NoExport
{
}

View File

@ -1,479 +0,0 @@
/**
* Author: Timothy Prepscius
* License: GPLv3 Affero + keep my name in the code!
*/
package core.server.srp.db;
import java.io.IOException;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.Date;
import core.exceptions.CryptoException;
import core.exceptions.PublicMessageException;
import core.exceptions.UserExistsException;
import core.server.srp.db.sql.Catalog;
import core.util.LogOut;
import core.util.Pair;
import core.util.Passwords;
import core.util.Strings;
import core.util.Triple;
import core.util.Base64;
public abstract class UserDb
{
static LogOut log = new LogOut(UserDb.class);
SecureRandom random = new SecureRandom();
Catalog catalog;
protected UserDb (Catalog catalog)
{
this.catalog = catalog;
}
public void testCreateUser (String version, String userName) throws Exception
{
checkRoomForNewUser();
testIllegalUserName(userName);
if (getUser(userName)!=null)
throw new UserExistsException();
}
public void checkRoomForNewUser () throws Exception
{
Connection connection = openConnection();
try
{
PreparedStatement statement = connection.prepareStatement (catalog.getSingle(catalog.ROOM_FOR_NEW_USER));
ResultSet results = statement.executeQuery();
if (results.next())
{
boolean hasRoom = results.getBoolean("room");
if (hasRoom)
return;
}
throw new PublicMessageException("No room for new users");
}
finally
{
closeConnection(connection);
}
}
public Integer getUserId (String userName) throws IOException, SQLException
{
return getUser(userName).first;
}
public void createUser(String version, String userName, byte[] v, byte[] s) throws Exception
{
checkRoomForNewUser();
testIllegalUserName(userName);
if (getUser(userName)!=null)
throw new UserExistsException();
Connection connection = openConnection();
try
{
PreparedStatement statement = connection.prepareStatement (catalog.getSingle(catalog.CREATE_USER));
statement.setString(1, version);
statement.setString(2, userName);
statement.setString(3, Base64.encode(v));
statement.setString(4, Base64.encode(s));
log(statement);
statement.executeUpdate();
}
finally
{
closeConnection(connection);
}
}
public Pair<Integer, Triple<String, byte[], byte[]> > getUser (String userName) throws IOException, SQLException
{
Connection connection = openConnection();
Pair<Integer, Triple<String, byte[], byte[]>> result = null;
try
{
PreparedStatement statement = connection.prepareStatement (catalog.getSingle(catalog.GET_USER));
statement.setString(1, userName);
log(statement);
ResultSet results = statement.executeQuery();
if (results.next())
{
result =
new Pair<Integer, Triple<String, byte[], byte[] > >(
results.getInt("id"),
new Triple<String, byte[], byte[]> (
results.getString("version"),
Base64.decode(results.getString("v")),
Base64.decode(results.getString("s"))
)
);
}
}
finally
{
closeConnection(connection);
}
return result;
}
public Triple<String, BigInteger, BigInteger> getVVS (String userName) throws IOException, SQLException
{
Triple<String, byte[], byte[]> vvs = getUser(userName).second;
return
new Triple<String, BigInteger, BigInteger>(
vvs.first,
new BigInteger (vvs.second),
new BigInteger (vvs.third)
);
}
protected byte[] setMailBlock (String userName, byte[] block) throws IOException, SQLException
{
Integer id = getUser(userName).first;
Connection connection = openConnection();
byte[] result = null;
try
{
PreparedStatement statement = connection.prepareStatement (catalog.getSingle(catalog.SET_USER_MAIL_BLOCK));
statement.setInt(1, id);
statement.setString (2, Base64.encode(block));
log(statement);
statement.executeUpdate();
}
finally
{
closeConnection(connection);
}
return result;
}
abstract public byte[] setBlock (String userName, byte[] block) throws IOException, SQLException, CryptoException;
abstract public byte[] getBlock (String userName) throws IOException, SQLException, CryptoException;
protected byte[] setKeyBlock (String userName, byte[] block) throws IOException, SQLException
{
Integer id = getUser(userName).first;
Connection connection = openConnection();
byte[] result = null;
try
{
PreparedStatement statement = connection.prepareStatement (catalog.getSingle(catalog.SET_USER_KEY_BLOCK));
statement.setInt(1, id);
statement.setString (2, Base64.encode(block));
log(statement);
statement.executeUpdate();
}
finally
{
closeConnection(connection);
}
return result;
}
protected byte[] getMailBlock (String userName) throws IOException, SQLException
{
Connection connection = openConnection();
byte[] result = null;
try
{
PreparedStatement statement = connection.prepareStatement (catalog.getSingle(catalog.GET_USER_MAIL_BLOCK));
statement.setString(1, userName);
log(statement);
ResultSet results = statement.executeQuery();
if (results.next())
result = Base64.decode(results.getString("block"));
}
finally
{
closeConnection(connection);
}
return result;
}
public byte[] getDeletedMailBlock(String userName) throws IOException, SQLException
{
Connection connection = openConnection();
byte[] result = null;
try
{
PreparedStatement statement = connection.prepareStatement (catalog.getSingle(catalog.GET_DELETED_USER_MAIL_BLOCK));
statement.setString(1, userName);
log(statement);
ResultSet results = statement.executeQuery();
if (results.next())
result = Base64.decode(results.getString("block"));
}
finally
{
closeConnection(connection);
}
return result;
}
public String getDeletedUser() throws IOException, SQLException
{
Connection connection = openConnection();
String result = null;
try
{
PreparedStatement statement = connection.prepareStatement (catalog.getSingle(catalog.GET_DELETED_USER));
log(statement);
ResultSet results = statement.executeQuery();
if (results.next())
result = results.getString("name");
}
finally
{
closeConnection(connection);
}
return result;
}
protected byte[] getKeyBlock (String userName) throws IOException, SQLException
{
Connection connection = openConnection();
byte[] result = null;
try
{
PreparedStatement statement = connection.prepareStatement (catalog.getSingle(catalog.GET_USER_KEY_BLOCK));
statement.setString(1, userName);
log(statement);
ResultSet results = statement.executeQuery();
if (results.next())
result = Base64.decode(results.getString("block"));
}
finally
{
closeConnection(connection);
}
return result;
}
public void ensureTables() throws SQLException, IOException
{
Connection connection = openConnection();
try
{
for (String sql : catalog.getMulti(catalog.CREATE_TABLES))
{
PreparedStatement statement = connection.prepareStatement (sql);
log(statement);
statement.executeUpdate();
}
}
finally
{
closeConnection(connection);
}
}
public void rateLimitFailure (String userName) throws SQLException, IOException
{
Connection connection = openConnection();
try
{
PreparedStatement statement = connection.prepareStatement (catalog.getSingle(catalog.GET_LAST_FAILURE));
statement.setString(1, userName);
log(statement);
ResultSet rs = statement.executeQuery();
if (rs.next())
{
Timestamp timeStamp = rs.getTimestamp("mark");
Date now = new Date();
if (now.getTime() - timeStamp.getTime() < catalog.FAILURE_TIMEOUT_SECONDS * 1000)
throw new PublicMessageException ("Too many failures, try again later.");
}
}
finally
{
closeConnection(connection);
}
}
public void markFailure (String userName) throws SQLException, IOException
{
Connection connection = openConnection();
try
{
PreparedStatement statement = connection.prepareStatement (catalog.getSingle(catalog.MARK_FAILURE));
statement.setString(1, userName);
statement.executeUpdate();
}
finally
{
closeConnection(connection);
}
}
public void deleteUser(String userName) throws IOException, SQLException
{
Connection connection = openConnection();
try
{
String[] texts = catalog.getMulti(catalog.DELETE);
for (String text : texts)
{
PreparedStatement statement = connection.prepareStatement (text);
statement.setString(1, userName);
log(statement);
statement.executeUpdate();
}
}
finally
{
closeConnection(connection);
}
}
public void expungeUser(String userName) throws IOException, SQLException
{
Connection connection = openConnection();
try
{
String[] texts = catalog.getMulti(catalog.EXPUNGE);
for (String text : texts)
{
PreparedStatement statement = connection.prepareStatement (text);
statement.setString(1, userName);
statement.executeUpdate();
}
}
finally
{
closeConnection(connection);
}
}
public Connection openConnection () throws IOException, SQLException
{
log.debug("Connecting to", catalog.CONNECTION_STRING);
return DriverManager.getConnection(catalog.CONNECTION_STRING, catalog.USER, Passwords.getPasswordFor(catalog.USER));
}
public void closeConnection (Connection connection)
{
try
{
if (connection != null)
connection.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void log (Statement sql)
{
System.out.println (sql);
}
protected void testIllegalUserName(String userName) throws Exception
{
// http://www.ietf.org/rfc/rfc2142.txt
final String[] illegalStartsWith = {
"info",
"marketing",
"sales",
"support",
"abuse",
"noc",
"security",
"postmaster",
"hostmaster",
"usenet",
"news",
"webmaster",
"www",
"uucp",
"ftp",
"admin",
"system",
"root",
"test",
"root",
"hostma",
"web",
"post",
"mail",
};
final String[] illegalParts = {
"postmaster",
"webmaster",
"root",
"admin",
"system",
};
String username = userName.toLowerCase();
for (String illegal : illegalParts)
{
if (username.indexOf(illegal) != -1)
throw new Exception("Illegal username");
}
for (String illegal : illegalStartsWith)
{
if (username.startsWith(illegal))
throw new Exception("Illegal username");
}
}
}

View File

@ -1,51 +0,0 @@
/**
* Author: Timothy Prepscius
* License: GPLv3 Affero + keep my name in the code!
*/
package core.server.srp.db.sql;
import java.io.IOException;
import java.sql.SQLException;
import core.constants.ConstantsServer;
import core.util.Passwords;
import core.util.SqlCatalog;
import core.util.Streams;
public final class Catalog extends SqlCatalog
{
public String CONNECTION_STRING = ConstantsServer.DBCONNECTION_PREFIX + "mail";
public String USER = "mail";
public int FAILURE_TIMEOUT_SECONDS = 60;
public final String
CREATE_TABLES = "create_tables",
CREATE_USER = "create_user",
GET_USER = "get_user",
GET_USER_MAIL_BLOCK = "get_user_mail_block",
SET_USER_MAIL_BLOCK = "set_user_mail_block",
GET_USER_KEY_BLOCK = "get_user_key_block",
SET_USER_KEY_BLOCK = "set_user_key_block",
GET_LAST_FAILURE = "get_last_failure",
MARK_FAILURE = "mark_failure",
DELETE = "delete_user.sql",
EXPUNGE = "expunge_deleted_user.sql",
GET_DELETED_USER = "get_deleted_user.sql",
GET_DELETED_USER_MAIL_BLOCK = "get_deleted_user_mail_block.sql",
ROOM_FOR_NEW_USER = "room_for_new_user";
public Catalog ()
{
}
public String getPassword () throws IOException
{
return Passwords.getPasswordFor(USER);
}
}

View File

@ -1,55 +0,0 @@
CREATE TABLE IF NOT EXISTS registry (
k VARCHAR(50),
v VARCHAR(255),
mark TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (k)
);
INSERT IGNORE INTO registry (k,v) VALUES ("max_users", "1000");
CREATE TABLE IF NOT EXISTS user (
version VARCHAR(50),
id INTEGER AUTO_INCREMENT,
name VARCHAR(255) COLLATE utf8_general_ci NOT NULL DEFAULT '',
v TEXT,
s TEXT,
mark TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (name),
UNIQUE KEY (id)
);
CREATE TABLE IF NOT EXISTS mail_block (
user_id INTEGER,
block TEXT,
mark TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (user_id)
);
CREATE TABLE IF NOT EXISTS key_block (
user_id INTEGER,
block TEXT,
mark TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (user_id)
);
CREATE TABLE IF NOT EXISTS failure (
user_id INTEGER,
mark TIMESTAMP,
PRIMARY KEY (user_id)
);
CREATE TABLE IF NOT EXISTS deleted_user (
version VARCHAR(50),
id INTEGER AUTO_INCREMENT,
name VARCHAR(255) COLLATE utf8_general_ci NOT NULL DEFAULT '',
v TEXT,
s TEXT,
mark TIMESTAMP NULL DEFAULT NULL,
deleted TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS deleted_mail_block LIKE mail_block;
CREATE TABLE IF NOT EXISTS deleted_key_block LIKE key_block;
DROP TABLE IF EXISTS metadata;

View File

@ -1 +0,0 @@
INSERT INTO user (version, name, v, s) VALUES (?, ?, ?, ?)

View File

@ -1,24 +0,0 @@
REPLACE INTO deleted_mail_block
SELECT mail_block.*
FROM mail_block, user
WHERE user.name=? AND mail_block.user_id = user.id;
REPLACE INTO deleted_key_block
SELECT key_block.*
FROM key_block, user
WHERE user.name=? AND key_block.user_id = user.id;
REPLACE INTO deleted_user(version, id, name, v, s, mark)
SELECT version, id, name, v, s, mark
FROM user
WHERE user.name=?;
DELETE mail_block.*
FROM mail_block, user
WHERE user.name=? AND mail_block.user_id = user.id;
DELETE key_block.*
FROM key_block, user
WHERE user.name=? AND key_block.user_id = user.id;
DELETE FROM user WHERE user.name=?

View File

@ -1,9 +0,0 @@
DELETE deleted_mail_block.*
FROM deleted_mail_block, deleted_user
WHERE deleted_user.name=? AND deleted_mail_block.user_id = deleted_user.id;
DELETE deleted_key_block.*
FROM deleted_key_block, deleted_user
WHERE deleted_user.name=? AND deleted_key_block.user_id = deleted_user.id;
DELETE FROM deleted_user WHERE deleted_user.name=?

View File

@ -1,7 +0,0 @@
select
*
from
deleted_user
order by
deleted
limit 1

View File

@ -1,8 +0,0 @@
SELECT
deleted_mail_block.*
FROM
deleted_user,
deleted_mail_block
WHERE
deleted_mail_block.user_id = deleted_user.id AND
deleted_user.name = ?

View File

@ -1,8 +0,0 @@
SELECT
failure.mark
FROM
user,
failure
WHERE
user.name = ? AND
failure.user_id = user.id

View File

@ -1,6 +0,0 @@
SELECT
*
FROM
user
WHERE
user.name = ?

View File

@ -1,8 +0,0 @@
SELECT
key_block.*
FROM
user,
key_block
WHERE
key_block.user_id = user.id AND
user.name = ?

View File

@ -1,8 +0,0 @@
SELECT
mail_block.*
FROM
user,
mail_block
WHERE
mail_block.user_id = user.id AND
user.name = ?

View File

@ -1,8 +0,0 @@
REPLACE INTO failure (user_id, mark)
SELECT
id as user_id,
now() as mark
FROM
user
WHERE
name = ?

View File

@ -1,4 +0,0 @@
select
count(*) < (select convert(v, unsigned integer) from registry where k="max_users") as room
from
user

View File

@ -1 +0,0 @@
REPLACE INTO key_block (user_id, block) VALUES (?, ?)

View File

@ -1 +0,0 @@
REPLACE INTO mail_block (user_id, block) VALUES (?, ?)