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

@ -2,9 +2,9 @@ package org.asamk;
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;
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.util.InvalidNumberException;
@ -98,6 +98,7 @@ public interface Signal extends DBusInterface {
}
class SyncMessageReceived extends DBusSignal {
private long timestamp;
private String source;
private String destination;

View file

@ -1,7 +1,7 @@
package org.asamk.signal;
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.SignalServiceEnvelope;

View file

@ -2,7 +2,7 @@ package org.asamk.signal;
import org.asamk.Signal;
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.whispersystems.signalservice.api.messages.SignalServiceAttachment;
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) {
if (envelope.isReceipt()) {
try {
conn.sendSignal(new Signal.ReceiptReceived(
conn.sendMessage(new Signal.ReceiptReceived(
objectPath,
envelope.getTimestamp(),
!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();
for (long timestamp : receiptMessage.getTimestamps()) {
try {
conn.sendSignal(new Signal.ReceiptReceived(
conn.sendMessage(new Signal.ReceiptReceived(
objectPath,
timestamp,
sender
@ -63,7 +63,7 @@ public class JsonDbusReceiveMessageHandler extends JsonReceiveMessageHandler {
!(message.getGroupContext().isPresent() &&
message.getGroupContext().get().getGroupV1Type() != SignalServiceGroup.Type.DELIVER)) {
try {
conn.sendSignal(new Signal.MessageReceived(
conn.sendMessage(new Signal.MessageReceived(
objectPath,
message.getTimestamp(),
envelope.isUnidentifiedSender() || !envelope.hasSource() ? content.getSender().getNumber().get() : envelope.getSourceE164().get(),
@ -84,7 +84,7 @@ public class JsonDbusReceiveMessageHandler extends JsonReceiveMessageHandler {
SignalServiceDataMessage message = transcript.getMessage();
try {
conn.sendSignal(new Signal.SyncMessageReceived(
conn.sendMessage(new Signal.SyncMessageReceived(
objectPath,
transcript.getTimestamp(),
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.SecurityProvider;
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.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException;
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
@ -76,11 +76,11 @@ public class Main {
if (ns.getBoolean("dbus") || ns.getBoolean("dbus_system")) {
try {
m = null;
int busType;
DBusConnection.DBusBusType busType;
if (ns.getBoolean("dbus_system")) {
busType = DBusConnection.SYSTEM;
busType = DBusConnection.DBusBusType.SYSTEM;
} else {
busType = DBusConnection.SESSION;
busType = DBusConnection.DBusBusType.SESSION;
}
dBusConn = DBusConnection.getConnection(busType);
ts = dBusConn.getRemoteObject(

View file

@ -7,7 +7,7 @@ import net.sourceforge.argparse4j.inf.Subparser;
import org.asamk.signal.DbusReceiveMessageHandler;
import org.asamk.signal.JsonDbusReceiveMessageHandler;
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 java.io.IOException;
@ -41,11 +41,11 @@ public class DaemonCommand implements LocalCommand {
DBusConnection conn = null;
try {
try {
int busType;
DBusConnection.DBusBusType busType;
if (ns.getBoolean("system")) {
busType = DBusConnection.SYSTEM;
busType = DBusConnection.DBusBusType.SYSTEM;
} else {
busType = DBusConnection.SESSION;
busType = DBusConnection.DBusBusType.SESSION;
}
conn = DBusConnection.getConnection(busType);
conn.exportObject(SIGNAL_OBJECTPATH, m);

View file

@ -3,7 +3,7 @@ package org.asamk.signal.commands;
import net.sourceforge.argparse4j.inf.Namespace;
import org.asamk.Signal;
import org.freedesktop.dbus.DBusConnection;
import org.freedesktop.dbus.connections.impl.DBusConnection;
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.manager.Manager;
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.whispersystems.util.Base64;

View file

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