deltachat

package
v1.134.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2024 License: MPL-2.0 Imports: 12 Imported by: 7

Documentation

Index

Constants

View Source
const (
	//Special contact ids
	ContactSelf        ContactId = 1
	ContactInfo        ContactId = 2
	ContactDevice      ContactId = 5
	ContactLastSpecial ContactId = 9

	// Chatlist Flags
	ChatListFlagArchivedOnly   ChatListFlag = 0x01
	ChatListFlagNoSpecials     ChatListFlag = 0x02
	ChatListFlagAddAlldoneHint ChatListFlag = 0x04
	ChatListFlagForForwarding  ChatListFlag = 0x08

	// Contact Flags
	ContactFlagVerifiedOnly ContactFlag = 0x01
	ContactFlagAddSelf      ContactFlag = 0x02

	//Chat types
	ChatUndefined   ChatType = 0
	ChatSingle      ChatType = 100
	ChatGroup       ChatType = 120
	ChatMailinglist ChatType = 140
	ChatBroadcast   ChatType = 160

	// Chat visibility types
	ChatVisibilityNormal   ChatVisibility = "Normal"
	ChatVisibilityArchived ChatVisibility = "Archived"
	ChatVisibilityPinned   ChatVisibility = "Pinned"

	//Message download states
	DownloadDone       DownloadState = "Done"
	DownloadAvailable  DownloadState = "Available"
	DownloadFailure    DownloadState = "Failure"
	DownloadInProgress DownloadState = "InProgress"

	// Message State
	MsgStateUndefined    MsgState = 0  // Message just created.
	MsgStateInFresh      MsgState = 10 // Incoming fresh message.
	MsgStateInNoticed    MsgState = 13 // Incoming noticed message.
	MsgStateInSeen       MsgState = 16 // Incoming seen message.
	MsgStateOutPreparing MsgState = 18 // Outgoing message being prepared.
	MsgStateOutDraft     MsgState = 19 // Outgoing message drafted.
	MsgStateOutPending   MsgState = 20 // Outgoing message waiting to be sent.
	MsgStateOutFailed    MsgState = 24 // Outgoing message failed sending.
	MsgStateOutDelivered MsgState = 26 // Outgoing message sent.
	MsgStateOutMdnRcvd   MsgState = 28 // Outgoing message sent and seen by recipients(s).

	//Message view types
	MsgUnknown             MsgType = "Unknown"
	MsgText                MsgType = "Text"
	MsgImage               MsgType = "Image"
	MsgGif                 MsgType = "Gif"
	MsgSticker             MsgType = "Sticker"
	MsgAudio               MsgType = "Audio"
	MsgVoice               MsgType = "Voice"
	MsgVideo               MsgType = "Video"
	MsgFile                MsgType = "File"
	MsgVideochatInvitation MsgType = "VideochatInvitation"
	MsgWebxdc              MsgType = "Webxdc"

	//System message types
	SysmsgUnknown                  SysmsgType = "Unknown"
	SysmsgGroupNameChanged         SysmsgType = "GroupNameChanged"
	SysmsgGroupImageChanged        SysmsgType = "GroupImageChanged"
	SysmsgMemberAddedToGroup       SysmsgType = "MemberAddedToGroup"
	SysmsgMemberRemovedFromGroup   SysmsgType = "MemberRemovedFromGroup"
	SysmsgAutocryptSetupMessage    SysmsgType = "AutocryptSetupMessage"
	SysmsgSecurejoinMessage        SysmsgType = "SecurejoinMessage"
	SysmsgLocationStreamingEnabled SysmsgType = "LocationStreamingEnabled"
	SysmsgLocationOnly             SysmsgType = "LocationOnly"
	SysmsgChatProtectionEnabled    SysmsgType = "ChatProtectionEnabled"
	SysmsgChatProtectionDisabled   SysmsgType = "ChatProtectionDisabled"
	SysmsgWebxdcStatusUpdate       SysmsgType = "WebxdcStatusUpdate"
	SysmsgEphemeralTimerChanged    SysmsgType = "EphemeralTimerChanged"
	SysmsgMultiDeviceSync          SysmsgType = "MultiDeviceSync"
	SysmsgWebxdcInfoMessage        SysmsgType = "WebxdcInfoMessage"
)

Variables

This section is empty.

Functions

func ParseMemberAdded added in v1.127.0

func ParseMemberAdded(rpc Rpc, accountId AccountId, msg *MsgSnapshot) (actor ContactId, target ContactId, err error)

Extract metadata from system message with type SysmsgTypeMemberAddedToGroup.

func ParseMemberRemoved added in v1.127.0

func ParseMemberRemoved(rpc Rpc, accountId AccountId, msg *MsgSnapshot) (actor ContactId, target ContactId, err error)

Extract metadata from system message with type SysmsgTypeMemberRemovedFromGroup.

Types

type AcFactory added in v0.15.0

type AcFactory struct {
	// DefaultCfg is the default settings to apply to new created accounts
	DefaultCfg map[string]option.Option[string]
	Debug      bool
	// contains filtered or unexported fields
}
func TestMain(m *testing.M) {
	acfactory = &deltachat.AcFactory{}
	acfactory.TearUp()
	defer acfactory.TearDown()
	m.Run()
}

func (*AcFactory) CreateChat added in v0.15.0

func (self *AcFactory) CreateChat(rpc1 *Rpc, accId1 AccountId, rpc2 *Rpc, accId2 AccountId) ChatId

Create a 1:1 chat with accId2 in the chatlist of accId1.

func (*AcFactory) IntroduceEachOther added in v0.15.0

func (self *AcFactory) IntroduceEachOther(rpc1 *Rpc, accId1 AccountId, rpc2 *Rpc, accId2 AccountId)

Introduce two accounts to each other creating a 1:1 chat between them and exchanging messages.

func (*AcFactory) MkdirTemp added in v0.17.0

func (self *AcFactory) MkdirTemp() string

MkdirTemp creates a new temporary directory. The directory is automatically removed on TearDown().

func (*AcFactory) NextMsg added in v0.15.0

func (self *AcFactory) NextMsg(rpc *Rpc, accId AccountId) *MsgSnapshot

Wait for the next incoming message in the given account.

func (*AcFactory) TearDown added in v0.15.0

func (self *AcFactory) TearDown()

Do cleanup, removing temporary directories and files created by the configured test accounts. Usually TearDown() is called with defer immediately after the creation of the AcFactory instance.

func (*AcFactory) TearUp added in v0.15.0

func (self *AcFactory) TearUp()

Prepare the AcFactory.

If the test mail server has not standard configuration, you should set the custom configuration here.

func (*AcFactory) TestImage added in v0.15.0

func (self *AcFactory) TestImage() string

Get a path to an image file that can be used for testing.

func (*AcFactory) TestWebxdc added in v0.15.0

func (self *AcFactory) TestWebxdc() string

Get a path to a Webxdc file that can be used for testing.

func (*AcFactory) WaitForEvent added in v0.15.0

