diff --git a/assets/whisper.store b/library/assets/whisper.store
similarity index 100%
rename from assets/whisper.store
rename to library/assets/whisper.store
diff --git a/library/library.iml b/library/library.iml
index 5c4185b541..e8d75032a8 100644
--- a/library/library.iml
+++ b/library/library.iml
@@ -25,6 +25,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/library/libs/thoughtcrimegson-2.1.jar b/library/libs/thoughtcrimegson-2.1.jar
new file mode 100644
index 0000000000..8406d51d03
Binary files /dev/null and b/library/libs/thoughtcrimegson-2.1.jar differ
diff --git a/src/org/thoughtcrime/securesms/Release.java b/library/src/org/whispersystems/textsecure/Release.java
similarity index 86%
rename from src/org/thoughtcrime/securesms/Release.java
rename to library/src/org/whispersystems/textsecure/Release.java
index f39d61b467..13d5b78824 100644
--- a/src/org/thoughtcrime/securesms/Release.java
+++ b/library/src/org/whispersystems/textsecure/Release.java
@@ -1,4 +1,4 @@
-package org.thoughtcrime.securesms;
+package org.whispersystems.textsecure;
public class Release {
public static final String PUSH_SERVICE_URL = "https://gcm.textsecure.whispersystems.org";
diff --git a/src/org/thoughtcrime/securesms/directory/BloomFilter.java b/library/src/org/whispersystems/textsecure/directory/BloomFilter.java
similarity index 95%
rename from src/org/thoughtcrime/securesms/directory/BloomFilter.java
rename to library/src/org/whispersystems/textsecure/directory/BloomFilter.java
index edbd05b67a..808047ce2d 100644
--- a/src/org/thoughtcrime/securesms/directory/BloomFilter.java
+++ b/library/src/org/whispersystems/textsecure/directory/BloomFilter.java
@@ -15,9 +15,9 @@
* along with this program. If not, see .
*/
-package org.thoughtcrime.securesms.directory;
+package org.whispersystems.textsecure.directory;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
diff --git a/src/org/thoughtcrime/securesms/directory/DirectoryDescriptor.java b/library/src/org/whispersystems/textsecure/directory/DirectoryDescriptor.java
similarity index 87%
rename from src/org/thoughtcrime/securesms/directory/DirectoryDescriptor.java
rename to library/src/org/whispersystems/textsecure/directory/DirectoryDescriptor.java
index 28d763627f..3c754c4892 100644
--- a/src/org/thoughtcrime/securesms/directory/DirectoryDescriptor.java
+++ b/library/src/org/whispersystems/textsecure/directory/DirectoryDescriptor.java
@@ -1,4 +1,4 @@
-package org.thoughtcrime.securesms.directory;
+package org.whispersystems.textsecure.directory;
public class DirectoryDescriptor {
private String version;
diff --git a/src/org/thoughtcrime/securesms/directory/NumberFilter.java b/library/src/org/whispersystems/textsecure/directory/NumberFilter.java
similarity index 95%
rename from src/org/thoughtcrime/securesms/directory/NumberFilter.java
rename to library/src/org/whispersystems/textsecure/directory/NumberFilter.java
index 89a6a5d7c5..0435b34d9d 100644
--- a/src/org/thoughtcrime/securesms/directory/NumberFilter.java
+++ b/library/src/org/whispersystems/textsecure/directory/NumberFilter.java
@@ -15,7 +15,7 @@
* along with this program. If not, see .
*/
-package org.thoughtcrime.securesms.directory;
+package org.whispersystems.textsecure.directory;
import android.content.Context;
import android.util.Log;
@@ -24,7 +24,6 @@ import com.google.thoughtcrimegson.Gson;
import com.google.thoughtcrimegson.JsonParseException;
import com.google.thoughtcrimegson.annotations.SerializedName;
-import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.textsecure.util.PhoneNumberFormatter;
import java.io.BufferedReader;
@@ -72,13 +71,11 @@ public class NumberFilter {
this.version = version;
}
- public synchronized boolean containsNumber(String number) {
+ public synchronized boolean containsNumber(String number, String localNumber) {
try {
if (bloomFilter == null) return false;
else if (number == null || number.length() == 0) return false;
- String localNumber = TextSecurePreferences.getLocalNumber(context);
-
return new BloomFilter(bloomFilter, hashCount)
.contains(PhoneNumberFormatter.formatNumber(number, localNumber));
} catch (IOException ioe) {
diff --git a/src/org/thoughtcrime/securesms/gcm/GcmMessageResponse.java b/library/src/org/whispersystems/textsecure/push/GcmMessageResponse.java
similarity index 85%
rename from src/org/thoughtcrime/securesms/gcm/GcmMessageResponse.java
rename to library/src/org/whispersystems/textsecure/push/GcmMessageResponse.java
index 25c1ed787f..6489f9d728 100644
--- a/src/org/thoughtcrime/securesms/gcm/GcmMessageResponse.java
+++ b/library/src/org/whispersystems/textsecure/push/GcmMessageResponse.java
@@ -1,4 +1,4 @@
-package org.thoughtcrime.securesms.gcm;
+package org.whispersystems.textsecure.push;
import java.util.List;
diff --git a/src/org/thoughtcrime/securesms/gcm/IncomingGcmMessage.java b/library/src/org/whispersystems/textsecure/push/IncomingGcmMessage.java
similarity index 92%
rename from src/org/thoughtcrime/securesms/gcm/IncomingGcmMessage.java
rename to library/src/org/whispersystems/textsecure/push/IncomingGcmMessage.java
index 9cc40bcdd0..a5823b75f1 100644
--- a/src/org/thoughtcrime/securesms/gcm/IncomingGcmMessage.java
+++ b/library/src/org/whispersystems/textsecure/push/IncomingGcmMessage.java
@@ -1,6 +1,5 @@
-package org.thoughtcrime.securesms.gcm;
+package org.whispersystems.textsecure.push;
-import java.util.LinkedList;
import java.util.List;
public class IncomingGcmMessage {
diff --git a/src/org/thoughtcrime/securesms/gcm/OutgoingGcmMessage.java b/library/src/org/whispersystems/textsecure/push/OutgoingGcmMessage.java
similarity index 95%
rename from src/org/thoughtcrime/securesms/gcm/OutgoingGcmMessage.java
rename to library/src/org/whispersystems/textsecure/push/OutgoingGcmMessage.java
index 911222f1c0..83da71393a 100644
--- a/src/org/thoughtcrime/securesms/gcm/OutgoingGcmMessage.java
+++ b/library/src/org/whispersystems/textsecure/push/OutgoingGcmMessage.java
@@ -1,4 +1,4 @@
-package org.thoughtcrime.securesms.gcm;
+package org.whispersystems.textsecure.push;
import java.util.LinkedList;
import java.util.List;
diff --git a/src/org/thoughtcrime/securesms/gcm/PushServiceSocket.java b/library/src/org/whispersystems/textsecure/push/PushServiceSocket.java
similarity index 94%
rename from src/org/thoughtcrime/securesms/gcm/PushServiceSocket.java
rename to library/src/org/whispersystems/textsecure/push/PushServiceSocket.java
index 17e5ead97b..db0abb7dd1 100644
--- a/src/org/thoughtcrime/securesms/gcm/PushServiceSocket.java
+++ b/library/src/org/whispersystems/textsecure/push/PushServiceSocket.java
@@ -1,4 +1,4 @@
-package org.thoughtcrime.securesms.gcm;
+package org.whispersystems.textsecure.push;
import android.content.Context;
import android.content.res.AssetManager;
@@ -6,9 +6,9 @@ import android.util.Base64;
import android.util.Log;
import com.google.thoughtcrimegson.Gson;
-import org.thoughtcrime.securesms.Release;
-import org.thoughtcrime.securesms.directory.DirectoryDescriptor;
-import org.thoughtcrime.securesms.directory.NumberFilter;
+import org.whispersystems.textsecure.Release;
+import org.whispersystems.textsecure.directory.DirectoryDescriptor;
+import org.whispersystems.textsecure.directory.NumberFilter;
import org.whispersystems.textsecure.util.Util;
import javax.net.ssl.HttpsURLConnection;
@@ -212,18 +212,6 @@ public class PushServiceSocket {
}
}
-
-// private class Verification {
-//
-// private String verificationCode;
-//
-// public Verification() {}
-//
-// public Verification(String verificationCode) {
-// this.verificationCode = verificationCode;
-// }
-// }
-
private class GcmRegistrationId {
private String gcmRegistrationId;
diff --git a/src/org/thoughtcrime/securesms/gcm/RateLimitException.java b/library/src/org/whispersystems/textsecure/push/RateLimitException.java
similarity index 72%
rename from src/org/thoughtcrime/securesms/gcm/RateLimitException.java
rename to library/src/org/whispersystems/textsecure/push/RateLimitException.java
index 83dfb2a397..bfce269eb2 100644
--- a/src/org/thoughtcrime/securesms/gcm/RateLimitException.java
+++ b/library/src/org/whispersystems/textsecure/push/RateLimitException.java
@@ -1,4 +1,4 @@
-package org.thoughtcrime.securesms.gcm;
+package org.whispersystems.textsecure.push;
public class RateLimitException extends Exception {
diff --git a/src/org/thoughtcrime/securesms/util/Conversions.java b/library/src/org/whispersystems/textsecure/util/Conversions.java
similarity index 99%
rename from src/org/thoughtcrime/securesms/util/Conversions.java
rename to library/src/org/whispersystems/textsecure/util/Conversions.java
index 561bf73ca5..b7630b1ad1 100644
--- a/src/org/thoughtcrime/securesms/util/Conversions.java
+++ b/library/src/org/whispersystems/textsecure/util/Conversions.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.thoughtcrime.securesms.util;
+package org.whispersystems.textsecure.util;
public class Conversions {
diff --git a/src/org/thoughtcrime/securesms/RegistrationProgressActivity.java b/src/org/thoughtcrime/securesms/RegistrationProgressActivity.java
index 736ed9274a..1937e9fbcb 100644
--- a/src/org/thoughtcrime/securesms/RegistrationProgressActivity.java
+++ b/src/org/thoughtcrime/securesms/RegistrationProgressActivity.java
@@ -29,8 +29,8 @@ import android.widget.TextView;
import android.widget.Toast;
import com.actionbarsherlock.app.SherlockActivity;
-import org.thoughtcrime.securesms.gcm.PushServiceSocket;
-import org.thoughtcrime.securesms.gcm.RateLimitException;
+import org.whispersystems.textsecure.push.PushServiceSocket;
+import org.whispersystems.textsecure.push.RateLimitException;
import org.thoughtcrime.securesms.service.RegistrationService;
import org.whispersystems.textsecure.util.PhoneNumberFormatter;
import org.whispersystems.textsecure.util.Util;
diff --git a/src/org/thoughtcrime/securesms/crypto/AsymmetricMasterCipher.java b/src/org/thoughtcrime/securesms/crypto/AsymmetricMasterCipher.java
index 92e2743e42..f6ae8c2518 100644
--- a/src/org/thoughtcrime/securesms/crypto/AsymmetricMasterCipher.java
+++ b/src/org/thoughtcrime/securesms/crypto/AsymmetricMasterCipher.java
@@ -27,7 +27,7 @@ import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
import org.bouncycastle.crypto.agreement.ECDHBasicAgreement;
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
import org.whispersystems.textsecure.util.Base64;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
import org.thoughtcrime.securesms.util.InvalidMessageException;
/**
diff --git a/src/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java b/src/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java
index f210a6376d..3595fc59aa 100644
--- a/src/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java
+++ b/src/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java
@@ -32,7 +32,7 @@ import org.thoughtcrime.bouncycastle.asn1.DERInteger;
import org.thoughtcrime.bouncycastle.asn1.DERSequence;
import org.whispersystems.textsecure.util.Base64;
import org.thoughtcrime.securesms.util.Combiner;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
import android.content.Context;
import android.content.SharedPreferences;
diff --git a/src/org/thoughtcrime/securesms/crypto/KeyExchangeMessage.java b/src/org/thoughtcrime/securesms/crypto/KeyExchangeMessage.java
index 0a2776520a..4b90758614 100644
--- a/src/org/thoughtcrime/securesms/crypto/KeyExchangeMessage.java
+++ b/src/org/thoughtcrime/securesms/crypto/KeyExchangeMessage.java
@@ -22,7 +22,7 @@ import android.util.Log;
import org.thoughtcrime.securesms.database.keys.LocalKeyRecord;
import org.thoughtcrime.securesms.protocol.Message;
import org.whispersystems.textsecure.util.Base64;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
import java.io.IOException;
diff --git a/src/org/thoughtcrime/securesms/crypto/KeyExchangeProcessor.java b/src/org/thoughtcrime/securesms/crypto/KeyExchangeProcessor.java
index 42a7bde148..18f0c64ea5 100644
--- a/src/org/thoughtcrime/securesms/crypto/KeyExchangeProcessor.java
+++ b/src/org/thoughtcrime/securesms/crypto/KeyExchangeProcessor.java
@@ -30,7 +30,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.sms.MessageSender;
import org.thoughtcrime.securesms.sms.OutgoingKeyExchangeMessage;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
/**
* This class processes key exchange interactions.
diff --git a/src/org/thoughtcrime/securesms/crypto/PublicKey.java b/src/org/thoughtcrime/securesms/crypto/PublicKey.java
index 4cdf637e68..eefd2cd96d 100644
--- a/src/org/thoughtcrime/securesms/crypto/PublicKey.java
+++ b/src/org/thoughtcrime/securesms/crypto/PublicKey.java
@@ -21,7 +21,7 @@ import java.security.NoSuchAlgorithmException;
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
import org.bouncycastle.math.ec.ECPoint;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
import org.thoughtcrime.securesms.util.Hex;
import android.util.Log;
diff --git a/src/org/thoughtcrime/securesms/crypto/SessionCipher.java b/src/org/thoughtcrime/securesms/crypto/SessionCipher.java
index ca9058bc33..3fd4e887c2 100644
--- a/src/org/thoughtcrime/securesms/crypto/SessionCipher.java
+++ b/src/org/thoughtcrime/securesms/crypto/SessionCipher.java
@@ -40,7 +40,7 @@ import org.thoughtcrime.securesms.database.keys.SessionKey;
import org.thoughtcrime.securesms.database.keys.SessionRecord;
import org.thoughtcrime.securesms.protocol.Message;
import org.thoughtcrime.securesms.recipients.Recipient;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
import android.content.Context;
import android.util.Log;
diff --git a/src/org/thoughtcrime/securesms/database/keys/Record.java b/src/org/thoughtcrime/securesms/database/keys/Record.java
index 7c5b0d0603..9d53eb424c 100644
--- a/src/org/thoughtcrime/securesms/database/keys/Record.java
+++ b/src/org/thoughtcrime/securesms/database/keys/Record.java
@@ -18,7 +18,7 @@ package org.thoughtcrime.securesms.database.keys;
import android.content.Context;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
import java.io.File;
import java.io.FileInputStream;
diff --git a/src/org/thoughtcrime/securesms/database/keys/SessionKey.java b/src/org/thoughtcrime/securesms/database/keys/SessionKey.java
index 8d2d482f48..565718e796 100644
--- a/src/org/thoughtcrime/securesms/database/keys/SessionKey.java
+++ b/src/org/thoughtcrime/securesms/database/keys/SessionKey.java
@@ -19,7 +19,7 @@ package org.thoughtcrime.securesms.database.keys;
import org.thoughtcrime.securesms.crypto.MasterCipher;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.crypto.SessionCipher;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
import org.thoughtcrime.securesms.util.Util;
import javax.crypto.spec.SecretKeySpec;
diff --git a/src/org/thoughtcrime/securesms/gcm/GcmIntentService.java b/src/org/thoughtcrime/securesms/gcm/GcmIntentService.java
index da009ffa82..01e6e35964 100644
--- a/src/org/thoughtcrime/securesms/gcm/GcmIntentService.java
+++ b/src/org/thoughtcrime/securesms/gcm/GcmIntentService.java
@@ -13,6 +13,9 @@ import org.thoughtcrime.securesms.service.RegistrationService;
import org.thoughtcrime.securesms.service.SendReceiveService;
import org.thoughtcrime.securesms.sms.IncomingTextMessage;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
+import org.whispersystems.textsecure.push.IncomingGcmMessage;
+import org.whispersystems.textsecure.push.PushServiceSocket;
+import org.whispersystems.textsecure.push.RateLimitException;
import org.whispersystems.textsecure.util.Util;
import java.io.IOException;
diff --git a/src/org/thoughtcrime/securesms/gcm/OptimizingTransport.java b/src/org/thoughtcrime/securesms/gcm/OptimizingTransport.java
index a01bd5c4ed..b621bb5916 100644
--- a/src/org/thoughtcrime/securesms/gcm/OptimizingTransport.java
+++ b/src/org/thoughtcrime/securesms/gcm/OptimizingTransport.java
@@ -6,8 +6,10 @@ import android.content.Context;
import android.telephony.SmsManager;
import android.util.Log;
-import org.thoughtcrime.securesms.directory.NumberFilter;
+import org.whispersystems.textsecure.directory.NumberFilter;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
+import org.whispersystems.textsecure.push.PushServiceSocket;
+import org.whispersystems.textsecure.push.RateLimitException;
import org.whispersystems.textsecure.util.PhoneNumberFormatter;
import java.io.IOException;
diff --git a/src/org/thoughtcrime/securesms/mms/MmsCommunication.java b/src/org/thoughtcrime/securesms/mms/MmsCommunication.java
index 16d87bb00a..a1cc941feb 100644
--- a/src/org/thoughtcrime/securesms/mms/MmsCommunication.java
+++ b/src/org/thoughtcrime/securesms/mms/MmsCommunication.java
@@ -32,7 +32,7 @@ import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.service.MmsDownloader;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.textsecure.util.Util;
diff --git a/src/org/thoughtcrime/securesms/mms/PngTransport.java b/src/org/thoughtcrime/securesms/mms/PngTransport.java
index b8cc5af088..283a3f9bd5 100644
--- a/src/org/thoughtcrime/securesms/mms/PngTransport.java
+++ b/src/org/thoughtcrime/securesms/mms/PngTransport.java
@@ -26,7 +26,7 @@ import java.util.zip.InflaterInputStream;
import org.thoughtcrime.securesms.crypto.SessionCipher;
import org.thoughtcrime.securesms.crypto.TransportDetails;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
import android.util.Log;
diff --git a/src/org/thoughtcrime/securesms/protocol/Message.java b/src/org/thoughtcrime/securesms/protocol/Message.java
index a0b477efcb..d65ee815d2 100644
--- a/src/org/thoughtcrime/securesms/protocol/Message.java
+++ b/src/org/thoughtcrime/securesms/protocol/Message.java
@@ -21,7 +21,7 @@ import android.util.Log;
import org.thoughtcrime.securesms.crypto.InvalidKeyException;
import org.thoughtcrime.securesms.crypto.InvalidMessageException;
import org.thoughtcrime.securesms.crypto.PublicKey;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
import java.nio.ByteBuffer;
diff --git a/src/org/thoughtcrime/securesms/service/RegistrationService.java b/src/org/thoughtcrime/securesms/service/RegistrationService.java
index 7cd7509cca..504be9bfe6 100644
--- a/src/org/thoughtcrime/securesms/service/RegistrationService.java
+++ b/src/org/thoughtcrime/securesms/service/RegistrationService.java
@@ -15,10 +15,10 @@ import android.util.Log;
import com.google.android.gcm.GCMRegistrar;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
-import org.thoughtcrime.securesms.gcm.GcmIntentService;
-import org.thoughtcrime.securesms.gcm.GcmRegistrationTimeoutException;
-import org.thoughtcrime.securesms.gcm.PushServiceSocket;
-import org.thoughtcrime.securesms.gcm.RateLimitException;
+import org.whispersystems.textsecure.push.GcmIntentService;
+import org.whispersystems.textsecure.push.GcmRegistrationTimeoutException;
+import org.whispersystems.textsecure.push.PushServiceSocket;
+import org.whispersystems.textsecure.push.RateLimitException;
import org.whispersystems.textsecure.util.Util;
import java.io.IOException;
diff --git a/src/org/thoughtcrime/securesms/sms/IncomingTextMessage.java b/src/org/thoughtcrime/securesms/sms/IncomingTextMessage.java
index b733af3144..dd2482471e 100644
--- a/src/org/thoughtcrime/securesms/sms/IncomingTextMessage.java
+++ b/src/org/thoughtcrime/securesms/sms/IncomingTextMessage.java
@@ -4,7 +4,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.SmsMessage;
-import org.thoughtcrime.securesms.gcm.IncomingGcmMessage;
+import org.whispersystems.textsecure.push.IncomingGcmMessage;
import java.util.List;
diff --git a/src/org/thoughtcrime/securesms/sms/MultipartSmsTransportMessage.java b/src/org/thoughtcrime/securesms/sms/MultipartSmsTransportMessage.java
index 505c4e1631..145c86eed2 100644
--- a/src/org/thoughtcrime/securesms/sms/MultipartSmsTransportMessage.java
+++ b/src/org/thoughtcrime/securesms/sms/MultipartSmsTransportMessage.java
@@ -6,7 +6,7 @@ import org.thoughtcrime.securesms.protocol.KeyExchangeWirePrefix;
import org.thoughtcrime.securesms.protocol.SecureMessageWirePrefix;
import org.thoughtcrime.securesms.protocol.WirePrefix;
import org.whispersystems.textsecure.util.Base64;
-import org.thoughtcrime.securesms.util.Conversions;
+import org.whispersystems.textsecure.util.Conversions;
import java.io.IOException;
import java.util.ArrayList;