Documentation ¶
Index ¶
- Constants
- type Account
- func (self *Account) AddDeviceMsg(label, text string) (*Message, error)
- func (self *Account) Avatar() (string, error)
- func (self *Account) BlockedContacts() ([]ContactSnapshot, error)
- func (self *Account) ChatListEntries() ([]*Chat, error)
- func (self *Account) ChatListItems() ([]*ChatListItem, error)
- func (self *Account) Configure() error
- func (self *Account) Contacts() ([]*Contact, error)
- func (self *Account) CreateBroadcastList() (*Chat, error)
- func (self *Account) CreateContact(addr string, name string) (*Contact, error)
- func (self *Account) CreateGroup(name string, protected bool) (*Chat, error)
- func (self *Account) DeleteMsgs(messages []*Message) error
- func (self *Account) ExportBackup(destination, passphrase string) error
- func (self *Account) ExportSelfKeys(destination, passphrase string) error
- func (self *Account) FreshMsgCount() (uint, error)
- func (self *Account) FreshMsgs() ([]*Message, error)
- func (self *Account) FreshMsgsInArrivalOrder() ([]*Message, error)
- func (self *Account) GetConfig(key string) (string, error)
- func (self *Account) GetContactByAddr(addr string) (*Contact, error)
- func (self *Account) GetEventChannel() <-chan *Event
- func (self *Account) ImportBackup(path, passphrase string) error
- func (self *Account) ImportSelfKeys(path, passphrase string) error
- func (self *Account) Info() (map[string]string, error)
- func (self *Account) InitiateAutocryptKeyTransfer() (string, error)
- func (self *Account) IsConfigured() (bool, error)
- func (self *Account) MarkSeenMsgs(messages []*Message) error
- func (self *Account) Me() *Contact
- func (self *Account) QrCode() ([2]string, error)
- func (self *Account) QueryChatListEntries(query string, contact *Contact, listFlags uint) ([]*Chat, error)
- func (self *Account) QueryChatListItems(query string, contact *Contact, listFlags uint) ([]*ChatListItem, error)
- func (self *Account) QueryContacts(query string, listFlags uint) ([]*Contact, error)
- func (self *Account) Remove() error
- func (self *Account) SecureJoin(qrdata string) (*Chat, error)
- func (self *Account) Select() error
- func (self *Account) SetAvatar(path string) error
- func (self *Account) SetConfig(key string, value string) error
- func (self *Account) Size() (int, error)
- func (self *Account) StartIO() error
- func (self *Account) StopIO() error
- func (self *Account) String() string
- func (self *Account) UpdateConfig(config map[string]string) error
- type AccountManager
- func (self *AccountManager) Accounts() ([]*Account, error)
- func (self *AccountManager) AddAccount() (*Account, error)
- func (self *AccountManager) Connectivity() (uint, error)
- func (self *AccountManager) MaybeNetwork() error
- func (self *AccountManager) SelectedAccount() (*Account, error)
- func (self *AccountManager) SetTranslations(translations map[uint]string) error
- func (self *AccountManager) StartIO() error
- func (self *AccountManager) StopIO() error
- func (self *AccountManager) String() string
- func (self *AccountManager) SystemInfo() (map[string]string, error)
- type BasicChatSnapshot
- type Bot
- func (self *Bot) Configure(addr string, password string) error
- func (self *Bot) GetConfig(key string) (string, error)
- func (self *Bot) IsConfigured() bool
- func (self *Bot) Me() *Contact
- func (self *Bot) On(event string, handler EventHandler)
- func (self *Bot) OnNewMsg(handler NewMsgHandler)
- func (self *Bot) Run()
- func (self *Bot) SetConfig(key string, value string) error
- func (self *Bot) Stop()
- func (self *Bot) String() string
- func (self *Bot) UpdateConfig(config map[string]string) error
- type Chat
- func (self *Chat) Accept() error
- func (self *Chat) AddContact(contact *Contact) error
- func (self *Chat) Archive() error
- func (self *Chat) BasicSnapshot() (*BasicChatSnapshot, error)
- func (self *Chat) Block() error
- func (self *Chat) Contacts() ([]*Contact, error)
- func (self *Chat) Delete() error
- func (self *Chat) DeleteMsgs(messages []*Message) error
- func (self *Chat) EncryptionInfo() (string, error)
- func (self *Chat) EphemeralTimer() (uint, error)
- func (self *Chat) FirstUnreadMsg() (*Message, error)
- func (self *Chat) FreshMsgCount() (uint, error)
- func (self *Chat) FullSnapshot() (*FullChatSnapshot, error)
- func (self *Chat) Leave() error
- func (self *Chat) MarkNoticed() error
- func (self *Chat) Messages(infoOnly, addDaymarker bool) ([]*Message, error)
- func (self *Chat) Pin() error
- func (self *Chat) QrCode() ([2]string, error)
- func (self *Chat) RemoveContact(contact *Contact) error
- func (self *Chat) RemoveImage() error
- func (self *Chat) SendMsg(msgData MsgData) (*Message, error)
- func (self *Chat) SendText(text string) (*Message, error)
- func (self *Chat) SendVideoChatInvitation() (*Message, error)
- func (self *Chat) SetEphemeralTimer(timer uint) error
- func (self *Chat) SetImage(path string) error
- func (self *Chat) SetName(name string) error
- func (self *Chat) String() string
- func (self *Chat) Unarchive() error
- func (self *Chat) Unpin() error
- type ChatListItem
- type Contact
- func (self *Contact) Block() error
- func (self *Contact) CreateChat() (*Chat, error)
- func (self *Contact) Delete() error
- func (self *Contact) EncryptionInfo() (string, error)
- func (self *Contact) SetName(name string) error
- func (self *Contact) Snapshot() (*ContactSnapshot, error)
- func (self *Contact) String() string
- func (self *Contact) Unblock() error
- type ContactSnapshot
- type Event
- type EventHandler
- type FullChatSnapshot
- type Message
- func (self *Message) ContinueAutocryptKeyTransfer(setupCode string) error
- func (self *Message) Delete() error
- func (self *Message) Download() error
- func (self *Message) Html() (string, error)
- func (self *Message) Info() (string, error)
- func (self *Message) MarkSeen() error
- func (self *Message) SendReaction(reaction ...string) error
- func (self *Message) SendStatusUpdate(update, description string) error
- func (self *Message) Snapshot() (*MsgSnapshot, error)
- func (self *Message) StatusUpdates(lastKnownSerial uint) (string, error)
- func (self *Message) String() string
- func (self *Message) WebxdcInfo() (*WebxdcMsgInfo, error)
- type MsgData
- type MsgQuote
- type MsgSnapshot
- type NewMsgHandler
- type Reactions
- type Rpc
- type RpcIO
- type WebxdcMsgInfo
Constants ¶
const ( //Special contact ids CONTACT_SELF uint64 = 1 CONTACT_INFO uint64 = 2 CONTACT_DEVICE uint64 = 5 CONTACT_LAST_SPECIAL uint64 = 9 // Chatlist Flags CHATLIST_FLAG_ARCHIVED_ONLY uint = 0x01 CHATLIST_FLAG_NO_SPECIALS uint = 0x02 CHATLIST_FLAG_ADD_ALLDONE_HINT uint = 0x04 CHATLIST_FLAG_FOR_FORWARDING uint = 0x08 // Contact Flags CONTACT_FLAG_VERIFIED_ONLY = 0x01 CONTACT_FLAG_ADD_SELF = 0x02 //Chat types CHAT_TYPE_UNDEFINED uint = 0 CHAT_TYPE_SINGLE uint = 100 CHAT_TYPE_GROUP uint = 120 CHAT_TYPE_MAILINGLIST uint = 140 CHAT_TYPE_BROADCAST uint = 160 // Chat visibility types CHAT_VISIBILITY_NORMAL = "Normal" CHAT_VISIBILITY_ARCHIVED = "Archived" CHAT_VISIBILITY_PINNED = "Pinned" //Message download states DOWNLOAD_STATE_DONE = "Done" DOWNLOAD_STATE_AVAILABLE = "Available" DOWNLOAD_STATE_FAILURE = "Failure" DOWNLOAD_STATE_IN_PROGRESS = "InProgress" //Message view types MSG_TYPE_UNKNOWN = "Unknown" MSG_TYPE_TEXT = "Text" MSG_TYPE_IMAGE = "Image" MSG_TYPE_GIF = "Gif" MSG_TYPE_STICKER = "Sticker" MSG_TYPE_AUDIO = "Audio" MSG_TYPE_VOICE = "Voice" MSG_TYPE_VIDEO = "Video" MSG_TYPE_FILE = "File" MSG_TYPE_VIDEOCHAT_INVITATION = "VideochatInvitation" MSG_TYPE_WEBXDC = "Webxdc" //System message types SYSMSG_TYPE_UNKNOWN = "Unknown" SYSMSG_TYPE_GROUP_NAME_CHANGED = "GroupNameChanged" SYSMSG_TYPE_GROUP_IMAGE_CHANGED = "GroupImageChanged" SYSMSG_TYPE_MEMBER_ADDED_TO_GROUP = "MemberAddedToGroup" SYSMSG_TYPE_MEMBER_REMOVED_FROM_GROUP = "MemberRemovedFromGroup" SYSMSG_TYPE_AUTOCRYPT_SETUP_MESSAGE = "AutocryptSetupMessage" SYSMSG_TYPE_SECUREJOIN_MESSAGE = "SecurejoinMessage" SYSMSG_TYPE_LOCATION_STREAMING_ENABLED = "LocationStreamingEnabled" SYSMSG_TYPE_LOCATION_ONLY = "LocationOnly" SYSMSG_TYPE_CHAT_PROTECTION_ENABLED = "ChatProtectionEnabled" SYSMSG_TYPE_CHAT_PROTECTION_DISABLED = "ChatProtectionDisabled" SYSMSG_TYPE_WEBXDC_STATUS_UPDATE = "WebxdcStatusUpdate" SYSMSG_TYPE_EPHEMERAL_TIMER_CHANGED = "EphemeralTimerChanged" SYSMSG_TYPE_MULTI_DEVICE_SYNC = "MultiDeviceSync" SYSMSG_TYPE_WEBXDC_INFO_MESSAGE = "WebxdcInfoMessage" // Event types EVENT_INFO = "Info" EVENT_SMTP_CONNECTED = "SmtpConnected" EVENT_IMAP_CONNECTED = "ImapConnected" EVENT_SMTP_MESSAGE_SENT = "SmtpMessageSent" EVENT_IMAP_MESSAGE_DELETED = "ImapMessageDeleted" EVENT_IMAP_MESSAGE_MOVED = "ImapMessageMoved" EVENT_NEW_BLOB_FILE = "NewBlobFile" EVENT_DELETED_BLOB_FILE = "DeletedBlobFile" EVENT_WARNING = "Warning" EVENT_ERROR = "Error" EVENT_ERROR_SELF_NOT_IN_GROUP = "ErrorSelfNotInGroup" EVENT_MSGS_CHANGED = "MsgsChanged" EVENT_REACTIONS_CHANGED = "ReactionsChanged" EVENT_INCOMING_MSG = "IncomingMsg" EVENT_INCOMING_MSG_BUNCH = "IncomingMsgBunch" EVENT_MSGS_NOTICED = "MsgsNoticed" EVENT_MSG_DELIVERED = "MsgDelivered" EVENT_MSG_FAILED = "MsgFailed" EVENT_MSG_READ = "MsgRead" EVENT_CHAT_MODIFIED = "ChatModified" EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED = "ChatEphemeralTimerModified" EVENT_CONTACTS_CHANGED = "ContactsChanged" EVENT_LOCATION_CHANGED = "LocationChanged" EVENT_CONFIGURE_PROGRESS = "ConfigureProgress" EVENT_IMEX_PROGRESS = "ImexProgress" EVENT_IMEX_FILE_WRITTEN = "ImexFileWritten" EVENT_SECUREJOIN_INVITER_PROGRESS = "SecurejoinInviterProgress" EVENT_SECUREJOIN_JOINER_PROGRESS = "SecurejoinJoinerProgress" EVENT_CONNECTIVITY_CHANGED = "ConnectivityChanged" EVENT_SELFAVATAR_CHANGED = "SelfavatarChanged" EVENT_WEBXDC_STATUS_UPDATE = "WebxdcStatusUpdate" EVENT_WEBXDC_INSTANCE_DELETED = "WebxdcInstanceDeleted" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { Manager *AccountManager Id uint64 }
Delta Chat account.
func (*Account) AddDeviceMsg ¶
Add a text message in the "Device messages" chat and return the resulting Message instance.
func (*Account) BlockedContacts ¶
func (self *Account) BlockedContacts() ([]ContactSnapshot, error)
Return a list with snapshots of all blocked contacts.
func (*Account) ChatListEntries ¶
Return the default chat list entries.
func (*Account) ChatListItems ¶
func (self *Account) ChatListItems() ([]*ChatListItem, error)
Return the default chat list items
func (*Account) CreateBroadcastList ¶
Create a new broadcast list.
func (*Account) CreateContact ¶
Create a new Contact or return an existing one. If there already is a Contact with that e-mail address, it is unblocked and its display name is updated if specified.
func (*Account) CreateGroup ¶
Create a new group chat. After creation, the group has only self-contact as member and is in unpromoted state.
func (*Account) DeleteMsgs ¶
Delete the given set of messages (local and remote).
func (*Account) ExportBackup ¶
Export account backup.
func (*Account) ExportSelfKeys ¶
Export public and private keys to the specified directory. Note that the account does not have to be started.
func (*Account) FreshMsgCount ¶
Get the number of fresh messages in this account.
func (*Account) FreshMsgs ¶
Return the list of fresh messages, newest messages first. This call is intended for displaying notifications.
func (*Account) FreshMsgsInArrivalOrder ¶
Return fresh messages list sorted in the order of their arrival, with ascending IDs.
func (*Account) GetContactByAddr ¶
Check if an e-mail address belongs to a known and unblocked contact.
func (*Account) GetEventChannel ¶
Get this account's event channel.
func (*Account) ImportBackup ¶
Import account backup.
func (*Account) ImportSelfKeys ¶
Import private keys found in the specified directory.
func (*Account) InitiateAutocryptKeyTransfer ¶
Start the AutoCrypt key transfer process.
func (*Account) IsConfigured ¶
Return true if this account is configured, false otherwise.
func (*Account) MarkSeenMsgs ¶
Mark the given set of messages as seen.
func (*Account) QueryChatListEntries ¶
func (self *Account) QueryChatListEntries(query string, contact *Contact, listFlags uint) ([]*Chat, error)
Return chat list entries matching the given query.
func (*Account) QueryChatListItems ¶
func (self *Account) QueryChatListItems(query string, contact *Contact, listFlags uint) ([]*ChatListItem, error)
Return chat list items matching the given query.
func (*Account) QueryContacts ¶
Get the list of contacts matching the given query.
func (*Account) SecureJoin ¶
Continue a Setup-Contact or Verified-Group-Invite protocol started on another device.
func (*Account) Select ¶
Select the account. The selected account will be returned by AccountManager.SelectedAccount()
type AccountManager ¶
type AccountManager struct {
Rpc Rpc
}
Delta Chat accounts manager. This is the root of the API.
func (*AccountManager) Accounts ¶
func (self *AccountManager) Accounts() ([]*Account, error)
Return all available accounts.
func (*AccountManager) AddAccount ¶
func (self *AccountManager) AddAccount() (*Account, error)
Create a new account.
func (*AccountManager) Connectivity ¶
func (self *AccountManager) Connectivity() (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
func (*AccountManager) MaybeNetwork ¶
func (self *AccountManager) MaybeNetwork() error
Indicate that the network likely has come back or just that the network conditions might have changed.
func (*AccountManager) SelectedAccount ¶
func (self *AccountManager) SelectedAccount() (*Account, error)
Get the selected account.
func (*AccountManager) SetTranslations ¶
func (self *AccountManager) SetTranslations(translations map[uint]string) error
Set stock translation strings.
func (*AccountManager) StartIO ¶
func (self *AccountManager) StartIO() error
Start the I/O of all accounts.
func (*AccountManager) StopIO ¶
func (self *AccountManager) StopIO() error
Stop the I/O of all accounts.
func (*AccountManager) SystemInfo ¶
func (self *AccountManager) SystemInfo() (map[string]string, error)
Get information about the Delta Chat core in this system.
type BasicChatSnapshot ¶
type BasicChatSnapshot struct { Id uint64 Name string IsProtected bool ProfileImage string Archived bool ChatType uint IsUnpromoted bool IsSelfTalk bool Color string IsContactRequest bool IsDeviceChat bool IsMuted bool }
Cheaper version of FullChatSnapshot.
type Bot ¶
type Bot struct { Account *Account // contains filtered or unexported fields }
Delta Chat bot that listen to events of a single account.
func NewBotFromAccountManager ¶
func NewBotFromAccountManager(manager *AccountManager) *Bot
Helper function to create a new Bot from the given AccountManager. The first available account will be used, a new account will be created if none exists.
func (*Bot) IsConfigured ¶
Return true if the bot's account is configured, false otherwise.
func (*Bot) On ¶
func (self *Bot) On(event string, 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.
type Chat ¶
Delta Chat Chat.
func (*Chat) AddContact ¶
Add contact to this group.
func (*Chat) BasicSnapshot ¶
func (self *Chat) BasicSnapshot() (*BasicChatSnapshot, error)
Get a chat snapshot with basic info about this chat.
func (*Chat) DeleteMsgs ¶
Forward a list of messages to this chat.
func (*Chat) EncryptionInfo ¶
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 (*Chat) EphemeralTimer ¶
Get ephemeral timer of this chat.
func (*Chat) FirstUnreadMsg ¶
Get first unread message in this chat.
func (*Chat) FreshMsgCount ¶
Get the number of fresh messages in this chat.
func (*Chat) FullSnapshot ¶
func (self *Chat) FullSnapshot() (*FullChatSnapshot, error)
Get a full snapshot of this chat.
func (*Chat) MarkNoticed ¶
Mark all messages in this chat as noticed.
func (*Chat) RemoveContact ¶
Remove contact from this group.
func (*Chat) SendVideoChatInvitation ¶
Send a video chat invitation.
func (*Chat) SetEphemeralTimer ¶
Set ephemeral timer of this chat.
type ChatListItem ¶
type ChatListItem struct { Id uint64 Name string AvatarPath string Color string LastUpdated int64 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 uint64 WasSeenRecently bool // Error // Id uint64 Error string }
Chat list item snapshot
type Contact ¶
Delta Chat Contact.
func (*Contact) CreateChat ¶
Create or get an existing 1:1 chat for this contact.
func (*Contact) EncryptionInfo ¶
Get encryption info for this 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 (*Contact) Snapshot ¶
func (self *Contact) Snapshot() (*ContactSnapshot, error)
Return a map with a snapshot of all contact properties.
type ContactSnapshot ¶
type ContactSnapshot struct { Address string Color string AuthName string Status string DisplayName string Id uint64 Name string ProfileImage string NameAndAddr string IsBlocked bool IsVerified bool VerifierAddr string VerifierId uint64 LastSeen uint64 WasSeenRecently bool }
Delta Chat Contact snapshot.
type Event ¶
type Event struct { Type string Msg string File string ChatId uint64 MsgId uint64 ContactId uint64 MsgIds []uint64 Timer int Progress uint Comment string Path string StatusUpdateSerial uint }
Delta Chat core Event
type EventHandler ¶
type EventHandler func(event *Event)
type FullChatSnapshot ¶
type FullChatSnapshot struct { Id uint64 Name string IsProtected bool ProfileImage string Archived bool ChatType uint IsUnpromoted bool IsSelfTalk bool Contacts []*ContactSnapshot ContactIds []uint64 Color string FreshMessageCounter uint IsContactRequest bool IsDeviceChat bool SelfInGroup bool IsMuted bool EphemeralTimer uint CanSend bool WasSeenRecently bool MailingListAddress string }
Full chat snapshot.
type Message ¶
Delta Chat Message.
func (*Message) ContinueAutocryptKeyTransfer ¶
Continue the AutoCrypt key transfer process.
func (*Message) SendReaction ¶
Send a reaction to this message.
func (*Message) SendStatusUpdate ¶
Send status update for the webxdc instance of this message.
func (*Message) Snapshot ¶
func (self *Message) Snapshot() (*MsgSnapshot, error)
Return map of this account configuration parameters.
func (*Message) StatusUpdates ¶
Get the status updates of this webxdc message as a JSON string.
func (*Message) WebxdcInfo ¶
func (self *Message) WebxdcInfo() (*WebxdcMsgInfo, error)
Get info from this webxdc message.
type MsgData ¶
type MsgData struct { Text string `json:"text,omitempty"` Html string `json:"html,omitempty"` ViewType string `json:"viewtype,omitempty"` File string `json:"file,omitempty"` Location *[2]float64 `json:"location,omitempty"` OverrideSenderName string `json:"overrideSenderName,omitempty"` QuotedMessageId uint64 `json:"quotedMessageId,omitempty"` }
Message data provided to Chat.SendMsg()
type MsgQuote ¶
type MsgQuote struct { Text string MessageId uint64 AuthorDisplayName string AuthorDisplayColor string OverrideSenderName string Image string IsForwarded bool ViewType string }
Message quote. Only the Text property is warrantied to be present, all other fields are optional.
type MsgSnapshot ¶
type MsgSnapshot struct { Id uint64 ChatId uint64 FromId uint64 Quote *MsgQuote ParentId uint64 Text string HasLocation bool HasHtml bool ViewType string State int Error string Timestamp int SortTimestamp int ReceivedTimestamp int HasDeviatingTimestamp bool Subject string ShowPadlock bool IsSetupmessage bool IsInfo bool IsForwarded bool IsBot bool SystemMessageType string 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 string Reactions *Reactions }
Message snapshot.
type NewMsgHandler ¶
type NewMsgHandler func(msg *Message)
type Rpc ¶
type Rpc interface { Start() error Stop() GetEventChannel(accountId uint64) <-chan *Event Call(method string, params ...any) error CallResult(result any, method string, params ...any) error String() string }
Delta Chat core RPC
type RpcIO ¶
type RpcIO struct { Stderr *os.File AccountsDir string Cmd string // contains filtered or unexported fields }
Delta Chat core RPC working over IO