func (self *AcFactory) WaitForEvent(rpc *Rpc, accId AccountId, event Event) Event

Wait for an event of the same type as the given event.

func (*AcFactory) WaitForEventInChat added in v0.15.0

func (self *AcFactory) WaitForEventInChat(rpc *Rpc, accId AccountId, chatId ChatId, event Event) Event

Wait for an event of the same type as the given event, the event must belong to the chat with the given ChatId.

func (*AcFactory) WithOnlineAccount added in v1.127.0

func (self *AcFactory) WithOnlineAccount(callback func(*Rpc, AccountId))

Get a new account configured and with I/O already started.

func (*AcFactory) WithOnlineBot added in v1.127.0

func (self *AcFactory) WithOnlineBot(callback func(*Bot, AccountId))

Get a new bot configured and with its account I/O already started. The bot is not running yet.

func (*AcFactory) WithRpc added in v1.127.0

func (self *AcFactory) WithRpc(callback func(*Rpc))

Call the given function passing a new Rpc as parameter.

func (*AcFactory) WithRunningBot added in v1.127.0

func (self *AcFactory) WithRunningBot(callback func(*Bot, AccountId))

Get a new bot configured and already listening to new events/messages. It is ensured that Bot.IsRunning() is true for the returned bot.

func (*AcFactory) WithUnconfiguredAccount added in v1.127.0

func (self *AcFactory) WithUnconfiguredAccount(callback func(*Rpc, AccountId))

Get a new Account that is not yet configured, but it is ready to be configured.

func (*AcFactory) WithUnconfiguredBot added in v1.127.0

func (self *AcFactory) WithUnconfiguredBot(callback func(*Bot, AccountId))

Get a new bot not yet configured, but its account is ready to be configured.

type Account

type Account struct {
	// Configured
	Id           AccountId
	DisplayName  option.Option[string]
	Addr         option.Option[string]
	ProfileImage option.Option[string]
	Color        string
}

type AccountId added in v0.12.0

type AccountId uint64

func GetAccount added in v1.127.0

func GetAccount(rpc *Rpc) AccountId

Get the first existing account or create a new one if there is no existing accounts. Useful for single-account bots/clients.

type BasicChatSnapshot

type BasicChatSnapshot struct {
	Id                 ChatId
	Name               string
	IsProtected        bool
	ProfileImage       string
	Archived           bool
	ChatType           ChatType
	IsUnpromoted       bool
	IsSelfTalk         bool
	Color              string
	IsContactRequest   bool
	IsProtectionBroken bool
	IsDeviceChat       bool
	IsMuted            bool
}

Cheaper version of FullChatSnapshot.

type Bot

type Bot struct {
	Rpc *Rpc
	// contains filtered or unexported fields
}

Delta Chat bot that listen to account events, multiple accounts supported.

func NewBot

func NewBot(rpc *Rpc) *Bot

Create a new Bot that will process events for all created accounts.

func (*Bot) Configure

func (self *Bot) Configure(accId AccountId, addr string, password string) error

Configure one of the bot's accounts.

func (*Bot) GetUiConfig added in v1.127.0

func (self *Bot) GetUiConfig(accId AccountId, key string) (option.Option[string], error)

Get custom UI-specific configuration value set with SetUiConfig().

func (*Bot) IsRunning added in v0.14.0

func (self *Bot) IsRunning() bool

Return true if bot is running (Bot.Run() is running) or false otherwise.

func (*Bot) On

func (self *Bot) On(event Event, handler EventHandler)

Set an EventHandler for the given event type. Calling On() several times with the same event type will override the previously set EventHandler.

func (*Bot) OnNewMsg

func (self *Bot) OnNewMsg(handler NewMsgHandler)

Set the NewMsgHandler for this bot.

func (*Bot) OnUnhandledEvent added in v1.127.0

func (self *Bot) OnUnhandledEvent(handler EventHandler)

Set an EventHandler to handle events whithout an EventHandler set via On(). Calling OnUnhandledEvent() several times will override the previously set EventHandler.

func (*Bot) RemoveEventHandler added in v0.12.0

func (self *Bot) RemoveEventHandler(event Event)

Remove EventHandler for the given event type.

func (*Bot) Run

func (self *Bot) Run() error

Process events until Stop() is called. If the bot is already running, BotRunningErr is returned.

func (*Bot) SetUiConfig added in v1.127.0

func (self *Bot) SetUiConfig(accId AccountId, key string, value option.Option[string]) error

Set UI-specific configuration value in the given account. This is useful for custom 3rd party settings set by bot programs.

func (*Bot) Stop added in v0.2.0

func (self *Bot) Stop()

Stop processing events.

type BotRunningErr added in v0.14.0

type BotRunningErr struct{}

BotRunningErr is returned by Bot.Run() if the Bot is already running

func (*BotRunningErr) Error added in v0.14.0

func (self *BotRunningErr) Error() string

type ChatId added in v0.12.0

type ChatId uint64

type ChatListFlag added in v0.13.0

type ChatListFlag uint

type ChatListItem

type ChatListItem struct {
	Id                  ChatId
	Name                string
	AvatarPath          string
	Color               string
	LastUpdated         Timestamp
	SummaryText1        string
	SummaryText2        string
	SummaryStatus       uint32
	IsProtected         bool
	IsGroup             bool
	FreshMessageCounter uint
	IsSelfTalk          bool
	IsDeviceTalk        bool
	IsSendingLocation   bool
	IsSelfInGroup       bool
	IsArchived          bool
	IsPinned            bool
	IsMuted             bool
	IsContactRequest    bool
	IsBroadcast         bool
	DmChatContact       ContactId
	WasSeenRecently     bool

	// Error
	// Id uint64
	Error string
}

Chat list item snapshot

type ChatType added in v0.12.0

type ChatType uint

Values in const.go

type ChatVisibility added in v0.13.0

type ChatVisibility string

type ContactFlag added in v0.13.0

type ContactFlag uint

type ContactId added in v0.12.0

type ContactId uint64

type ContactSnapshot

type ContactSnapshot struct {
	Address           string
	Color             string
	AuthName          string
	Status            string
	DisplayName       string
	Id                ContactId
	Name              string
	ProfileImage      string
	NameAndAddr       string
	IsBlocked         bool
	IsVerified        bool
	IsProfileVerified bool
	VerifierId        ContactId
	LastSeen          Timestamp
	WasSeenRecently   bool
	IsBot             bool
}

Delta Chat Contact snapshot.

type DownloadState added in v0.13.0

type DownloadState string

type Event

type Event interface {
	// contains filtered or unexported methods
}

Delta Chat core Event

type EventAccountsBackgroundFetchDone added in v1.134.0

type EventAccountsBackgroundFetchDone struct{}

Tells that the Background fetch was completed (or timed out). This event acts as a marker, when you reach this event you can be sure that all events emitted during the background fetch were processed.

This event is only emitted by the account manager

type EventChatEphemeralTimerModified added in v0.13.0

type EventChatEphemeralTimerModified struct {
	ChatId ChatId
	Timer  int
}

