private final static String URL = "https://textsecure-service.whispersystems.org";
private final static TrustStore TRUST_STORE = new WhisperTrustStore();
- private final static String USER_AGENT = "textsecure-cli";
+ public final static String PROJECT_NAME = Manager.class.getPackage().getImplementationTitle();
+ public final static String PROJECT_VERSION = Manager.class.getPackage().getImplementationVersion();
+ private final static String USER_AGENT = PROJECT_NAME + " " + PROJECT_VERSION;
private final static String settingsPath = System.getProperty("user.home") + "/.config/textsecure";
private final static String dataPath = settingsPath + "/data";
public void verifyAccount(String verificationCode) throws IOException {
verificationCode = verificationCode.replace("-", "");
signalingKey = Util.getSecret(52);
- accountManager.verifyAccountWithCode(verificationCode, signalingKey, axolotlStore.getLocalRegistrationId());
+ accountManager.verifyAccountWithCode(verificationCode, signalingKey, axolotlStore.getLocalRegistrationId(), false);
//accountManager.setGcmId(Optional.of(GoogleCloudMessaging.getInstance(this).register(REGISTRATION_ID)));
registered = true;
} finally {
if (output != null) {
output.close();
+ output = null;
+ }
+ if (!tmpFile.delete()) {
+ System.err.println("Failed to delete temp file: " + tmpFile);
+ }
+ }
+ if (pointer.getPreview().isPresent()) {
+ File previewFile = new File(outputFile + ".preview");
+ try {
+ output = new FileOutputStream(previewFile);
+ byte[] preview = pointer.getPreview().get();
+ output.write(preview, 0, preview.length);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ return null;
+ } finally {
+ if (output != null) {
+ output.close();
+ }
}
- tmpFile.delete();
}
return outputFile;
}