Home > borogove > Chat

Chat class

Signature:

export class Chat 

Constructors

Constructor Modifiers Description
(constructor)(client, stream, persistence, chatId, uiState, isBlocked, extensions, readUpToId, readUpToBy, omemoContactDeviceIDs) protected Constructs a new instance of the Chat class

Properties

Property Modifiers Type Description
chatId readonly string ID of this Chat
isBlocked readonly boolean Is this chat blocked?
lastMessage readonly borogove.ChatMessage | null The most recent message in this chat
uiState readonly enums.UiState Current state of this chat

Methods

Method Modifiers Description
acceptCall() Accept any incoming calls in this Chat
addMedia(streams)
addReaction(m, reaction) Add new reaction to a message in this Chat
block(reportSpam, onServer) Block this chat so it will not re-open
bookmark() Save this Chat on the server
callStatus() The current status of a call in this chat
canAudioCall() Can audio calls be started in this Chat?
canVideoCall() Can video calls be started in this Chat?
close() Archive this chat
correctMessage(localId, message) Correct an already-send message by replacing it with a new one
dtmf() A DTMFSender for a call in this chat, or NULL
encryptionMode() Get encryption mode for this chat
getDisplayName() The display name of this Chat
getMessagesAfter(afterId, afterTime) Fetch a page of messages after some point
getMessagesAround(aroundId, aroundTime) Fetch a page of messages around (before, including, and after) some point
getMessagesBefore(beforeId, beforeTime) Fetch a page of messages before some point
getParticipantDetails(participantId) Get the details for one participant in this Chat
getParticipants() Get the list of IDs of participants in this Chat
getPhoto() Get the URI image to represent this Chat, or null
getPlaceholder() Get the URI to a placeholder image to represent this Chat
hangup() Hangup or reject any calls in this chat
isTrusted() Is this a chat with an entity we trust to see our online status?
lastMessageId() An ID of the most recent message in this chat
markReadUpTo(message) Signals that all messages up to and including this one have probably been displayed to the user
notificationsFiltered() Should notifications be filtered?
notifyMention() Should a mention produce a notification?
notifyReply() Should a reply produce a notification?
preview() A preview of the chat, such as the most recent message body
readUpTo() An ID of the last message displayed to the user
removeReaction(m, reaction) Remove an already-sent reaction from a message
sendMessage(message) Send a ChatMessage to this Chat
setActive(active, threadId) Call this whenever the user makes a chat or thread "active" in your UX If you call this with true you MUST later call it will false
setDisplayName(displayName) Set the display name to use for this chat
setNotifications(filtered, mention, reply) Update notification preferences
setTrusted(trusted) Set if this chat is to be trusted with our presence, etc
startCall(audio, video) Start a new call in this Chat
syncing()
togglePinned() Pin or unpin this chat
typing(threadId, content) Call this whenever the user is typing, can call on every keystroke
unblock(onServer) Unblock this chat so it will open again
unreadCount() The number of message that have not yet been displayed to the user
videoTracks() All video tracks in all active calls in this chat