Chat ephemeral timer changed.

type EventChatModified added in v0.13.0

type EventChatModified struct {
	ChatId ChatId
}

Chat changed. The name or the image of a chat group was changed or members were added or removed. Or the verify state of a chat has changed. See Chat.SetName(), Chat.SetImage(), Chat.AddContact() and Chat.RemoveContact().

This event does not include ephemeral timer modification, which is a separate event.

type EventConfigSynced added in v1.134.0

type EventConfigSynced struct {
	Key string
}

A multi-device synced config value changed. Maybe the app needs to refresh smth. For uniformity this is emitted on the source device too. The value isn't here, otherwise it would be logged which might not be good for privacy.

type EventConfigureProgress added in v0.13.0

type EventConfigureProgress struct {
	// Progress.
	// 0=error, 1-999=progress in permille, 1000=success and done
	Progress uint

	// Optional progress comment or error, something to display to the user.
	Comment string
}

Inform about the configuration progress started by Account.Configure().

type EventConnectivityChanged added in v0.13.0

type EventConnectivityChanged struct{}

The connectivity to the server changed. This means that you should refresh the connectivity view and possibly the connectivtiy HTML; see Account.Connectivity() and Account.ConnectivityHtml() for details.

type EventContactsChanged added in v0.13.0

type EventContactsChanged struct {
	// The id of contact that has changed, or zero if several contacts have changed.
	ContactId ContactId
}

Contact(s) created, renamed, blocked or deleted.

type EventDeletedBlobFile added in v0.13.0

type EventDeletedBlobFile struct {
	File string
}

Emitted when an file in the $BLOBDIR was deleted

type EventError added in v0.13.0

type EventError struct {
	Msg string
}

The library-user should report an error to the end-user.

As most things are asynchronous, things may go wrong at any time and the user should not be disturbed by a dialog or so. Instead, use a bubble or so.

However, for ongoing processes (eg. Account.Configure()) or for functions that are expected to fail (eg. Message.AutocryptContinueKeyTransfer()) it might be better to delay showing these events until the function has really failed (returned false). It should be sufficient to report only the *last* error in a messasge box then.

type EventErrorSelfNotInGroup added in v0.13.0

type EventErrorSelfNotInGroup struct {
	Msg string
}

An action cannot be performed because the user is not in the group. Reported eg. after a call to Chat.SetName(), Chat.SetImage(), Chat.AddContact(), Chat.RemoveContact(), and messages sending functions.

type EventHandler

type EventHandler func(bot *Bot, accId AccountId, event Event)

type EventImapConnected added in v0.13.0

type EventImapConnected struct {
	Msg string
}

Emitted when IMAP connection is established and login was successful.

type EventImapInboxIdle added in v0.13.0

type EventImapInboxIdle struct{}

Emitted before going into IDLE on the Inbox folder.

type EventImapMessageDeleted added in v0.13.0

type EventImapMessageDeleted struct {
	Msg string
}

Emitted when an IMAP message has been marked as deleted

type EventImapMessageMoved added in v0.13.0

type EventImapMessageMoved struct {
	Msg string
}

Emitted when an IMAP message has been moved

type EventImexFileWritten added in v0.13.0

type EventImexFileWritten struct {
	Path string
}

A file has been exported. This event may be sent after a call to Account.ExportBackup() or Account.ExportSelfKeys().

A typical purpose for a handler of this event may be to make the file public to some system services.

type EventImexProgress added in v0.13.0

type EventImexProgress struct {
	// Progress.
	// (usize) 0=error, 1-999=progress in permille, 1000=success and done
	Progress uint
}

Inform about the import/export progress.

type EventIncomingMsg added in v0.13.0

type EventIncomingMsg struct {
	ChatId ChatId
	MsgId  MsgId
}

There is a fresh message. Typically, the user will show an notification when receiving this message.

There is no extra EventMsgsChanged event send together with this event.

type EventIncomingMsgBunch added in v0.13.0

type EventIncomingMsgBunch struct {
	MsgIds []MsgId
}

Downloading a bunch of messages just finished. This is an experimental event to allow the UI to only show one notification per message bunch, instead of cluttering the user with many notifications.

msg_ids contains the message ids.

type EventInfo added in v0.13.0

type EventInfo struct {
	Msg string
}

The library-user may write an informational string to the log.

This event should *not* be reported to the end-user using a popup or something like that.

type EventLocationChanged added in v0.13.0

type EventLocationChanged struct {
	// The id of contact for which the location has changed, or zero if the locations of several contacts have been changed.
	ContactId ContactId
}

Location of one or more contact has changed.

type EventMsgDeleted added in v1.127.0

type EventMsgDeleted struct {
	ChatId ChatId
	MsgId  MsgId
}

A single message is deleted.

type EventMsgDelivered added in v0.13.0

type EventMsgDelivered struct {
	ChatId ChatId
	MsgId  MsgId
}

A single message is sent successfully. State changed from MsgStateOutPending to MsgStateOutDelivered.

type EventMsgFailed added in v0.13.0

type EventMsgFailed struct {
	ChatId ChatId
	MsgId  MsgId
}

A single message could not be sent. State changed from MsgStateOutPending or MsgStateOutDelivered to MsgStateOutFailed.

type EventMsgRead added in v0.13.0

type EventMsgRead struct {
	ChatId ChatId
	MsgId  MsgId
}

A single message is read by the receiver. State changed from MsgStateOutDelivered to MsgStateOutMdnRcvd.

type EventMsgsChanged added in v0.13.0

type EventMsgsChanged struct {
	ChatId ChatId
	MsgId  MsgId
}

Messages or chats changed. One or more messages or chats changed for various reasons in the database: - Messages sent, received or removed - Chats created, deleted or archived - A draft has been set

ChatId is set if only a single chat is affected by the changes, otherwise 0. MsgId is set if only a single message is affected by the changes, otherwise 0.

type EventMsgsNoticed added in v0.13.0

type EventMsgsNoticed struct {
	ChatId ChatId
}

Messages were seen or noticed. chat id is always set.

type EventNewBlobFile added in v0.13.0

type EventNewBlobFile struct {
	File string
}

Emitted when an new file in the $BLOBDIR was created

type EventReactionsChanged added in v0.13.0

type EventReactionsChanged struct {
	ChatId    ChatId
	MsgId     MsgId
	ContactId ContactId
}

Reactions for the message changed.

type EventSecurejoinInviterProgress added in v0.13.0

type EventSecurejoinInviterProgress struct {
	// ID of the contact that wants to join.
	ContactId ContactId

	// Progress as:
	// 300=vg-/vc-request received, typically shown as "bob@addr joins".
	// 600=vg-/vc-request-with-auth received, vg-member-added/vc-contact-confirm sent, typically shown as "bob@addr verified".
	// 800=vg-member-added-received received, shown as "bob@addr securely joined GROUP", only sent for the verified-group-protocol.
	// 1000=Protocol finished for this contact.
	Progress uint
}

