Switch to hypfvieh dbus-java

Removes transitive dependency on libmatthew-unix-java

Fixes #285
This commit is contained in:
AsamK 2020-05-06 09:13:49 +02:00
parent 207075c236
commit 00777a469c
9 changed files with 27 additions and 22 deletions

View file

@ -13,9 +13,6 @@ compileJava.options.encoding = 'UTF-8'
repositories { repositories {
mavenLocal() mavenLocal()
maven {
url "https://raw.github.com/AsamK/maven/master/releases/"
}
mavenCentral() mavenCentral()
} }
@ -23,7 +20,8 @@ dependencies {
compile 'com.github.turasa:signal-service-java:2.15.3_unofficial_7' compile 'com.github.turasa:signal-service-java:2.15.3_unofficial_7'
compile 'org.bouncycastle:bcprov-jdk15on:1.64' compile 'org.bouncycastle:bcprov-jdk15on:1.64'
compile 'net.sourceforge.argparse4j:argparse4j:0.8.1' compile 'net.sourceforge.argparse4j:argparse4j:0.8.1'
compile 'org.freedesktop.dbus:dbus-java:2.7.0' compile 'com.github.hypfvieh:dbus-java:3.2.0'
compile 'org.slf4j:slf4j-nop:1.7.30'
} }
jar { jar {

View file

@ -2,9 +2,9 @@ package org.asamk;
import org.asamk.signal.AttachmentInvalidException; import org.asamk.signal.AttachmentInvalidException;
import org.asamk.signal.GroupNotFoundException; import org.asamk.signal.GroupNotFoundException;
import org.freedesktop.dbus.DBusInterface;
import org.freedesktop.dbus.DBusSignal;
import org.freedesktop.dbus.exceptions.DBusException; import org.freedesktop.dbus.exceptions.DBusException;
import org.freedesktop.dbus.interfaces.DBusInterface;
import org.freedesktop.dbus.messages.DBusSignal;
import org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptions; import org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptions;
import org.whispersystems.signalservice.api.util.InvalidNumberException; import org.whispersystems.signalservice.api.util.InvalidNumberException;
@ -98,6 +98,7 @@ public interface Signal extends DBusInterface {
} }
class SyncMessageReceived extends DBusSignal { class SyncMessageReceived extends DBusSignal {
private long timestamp; private long timestamp;
private String source; private String source;
private String destination; private String destination;

View file

@ -1,7 +1,7 @@
package org.asamk.signal; package org.asamk.signal;
import org.asamk.signal.manager.Manager; import org.asamk.signal.manager.Manager;
import org.freedesktop.dbus.DBusConnection; import org.freedesktop.dbus.connections.impl.DBusConnection;
import org.whispersystems.signalservice.api.messages.SignalServiceContent; import org.whispersystems.signalservice.api.messages.SignalServiceContent;
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;

View file

@ -2,7 +2,7 @@ package org.asamk.signal;
import org.asamk.Signal; import org.asamk.Signal;
import org.asamk.signal.manager.Manager; import org.asamk.signal.manager.Manager;
import org.freedesktop.dbus.DBusConnection; import org.freedesktop.dbus.connections.impl.DBusConnection;
import org.freedesktop.dbus.exceptions.DBusException; import org.freedesktop.dbus.exceptions.DBusException;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment; import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
import org.whispersystems.signalservice.api.messages.SignalServiceContent; import org.whispersystems.signalservice.api.messages.SignalServiceContent;
@ -31,7 +31,7 @@ public class JsonDbusReceiveMessageHandler extends JsonReceiveMessageHandler {
static void sendReceivedMessageToDbus(SignalServiceEnvelope envelope, SignalServiceContent content, DBusConnection conn, final String objectPath, Manager m) { static void sendReceivedMessageToDbus(SignalServiceEnvelope envelope, SignalServiceContent content, DBusConnection conn, final String objectPath, Manager m) {
if (envelope.isReceipt()) { if (envelope.isReceipt()) {
try { try {
conn.sendSignal(new Signal.ReceiptReceived( conn.sendMessage(new Signal.ReceiptReceived(
objectPath, objectPath,
envelope.getTimestamp(), envelope.getTimestamp(),
!envelope.isUnidentifiedSender() && envelope.hasSource() ? envelope.getSourceE164().get() : content.getSender().getNumber().get() !envelope.isUnidentifiedSender() && envelope.hasSource() ? envelope.getSourceE164().get() : content.getSender().getNumber().get()
@ -46,7 +46,7 @@ public class JsonDbusReceiveMessageHandler extends JsonReceiveMessageHandler {
final String sender = !envelope.isUnidentifiedSender() && envelope.hasSource() ? envelope.getSourceE164().get() : content.getSender().getNumber().get(); final String sender = !envelope.isUnidentifiedSender() && envelope.hasSource() ? envelope.getSourceE164().get() : content.getSender().getNumber().get();
for (long timestamp : receiptMessage.getTimestamps()) { for (long timestamp : receiptMessage.getTimestamps()) {
try { try {
conn.sendSignal(new Signal.ReceiptReceived( conn.sendMessage(new Signal.ReceiptReceived(
objectPath, objectPath,
timestamp, timestamp,
sender sender
@ -63,7 +63,7 @@ public class JsonDbusReceiveMessageHandler extends JsonReceiveMessageHandler {
!(message.getGroupContext().isPresent() && !(message.getGroupContext().isPresent() &&
message.getGroupContext().get().getGroupV1Type() != SignalServiceGroup.Type.DELIVER)) { message.getGroupContext().get().getGroupV1Type() != SignalServiceGroup.Type.DELIVER)) {
try { try {
conn.sendSignal(new Signal.MessageReceived( conn.sendMessage(new Signal.MessageReceived(
objectPath, objectPath,
message.getTimestamp(), message.getTimestamp(),
envelope.isUnidentifiedSender() || !envelope.hasSource() ? content.getSender().getNumber().get() : envelope.getSourceE164().get(), envelope.isUnidentifiedSender() || !envelope.hasSource() ? content.getSender().getNumber().get() : envelope.getSourceE164().get(),
@ -84,7 +84,7 @@ public class JsonDbusReceiveMessageHandler extends JsonReceiveMessageHandler {
SignalServiceDataMessage message = transcript.getMessage(); SignalServiceDataMessage message = transcript.getMessage();
try { try {
conn.sendSignal(new Signal.SyncMessageReceived( conn.sendMessage(new Signal.SyncMessageReceived(
objectPath, objectPath,
transcript.getTimestamp(), transcript.getTimestamp(),
envelope.getSourceAddress().getNumber().get(), envelope.getSourceAddress().getNumber().get(),

View file

@ -36,7 +36,7 @@ import org.asamk.signal.manager.Manager;
import org.asamk.signal.util.IOUtils; import org.asamk.signal.util.IOUtils;
import org.asamk.signal.util.SecurityProvider; import org.asamk.signal.util.SecurityProvider;
import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.freedesktop.dbus.DBusConnection; import org.freedesktop.dbus.connections.impl.DBusConnection;
import org.freedesktop.dbus.exceptions.DBusException; import org.freedesktop.dbus.exceptions.DBusException;
import org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException; import org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException;
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter; import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
@ -76,11 +76,11 @@ public class Main {
if (ns.getBoolean("dbus") || ns.getBoolean("dbus_system")) { if (ns.getBoolean("dbus") || ns.getBoolean("dbus_system")) {
try { try {
m = null; m = null;
int busType; DBusConnection.DBusBusType busType;
if (ns.getBoolean("dbus_system")) { if (ns.getBoolean("dbus_system")) {
busType = DBusConnection.SYSTEM; busType = DBusConnection.DBusBusType.SYSTEM;
} else { } else {
busType = DBusConnection.SESSION; busType = DBusConnection.DBusBusType.SESSION;
} }
dBusConn = DBusConnection.getConnection(busType); dBusConn = DBusConnection.getConnection(busType);
ts = dBusConn.getRemoteObject( ts = dBusConn.getRemoteObject(

View file

@ -7,7 +7,7 @@ import net.sourceforge.argparse4j.inf.Subparser;
import org.asamk.signal.DbusReceiveMessageHandler; import org.asamk.signal.DbusReceiveMessageHandler;
import org.asamk.signal.JsonDbusReceiveMessageHandler; import org.asamk.signal.JsonDbusReceiveMessageHandler;
import org.asamk.signal.manager.Manager; import org.asamk.signal.manager.Manager;
import org.freedesktop.dbus.DBusConnection; import org.freedesktop.dbus.connections.impl.DBusConnection;
import org.freedesktop.dbus.exceptions.DBusException; import org.freedesktop.dbus.exceptions.DBusException;
import java.io.IOException; import java.io.IOException;
@ -41,11 +41,11 @@ public class DaemonCommand implements LocalCommand {
DBusConnection conn = null; DBusConnection conn = null;
try { try {
try { try {
int busType; DBusConnection.DBusBusType busType;
if (ns.getBoolean("system")) { if (ns.getBoolean("system")) {
busType = DBusConnection.SYSTEM; busType = DBusConnection.DBusBusType.SYSTEM;
} else { } else {
busType = DBusConnection.SESSION; busType = DBusConnection.DBusBusType.SESSION;
} }
conn = DBusConnection.getConnection(busType); conn = DBusConnection.getConnection(busType);
conn.exportObject(SIGNAL_OBJECTPATH, m); conn.exportObject(SIGNAL_OBJECTPATH, m);

View file

@ -3,7 +3,7 @@ package org.asamk.signal.commands;
import net.sourceforge.argparse4j.inf.Namespace; import net.sourceforge.argparse4j.inf.Namespace;
import org.asamk.Signal; import org.asamk.Signal;
import org.freedesktop.dbus.DBusConnection; import org.freedesktop.dbus.connections.impl.DBusConnection;
public interface ExtendedDbusCommand extends Command { public interface ExtendedDbusCommand extends Command {

View file

@ -16,7 +16,7 @@ import org.asamk.signal.ReceiveMessageHandler;
import org.asamk.signal.json.JsonMessageEnvelope; import org.asamk.signal.json.JsonMessageEnvelope;
import org.asamk.signal.manager.Manager; import org.asamk.signal.manager.Manager;
import org.asamk.signal.util.DateUtils; import org.asamk.signal.util.DateUtils;
import org.freedesktop.dbus.DBusConnection; import org.freedesktop.dbus.connections.impl.DBusConnection;
import org.freedesktop.dbus.exceptions.DBusException; import org.freedesktop.dbus.exceptions.DBusException;
import org.whispersystems.util.Base64; import org.whispersystems.util.Base64;

View file

@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.asamk.Signal; import org.asamk.Signal;
import org.asamk.signal.AttachmentInvalidException; import org.asamk.signal.AttachmentInvalidException;
import org.asamk.signal.DbusConfig;
import org.asamk.signal.GroupNotFoundException; import org.asamk.signal.GroupNotFoundException;
import org.asamk.signal.NotAGroupMemberException; import org.asamk.signal.NotAGroupMemberException;
import org.asamk.signal.StickerPackInvalidException; import org.asamk.signal.StickerPackInvalidException;
@ -1825,6 +1826,11 @@ public class Manager implements Signal {
return false; return false;
} }
@Override
public String getObjectPath() {
return null;
}
private void sendGroups() throws IOException, UntrustedIdentityException { private void sendGroups() throws IOException, UntrustedIdentityException {
File groupsFile = IOUtils.createTempFile(); File groupsFile = IOUtils.createTempFile();