]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java
Implement Dbus updateProfile with givenName (#734)
[signal-cli] / src / main / java / org / asamk / signal / dbus / DbusSignalImpl.java
index 63764a2fab5eed038cc114b12b6ccdf30794334a..c73918ef6c506a757d09cd19f05226d6953799d5 100644 (file)
@@ -497,6 +497,28 @@ public class DbusSignalImpl implements Signal {
         }).collect(Collectors.toList());
     }
 
+    @Override
+    public void updateProfile(
+            final String givenName,
+            final String familyName,
+            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(givenName, familyName, about, aboutEmoji, avatarFile);
+        } catch (IOException e) {
+            throw new Error.Failure(e.getMessage());
+        }
+    }
+
     @Override
     public void updateProfile(
             final String name,