Progress information of a secure-join handshake from the view of the inviter (Alice, the person who shows the QR code).

These events are typically sent after a joiner has scanned the QR code generated by Account.QrCode() or Chat.QrCode().

type EventSecurejoinJoinerProgress added in v0.13.0

type EventSecurejoinJoinerProgress struct {
	// ID of the inviting contact.
	ContactId ContactId

	// Progress as:
	// 400=vg-/vc-request-with-auth sent, typically shown as "alice@addr verified, introducing myself."
	// (Bob has verified alice and waits until Alice does the same for him)
	Progress uint
}

Progress information of a secure-join handshake from the view of the joiner (Bob, the person who scans the QR code). The events are typically sent while Account.SecureJoin(), which may take some time, is executed.

type EventSelfavatarChanged added in v0.13.0

type EventSelfavatarChanged struct{}

The user's avatar changed.

type EventSmtpConnected added in v0.13.0

type EventSmtpConnected struct {
	Msg string
}

Emitted when SMTP connection is established and login was successful.

type EventSmtpMessageSent added in v0.13.0

type EventSmtpMessageSent struct {
	Msg string
}

Emitted when a message was successfully sent to the SMTP server.

type EventWarning added in v0.13.0

type EventWarning struct {
	Msg string
}

The library-user should write a warning string to the log.

This event should *not* be reported to the end-user using a popup or something like that.

type EventWebxdcInstanceDeleted added in v0.13.0

type EventWebxdcInstanceDeleted struct {
	MsgId MsgId
}

Inform that a message containing a webxdc instance has been deleted

type EventWebxdcStatusUpdate added in v0.13.0

type EventWebxdcStatusUpdate struct {
	MsgId              MsgId
	StatusUpdateSerial uint
}

Webxdc status update received.

type FullChatSnapshot

type FullChatSnapshot struct {
	Id                  ChatId
	Name                string
	IsProtected         bool
	ProfileImage        string
	Archived            bool
	ChatType            ChatType
	IsUnpromoted        bool
	IsSelfTalk          bool
	Contacts            []*ContactSnapshot
	ContactIds          []ContactId
	Color               string
	FreshMessageCounter uint
	IsContactRequest    bool
	IsProtectionBroken  bool
	IsDeviceChat        bool
	SelfInGroup         bool
	IsMuted             bool
	EphemeralTimer      uint
	CanSend             bool
	WasSeenRecently     bool
	MailingListAddress  string
}

Full chat snapshot.

type MsgData

type MsgData struct {
	Text               string      `json:"text,omitempty"`
	Html               string      `json:"html,omitempty"`
	ViewType           MsgType     `json:"viewtype,omitempty"`
	File               string      `json:"file,omitempty"`
	Location           *[2]float64 `json:"location,omitempty"`
	OverrideSenderName string      `json:"overrideSenderName,omitempty"`
	QuotedMessageId    MsgId       `json:"quotedMessageId,omitempty"`
}

Message data provided to Chat.SendMsg()

type MsgId added in v0.12.0

type MsgId uint64

type MsgQuote

type MsgQuote struct {
	Text               string
	MessageId          MsgId
	AuthorDisplayName  string
	AuthorDisplayColor string
	OverrideSenderName string
	Image              string
	IsForwarded        bool
	ViewType           MsgType
}

Message quote. Only the Text property is warrantied to be present, all other fields are optional.

type MsgSearchResult added in v0.11.0

type MsgSearchResult struct {
	Id                 MsgId
	AuthorProfileImage string
	AuthorName         string
	AuthorColor        string
	ChatName           string
	Message            string
	Timestamp          Timestamp
}

Message search result.

type MsgSnapshot

type MsgSnapshot struct {
	Id                    MsgId
	ChatId                ChatId
	FromId                ContactId
	Quote                 *MsgQuote
	ParentId              MsgId
	Text                  string
	HasLocation           bool
	HasHtml               bool
	ViewType              MsgType
	State                 MsgState
	Error                 string
	Timestamp             Timestamp
	SortTimestamp         Timestamp
	ReceivedTimestamp     Timestamp
	HasDeviatingTimestamp bool
	Subject               string
	ShowPadlock           bool
	IsSetupmessage        bool
	IsInfo                bool
	IsForwarded           bool
	IsBot                 bool
	SystemMessageType     SysmsgType
	Duration              int
	DimensionsHeight      int
	DimensionsWidth       int
	VideochatType         int
	VideochatUrl          string
	OverrideSenderName    string
	Sender                *ContactSnapshot
	SetupCodeBegin        string
	File                  string
	FileMime              string
	FileBytes             uint64
	FileName              string
	WebxdcInfo            *WebxdcMsgInfo
	DownloadState         DownloadState
	Reactions             *Reactions
}

Message snapshot.

type MsgState added in v0.14.0

type MsgState uint

type MsgType added in v0.13.0

type MsgType string

type NewMsgHandler

type NewMsgHandler func(bot *Bot, accId AccountId, msgId MsgId)

type Reactions

type Reactions struct {
	ReactionsByContact map[ContactId][]string
	Reactions          map[string]int // Unique reactions and their count
}

type Rpc

type Rpc struct {
	// Context to be used on calls to Transport.CallResult() and Transport.Call()
	Context   context.Context
	Transport transport.RpcTransport
}

Delta Chat RPC client. This is the root of the API.

func (*Rpc) AcceptChat added in v1.127.0

func (self *Rpc) AcceptChat(accountId AccountId, chatId ChatId) error

func (*Rpc) AddAccount added in v1.127.0

func (self *Rpc) AddAccount() (AccountId, error)

Create a new account.

func (*Rpc) AddContactToChat added in v1.127.0

func (self *Rpc) AddContactToChat(accountId AccountId, chatId ChatId, contactId ContactId) error

Add a member to a group.

func (*Rpc) AddDeviceMessage added in v1.127.0

func (self *Rpc) AddDeviceMessage(accountId AccountId, label string, msg option.Option[MsgData]) (MsgId, error)

Add a message to the device-chat. Device-messages usually contain update information and some hints that are added during the program runs, multi-device etc. The device-message may be defined by a label; if a message with the same label was added or skipped before, the message is not added again, even if the message was deleted in between. If needed, the device-chat is created before.

Sends the `MsgsChanged` event on success.

Setting msg to None will prevent the device message with this label from being added in the future.

func (*Rpc) BatchGetConfig added in v1.127.0

func (self *Rpc) BatchGetConfig(accountId AccountId, keys []string) (map[string]option.Option[string], error)

Get a batch of account configuration values.

func (*Rpc) BatchSetConfig added in v1.127.0

func (self *Rpc) BatchSetConfig(accountId AccountId, config map[string]option.Option[string]) error

Tweak several account configuration values in a batch.

func (*Rpc) BlockChat added in v1.127.0

func (self *Rpc) BlockChat(accountId AccountId, chatId ChatId) error

func (*Rpc) BlockContact added in v1.127.0

func (self *Rpc) BlockContact(accountId AccountId, contactId ContactId) error

