Rename to signal-cli

Changes experimental dbus interface from
org.asamk.TextSecure to org.asamk.Signal
This commit is contained in:
AsamK 2016-03-27 13:53:04 +02:00
parent 10719a443a
commit eabd361405
27 changed files with 108 additions and 108 deletions

View file

@ -1,7 +1,7 @@
package org.asamk;
import org.asamk.textsecure.AttachmentInvalidException;
import org.asamk.textsecure.GroupNotFoundException;
import org.asamk.signal.AttachmentInvalidException;
import org.asamk.signal.GroupNotFoundException;
import org.freedesktop.dbus.DBusInterface;
import org.freedesktop.dbus.DBusSignal;
import org.freedesktop.dbus.exceptions.DBusException;
@ -10,7 +10,7 @@ import org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptio
import java.io.IOException;
import java.util.List;
public interface TextSecure extends DBusInterface {
public interface Signal extends DBusInterface {
void sendMessage(String message, List<String> attachments, String recipient) throws EncapsulatedExceptions, AttachmentInvalidException, IOException;
void sendMessage(String message, List<String> attachments, List<String> recipients) throws EncapsulatedExceptions, AttachmentInvalidException, IOException;

View file

@ -1,4 +1,4 @@
package org.asamk.textsecure;
package org.asamk.signal;
import org.freedesktop.dbus.exceptions.DBusExecutionException;

View file

@ -1,4 +1,4 @@
package org.asamk.textsecure;
package org.asamk.signal;
/**
* <p>Encodes and decodes to and from Base64 notation.</p>

View file

@ -1,4 +1,4 @@
package org.asamk.textsecure;
package org.asamk.signal;
import com.fasterxml.jackson.annotation.JsonProperty;

View file

@ -1,4 +1,4 @@
package org.asamk.textsecure;
package org.asamk.signal;
import org.freedesktop.dbus.exceptions.DBusExecutionException;

View file

@ -1,4 +1,4 @@
package org.asamk.textsecure;
package org.asamk.signal;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;

View file

@ -1,4 +1,4 @@
package org.asamk.textsecure;
package org.asamk.signal;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;

View file

@ -1,4 +1,4 @@
package org.asamk.textsecure;
package org.asamk.signal;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;

View file

@ -1,4 +1,4 @@
package org.asamk.textsecure;
package org.asamk.signal;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;

View file

@ -1,4 +1,4 @@
package org.asamk.textsecure;
package org.asamk.signal;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

View file

@ -1,4 +1,4 @@
package org.asamk.textsecure;
package org.asamk.signal;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;

View file

@ -14,14 +14,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.asamk.textsecure;
package org.asamk.signal;
import net.sourceforge.argparse4j.ArgumentParsers;
import net.sourceforge.argparse4j.impl.Arguments;
import net.sourceforge.argparse4j.inf.*;
import org.apache.commons.io.IOUtils;
import org.apache.http.util.TextUtils;
import org.asamk.TextSecure;
import org.asamk.Signal;
import org.freedesktop.dbus.DBusConnection;
import org.freedesktop.dbus.exceptions.DBusException;
import org.freedesktop.dbus.exceptions.DBusExecutionException;
@ -41,8 +41,8 @@ import java.util.List;
public class Main {
public static final String TEXTSECURE_BUSNAME = "org.asamk.TextSecure";
public static final String TEXTSECURE_OBJECTPATH = "/org/asamk/TextSecure";
public static final String SIGNAL_BUSNAME = "org.asamk.Signal";
public static final String SIGNAL_OBJECTPATH = "/org/asamk/Signal";
public static void main(String[] args) {
// Workaround for BKS truststore
@ -55,7 +55,7 @@ public class Main {
final String username = ns.getString("username");
Manager m;
TextSecure ts;
Signal ts;
DBusConnection dBusConn = null;
try {
if (ns.getBoolean("dbus") || ns.getBoolean("dbus_system")) {
@ -68,9 +68,9 @@ public class Main {
busType = DBusConnection.SESSION;
}
dBusConn = DBusConnection.getConnection(busType);
ts = (TextSecure) dBusConn.getRemoteObject(
TEXTSECURE_BUSNAME, TEXTSECURE_OBJECTPATH,
TextSecure.class);
ts = (Signal) dBusConn.getRemoteObject(
SIGNAL_BUSNAME, SIGNAL_OBJECTPATH,
Signal.class);
} catch (DBusException e) {
e.printStackTrace();
if (dBusConn != null) {
@ -82,7 +82,7 @@ public class Main {
} else {
String settingsPath = ns.getString("config");
if (TextUtils.isEmpty(settingsPath)) {
settingsPath = System.getProperty("user.home") + "/.config/textsecure";
settingsPath = System.getProperty("user.home") + "/.config/signal";
}
m = new Manager(username, settingsPath);
@ -299,8 +299,8 @@ public class Main {
busType = DBusConnection.SESSION;
}
conn = DBusConnection.getConnection(busType);
conn.exportObject(TEXTSECURE_OBJECTPATH, m);
conn.requestBusName(TEXTSECURE_BUSNAME);
conn.exportObject(SIGNAL_OBJECTPATH, m);
conn.requestBusName(SIGNAL_BUSNAME);
} catch (DBusException e) {
e.printStackTrace();
System.exit(3);
@ -353,16 +353,16 @@ public class Main {
}
private static Namespace parseArgs(String[] args) {
ArgumentParser parser = ArgumentParsers.newArgumentParser("textsecure-cli")
ArgumentParser parser = ArgumentParsers.newArgumentParser("signal-cli")
.defaultHelp(true)
.description("Commandline interface for TextSecure.")
.description("Commandline interface for Signal.")
.version(Manager.PROJECT_NAME + " " + Manager.PROJECT_VERSION);
parser.addArgument("-v", "--version")
.help("Show package version.")
.action(Arguments.version());
parser.addArgument("--config")
.help("Set the path, where to store the config (Default: $HOME/.config/textsecure-cli).");
.help("Set the path, where to store the config (Default: $HOME/.config/signal-cli).");
MutuallyExclusiveGroup mut = parser.addMutuallyExclusiveGroup();
mut.addArgument("-u", "--username")
@ -630,8 +630,8 @@ public class Main {
if (!message.isEndSession() &&
!(message.getGroupInfo().isPresent() && message.getGroupInfo().get().getType() != SignalServiceGroup.Type.DELIVER)) {
try {
conn.sendSignal(new TextSecure.MessageReceived(
TEXTSECURE_OBJECTPATH,
conn.sendSignal(new Signal.MessageReceived(
SIGNAL_OBJECTPATH,
envelope.getSource(),
message.getGroupInfo().isPresent() ? message.getGroupInfo().get().getGroupId() : new byte[0],
message.getBody().isPresent() ? message.getBody().get() : "",

View file

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.asamk.textsecure;
package org.asamk.signal;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
@ -23,7 +23,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.asamk.TextSecure;
import org.asamk.Signal;
import org.whispersystems.libsignal.*;
import org.whispersystems.libsignal.ecc.Curve;
import org.whispersystems.libsignal.ecc.ECKeyPair;
@ -52,8 +52,8 @@ import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
class Manager implements TextSecure {
private final static String URL = "https://SignalService-service.whispersystems.org";
class Manager implements Signal {
private final static String URL = "https://textsecure-service.whispersystems.org";
private final static TrustStore TRUST_STORE = new WhisperTrustStore();
public final static String PROJECT_NAME = Manager.class.getPackage().getImplementationTitle();

View file

@ -1,4 +1,4 @@
package org.asamk.textsecure;
package org.asamk.signal;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;

View file

@ -1,4 +1,4 @@
package org.asamk.textsecure;
package org.asamk.signal;
import org.whispersystems.signalservice.api.push.TrustStore;