import org.asamk.signal.manager.api.NotAGroupMemberException;
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
import org.asamk.signal.manager.api.PendingAdminApprovalException;
+import org.asamk.signal.manager.api.RateLimitException;
import org.asamk.signal.manager.api.RecipientAddress;
import org.asamk.signal.manager.api.RecipientIdentifier;
import org.asamk.signal.manager.api.SendMessageResult;
import org.asamk.signal.manager.api.UpdateGroup;
import org.asamk.signal.manager.api.UpdateProfile;
import org.asamk.signal.manager.api.UserStatus;
+import org.asamk.signal.util.DateUtils;
import org.asamk.signal.util.SendMessageResultUtils;
import org.freedesktop.dbus.DBusPath;
import org.freedesktop.dbus.connections.impl.DBusConnection;
m.addDeviceLink(deviceLinkUrl);
} catch (IOException | InvalidDeviceLinkException e) {
throw new Error.Failure(e.getClass().getSimpleName() + " Add device link failed. " + e.getMessage());
+ } catch (NotPrimaryDeviceException e) {
+ throw new Error.Failure("This command doesn't work on linked devices.");
} catch (URISyntaxException e) {
throw new Error.InvalidUri(e.getClass().getSimpleName()
+ " Device link uri has invalid format: "
registered = m.getUserStatus(new HashSet<>(numbers));
} catch (IOException e) {
throw new Error.Failure(e.getMessage());
+ } catch (RateLimitException e) {
+ throw new Error.Failure(e.getMessage()
+ + ", retry at "
+ + DateUtils.formatTimestamp(e.getNextAttemptTimestamp()));
}
return numbers.stream().map(number -> registered.get(number).uuid() != null).toList();
}
var errors = SendMessageResultUtils.getErrorMessagesFromSendMessageResults(results);
- if (errors.size() == 0 || errors.size() < results.size()) {
+ if (errors.isEmpty() || errors.size() < results.size()) {
return;
}
connection.exportObject(object);
logger.debug("Exported dbus object: " + object.getObjectPath());
} catch (DBusException e) {
- e.printStackTrace();
+ logger.warn("Failed to export dbus object (" + object.getObjectPath() + "): " + e.getMessage());
}
}
@Override
public String getObjectPath() {
- return getIdentityObjectPath(objectPath, identity.recipient().getLegacyIdentifier());
+ return getIdentityObjectPath(objectPath,
+ identity.recipient().getLegacyIdentifier() + "_" + identity.recipient().getIdentifier());
}
@Override
} catch (UnregisteredRecipientException e) {
throw new Error.Failure("The user " + e.getSender().getIdentifier() + " is not registered.");
}
+ updateIdentities();
}
@Override
} catch (UnregisteredRecipientException e) {
throw new Error.Failure("The user " + e.getSender().getIdentifier() + " is not registered.");
}
+ updateIdentities();
}
}