func (*Rpc) CanSend added in v1.127.0

func (self *Rpc) CanSend(accountId AccountId, chatId ChatId) (bool, error)

Checks if messages can be sent to a given chat.

func (*Rpc) ChangeContactName added in v1.127.0

func (self *Rpc) ChangeContactName(accountId AccountId, contactId ContactId, name string) error

func (*Rpc) CheckEmailValidity added in v1.127.0

func (self *Rpc) CheckEmailValidity(email string) (bool, error)

Check if an email address is valid.

func (*Rpc) Configure added in v1.127.0

func (self *Rpc) Configure(accountId AccountId) error

Configures an account with the currently set parameters. Setup the credential config before calling this.

func (*Rpc) ContinueAutocryptKeyTransfer added in v1.127.0

func (self *Rpc) ContinueAutocryptKeyTransfer(accountId AccountId, msgId MsgId, setupCode string) error

Continue the AutoCrypt key transfer process.

func (*Rpc) CreateBroadcastList added in v1.127.0

func (self *Rpc) CreateBroadcastList(accountId AccountId) (ChatId, error)

Create a new broadcast list.

func (*Rpc) CreateChatByContactId added in v1.127.0

func (self *Rpc) CreateChatByContactId(accountId AccountId, contactId ContactId) (ChatId, error)

Returns contact id of the created or existing DM chat with that contact

func (*Rpc) CreateContact added in v1.127.0

func (self *Rpc) CreateContact(accountId AccountId, email string, name string) (ContactId, error)

Add a single contact as a result of an explicit user action.

Returns contact id of the created or existing contact

func (*Rpc) CreateGroupChat added in v1.127.0

func (self *Rpc) CreateGroupChat(accountId AccountId, name string, protected bool) (ChatId, error)

Create a new group chat. After creation, the group has only self-contact as member and is in unpromoted state.

func (*Rpc) DeleteChat added in v1.127.0

func (self *Rpc) DeleteChat(accountId AccountId, chatId ChatId) error

Delete a chat.

Messages are deleted from the device and the chat database entry is deleted. After that, the event #DC_EVENT_MSGS_CHANGED is posted.

Things that are _not done_ implicitly:

  • Messages are **not deleted from the server**.
  • The chat or the contact is **not blocked**, so new messages from the user/the group may appear as a contact request and the user may create the chat again.
  • **Groups are not left** - this would be unexpected as (1) deleting a normal chat also does not prevent new mails from arriving, (2) leaving a group requires sending a message to all group members - especially for groups not used for a longer time, this is really unexpected when deletion results in contacting all members again, (3) only leaving groups is also a valid usecase.

To leave a chat explicitly, use leave_group()

func (*Rpc) DeleteContact added in v1.127.0

func (self *Rpc) DeleteContact(accountId AccountId, contactId ContactId) error

func (*Rpc) DeleteMessages added in v1.127.0

func (self *Rpc) DeleteMessages(accountId AccountId, msgIds []MsgId) error

Delete messages. The messages are deleted on the current device and on the IMAP server.

func (*Rpc) DownloadFullMessage added in v1.127.0

func (self *Rpc) DownloadFullMessage(accountId AccountId, msgId MsgId) error

Asks the core to start downloading a message fully. This function is typically called when the user hits the "Download" button that is shown by the UI in case `download_state` is `'Available'` or `'Failure'`

On success, the @ref DC_MSG "view type of the message" may change or the message may be replaced completely by one or more messages with other message IDs. That may happen e.g. in cases where the message was encrypted and the type could not be determined without fully downloading. Downloaded content can be accessed as usual after download.

To reflect these changes a @ref DC_EVENT_MSGS_CHANGED event will be emitted.

func (*Rpc) EstimateAutoDeletionCount added in v1.127.0

func (self *Rpc) EstimateAutoDeletionCount(accountId AccountId, fromServer bool, seconds int64) (uint, error)

Estimate the number of messages that will be deleted by the SetConfig()-options `delete_device_after` or `delete_server_after`. This is typically used to show the estimated impact to the user before actually enabling deletion of old messages.

func (*Rpc) ExportBackup added in v1.127.0

func (self *Rpc) ExportBackup(accountId AccountId, destination string, passphrase option.Option[string]) error

Export account backup.

func (*Rpc) ExportSelfKeys added in v1.127.0

func (self *Rpc) ExportSelfKeys(accountId AccountId, path string) error

Export public and private keys to the specified directory. Note that the account does not have to be started.

func (*Rpc) ForwardMessages added in v1.127.0

func (self *Rpc) ForwardMessages(accountId AccountId, msgIds []MsgId, chatId ChatId) error

Forward messages to another chat.

All types of messages can be forwarded, however, they will be flagged as such (dc_msg_is_forwarded() is set).

Original sender, info-state and webxdc updates are not forwarded on purpose.

func (*Rpc) GetAccountFileSize added in v1.127.0

func (self *Rpc) GetAccountFileSize(accountId AccountId) (uint64, error)

Get the combined filesize of an account in bytes.

func (*Rpc) GetAllAccountIds added in v1.127.0

func (self *Rpc) GetAllAccountIds() ([]AccountId, error)

Return all available accounts.

func (*Rpc) GetBackup added in v1.127.0

func (self *Rpc) GetBackup(accountId AccountId, qrText string) error

Gets a backup from a remote provider.

This retrieves the backup from a remote device over the network and imports it into the current device.

Can be cancelled by stopping the ongoing process.

func (*Rpc) GetBackupQr added in v1.127.0

func (self *Rpc) GetBackupQr(accountId AccountId) (string, error)

Returns the text of the QR code for the running [`CommandApi::provide_backup`].

This QR code text can be used in [`CommandApi::get_backup`] on a second device to retrieve the backup and setup this second device.

This call will fail if there is currently no concurrent call to [`CommandApi::provide_backup`]. This call may block if the QR code is not yet ready.

func (*Rpc) GetBackupQrSvg added in v1.127.0

func (self *Rpc) GetBackupQrSvg(accountId AccountId) (string, error)

Returns the rendered QR code for the running [`CommandApi::provide_backup`].

This QR code can be used in [`CommandApi::get_backup`] on a second device to retrieve the backup and setup this second device.

This call will fail if there is currently no concurrent call to [`CommandApi::provide_backup`]. This call may block if the QR code is not yet ready.

Returns the QR code rendered as an SVG image.

func (*Rpc) GetBasicChatInfo added in v1.127.0

func (self *Rpc) GetBasicChatInfo(accountId AccountId, chatId ChatId) (*BasicChatSnapshot, error)

get basic info about a chat, use GetFullChatById() instead if you need more information

func (*Rpc) GetBlockedContacts added in v1.127.0

func (self *Rpc) GetBlockedContacts(accountId AccountId) ([]*ContactSnapshot, error)

func (*Rpc) GetChatContacts added in v1.127.0

func (self *Rpc) GetChatContacts(accountId AccountId, chatId ChatId) ([]ContactId, error)

