diff --git a/src/main/java/chat/delta/rpc/Rpc.java b/src/main/java/chat/delta/rpc/Rpc.java index d5b825d5a..2275a0c8c 100644 --- a/src/main/java/chat/delta/rpc/Rpc.java +++ b/src/main/java/chat/delta/rpc/Rpc.java @@ -443,10 +443,19 @@ public class Rpc { } /** - * Estimate the number of messages that will be deleted - * by the set_config()-options `delete_device_after` or `delete_server_after`. + * Estimates the number of messages that will be deleted + * by the `set_config()`-option `delete_device_after`. + *

* This is typically used to show the estimated impact to the user * before actually enabling deletion of old messages. + *

+ * Messages in the "Saved Messages" chat are not counted as they will not be deleted automatically. + *

+ * Parameters: + * - `from_server`: Deprecated, pass `false` here + * - `seconds`: Count messages older than the given number of seconds. + *

+ * Returns the number of messages that are older than the given number of seconds. */ public Integer estimateAutoDeletionCount(Integer accountId, Boolean fromServer, Integer seconds) throws RpcException { return transport.callForResult(new TypeReference(){}, "estimate_auto_deletion_count", mapper.valueToTree(accountId), mapper.valueToTree(fromServer), mapper.valueToTree(seconds)); @@ -913,8 +922,22 @@ public class Rpc { } /** - * Returns all messages of a particular chat. + * Get all message IDs belonging to a chat. *

+ * The list is already sorted and starts with the oldest message. + * Clients should not try to re-sort the list as this would be an expensive action + * and would result in inconsistencies between clients. + * Note that the messages are not necessarily sorted by their ID or by their displayed timestamp; + * UIs need to handle both the case of descending message IDs + * and of decreasing timestamps. + *

+ * Optionally, 'daymarkers' added to the ID array may help to + * implement virtual lists. + *

+ * Parameters: + *

+ * * chat_id The chat ID of which the messages IDs should be queried. + * * _info_only: Deprecated, pass `false` here. * * `add_daymarker` - If `true`, add day markers as `DC_MSG_ID_DAYMARKER` to the result, * e.g. [1234, 1237, 9, 1239]. The day marker timestamp is the midnight one for the * corresponding (following) day in the local timezone. @@ -932,6 +955,14 @@ public class Rpc { return transport.callForResult(new TypeReference>(){}, "get_existing_msg_ids", mapper.valueToTree(accountId), mapper.valueToTree(msgIds)); } + /** + * Get all messages belonging to a chat. + *

+ * Similar to `get_message_ids` / `getMessageIds`, + * see that function for details. + * The difference is that this function here returns a list of `MessageListItem`, + * which is an enum of a message or a daymarker. + */ public java.util.List getMessageListItems(Integer accountId, Integer chatId, Boolean infoOnly, Boolean addDaymarker) throws RpcException { return transport.callForResult(new TypeReference>(){}, "get_message_list_items", mapper.valueToTree(accountId), mapper.valueToTree(chatId), mapper.valueToTree(infoOnly), mapper.valueToTree(addDaymarker)); } @@ -1181,11 +1212,6 @@ public class Rpc { return transport.callForResult(new TypeReference(){}, "make_vcard", mapper.valueToTree(accountId), mapper.valueToTree(contacts)); } - /** Sets vCard containing the given contacts to the message draft. */ - public void setDraftVcard(Integer accountId, Integer msgId, java.util.List contacts) throws RpcException { - transport.call("set_draft_vcard", mapper.valueToTree(accountId), mapper.valueToTree(msgId), mapper.valueToTree(contacts)); - } - /** * Returns the [`ChatId`] for the 1:1 chat with `contact_id` if it exists. *

@@ -1328,10 +1354,47 @@ public class Rpc { return transport.callForResult(new TypeReference(){}, "get_connectivity_html", mapper.valueToTree(accountId)); } + /** + * Sets current location. + *

+ * Returns true if location streaming is currently + * enabled and locations should be updated. + *

+ * Location is represented as latitude and longitude in degrees + * and horizontal accuracy in meters. + */ + public Boolean setLocation(Float latitude, Float longitude, Float accuracy) throws RpcException { + return transport.callForResult(new TypeReference(){}, "set_location", mapper.valueToTree(latitude), mapper.valueToTree(longitude), mapper.valueToTree(accuracy)); + } + public java.util.List getLocations(Integer accountId, Integer chatId, Integer contactId, Integer timestampBegin, Integer timestampEnd) throws RpcException { return transport.callForResult(new TypeReference>(){}, "get_locations", mapper.valueToTree(accountId), mapper.valueToTree(chatId), mapper.valueToTree(contactId), mapper.valueToTree(timestampBegin), mapper.valueToTree(timestampEnd)); } + /** + * Enables location streaming in chat identified by `chat_id` for `seconds` seconds. + *

+ * Pass 0 as the number of seconds to disable location streaming in the chat. + */ + public void sendLocationsToChat(Integer accountId, Integer chatId, Integer seconds) throws RpcException { + transport.call("send_locations_to_chat", mapper.valueToTree(accountId), mapper.valueToTree(chatId), mapper.valueToTree(seconds)); + } + + /** Returns whether any chat is sending locations. */ + public Boolean isSendingLocations(Integer accountId) throws RpcException { + return transport.callForResult(new TypeReference(){}, "is_sending_locations", mapper.valueToTree(accountId)); + } + + /** Returns whether `chat_id` is sending locations. */ + public Boolean isSendingLocationsToChat(Integer accountId, Integer chatId) throws RpcException { + return transport.callForResult(new TypeReference(){}, "is_sending_locations_to_chat", mapper.valueToTree(accountId), mapper.valueToTree(chatId)); + } + + /** Stops sending locations to all chats. */ + public void stopSendingLocations() throws RpcException { + transport.call("stop_sending_locations"); + } + public void sendWebxdcStatusUpdate(Integer accountId, Integer instanceMsgId, String updateStr, String descr) throws RpcException { transport.call("send_webxdc_status_update", mapper.valueToTree(accountId), mapper.valueToTree(instanceMsgId), mapper.valueToTree(updateStr), mapper.valueToTree(descr)); } @@ -1467,17 +1530,18 @@ public class Rpc { transport.call("resend_messages", mapper.valueToTree(accountId), mapper.valueToTree(messageIds)); } + /** @deprecated as of 2026-04; use `send_msg` with `Viewtype::Sticker` instead. */ public Integer sendSticker(Integer accountId, Integer chatId, String stickerPath) throws RpcException { return transport.callForResult(new TypeReference(){}, "send_sticker", mapper.valueToTree(accountId), mapper.valueToTree(chatId), mapper.valueToTree(stickerPath)); } /** - * Send a reaction to message. + * Sends a reaction to message. *

- * Reaction is a string of emojis separated by spaces. Reaction to a - * single message can be sent multiple times. The last reaction - * received overrides all previously received reactions. It is - * possible to remove all reactions by sending an empty string. + * A reaction is a string that represents an emoji. + * You can call this function again to change the emoji; + * the last sent reaction overrides all previously sent reactions. + * It is possible to remove the reaction by sending an empty string. */ public Integer sendReaction(Integer accountId, Integer messageId, java.util.List reaction) throws RpcException { return transport.callForResult(new TypeReference(){}, "send_reaction", mapper.valueToTree(accountId), mapper.valueToTree(messageId), mapper.valueToTree(reaction)); diff --git a/src/main/java/chat/delta/rpc/types/EnteredLoginParam.java b/src/main/java/chat/delta/rpc/types/EnteredLoginParam.java index 36f516422..36e58abde 100644 --- a/src/main/java/chat/delta/rpc/types/EnteredLoginParam.java +++ b/src/main/java/chat/delta/rpc/types/EnteredLoginParam.java @@ -12,6 +12,13 @@ public class EnteredLoginParam { /** TLS options: whether to allow invalid certificates and/or invalid hostnames. Default: Automatic */ @com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET) public EnteredCertificateChecks certificateChecks; + /** + * IMAP server folder. + *

+ * Defaults to "INBOX" if not set. Should not be an empty string. + */ + @com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET) + public String imapFolder; /** Imap server port. */ @com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET) public Integer imapPort; diff --git a/src/main/java/chat/delta/rpc/types/Reactions.java b/src/main/java/chat/delta/rpc/types/Reactions.java index 94ac17e72..7ff5f948e 100644 --- a/src/main/java/chat/delta/rpc/types/Reactions.java +++ b/src/main/java/chat/delta/rpc/types/Reactions.java @@ -5,6 +5,6 @@ package chat.delta.rpc.types; public class Reactions { /** Unique reactions and their count, sorted in descending order. */ public java.util.List reactions; - /** Map from a contact to it's reaction to message. */ + /** Map from a contact to it's reaction to message. There is only a single reaction per contact, but this contains a list of reactions for historical reasons. */ public java.util.Map> reactionsByContact; } \ No newline at end of file diff --git a/src/main/java/chat/delta/rpc/types/Viewtype.java b/src/main/java/chat/delta/rpc/types/Viewtype.java index b4c5adc16..2ae248028 100644 --- a/src/main/java/chat/delta/rpc/types/Viewtype.java +++ b/src/main/java/chat/delta/rpc/types/Viewtype.java @@ -14,7 +14,7 @@ public enum Viewtype { Gif, /** - * Message containing a sticker, similar to image. NB: When sending, the message viewtype may be changed to `Image` by some heuristics like checking for transparent pixels. Use `Message::force_sticker()` to disable them. + * Message containing a sticker, similar to image. *

* If possible, the ui should display the image without borders in a transparent way. A click on a sticker will offer to install the sticker set in some future. */ diff --git a/src/main/java/chat/delta/rpc/types/WebxdcMessageInfo.java b/src/main/java/chat/delta/rpc/types/WebxdcMessageInfo.java index 8cfc09468..3efcda8f6 100644 --- a/src/main/java/chat/delta/rpc/types/WebxdcMessageInfo.java +++ b/src/main/java/chat/delta/rpc/types/WebxdcMessageInfo.java @@ -15,6 +15,10 @@ public class WebxdcMessageInfo { public String icon; /** True if full internet access should be granted to the app. */ public Boolean internetAccess; + /** Define if the local user is the one who initially shared the webxdc application in the chat. */ + public Boolean isAppSender; + /** Define if the app runs in a broadcasting context. */ + public Boolean isBroadcast; /** * The name of the app. *