]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java
Add updateProfile to Dbus (#522)
[signal-cli] / src / main / java / org / asamk / signal / dbus / DbusSignalImpl.java
index a2f6cace9933b95685dc0bf6de5c9296798a695d..4f23d461610f49cbaab7a4d5b151333c1758cec7 100644 (file)
@@ -13,6 +13,8 @@ import org.whispersystems.libsignal.util.Pair;
 import org.whispersystems.signalservice.api.messages.SendMessageResult;
 import org.whispersystems.signalservice.api.push.SignalServiceAddress;
 import org.whispersystems.signalservice.api.util.InvalidNumberException;
+import org.whispersystems.libsignal.util.guava.Optional;
+import org.asamk.signal.manager.storage.contacts.ContactInfo;
 
 import java.io.File;
 import java.io.IOException;
@@ -248,4 +250,20 @@ public class DbusSignalImpl implements Signal {
     public boolean isRegistered() {
         return true;
     }
+
+    @Override
+    public void updateProfile(final String name,final String about,final String aboutEmoji, String avatarPath, final boolean removeAvatar) {
+        try {
+                if (avatarPath.isEmpty()) {
+                avatarPath = null;
+            }
+            Optional<File> avatarFile = removeAvatar
+                    ? Optional.absent()
+                    : avatarPath == null ? null : Optional.of(new File(avatarPath));
+            m.setProfile(name, about, aboutEmoji, avatarFile);
+        } catch (IOException e) {
+            throw new Error.Failure(e.getMessage());
+        }
+    }
+
 }