Get the contact IDs belonging to a chat.

  • for normal chats, the function always returns exactly one contact, DC_CONTACT_ID_SELF is returned only for SELF-chats.

  • for group chats all members are returned, DC_CONTACT_ID_SELF is returned explicitly as it may happen that oneself gets removed from a still existing group

- for broadcasts, all recipients are returned, DC_CONTACT_ID_SELF is not included

  • for mailing lists, the behavior is not documented currently, we will decide on that later. for now, the UI should not show the list for mailing lists. (we do not know all members and there is not always a global mailing list address, so we could return only SELF or the known members; this is not decided yet)

func (*Rpc) GetChatEncryptionInfo added in v1.127.0

func (self *Rpc) GetChatEncryptionInfo(accountId AccountId, chatId ChatId) (string, error)

Get encryption info for this chat. Get a multi-line encryption info, containing encryption preferences of all members. Can be used to find out why messages sent to group are not encrypted.

returns Multi-line text

func (*Rpc) GetChatEphemeralTimer added in v1.127.0

func (self *Rpc) GetChatEphemeralTimer(accountId AccountId, chatId ChatId) (uint, error)

func (*Rpc) GetChatIdByContactId added in v1.134.0

func (self *Rpc) GetChatIdByContactId(accountId AccountId, contactId ContactId) (ChatId, error)

Returns the [`ChatId`] for the 1:1 chat with `contactId` if it exists.

If it does not exist, zero is returned.

func (*Rpc) GetChatMedia added in v1.127.0

func (self *Rpc) GetChatMedia(accountId AccountId, chatId ChatId, messageType MsgType, orMessageType2 option.Option[MsgType], orMessageType3 option.Option[MsgType]) ([]MsgId, error)

Returns all message IDs of the given types in a chat. Typically used to show a gallery.

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.

Setting `chat_id` to `None` (`null` in typescript) means get messages with media from any chat of the currently used account.

func (*Rpc) GetChatSecurejoinQrCodeSvg added in v1.127.0

func (self *Rpc) GetChatSecurejoinQrCodeSvg(accountId AccountId, chatId option.Option[ChatId]) (string, string, error)

Get Join-Group QR code text and SVG data.

func (*Rpc) GetChatlistEntries added in v1.127.0

func (self *Rpc) GetChatlistEntries(accountId AccountId, listFlags option.Option[uint], query option.Option[string], contactId option.Option[ContactId]) ([]ChatId, error)

func (*Rpc) GetChatlistItemsByEntries added in v1.127.0

func (self *Rpc) GetChatlistItemsByEntries(accountId AccountId, entries []ChatId) (map[ChatId]*ChatListItem, error)

func (*Rpc) GetConfig added in v1.127.0

func (self *Rpc) GetConfig(accountId AccountId, key string) (option.Option[string], error)

Get custom UI-specific configuration value set with SetUiConfig().

func (*Rpc) GetConnectivity added in v1.127.0

func (self *Rpc) GetConnectivity(accountId AccountId) (uint, error)

Get the current connectivity, i.e. whether the device is connected to the IMAP server. One of: - DC_CONNECTIVITY_NOT_CONNECTED (1000-1999): Show e.g. the string "Not connected" or a red dot - DC_CONNECTIVITY_CONNECTING (2000-2999): Show e.g. the string "Connecting…" or a yellow dot - DC_CONNECTIVITY_WORKING (3000-3999): Show e.g. the string "Getting new messages" or a spinning wheel - DC_CONNECTIVITY_CONNECTED (>=4000): Show e.g. the string "Connected" or a green dot

We don't use exact values but ranges here so that we can split up states into multiple states in the future.

Meant as a rough overview that can be shown e.g. in the title of the main screen.

If the connectivity changes, a #DC_EVENT_CONNECTIVITY_CHANGED will be emitted.

func (*Rpc) GetConnectivityHtml added in v1.127.0

func (self *Rpc) GetConnectivityHtml(accountId AccountId) (string, error)

Get an overview of the current connectivity, and possibly more statistics. Meant to give the user more insight about the current status than the basic connectivity info returned by get_connectivity(); show this e.g., if the user taps on said basic connectivity info.

If this page changes, a #DC_EVENT_CONNECTIVITY_CHANGED will be emitted.

This comes as an HTML from the core so that we can easily improve it and the improvement instantly reaches all UIs.

func (*Rpc) GetContact added in v1.127.0

func (self *Rpc) GetContact(accountId AccountId, contactId ContactId) (*ContactSnapshot, error)

Get the properties of a single contact by ID.

func (*Rpc) GetContactEncryptionInfo added in v1.127.0

func (self *Rpc) GetContactEncryptionInfo(accountId AccountId, contactId ContactId) (string, error)

Get encryption info for a contact. Get a multi-line encryption info, containing your fingerprint and the fingerprint of the contact, used e.g. to compare the fingerprints for a simple out-of-band verification.

func (*Rpc) GetContactIds added in v1.127.0

func (self *Rpc) GetContactIds(accountId AccountId, listFlags uint, query option.Option[string]) ([]ContactId, error)

func (*Rpc) GetDraft added in v1.127.0

func (self *Rpc) GetDraft(accountId AccountId, chatId ChatId) (option.Option[MsgSnapshot], error)

Get draft for a chat, if any.

func (*Rpc) GetFirstUnreadMessageOfChat added in v1.127.0

func (self *Rpc) GetFirstUnreadMessageOfChat(accountId AccountId, chatId ChatId) (option.Option[MsgId], error)

func (*Rpc) GetFreshMsgCnt added in v1.127.0

func (self *Rpc) GetFreshMsgCnt(accountId AccountId, chatId ChatId) (uint, error)

Get the number of fresh messages in a chat. Typically used to implement a badge with a number in the chatlist.

If the specified chat is muted, the UI should show the badge counter "less obtrusive", e.g. using "gray" instead of "red" color.

func (*Rpc) GetFreshMsgs added in v1.127.0

func (self *Rpc) GetFreshMsgs(accountId AccountId) ([]MsgId, error)

Returns the message IDs of all fresh messages of any chat. Typically used for implementing notification summaries or badge counters e.g. on the app icon. The list is already sorted and starts with the most recent fresh message.

Messages belonging to muted chats or to the contact requests are not returned; these messages should not be notified and also badge counters should not include these messages.

To get the number of fresh messages for a single chat, muted or not, use GetFreshMsgCnt().

func (*Rpc) GetFullChatById added in v1.127.0

func (self *Rpc) GetFullChatById(accountId AccountId, chatId ChatId) (*FullChatSnapshot, error)

func (*Rpc) GetInfo added in v1.127.0

func (self *Rpc) GetInfo(accountId AccountId) (map[string]string, error)

Get system info for an account.

func (*Rpc) GetMessage added in v1.127.0

func (self *Rpc) GetMessage(accountId AccountId, msgId MsgId) (*MsgSnapshot, error)

Return map of this account configuration parameters.

func (*Rpc) GetMessageHtml added in v1.127.0

