Move directory and push service socket into library.

This commit is contained in:
Moxie Marlinspike 2013-07-10 16:22:58 -07:00
parent a200d29514
commit 1ac06312a0
30 changed files with 49 additions and 51 deletions

View File

@ -25,6 +25,15 @@
<SOURCES /> <SOURCES />
</library> </library>
</orderEntry> </orderEntry>
<orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/libs/thoughtcrimegson-2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component> </component>
</module> </module>

Binary file not shown.

View File

@ -1,4 +1,4 @@
package org.thoughtcrime.securesms; package org.whispersystems.textsecure;
public class Release { public class Release {
public static final String PUSH_SERVICE_URL = "https://gcm.textsecure.whispersystems.org"; public static final String PUSH_SERVICE_URL = "https://gcm.textsecure.whispersystems.org";

View File

@ -15,9 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
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.Mac;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;

View File

@ -1,4 +1,4 @@
package org.thoughtcrime.securesms.directory; package org.whispersystems.textsecure.directory;
public class DirectoryDescriptor { public class DirectoryDescriptor {
private String version; private String version;

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.thoughtcrime.securesms.directory; package org.whispersystems.textsecure.directory;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
@ -24,7 +24,6 @@ import com.google.thoughtcrimegson.Gson;
import com.google.thoughtcrimegson.JsonParseException; import com.google.thoughtcrimegson.JsonParseException;
import com.google.thoughtcrimegson.annotations.SerializedName; import com.google.thoughtcrimegson.annotations.SerializedName;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.textsecure.util.PhoneNumberFormatter; import org.whispersystems.textsecure.util.PhoneNumberFormatter;
import java.io.BufferedReader; import java.io.BufferedReader;
@ -72,13 +71,11 @@ public class NumberFilter {
this.version = version; this.version = version;
} }
public synchronized boolean containsNumber(String number) { public synchronized boolean containsNumber(String number, String localNumber) {
try { try {
if (bloomFilter == null) return false; if (bloomFilter == null) return false;
else if (number == null || number.length() == 0) return false; else if (number == null || number.length() == 0) return false;
String localNumber = TextSecurePreferences.getLocalNumber(context);
return new BloomFilter(bloomFilter, hashCount) return new BloomFilter(bloomFilter, hashCount)
.contains(PhoneNumberFormatter.formatNumber(number, localNumber)); .contains(PhoneNumberFormatter.formatNumber(number, localNumber));
} catch (IOException ioe) { } catch (IOException ioe) {

View File

@ -1,4 +1,4 @@
package org.thoughtcrime.securesms.gcm; package org.whispersystems.textsecure.push;
import java.util.List; import java.util.List;

View File

@ -1,6 +1,5 @@
package org.thoughtcrime.securesms.gcm; package org.whispersystems.textsecure.push;
import java.util.LinkedList;
import java.util.List; import java.util.List;
public class IncomingGcmMessage { public class IncomingGcmMessage {

View File

@ -1,4 +1,4 @@
package org.thoughtcrime.securesms.gcm; package org.whispersystems.textsecure.push;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package org.thoughtcrime.securesms.gcm; package org.whispersystems.textsecure.push;
import android.content.Context; import android.content.Context;
import android.content.res.AssetManager; import android.content.res.AssetManager;
@ -6,9 +6,9 @@ import android.util.Base64;
import android.util.Log; import android.util.Log;
import com.google.thoughtcrimegson.Gson; import com.google.thoughtcrimegson.Gson;
import org.thoughtcrime.securesms.Release; import org.whispersystems.textsecure.Release;
import org.thoughtcrime.securesms.directory.DirectoryDescriptor; import org.whispersystems.textsecure.directory.DirectoryDescriptor;
import org.thoughtcrime.securesms.directory.NumberFilter; import org.whispersystems.textsecure.directory.NumberFilter;
import org.whispersystems.textsecure.util.Util; import org.whispersystems.textsecure.util.Util;
import javax.net.ssl.HttpsURLConnection; 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 class GcmRegistrationId {
private String gcmRegistrationId; private String gcmRegistrationId;

View File

@ -1,4 +1,4 @@
package org.thoughtcrime.securesms.gcm; package org.whispersystems.textsecure.push;
public class RateLimitException extends Exception { public class RateLimitException extends Exception {

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.thoughtcrime.securesms.util; package org.whispersystems.textsecure.util;
public class Conversions { public class Conversions {

View File

@ -29,8 +29,8 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.actionbarsherlock.app.SherlockActivity; import com.actionbarsherlock.app.SherlockActivity;
import org.thoughtcrime.securesms.gcm.PushServiceSocket; import org.whispersystems.textsecure.push.PushServiceSocket;
import org.thoughtcrime.securesms.gcm.RateLimitException; import org.whispersystems.textsecure.push.RateLimitException;
import org.thoughtcrime.securesms.service.RegistrationService; import org.thoughtcrime.securesms.service.RegistrationService;
import org.whispersystems.textsecure.util.PhoneNumberFormatter; import org.whispersystems.textsecure.util.PhoneNumberFormatter;
import org.whispersystems.textsecure.util.Util; import org.whispersystems.textsecure.util.Util;

View File

@ -27,7 +27,7 @@ import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
import org.bouncycastle.crypto.agreement.ECDHBasicAgreement; import org.bouncycastle.crypto.agreement.ECDHBasicAgreement;
import org.bouncycastle.crypto.params.ECPublicKeyParameters; import org.bouncycastle.crypto.params.ECPublicKeyParameters;
import org.whispersystems.textsecure.util.Base64; import org.whispersystems.textsecure.util.Base64;
import org.thoughtcrime.securesms.util.Conversions; import org.whispersystems.textsecure.util.Conversions;
import org.thoughtcrime.securesms.util.InvalidMessageException; import org.thoughtcrime.securesms.util.InvalidMessageException;
/** /**

View File

@ -32,7 +32,7 @@ import org.thoughtcrime.bouncycastle.asn1.DERInteger;
import org.thoughtcrime.bouncycastle.asn1.DERSequence; import org.thoughtcrime.bouncycastle.asn1.DERSequence;
import org.whispersystems.textsecure.util.Base64; import org.whispersystems.textsecure.util.Base64;
import org.thoughtcrime.securesms.util.Combiner; 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.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;

View File

@ -22,7 +22,7 @@ import android.util.Log;
import org.thoughtcrime.securesms.database.keys.LocalKeyRecord; import org.thoughtcrime.securesms.database.keys.LocalKeyRecord;
import org.thoughtcrime.securesms.protocol.Message; import org.thoughtcrime.securesms.protocol.Message;
import org.whispersystems.textsecure.util.Base64; import org.whispersystems.textsecure.util.Base64;
import org.thoughtcrime.securesms.util.Conversions; import org.whispersystems.textsecure.util.Conversions;
import java.io.IOException; import java.io.IOException;

View File

@ -30,7 +30,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.service.KeyCachingService; import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.sms.MessageSender; import org.thoughtcrime.securesms.sms.MessageSender;
import org.thoughtcrime.securesms.sms.OutgoingKeyExchangeMessage; import org.thoughtcrime.securesms.sms.OutgoingKeyExchangeMessage;
import org.thoughtcrime.securesms.util.Conversions; import org.whispersystems.textsecure.util.Conversions;
/** /**
* This class processes key exchange interactions. * This class processes key exchange interactions.

View File

@ -21,7 +21,7 @@ import java.security.NoSuchAlgorithmException;
import org.bouncycastle.crypto.params.ECPublicKeyParameters; import org.bouncycastle.crypto.params.ECPublicKeyParameters;
import org.bouncycastle.math.ec.ECPoint; 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 org.thoughtcrime.securesms.util.Hex;
import android.util.Log; import android.util.Log;

View File

@ -40,7 +40,7 @@ import org.thoughtcrime.securesms.database.keys.SessionKey;
import org.thoughtcrime.securesms.database.keys.SessionRecord; import org.thoughtcrime.securesms.database.keys.SessionRecord;
import org.thoughtcrime.securesms.protocol.Message; import org.thoughtcrime.securesms.protocol.Message;
import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.Conversions; import org.whispersystems.textsecure.util.Conversions;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;

View File

@ -18,7 +18,7 @@ package org.thoughtcrime.securesms.database.keys;
import android.content.Context; import android.content.Context;
import org.thoughtcrime.securesms.util.Conversions; import org.whispersystems.textsecure.util.Conversions;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;

View File

@ -19,7 +19,7 @@ package org.thoughtcrime.securesms.database.keys;
import org.thoughtcrime.securesms.crypto.MasterCipher; import org.thoughtcrime.securesms.crypto.MasterCipher;
import org.thoughtcrime.securesms.crypto.MasterSecret; import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.crypto.SessionCipher; 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 org.thoughtcrime.securesms.util.Util;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;

View File

@ -13,6 +13,9 @@ import org.thoughtcrime.securesms.service.RegistrationService;
import org.thoughtcrime.securesms.service.SendReceiveService; import org.thoughtcrime.securesms.service.SendReceiveService;
import org.thoughtcrime.securesms.sms.IncomingTextMessage; import org.thoughtcrime.securesms.sms.IncomingTextMessage;
import org.thoughtcrime.securesms.util.TextSecurePreferences; 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 org.whispersystems.textsecure.util.Util;
import java.io.IOException; import java.io.IOException;

View File

@ -6,8 +6,10 @@ import android.content.Context;
import android.telephony.SmsManager; import android.telephony.SmsManager;
import android.util.Log; import android.util.Log;
import org.thoughtcrime.securesms.directory.NumberFilter; import org.whispersystems.textsecure.directory.NumberFilter;
import org.thoughtcrime.securesms.util.TextSecurePreferences; 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 org.whispersystems.textsecure.util.PhoneNumberFormatter;
import java.io.IOException; import java.io.IOException;

View File

@ -32,7 +32,7 @@ import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams; import org.apache.http.params.HttpProtocolParams;
import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.service.MmsDownloader; 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.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.textsecure.util.Util; import org.whispersystems.textsecure.util.Util;

View File

@ -26,7 +26,7 @@ import java.util.zip.InflaterInputStream;
import org.thoughtcrime.securesms.crypto.SessionCipher; import org.thoughtcrime.securesms.crypto.SessionCipher;
import org.thoughtcrime.securesms.crypto.TransportDetails; import org.thoughtcrime.securesms.crypto.TransportDetails;
import org.thoughtcrime.securesms.util.Conversions; import org.whispersystems.textsecure.util.Conversions;
import android.util.Log; import android.util.Log;

View File

@ -21,7 +21,7 @@ import android.util.Log;
import org.thoughtcrime.securesms.crypto.InvalidKeyException; import org.thoughtcrime.securesms.crypto.InvalidKeyException;
import org.thoughtcrime.securesms.crypto.InvalidMessageException; import org.thoughtcrime.securesms.crypto.InvalidMessageException;
import org.thoughtcrime.securesms.crypto.PublicKey; import org.thoughtcrime.securesms.crypto.PublicKey;
import org.thoughtcrime.securesms.util.Conversions; import org.whispersystems.textsecure.util.Conversions;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;

View File

@ -15,10 +15,10 @@ import android.util.Log;
import com.google.android.gcm.GCMRegistrar; import com.google.android.gcm.GCMRegistrar;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity; import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.gcm.GcmIntentService; import org.whispersystems.textsecure.push.GcmIntentService;
import org.thoughtcrime.securesms.gcm.GcmRegistrationTimeoutException; import org.whispersystems.textsecure.push.GcmRegistrationTimeoutException;
import org.thoughtcrime.securesms.gcm.PushServiceSocket; import org.whispersystems.textsecure.push.PushServiceSocket;
import org.thoughtcrime.securesms.gcm.RateLimitException; import org.whispersystems.textsecure.push.RateLimitException;
import org.whispersystems.textsecure.util.Util; import org.whispersystems.textsecure.util.Util;
import java.io.IOException; import java.io.IOException;

View File

@ -4,7 +4,7 @@ import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.telephony.SmsMessage; import android.telephony.SmsMessage;
import org.thoughtcrime.securesms.gcm.IncomingGcmMessage; import org.whispersystems.textsecure.push.IncomingGcmMessage;
import java.util.List; import java.util.List;

View File

@ -6,7 +6,7 @@ import org.thoughtcrime.securesms.protocol.KeyExchangeWirePrefix;
import org.thoughtcrime.securesms.protocol.SecureMessageWirePrefix; import org.thoughtcrime.securesms.protocol.SecureMessageWirePrefix;
import org.thoughtcrime.securesms.protocol.WirePrefix; import org.thoughtcrime.securesms.protocol.WirePrefix;
import org.whispersystems.textsecure.util.Base64; import org.whispersystems.textsecure.util.Base64;
import org.thoughtcrime.securesms.util.Conversions; import org.whispersystems.textsecure.util.Conversions;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;