func (self *Rpc) GetMessageHtml(accountId AccountId, msgId MsgId) (option.Option[string], error)

Get the HTML part of this message.

func (*Rpc) GetMessageIds added in v1.127.0

func (self *Rpc) GetMessageIds(accountId AccountId, chatId ChatId, infoOnly, addDaymarker bool) ([]MsgId, error)

func (*Rpc) GetMessageInfo added in v1.127.0

func (self *Rpc) GetMessageInfo(accountId AccountId, msgId MsgId) (string, error)

Get an informational text for a single message. The text is multiline and may contain e.g. the raw text of the message.

The max. text returned is typically longer (about 100000 characters) than the max. text returned by dc_msg_get_text() (about 30000 characters).

func (*Rpc) GetMessageReactions added in v1.127.0

func (self *Rpc) GetMessageReactions(accountId AccountId, msgId MsgId) (option.Option[Reactions], error)

Returns reactions to the message.

func (*Rpc) GetNextEvent added in v1.127.0

func (self *Rpc) GetNextEvent() (AccountId, Event, error)

Get the next event.

func (*Rpc) GetNextMsgs added in v1.127.0

func (self *Rpc) GetNextMsgs(accountId AccountId) ([]MsgId, error)

Gets messages to be processed by the bot and returns their IDs.

Only messages with database ID higher than last_msg_id config value are returned. After processing the messages, the bot should update last_msg_id by calling MarkseenMsgs() or manually updating the value to avoid getting already processed messages.

func (*Rpc) GetSelectedAccountId added in v1.127.0

func (self *Rpc) GetSelectedAccountId() (option.Option[AccountId], error)

Get the selected account id of the internal state.

func (*Rpc) GetSystemInfo added in v1.127.0

func (self *Rpc) GetSystemInfo() (map[string]string, error)

Get general system info.

func (*Rpc) GetWebxdcBlob added in v1.127.0

func (self *Rpc) GetWebxdcBlob(accountId AccountId, msgId MsgId, path string) (string, error)

Get blob encoded as base64 from a webxdc message

path is the path of the file within webxdc archive

func (*Rpc) GetWebxdcInfo added in v1.127.0

func (self *Rpc) GetWebxdcInfo(accountId AccountId, msgId MsgId) (*WebxdcMsgInfo, error)

Get info from this webxdc message.

func (*Rpc) GetWebxdcStatusUpdates added in v1.127.0

func (self *Rpc) GetWebxdcStatusUpdates(accountId AccountId, msgId MsgId, lastKnownSerial uint) (string, error)

func (*Rpc) ImportBackup added in v1.127.0

func (self *Rpc) ImportBackup(accountId AccountId, path string, passphrase option.Option[string]) error

Import account backup.

func (*Rpc) ImportSelfKeys added in v1.127.0

func (self *Rpc) ImportSelfKeys(accountId AccountId, path string) error

Import private keys found in the specified directory.

func (*Rpc) InitiateAutocryptKeyTransfer added in v1.127.0

func (self *Rpc) InitiateAutocryptKeyTransfer(accountId AccountId) (string, error)

Start the AutoCrypt key transfer process.

func (*Rpc) IsConfigured added in v1.127.0

func (self *Rpc) IsConfigured(accountId AccountId) (bool, error)

Checks if the account is already configured.

func (*Rpc) LeaveGroup added in v1.127.0

func (self *Rpc) LeaveGroup(accountId AccountId, chatId ChatId) error

func (*Rpc) LookupContactIdByAddr added in v1.127.0

func (self *Rpc) LookupContactIdByAddr(accountId AccountId, addr string) (option.Option[ContactId], error)

Check if an e-mail address belongs to a known and unblocked contact. To get a list of all known and unblocked contacts, use contacts_get_contacts().

To validate an e-mail address independently of the contact database use check_email_validity().

func (*Rpc) MarknoticedChat added in v1.127.0

func (self *Rpc) MarknoticedChat(accountId AccountId, chatId ChatId) error

Mark all messages in a chat as _noticed_. _Noticed_ messages are no longer _fresh_ and do not count as being unseen but are still waiting for being marked as "seen" using markseen_msgs() (IMAP/MDNs is not done for noticed messages).

Calling this function usually results in the event #DC_EVENT_MSGS_NOTICED. See also markseen_msgs().

func (*Rpc) MarkseenMsgs added in v1.127.0

func (self *Rpc) MarkseenMsgs(accountId AccountId, msgIds []MsgId) error

Mark messages as presented to the user. Typically, UIs call this function on scrolling through the message list, when the messages are presented at least for a little moment. The concrete action depends on the type of the chat and on the users settings (dc_msgs_presented() may be a better name therefore, but well. :)

  • For normal chats, the IMAP state is updated, MDN is sent (if set_config()-options `mdns_enabled` is set) and the internal state is changed to @ref DC_STATE_IN_SEEN to reflect these actions.

  • For contact requests, no IMAP or MDNs is done and the internal state is not changed therefore. See also marknoticed_chat().

Moreover, timer is started for incoming ephemeral messages. This also happens for contact requests chats.

This function updates `last_msg_id` configuration value to the maximum of the current value and IDs passed to this function. Bots which mark messages as seen can rely on this side effect to avoid updating `last_msg_id` value manually.

One #DC_EVENT_MSGS_NOTICED event is emitted per modified chat.

func (*Rpc) MaybeNetwork added in v1.127.0

func (self *Rpc) MaybeNetwork() error

Indicate that the network likely has come back. or just that the network conditions might have changed

func (*Rpc) MessageIdsToSearchResults added in v1.127.0

func (self *Rpc) MessageIdsToSearchResults(accountId AccountId, msgIds []MsgId) (map[MsgId]*MsgSearchResult, error)

func (*Rpc) MiscSendDraft added in v1.134.0

func (self *Rpc) MiscSendDraft(accountId AccountId, chatId ChatId) (MsgId, error)

send the chat's current set draft

func (*Rpc) MiscSendTextMessage added in v1.127.0

func (self *Rpc) MiscSendTextMessage(accountId AccountId, chatId ChatId, text string) (MsgId, error)

Send a text message and return the resulting Message instance.

func (*Rpc) MiscSetDraft added in v1.127.0

func (self *Rpc) MiscSetDraft(accountId AccountId, chatId ChatId, text option.Option[string], file option.Option[string], quotedMessageId option.Option[MsgId], viewType option.Option[MsgType]) error

mimics the old desktop call, will get replaced with something better in the composer rewrite, the better version should support: - changing viewtype to enable/disable compression - keeping same message id as long as attachment does not change for webxdc messages

func (*Rpc) ProvideBackup added in v1.127.0

func (self *Rpc) ProvideBackup(accountId AccountId) error

Offers a backup for remote devices to retrieve.

Can be cancelled by stopping the ongoing process. Success or failure can be tracked via the `ImexProgress` event which should either reach `1000` for success or `0` for failure.

This **stops IO** while it is running.

Returns once a remote device has retrieved the backup, or is cancelled.

func (*Rpc) RemoveAccount added in v1.127.0

func (self *Rpc) RemoveAccount(accountId AccountId) error

Remove an account.

func (*Rpc) RemoveContactFromChat added in v1.127.0

func (self *Rpc) RemoveContactFromChat(accountId AccountId, chatId ChatId, contactId ContactId) error

Remove a member from a group.

func (*Rpc) RemoveDraft added in v1.127.0

func (self *Rpc) RemoveDraft(accountId AccountId, chatId ChatId) error

func (*Rpc) ResendMessages added in v1.127.0

func (self *Rpc) ResendMessages(accountId AccountId, msgIds []MsgId) error

Resend messages and make information available for newly added chat members. Resending sends out the original message, however, recipients and webxdc-status may differ. Clients that already have the original message can still ignore the resent message as they have tracked the state by dedicated updates.

Some messages cannot be resent, eg. info-messages, drafts, already pending messages or messages that are not sent by SELF.

msgIds all message IDs that should be resend. All messages must belong to the same chat.

func (*Rpc) SearchMessages added in v1.127.0

func (self *Rpc) SearchMessages(accountId AccountId, query string, chatId option.Option[ChatId]) ([]MsgId, error)

Search messages containing the given query string. Searching can be done globally (chat_id=None) or in a specified chat only (chat_id set).

Global search results are typically displayed using dc_msg_get_summary(), chat search results may just highlight the corresponding messages and present a prev/next button.

For the global search, the result is limited to 1000 messages, this allows an incremental search done fast. So, when getting exactly 1000 messages, the result actually may be truncated; the UIs may display sth. like "1000+ messages found" in this case. The chat search (if chat_id is set) is not limited.

func (*Rpc) SecureJoin added in v1.127.0

func (self *Rpc) SecureJoin(accountId AccountId, qrdata string) (ChatId, error)

Continue a Setup-Contact or Verified-Group-Invite protocol started on another device.

func (*Rpc) SelectAccount added in v1.127.0

func (self *Rpc) SelectAccount(accountId AccountId) error

Select account id for internally selected state.

func (*Rpc) SendMsg added in v1.127.0

func (self *Rpc) SendMsg(accountId AccountId, chatId ChatId, data MsgData) (MsgId, error)

Send a message and return the resulting Message instance.

func (*Rpc) SendReaction added in v1.127.0

func (self *Rpc) SendReaction(accountId AccountId, msgId MsgId, reaction ...string) (MsgId, error)

Send 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.

func (*Rpc) SendSticker added in v1.127.0

func (self *Rpc) SendSticker(accountId AccountId, chatId ChatId, path string) (MsgId, error)

func (*Rpc) SendVideoChatInvitation added in v1.127.0

func (self *Rpc) SendVideoChatInvitation(accountId AccountId, chatId ChatId) (MsgId, error)

func (*Rpc) SendWebxdcStatusUpdate added in v1.127.0

func (self *Rpc) SendWebxdcStatusUpdate(accountId AccountId, msgId MsgId, update string, description string) error

func (*Rpc) SetChatEphemeralTimer added in v1.127.0

func (self *Rpc) SetChatEphemeralTimer(accountId AccountId, chatId ChatId, timer uint) error

func (*Rpc) SetChatName added in v1.127.0

func (self *Rpc) SetChatName(accountId AccountId, chatId ChatId, name string) error

Set group name.

func (*Rpc) SetChatProfileImage added in v1.127.0

func (self *Rpc) SetChatProfileImage(accountId AccountId, chatId ChatId, path option.Option[string]) error

Set group profile image.

If the group is already _promoted_ (any message was sent to the group), all group members are informed by a special status message that is sent automatically by this function.

Sends out #DC_EVENT_CHAT_MODIFIED and #DC_EVENT_MSGS_CHANGED if a status message was sent.

To find out the profile image of a chat, use dc_chat_get_profile_image()

@param image_path Full path of the image to use as the group image. The image will immediately be copied to the

`blobdir`; the original image will not be needed anymore.
 If you pass null here, the group image is deleted (for promoted groups, all members are informed about
 this change anyway).

func (*Rpc) SetChatVisibility added in v1.127.0

func (self *Rpc) SetChatVisibility(accountId AccountId, chatId ChatId, visibility ChatVisibility) error

func (*Rpc) SetConfig added in v1.127.0

func (self *Rpc) SetConfig(accountId AccountId, key string, value option.Option[string]) error

Set account configuration value.

func (*Rpc) SetStockStrings added in v1.127.0

func (self *Rpc) SetStockStrings(translations map[uint]string) error

Set stock strings.

func (*Rpc) StartIo added in v1.127.0

func (self *Rpc) StartIo(accountId AccountId) error

Start the account I/O.

func (*Rpc) StartIoForAllAccounts added in v1.127.0

func (self *Rpc) StartIoForAllAccounts() error

Start the I/O of all accounts.

func (*Rpc) StopIo added in v1.127.0

func (self *Rpc) StopIo(accountId AccountId) error

Stop the account I/O.

func (*Rpc) StopIoForAllAccounts added in v1.127.0

func (self *Rpc) StopIoForAllAccounts() error

Stop the I/O of all accounts.

func (*Rpc) StopOngoingProcess added in v1.127.0

func (self *Rpc) StopOngoingProcess(accountId AccountId) error

Signal an ongoing process to stop.

func (*Rpc) UnblockContact added in v1.127.0

func (self *Rpc) UnblockContact(accountId AccountId, contactId ContactId) error

func (*Rpc) WaitNextMsgs added in v1.127.0

func (self *Rpc) WaitNextMsgs(accountId AccountId) ([]MsgId, error)

Waits for messages to be processed by the bot and returns their IDs.

This function is similar to GetNextMsgs(), but waits for internal new message notification before returning. New message notification is sent when new message is added to the database, on initialization, when I/O is started and when I/O is stopped. This allows bots to use WaitNextMsgs() in a loop to process old messages after initialization and during the bot runtime. To shutdown the bot, stopping I/O can be used to interrupt pending or next WaitNextMsgs() call.

type SysmsgType added in v0.13.0

type SysmsgType string

type Timestamp added in v0.13.0

type Timestamp struct {
	time.Time
}

func (Timestamp) MarshalJSON added in v0.13.0

func (self Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON turns Timestamp back into the format expected by Delta Chat core.

func (*Timestamp) UnmarshalJSON added in v0.13.0

func (self *Timestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON parses a Delta Chat timestamp into a Timestamp type.

type UnknownEvent added in v1.134.0

type UnknownEvent struct {
	Kind eventType
}

Unknown event from a newer unsupported core version

type WebxdcMsgInfo

type WebxdcMsgInfo struct {
	Name           string
	Icon           string
	Document       string
	Summary        string
	SourceCodeUrl  string
	InternetAccess bool
}

Directories

Path Synopsis
Package helping with the communication between bots and WebXDC apps via JSON-RPC 1.0
Package helping with the communication between bots and WebXDC apps via JSON-RPC 1.0

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL