diff --git a/docs/html/functions.html b/docs/html/functions.html index 39c2c304..57e2aaa8 100644 --- a/docs/html/functions.html +++ b/docs/html/functions.html @@ -145,8 +145,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , mrcontact_t
The following constants are used as events reported to the callback given to mrmailbox_new().
If you do not want to handle an event, it is always safe to return 0, so there is no need to add a "case" for every event.
#define MR_EVENT_CHAT_MODIFIED 2020 | +#define MR_EVENT_INFO 100 |
Group name/image changed or members added/removed.
-data1 | chat_id |
data2 | 0 |
#define MR_EVENT_CONFIGURE_PROGRESS 2041 | -
Inform about the configuration progress started by mrmailbox_configure_and_connect().
-data1 | Permille |
data2 | 0 |
#define MR_EVENT_CONTACTS_CHANGED 2030 | -
Contact(s) created, renamed, blocked or deleted.
+The user may write an informational string to the log.
+Passed to the callback given to mrmailbox_new(). This event should not be reported using a popup or something like that.
data1 | 0 |
data2 | 0 |
data2 | Info string |
#define MR_EVENT_WARNING 300 | +
The user should write an warning string to the log.
+Passed to the callback given to mrmailbox_new(). This event should not be reported using a popup or something like that.
+data1 | 0 |
data2 | Warning string |
#define MR_EVENT_GET_QUANTITY_STRING 2092 | +#define MR_EVENT_MSGS_CHANGED 2000 |
Requeste a localized quantitiy string from the frontend.
-Quantitiy strings may have eg. different plural forms and usually also include the count itself to the string. Typical strings in this form are "1 Message" vs. "2 Messages".
+Messages or chats changed.
+One or more messages or chats changed for various reasons in the database:
data1 | ID of the string to request, one of the MR_STR_* constants as defined in mrstock.h |
data2 | The count. The frontend may retrurn different strings on this value and normally also includes the value itself to the string. |
#define MR_EVENT_GET_STRING 2091 | -
Requeste a localized string from the frontend.
-data1 | ID of the string to request, one of the MR_STR_* constants as defined in mrstock.h |
data2 | 0 |
#define MR_EVENT_HTTP_GET 2100 | -
Request a HTTP-file from the frontend.
-data1 | URL |
data2 | 0 |
#define MR_EVENT_IMEX_ENDED 2050 | -
Import/export done.
-You'll get this event from a call to mrmailbox_imex(). As we want to get rid of the threads in the core, this event may be deleted.
-data1 | 0:failed, 1=success |
data2 | 0 |
#define MR_EVENT_IMEX_FILE_WRITTEN 2052 | -
A file has been exported.
-A file has been written by mrmailbox_imex(). This event may be send multiple times by a single call to mrmailbox_imex(); if the export is done, MR_EVENT_IMEX_ENDED is sent.
-A typical purpose for a handler of this event may be to make the file public to some system services.
-data1 | File name |
data2 | 0 |
#define MR_EVENT_IMEX_PROGRESS 2051 | -
Inform about the import/export progress started by mrmailbox_imex().
-data1 | Permille |
data2 | 0 |
data1 | chat_id for single added messages |
data2 | msg_id for single added messages |
There is a fresh message.
Typically, the user will show an notification when receiving this message.
+There is no extra MR_EVENT_MSGS_CHANGED event send together with this event.
An object representing a single chat in memory.
Chat objects are created using eg. mrmailbox_get_chat() and are not updated on database changes; if you want an update, you have to recreate the object.
char * mrchat_get_subtitle | -( | -mrchat_t * | -chat | ) | -- |
Get a subtitle for a chat.
-The sibtitle is eg. the email-address or the number of group members.
-chat | The chat object to calulate the subtitle for. |
int mrchat_get_unpromoted | +( | +mrchat_t * | +chat | ) | ++ |
Check if a chat is still unpromoted.
+Chats are unpromoted until the first message is sent. With unpromoted chats, members can be sent, settings can be modified without the need of special status messages being sent.
+After the creation with mrmailbox_create_group_chat() the chat is usuall unpromoted until the first call to mrmailbox_send_msg() or mrmailbox_send_text_msg().
+chat | The chat object. |
char * mrchat_get_profile_image | +( | +mrchat_t * | +chat | ) | ++ |
Get the chat's profile image.
+The profile image is set using mrmailbox_set_chat_profile_image() for groups. For normal chats, the profile image is set using mrmailbox_set_contact_profile_image() (not yet implemented).
+chat | The chat object. |
char * mrchat_get_subtitle | +( | +mrchat_t * | +chat | ) | ++ |
Get a subtitle for a chat.
+The subtitle is eg. the email-address or the number of group members.
+chat | The chat object to calulate the subtitle for. |
int mrchat_t::m_archived | -
Flag for the archived state.
-0=normal chat, not archived, not sticky.
-1=chat archived
-2=chat sticky (reserved for future use, if you do not support this value, just treat the chat as a normal one)
-To archive or unarchive chats, use mrmailbox_archive_chat(). If chats are archived, this should be shown in the UI by a little icon or text, eg. the search will also return archived chats.
- -char* mrchat_t::m_draft_text | -
The draft text.
-The timetamp of the draft is placed in mrchat_t::m_draft_timestamp. To save a draft for a chat, use mrmailbox_set_draft()
-NULL if there is no draft.
- -time_t mrchat_t::m_draft_timestamp | -
Timestamp of the draft.
-The draft itself is placed in mrchat_t::m_draft_text. To save a draft for a chat, use mrmailbox_set_draft()
-0 if there is no draft.
- -"Normal" chat IDs are larger than these special IDs (larger than MR_CHAT_ID_LAST_SPECIAL).
-mrmailbox_t* mrchat_t::m_mailbox | -
The mailbox object the chat belongs to.
-Never NULL.
- -char* mrchat_t::m_name | -
Name of the chat.
-For one-to-one chats, this is the name of the contact. For group chats, this is the name given eg. to mrmailbox_create_group_chat() or received by a group-creation message.
-To change the name, use mrmailbox_set_chat_name()
-NULL if unset.
- -mrparam_t* mrchat_t::m_param | -
Additional parameters for the chat.
-To access the parameters, use mrparam_exists(), mrparam_get() for mrparam_get_int()
-If the chat type is not set, it is MR_CHAT_TYPE_UNDEFINED (0).
+char* mrchat_t::m_name | +
Name of the chat.
+For one-to-one chats, this is the name of the contact. For group chats, this is the name given eg. to mrmailbox_create_group_chat() or received by a group-creation message.
+To change the name, use mrmailbox_set_chat_name()
+NULL if unset.
+ +time_t mrchat_t::m_draft_timestamp | +
Timestamp of the draft.
+The draft itself is placed in mrchat_t::m_draft_text. To save a draft for a chat, use mrmailbox_set_draft()
+0 if there is no draft.
+ +char* mrchat_t::m_draft_text | +
The draft text.
+The timetamp of the draft is placed in mrchat_t::m_draft_timestamp. To save a draft for a chat, use mrmailbox_set_draft()
+NULL if there is no draft.
+ +mrmailbox_t* mrchat_t::m_mailbox | +
The mailbox object the chat belongs to.
+Never NULL.
+ +int mrchat_t::m_archived | +
Flag for the archived state.
+0=normal chat, not archived, not sticky.
+1=chat archived
+2=chat sticky (reserved for future use, if you do not support this value, just treat the chat as a normal one)
+To archive or unarchive chats, use mrmailbox_archive_chat(). If chats are archived, this should be shown in the UI by a little icon or text, eg. the search will also return archived chats.
+An object representing a single chatlist in memory.
Chatlist objects contain chat IDs and, if possible, message IDs belonging to them. Chatlist objects are created eg. using mrmailbox_get_chatlist(). The chatlist object is not updated. If you want an update, you have to recreate the object.
void mrchatlist_unref | +( | +mrchatlist_t * | +chatlist | ) | ++ |
Free a chatlist object.
+chatlist | The chatlist object to free, created eg. by mrmailbox_get_chatlist(), mrmailbox_search_msgs(). |
size_t mrchatlist_get_cnt | +( | +mrchatlist_t * | +chatlist | ) | ++ |
Find out the number of chats in a chatlist.
+chatlist | The chatlist object as created eg. by mrmailbox_get_chatlist(). |
size_t mrchatlist_get_cnt | -( | -mrchatlist_t * | -chatlist | ) | -- |
Find out the number of chats in a chatlist.
-chatlist | The chatlist object as created eg. by mrmailbox_get_chatlist(). |
void mrchatlist_unref | -( | -mrchatlist_t * | -chatlist | ) | -- |
Free a chatlist object.
-chatlist | The chatlist object to free, created eg. by mrmailbox_get_chatlist(), mrmailbox_search_msgs(). |
An object representing a single contact in memory.
The contact object is not updated. If you want an update, you have to recreate the object.
void mrcontact_unref | +( | +mrcontact_t * | +contact | ) | ++ |
Free a contact object.
+contact | The contact object as created eg. by mrmailbox_get_contact(). |
char * mrcontact_get_addr | +( | +mrcontact_t * | +contact | ) | ++ |
Get email address.
+May be an empty string.
+contact | The contact object |
char * mrcontact_get_name | +( | +mrcontact_t * | +contact | ) | ++ |
Get name.
+This is the name as defined the the contact himself or modified by the user. May be an empty string.
+This name is typically used in a form where the user can edit the name of a contact. This name must not be spreaded via mail (To:, CC: ...) as it as it may be sth. like "Daddy". To get a fine name to display in lists etc., use mrcontact_get_display_name() or mrcontact_get_name_n_addr().
+contact | The contact object |
char * mrcontact_get_display_name | +( | +mrcontact_t * | +contact | ) | ++ |
Get display name.
+This is the name as defined the the contact himself, modified by the user or, if both are unset, the email address.
+This name is typically used in lists and must not be speaded via mail (To:, CC: ...). To get the name editable in a formular, use mrcontact_get_edit_name().
+contact | The contact object |
char * mrcontact_get_name_n_addr | +( | +mrcontact_t * | +contact | ) | ++ |
Get a summary of name and address.
+The returned string is either "Name (email@domain.com)" or just "email@domain.com" if the name is unset.
+The summary is typically used when asking the user something about the contact. The attached email address makes the question unique, eg. "Chat with Alan Miller (am@uniquedomain.com)?"
+The summary must not be spreaded via mail (To:, CC: ...) as it as it may contain sth. like "Daddy".
+contact | The contact object |
Typically, this function is not needed as it is called implicitly by mrmailbox_add_address_book()
full_name | Buffer with the name, is modified during processing; the resulting string may be shorter but never longer. |
void mrcontact_unref | -( | -mrcontact_t * | -contact | ) | -- |
Free a contact object.
-contact | The contact object as created eg. by mrmailbox_get_contact(). |
char* mrcontact_t::m_addr | -
The E-Mail-Address of the contact.
-May be NULL or empty.
- -char* mrcontact_t::m_authname | -
Name authorized by the contact himself.
-May be NULL or empty, this is the name authorized by the sender, only this name may be speaded to others, eg. in To:-lists; for displaying in the app, use m_name
- -int mrcontact_t::m_blocked | -
Blocked state.
-1=contact is blocked, 0=contact is not blocked. To block or unblock a contact, use mrmailbox_block_contact().
- -Name given by the user to the contact.
-Should be used for displaying everywhere and is editable by the user but must not be spreaded via mail (To:, CC: ...) as it as it may be sth. like "Daddy".
-May be NULL or empty, initially set to m_authname
+Contact name.
+It is recommended to use mrcontact_get_name(), mrcontact_get_display_name() or mrcontact_get_name_n_addr() to access this field. May be NULL or empty, initially set to m_authname.
+ +char* mrcontact_t::m_authname | +
Name authorized by the contact himself.
+It is recommended to use mrcontact_get_name(), mrcontact_get_display_name() or mrcontact_get_name_n_addr() to access this field. This is the name authorized by the sender, only this name may be speaded to others, eg. in To:-lists. May be NULL or empty.
+ +char* mrcontact_t::m_addr | +
E-Mail-Address of the contact.
+It is recommended to use mrcontact_get_addr() to access this field. May be NULL.
+ +int mrcontact_t::m_blocked | +
Blocked state.
+1=contact is blocked, 0=contact is not blocked. To block or unblock a contact, use mrmailbox_block_contact().
int mrmailbox_add_address_book | +mrmailbox_t * mrmailbox_new | ( | -mrmailbox_t * | -mailbox, | +mrmailboxcb_t | +cb, | +
+ | + | void * | +userdata, | |||
const char * | -adr_book | +os_name | ||||
@@ -353,160 +359,58 @@ Public Attributes |
Add a number of contacts.
-Typically used to add the whole address book from the OS. As names here are typically not well formatted, we call mrcontact_normalize_name() for each name given.
-To add a single contact entered by the user, you should prefer mrmailbox_create_contact()
+Create a new mailbox object.
+After creation it is usually opened, connected and mails are fetched. After usage, the object should be deleted using mrmailbox_unref().
+cb | a callback function that is called for events (update, state changes etc.) and to get some information form the client (eg. translation for a given string). See mrevent.h for a list of possible events that may be passed to the callback.
|
userdata | can be used by the client for any purpuse. He finds it later in mrmailbox__t::m_userdata(). |
os_name | is only for decorative use and is shown eg. in the X-Mailer header in the form "Delta Chat <version> for <osName>" |
void mrmailbox_unref | +( | +mrmailbox_t * | +mailbox | ) | ++ |
Free a mailbox object.
+If app runs can only be terminated by a forced kill, this may be superfluous.
mailbox | the mailbox object as created by mrmailbox_new(). |
adr_book | A multi-line string in the format in the format Name one\nAddress one\nName two\Address two . If an email address already exists, the name is updated and the origin is increased to "manually created". |
int mrmailbox_add_contact_to_chat | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id, | -
- | - | uint32_t | -contact_id | -
- | ) | -- |
Add a member to a group.
-If the group is already promoted (any message was sent to the group), all group members are informed by a special message that is sent automatically by this function.
-mailbox | Mailbox object as created by mrmailbox_new(). |
chat_id | The chat ID to add the contact to. Must be a group chat. |
contact_id | The contact ID to add to the chat. |
void mrmailbox_archive_chat | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id, | -
- | - | int | -archive | -
- | ) | -- |
Archive or unarchive a chat.
-Archived chats are not included in the default chatlist returned by mrmailbox_get_chatlist(). Instead, if there are any archived chats, the pseudo-chat with the chat_id MR_CHAT_ID_ARCHIVED_LINK will be added the the end of the chatlist.
-To get a list of archived chats, use mrmailbox_get_chatlist() with the flag MR_GCL_ARCHIVED_ONLY.
-To find out the archived state of a given chat, use mrchat_t::m_archived
-mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | The ID of the chat to archive or unarchive. |
archive | 1=archive chat, 0=unarchive chat, all other values are reserved for future use |
void mrmailbox_block_contact | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -contact_id, | -
- | - | int | -new_blocking | -
- | ) | -- |
Block or unblock a contact.
-May result in a MR_EVENT_CONTACTS_CHANGED event.
-mailbox | The mailbox object as created by mrmailbox_new(). |
contact_id | The ID of the contact to block or unblock. |
new_blocking | 1=block contact, 0=unblock contact |
int mrmailbox_check_password | +int mrmailbox_open | ( | mrmailbox_t * | mailbox, | @@ -515,7 +419,13 @@ Public Attributesconst char * | -test_pw | +dbfile, | + +
+ | + | const char * | +blobdir | |
@@ -525,16 +435,17 @@ Public Attributes |
Check if the user is authorized by the given password in some way.
-This is to promt for the password eg. before exporting keys/backup.
+Open mailbox database.
+If the given file does not exist, it is created and can be set up using mrmailbox_set_config() afterwards.
mailbox | Mailbox object as created by mrmailbox_new(). |
test_pw | Password to check. |
mailbox | the mailbox object as created by mrmailbox_new |
dbfile | the file to use to store the database, sth. like "~/file" won't work on all systems, if in doubt, use absolute paths. You can find the file path later in mrmailbox_t::m_dbfile |
blobdir | a directory to store the blobs in, the trailing slash is added by us, so if you want to avoid double slashes, do not add one. If you give NULL as blobdir, dbfile-blobs is used in the same directory as dbfile will be created in. You can find the path to the blob direcrory later in mrmailbox_t::m_blobdir |
int mrmailbox_configure_and_connect | +int mrmailbox_is_open | ( | -mrmailbox_t * | +const mrmailbox_t * | mailbox | ) |
Configure and connect a mailbox.
-addr
and mail_pw
using mrmailbox_set_config().Check if the mailbox database is open.
mailbox | the mailbox object as created by mrmailbox_new(). |
There is no need to call this every program start, the result is saved in the database. Instead, you can use mrmailbox_connect() which reuses the configuration and is much faster:
-void mrmailbox_configure_cancel | +int mrmailbox_set_config | +( | +mrmailbox_t * | +ths, | +
+ | + | const char * | +key, | +|
+ | + | const char * | +value | +|
+ | ) | ++ |
Configure the mailbox.
+The configuration is handled by key=value pairs. Typical configuration options are:
+ths | the mailbox object |
key | the option to change, typically one of the strings listed above |
value | the value to save for "key" |
char * mrmailbox_get_config | +( | +mrmailbox_t * | +ths, | +
+ | + | const char * | +key, | +
+ | + | const char * | +def | +
+ | ) | ++ |
Get a configuration option.
+The configuration option is typically set by mrmailbox_set_config() or by the library itself.
+ths | the mailbox object as created by mrmmailbox_new() |
key | the key to query |
def | default value to return if "key" is unset |
int mrmailbox_set_config_int | +( | +mrmailbox_t * | +ths, | +
+ | + | const char * | +key, | +
+ | + | int32_t | +value | +
+ | ) | ++ |
Configure the mailbox.
+Similar to mrmailbox_set_config() but sets an integer instead of a string. If there is already a key with a string set, this is overwritten by the given integer value.
+ +int32_t mrmailbox_get_config_int | +( | +mrmailbox_t * | +ths, | +
+ | + | const char * | +key, | +
+ | + | int32_t | +def | +
+ | ) | ++ |
Get a configuration option.
+Similar as mrmailbox_get_config() but gets the value as an integer instead of a string.
+ +char * mrmailbox_get_info | ( | mrmailbox_t * | mailbox | ) | @@ -608,16 +686,34 @@ Public Attributes
Signal the configure-process to stop.
-After that, mrmailbox_configure_cancel() returns without waiting for mrmailbox_configure_and_connect() to return.
-mrmailbox_configure_and_connect() will return ASAP then, however, it may still take a moment. If in doubt, the caller may also decide the kill the thread after a few seconds; eg. the configuration process may hang in a function not under the control of the core (eg. MR_EVENT_HTTP_GET). Another reason for mrmailbox_configure_cancel() not to wait is that otherwise it would be GUI-blocking and should be started in another thread then; this would make things even more complicated.
+Get information about the mailbox.
+The information is returned by a multi-line string and contains information about the current configuration and the last log entries.
mailbox | The mailbox object as created by mrmailbox_new() |
mailbox | Mailbox object as returned by mrmailbox_new(). |
char * mrmailbox_get_version_str | +( | +void | +) | ++ |
Find out the version of the Delta Chat core library.
+major.minor.revision
. The return value must be free()'d. uint32_t mrmailbox_create_chat_by_contact_id | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -contact_id | -
- | ) | -- |
Create a normal chat with a single user.
-To create group chats, see mrmailbox_create_group_chat()
-mailbox | The mailbox object as returned from mrmailbox_new(). |
contact_id | The contact ID to create the chat for. If there is already a chat with this contact, the already existing ID is returned. |
uint32_t mrmailbox_create_contact | -( | -mrmailbox_t * | -mailbox, | -
- | - | const char * | -name, | -
- | - | const char * | -addr | -
- | ) | -- |
Add a single contact.
-We assume, the contact name, if any, is entered by the user and is used "as is" therefore, mrcontact_normalize_name() is not called for the name.
-To add a number of contacts, see mrmailbox_add_address_book()
-mailbox | The mailbox object as created by mrmailbox_new(). |
name | Name of the contact to add. If you do not know the name belonging to the address, you can give NULL here. |
addr | E-mail-address of the contact to add. If the email address already exists, the name is updated and the origin is increased to "manually created". |
uint32_t mrmailbox_create_group_chat | -( | -mrmailbox_t * | -mailbox, | -
- | - | const char * | -chat_name | -
- | ) | -- |
Create a new group chat.
-After creation, the groups has one member with the ID MR_CONTACT_ID_SELF and is in unpromoted state. This means, you can add or remove members, change the name, the group image and so on without messages being send to all group members.
-This changes as soon as the first message is sent to the group members and the group becomes promoted. After that, all changes are synced with all group members by sending status message.
-mailbox | Mailbox object as created by mrmailbox_new(). |
chat_name | The name of the group chat to create. The name may be changed later using mrmailbox_set_chat_name(). To find out the name of a group later, see mrchat_t::m_name |
char * mrmailbox_create_setup_code | -( | -mrmailbox_t * | -mailbox | ) | -- |
Create random setup code.
-The created "Autocrypt Level 1" setup code has the following form:
-Linebreaks and spaces are not added to the setup code, but the "-" are. Should be given to mrmailbox_imex() for encryption, should be wiped and free()'d after usage.
-mailbox | Mailbox object as created by mrmailbox_new(). |
void mrmailbox_delete_chat | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id | -
- | ) | -- |
Delete a chat.
-Messages are deleted from the device and the chat database entry is deleted. After that, the event MR_EVENT_MSGS_CHANGED is posted.
-Things that are not done implicitly:
-mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | The ID of the chat to delete. |
int mrmailbox_delete_contact | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -contact_id | -
- | ) | -- |
Delete a contact.
-The contact is deleted from the local device. It may happen that this is not possible as the contact is in used. In this case, the contact can be blocked.
-mailbox | The mailbox object as created by mrmailbox_new(). |
contact_id | ID of the contact to delete. |
void mrmailbox_delete_msgs | -( | -mrmailbox_t * | -mailbox, | -
- | - | const uint32_t * | -msg_ids, | -
- | - | int | -msg_cnt | -
- | ) | -- |
Delete messages.
-The messages are deleted on the current device and on the IMAP server.
-mailbox | the mailbox object as created by mrmailbox_new() |
msg_ids | an array of uint32_t containing all message IDs that should be deleted |
msg_cnt | the number of messages IDs in the msg_ids array |
void mrmailbox_forward_msgs | +void mrmailbox_heartbeat | +( | +mrmailbox_t * | +ths | ) | ++ |
Stay alive.
+The library tries itself to stay alive. For this purpose there is an additional "heartbeat" thread that checks if the IDLE-thread is up and working. This check is done about every minute. However, depending on the operating system, this thread may be delayed or stopped, if this is the case you can force additional checks manually by just calling mrmailbox_heartbeat() about every minute. If in doubt, call this function too often, not too less :-)
+ +mrchatlist_t * mrmailbox_get_chatlist | ( | mrmailbox_t * | mailbox, | ||
- | - | const uint32_t * | -msg_ids, | -||
int | -msg_cnt, | +listflags, | |||
- | uint32_t | -chat_id | +const char * | +query | |
@@ -979,66 +817,20 @@ Public Attributes |
Forward messages to another chat.
+Get a list of chats.
mailbox | the mailbox object as created by mrmailbox_new() |
msg_ids | an array of uint32_t containing all message IDs that should be forwarded |
msg_cnt | the number of messages IDs in the msg_ids array |
chat_id | The destination chat ID. |
mrarray_t * mrmailbox_get_blocked_contacts | -( | -mrmailbox_t * | -mailbox | ) | -- |
Get blocked contacts.
-mailbox | The mailbox object as created by mrmailbox_new(). |
int mrmailbox_get_blocked_count | -( | -mrmailbox_t * | -mailbox | ) | -- |
Get the number of blocked contacts.
-mailbox | The mailbox object as created by mrmailbox_new(). |
mailbox | The mailbox object as returned by mrmailbox_new() |
listflags | A combination of flags:
|
query | An optional query for filtering the list. Only chats matching this query are returned. Give NULL for no filtering. |
mrarray_t * mrmailbox_get_chat_contacts | +void mrmailbox_marknoticed_chat | ( | mrmailbox_t * | mailbox, | @@ -1102,20 +894,16 @@ Public Attributes
Get contact IDs belonging to a chat.
-Mark all message in a chat as noticed.
+Noticed messages are no longer fresh and do not count as being unseen. IMAP/MDNs is not done for noticed messages. See also mrmailbox_marknoticed_contact() and mrmailbox_markseen_msgs()
mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | Chat ID to get the belonging contact IDs for. |
chat_id | The chat ID of which all messages should be marked as being noticed. |
uint32_t mrmailbox_create_chat_by_contact_id | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +contact_id | +
+ | ) | ++ |
Create a normal chat with a single user.
+To create group chats, see mrmailbox_create_group_chat()
+mailbox | The mailbox object as returned from mrmailbox_new(). |
contact_id | The contact ID to create the chat for. If there is already a chat with this contact, the already existing ID is returned. |
uint32_t mrmailbox_get_next_media | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +curr_msg_id, | +
+ | + | int | +dir | +
+ | ) | ++ |
Returns all message IDs of the given types in a chat.
+Typically used to show a gallery. The result must be mrarray_unref()'d
+mailbox | The mailbox object as returned from mrmailbox_new(). |
curr_msg_id | This is the current (image) message displayed. |
dir | 1=get the next (image) message, -1=get the previous one. |
mrarray_t * mrmailbox_get_chat_contacts | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +chat_id | +
+ | ) | ++ |
Get contact IDs belonging to a chat.
+mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | Chat ID to get the belonging contact IDs for. |
mrarray_t * mrmailbox_get_fresh_msgs | +( | +mrmailbox_t * | +mailbox | ) | ++ |
Returns the message IDs of all fresh messages of any chat.
+Typically used for implementing notification summaries. The result must be free()'d.
+mailbox | The mailbox object as returned from mrmailbox_new(). |
mrchatlist_t * mrmailbox_get_chatlist | +mrarray_t * mrmailbox_search_msgs | ( | mrmailbox_t * | mailbox, | @@ -1270,8 +1205,8 @@ Public Attributes|
- | int | -listflags, | +uint32_t | +chat_id, | |
@@ -1287,108 +1222,27 @@ Public Attributes |
Get a list of chats.
+Search messages containing the given query string.
+Searching can be done globally (chat_id=0) or in a specified chat only (chat_id set).
+Global chat results are typically displayed using mrmsg_get_summary(), chat search results may just hilite the corresponding messages and present a prev/next button.
mailbox | The mailbox object as returned by mrmailbox_new() |
listflags | A combination of flags:
|
query | An optional query for filtering the list. Only chats matching this query are returned. Give NULL for no filtering. |
mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | ID of the chat to search messages in. Set this to 0 for a global search. |
query | The query to search for. |
char * mrmailbox_get_config | -( | -mrmailbox_t * | -ths, | -
- | - | const char * | -key, | -
- | - | const char * | -def | -
- | ) | -- |
Get a configuration option.
-The configuration option is typically set by mrmailbox_set_config() or by the library itself.
-ths | the mailbox object as created by mrmmailbox_new() |
key | the key to query |
def | default value to return if "key" is unset |
int32_t mrmailbox_get_config_int | -( | -mrmailbox_t * | -ths, | -
- | - | const char * | -key, | -
- | - | int32_t | -def | -
- | ) | -- |
Get a configuration option.
-Similar as mrmailbox_get_config() but gets the value as an integer instead of a string.
- -mrcontact_t * mrmailbox_get_contact | +void mrmailbox_set_draft | ( | mrmailbox_t * | mailbox, | @@ -1397,7 +1251,13 @@ Public Attributesuint32_t | -contact_id | +chat_id, | + +
+ | + | const char * | +msg | |
@@ -1407,25 +1267,26 @@ Public Attributes |
Get a single contact object.
-For a list, see eg. mrmailbox_get_known_contacts().
+Save a draft for a chat.
+To get the draft for a given chat ID, use mrchat_t::m_draft_text
mailbox | The mailbox object as created by mrmailbox_new(). |
contact_id | ID of the contact to get the object for. |
mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | The chat ID to save the draft for. |
msg | The message text to save as a draft. |
char * mrmailbox_get_contact_encrinfo | +int mrmailbox_get_total_msg_count | ( | mrmailbox_t * | mailbox, | @@ -1434,7 +1295,7 @@ Public Attributesuint32_t | -contact_id | +chat_id |
@@ -1444,16 +1305,15 @@ Public Attributes |
Get encryption info for a contact.
-Get a multi-line encryption info, containing your fingerprint and the fingerprint of the contact, used eg. to compare the fingerprints for a simple out-of-band verification.
+Get the total number of messages in a chat.
mailbox | The mailbox object as created by mrmailbox_new(). |
contact_id | ID of the contact to get the encryption info for. |
mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | The ID of the chat to count the messages for. |
mrarray_t * mrmailbox_get_fresh_msgs | +void mrmailbox_archive_chat | ( | mrmailbox_t * | -mailbox | ) | +mailbox, | +
+ | uint32_t | +chat_id, | +||||
+ | + | int | +archive | +|||
+ | ) | +
Returns the message IDs of all fresh messages of any chat.
-Typically used for implementing notification summaries. The result must be free()'d.
+Archive or unarchive a chat.
+Archived chats are not included in the default chatlist returned by mrmailbox_get_chatlist(). Instead, if there are any archived chats, the pseudo-chat with the chat_id MR_CHAT_ID_ARCHIVED_LINK will be added the the end of the chatlist.
+To get a list of archived chats, use mrmailbox_get_chatlist() with the flag MR_GCL_ARCHIVED_ONLY.
+To find out the archived state of a given chat, use mrchat_t::m_archived
+Calling this function usually results in the event MR_EVENT_MSGS_CHANGED
mailbox | The mailbox object as returned from mrmailbox_new(). |
mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | The ID of the chat to archive or unarchive. |
archive | 1=archive chat, 0=unarchive chat, all other values are reserved for future use |
char * mrmailbox_get_info | +void mrmailbox_delete_chat | ( | mrmailbox_t * | -mailbox | ) | +mailbox, | +
+ | uint32_t | +chat_id | +||||
+ | ) | +
Get information about the mailbox.
-The information is returned by a multi-line string and contains information about the current configuration and the last log entries.
+Delete a chat.
+Messages are deleted from the device and the chat database entry is deleted. After that, the event MR_EVENT_MSGS_CHANGED is posted.
+Things that are not done implicitly:
+mailbox | Mailbox object as returned by mrmailbox_new(). |
mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | The ID of the chat to delete. |
uint32_t mrmailbox_send_text_msg | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +chat_id, | +
+ | + | const char * | +text_to_send | +
+ | ) | ++ |
Send a simple text message to the given chat.
+Sends the event MR_EVENT_MSGS_CHANGED on succcess. However, this does not imply, the message really reached the recipient - sending may be delayed eg. due to network problems. However, from your view, you're done with the message. Sooner or later it will find its way.
+To send messages of other types, see mrmailbox_send_msg().
+mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | Chat ID to send the message to. |
text_to_send | Text to send to the chat defined by the chat ID. |
uint32_t mrmailbox_send_msg | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +chat_id, | +
+ | + | mrmsg_t * | +msg | +
+ | ) | ++ |
Send a message of any type to a chat.
+The given message object is not unref'd by the function but some fields are set up.
+Sends the event MR_EVENT_MSGS_CHANGED on succcess. However, this does not imply, the message really reached the recipient - sending may be delayed eg. due to network problems. However, from your view, you're done with the message. Sooner or later it will find its way.
+To send a simple text message, you can also use mrmailbox_send_text_msg() which is easier to use.
+mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | Chat ID to send the message to. |
msg | Message object to send to the chat defined by the chat ID. The function does not take ownership of the object, so you have to free it using mrmsg_unref() as usual. |
Examples:
+uint32_t mrmailbox_create_group_chat | +( | +mrmailbox_t * | +mailbox, | +
+ | + | const char * | +chat_name | +
+ | ) | ++ |
Create a new group chat.
+After creation, the group has one member with the ID MR_CONTACT_ID_SELF and is in unpromoted state. This means, you can add or remove members, change the name, the group image and so on without messages being send to all group members.
+This changes as soon as the first message is sent to the group members and the group becomes promoted. After that, all changes are synced with all group members by sending status message.
+To check, if a chat is still unpromoted, you mrchat_get_unpromoted()
+mailbox | Mailbox object as created by mrmailbox_new(). |
chat_name | The name of the group chat to create. The name may be changed later using mrmailbox_set_chat_name(). To find out the name of a group later, see mrchat_t::m_name |
int mrmailbox_set_chat_name | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +chat_id, | +
+ | + | const char * | +new_name | +
+ | ) | ++ |
Set group name.
+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 MR_EVENT_CHAT_MODIFIED and MR_EVENT_MSGS_CHANGED if a status message was sent.
+chat_id | The chat ID to set the name for. Must be a group chat. |
new_name | New name of the group. |
mailbox | Mailbox object as created by mrmailbox_new(). |
int mrmailbox_set_chat_profile_image | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +chat_id, | +
+ | + | const char * | +new_image | +
+ | ) | ++ |
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 MR_EVENT_CHAT_MODIFIED and MR_EVENT_MSGS_CHANGED if a status message was sent.
+To find out the profile image of a chat, use mrchat_get_profile_image()
+mailbox | Mailbox object as created by mrmailbox_new(). |
chat_id | The chat ID to set the image for. |
new_image | Full path of the image to use as the group image. If you pass NULL here, the group image is deleted (for promoted groups, all members are informed about this change anyway). |
int mrmailbox_is_contact_in_chat | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +chat_id, | +
+ | + | uint32_t | +contact_id | +
+ | ) | ++ |
Check if a given contact ID is a member of a group chat.
+mailbox | Mailbox object as created by mrmailbox_new(). |
chat_id | The chat ID to check. |
contact_id | The contact ID to check. To check if yourself is member of the chat, pass MR_CONTACT_ID_SELF (1) here. |
int mrmailbox_add_contact_to_chat | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +chat_id, | +
+ | + | uint32_t | +contact_id | +
+ | ) | ++ |
Add a member to a group.
+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 MR_EVENT_CHAT_MODIFIED and MR_EVENT_MSGS_CHANGED if a status message was sent.
+mailbox | Mailbox object as created by mrmailbox_new(). |
chat_id | The chat ID to add the contact to. Must be a group chat. |
contact_id | The contact ID to add to the chat. |
int mrmailbox_remove_contact_from_chat | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +chat_id, | +
+ | + | uint32_t | +contact_id | +
+ | ) | ++ |
Remove a member from a group.
+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 MR_EVENT_CHAT_MODIFIED and MR_EVENT_MSGS_CHANGED if a status message was sent.
+mailbox | Mailbox object as created by mrmailbox_new(). |
chat_id | The chat ID to remove the contact from. Must be a group chat. |
contact_id | The contact ID to remove from the chat. |
uint32_t mrmailbox_create_contact | +( | +mrmailbox_t * | +mailbox, | +
+ | + | const char * | +name, | +
+ | + | const char * | +addr | +
+ | ) | ++ |
Add a single contact.
+We assume, the contact name, if any, is entered by the user and is used "as is" therefore, mrcontact_normalize_name() is not called for the name.
+To add a number of contacts, see mrmailbox_add_address_book()
+mailbox | The mailbox object as created by mrmailbox_new(). |
name | Name of the contact to add. If you do not know the name belonging to the address, you can give NULL here. |
addr | E-mail-address of the contact to add. If the email address already exists, the name is updated and the origin is increased to "manually created". |
int mrmailbox_add_address_book | +( | +mrmailbox_t * | +mailbox, | +
+ | + | const char * | +adr_book | +
+ | ) | ++ |
Add a number of contacts.
+Typically used to add the whole address book from the OS. As names here are typically not well formatted, we call mrcontact_normalize_name() for each name given.
+To add a single contact entered by the user, you should prefer mrmailbox_create_contact()
+mailbox | the mailbox object as created by mrmailbox_new(). |
adr_book | A multi-line string in the format in the format Name one\nAddress one\nName two\Address two . If an email address already exists, the name is updated and the origin is increased to "manually created". |
mrarray_t * mrmailbox_get_blocked_contacts | +( | +mrmailbox_t * | +mailbox | ) | ++ |
Get blocked contacts.
+mailbox | The mailbox object as created by mrmailbox_new(). |
int mrmailbox_get_blocked_count | +( | +mrmailbox_t * | +mailbox | ) | ++ |
Get the number of blocked contacts.
+mailbox | The mailbox object as created by mrmailbox_new(). |
mrcontact_t * mrmailbox_get_contact | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +contact_id | +
+ | ) | ++ |
Get a single contact object.
+For a list, see eg. mrmailbox_get_known_contacts().
+mailbox | The mailbox object as created by mrmailbox_new(). |
contact_id | ID of the contact to get the object for. |
void mrmailbox_marknoticed_contact | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +contact_id | +
+ | ) | ++ |
Mark all messages send by the given contact as noticed.
+See also mrmailbox_marknoticed_chat() and mrmailbox_markseen_msgs()
+mailbox | The mailbox object as created by mrmmailbox_new() |
contact_id | The contact ID of which all messages should be marked as noticed. |
void mrmailbox_block_contact | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +contact_id, | +
+ | + | int | +new_blocking | +
+ | ) | ++ |
Block or unblock a contact.
+May result in a MR_EVENT_CONTACTS_CHANGED event.
+mailbox | The mailbox object as created by mrmailbox_new(). |
contact_id | The ID of the contact to block or unblock. |
new_blocking | 1=block contact, 0=unblock contact |
char * mrmailbox_get_contact_encrinfo | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +contact_id | +
+ | ) | ++ |
Get encryption info for a contact.
+Get a multi-line encryption info, containing your fingerprint and the fingerprint of the contact, used eg. to compare the fingerprints for a simple out-of-band verification.
+mailbox | The mailbox object as created by mrmailbox_new(). |
contact_id | ID of the contact to get the encryption info for. |
int mrmailbox_delete_contact | +( | +mrmailbox_t * | +mailbox, | +
+ | + | uint32_t | +contact_id | +
+ | ) | ++ |
Delete a contact.
+The contact is deleted from the local device. It may happen that this is not possible as the contact is in used. In this case, the contact can be blocked.
+mailbox | The mailbox object as created by mrmailbox_new(). |
contact_id | ID of the contact to delete. |
uint32_t mrmailbox_get_next_media | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -curr_msg_id, | -
- | - | int | -dir | -
- | ) | -- |
Returns all message IDs of the given types in a chat.
-Typically used to show a gallery. The result must be mrarray_unref()'d
-mailbox | The mailbox object as returned from mrmailbox_new(). |
curr_msg_id | This is the current (image) message displayed. |
dir | 1=get the next (image) message, -1=get the previous one. |
int mrmailbox_get_total_msg_count | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id | -
- | ) | -- |
Get the total number of messages in a chat.
-mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | The ID of the chat to count the messages for. |
char * mrmailbox_get_version_str | -( | -void | -) | -- |
Find out the version of the Delta Chat core library.
-major.minor.revision
. The return value must be free()'d. void mrmailbox_heartbeat | -( | -mrmailbox_t * | -ths | ) | -- |
Stay alive.
-The library tries itself to stay alive. For this purpose there is an additional "heartbeat" thread that checks if the IDLE-thread is up and working. This check is done about every minute. However, depending on the operating system, this thread may be delayed or stopped, if this is the case you can force additional checks manually by just calling mrmailbox_heartbeat() about every minute. If in doubt, call this function too often, not too less :-)
- -void mrmailbox_imex | -( | -mrmailbox_t * | -mailbox, | -
- | - | int | -what, | -
- | - | const char * | -param1, | -
- | - | const char * | -setup_code | -
- | ) | -- |
Import/export things.
-mrmailbox_imex() imports and exports export keys, backup etc. Function, sends MR_EVENT_IMEX_* events. To avoid double slashes, the given directory should not end with a slash. what to export is defined by a MR_IMEX_* constant.
-mailbox | Mailbox object as created by mrmailbox_new(). |
what | One of the MR_IMEX_* constants. |
param1 | Meaning depends on the MR_IMEX_* constants. |
setup_code | Setup-code to encrypt/decrypt data. |
char * mrmailbox_imex_has_backup | -( | -mrmailbox_t * | -mailbox, | -
- | - | const char * | -dir_name | -
- | ) | -- |
Check if there is a backup file.
-May only be used on fresh installations (mrmailbox_is_configured() returns 0).
-mailbox | Mailbox object as created by mrmailbox_new(). |
dir_name | Directory to search backups in. |
int mrmailbox_is_configured | -( | -mrmailbox_t * | -mailbox | ) | -- |
Check if the mailbox is already configured.
-Typically, for unconfigured mailboxes, the user is prompeted for to enter some settings and mrmailbox_configure_and_connect() is called in a thread then.
-mailbox | The mailbox object as created by mrmailbox_new(). |
int mrmailbox_is_contact_in_chat | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id, | -
- | - | uint32_t | -contact_id | -
- | ) | -- |
Check if a given contact ID is a member of a group chat.
-mailbox | Mailbox object as created by mrmailbox_new(). |
chat_id | The chat ID to check. |
contact_id | The contact ID to check. To check if yourself is member of the chat, pass MR_CONTACT_ID_SELF (1) here. |
int mrmailbox_is_open | -( | -const mrmailbox_t * | -mailbox | ) | -- |
Check if the mailbox database is open.
-mailbox | the mailbox object as created by mrmailbox_new(). |
void mrmailbox_marknoticed_chat | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id | -
- | ) | -- |
Mark all message in a chat as noticed.
-Noticed messages are no longer fresh and do not count as being unseen. IMAP/MDNs is not done for noticed messages. See also mrmailbox_marknoticed_contact() and mrmailbox_markseen_msgs()
-mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | The chat ID of which all messages should be marked as being noticed. |
void mrmailbox_marknoticed_contact | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -contact_id | -
- | ) | -- |
Mark all messages send by the given contact as noticed.
-See also mrmailbox_marknoticed_chat() and mrmailbox_markseen_msgs()
-mailbox | The mailbox object as created by mrmmailbox_new() |
contact_id | The contact ID of which all messages should be marked as noticed. |
void mrmailbox_markseen_msgs | +void mrmailbox_forward_msgs | ( | mrmailbox_t * | mailbox, | @@ -2050,7 +2254,13 @@ Public Attributesint | -msg_cnt | +msg_cnt, | + +
+ | + | uint32_t | +chat_id | |
@@ -2060,519 +2270,18 @@ Public Attributes |
Mark a message as seen, updates the IMAP state and sends MDNs.
-if the message is not in a real chat (eg. a contact request), the message is only marked as NOTICED and no IMAP/MDNs is done. See also mrmailbox_marknoticed_chat() and mrmailbox_marknoticed_contact()
+Forward messages to another chat.
mailbox | The mailbox object. |
msg_ids | an array of uint32_t containing all the messages IDs that should be marked as seen. |
msg_cnt | The number of message IDs in msg_ids. |
mailbox | the mailbox object as created by mrmailbox_new() |
msg_ids | an array of uint32_t containing all message IDs that should be forwarded |
msg_cnt | the number of messages IDs in the msg_ids array |
chat_id | The destination chat ID. |
mrmailbox_t * mrmailbox_new | -( | -mrmailboxcb_t | -cb, | -
- | - | void * | -userdata, | -
- | - | const char * | -os_name | -
- | ) | -- |
Create a new mailbox object.
-After creation it is usually opened, connected and mails are fetched. After usage, the object should be deleted using mrmailbox_unref().
-cb | a callback function that is called for events (update, state changes etc.) and to get some information form the client (eg. translation for a given string). See mrevent.h for a list of possible events that may be passed to the callback.
|
userdata | can be used by the client for any purpuse. He finds it later in mrmailbox__t::m_userdata(). |
os_name | is only for decorative use and is shown eg. in the X-Mailer header in the form "Delta Chat <version> for <osName>" |
int mrmailbox_open | -( | -mrmailbox_t * | -mailbox, | -
- | - | const char * | -dbfile, | -
- | - | const char * | -blobdir | -
- | ) | -- |
Open mailbox database.
-If the given file does not exist, it is created and can be set up using mrmailbox_set_config() afterwards.
-mailbox | the mailbox object as created by mrmailbox_new |
dbfile | the file to use to store the database, sth. like "~/file" won't work on all systems, if in doubt, use absolute paths. You can find the file path later in mrmailbox_t::m_dbfile |
blobdir | a directory to store the blobs in, the trailing slash is added by us, so if you want to avoid double slashes, do not add one. If you give NULL as blobdir, dbfile-blobs is used in the same directory as dbfile will be created in. You can find the path to the blob direcrory later in mrmailbox_t::m_blobdir |
int mrmailbox_remove_contact_from_chat | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id, | -
- | - | uint32_t | -contact_id | -
- | ) | -- |
Remove a member from a group.
-If the group is already promoted (any message was sent to the group), all group members are informed by a special message that is sent automatically by this function.
-mailbox | Mailbox object as created by mrmailbox_new(). |
chat_id | The chat ID to remove the contact from. Must be a group chat. |
contact_id | The contact ID to remove from the chat. |
mrarray_t * mrmailbox_search_msgs | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id, | -
- | - | const char * | -query | -
- | ) | -- |
Search messages containing the given query string.
-Searching can be done globally (chat_id=0) or in a specified chat only (chat_id set).
-Global chat results are typically displayed using mrmsg_get_summary(), chat search results may just hilite the corresponding messages and present a prev/next button.
-mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | ID of the chat to search messages in. Set this to 0 for a global search. |
query | The query to search for. |
uint32_t mrmailbox_send_msg | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id, | -
- | - | mrmsg_t * | -msg | -
- | ) | -- |
Send a message of any type to a chat.
-The given message object is not unref'd by the function but some fields are set up.
-Sends the event MR_EVENT_MSGS_CHANGED on succcess. However, this does not imply, the message really reached the recipient - sending may be delayed eg. due to network problems. However, from your view, you're done with the message. Sooner or later it will find its way.
-To send a simple text message, you can also use mrmailbox_send_text_msg() which is easier to use.
-mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | Chat ID to send the message to. |
msg | Message object to send to the chat defined by the chat ID. The function does not take ownership of the object, so you have to free it using mrmsg_unref() as usual. |
Examples:
-uint32_t mrmailbox_send_text_msg | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id, | -
- | - | const char * | -text_to_send | -
- | ) | -- |
Send a simple text message to the given chat.
-Sends the event MR_EVENT_MSGS_CHANGED on succcess. However, this does not imply, the message really reached the recipient - sending may be delayed eg. due to network problems. However, from your view, you're done with the message. Sooner or later it will find its way.
-To send messages of other types, see mrmailbox_send_msg().
-mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | Chat ID to send the message to. |
text_to_send | Text to send to the chat defined by the chat ID. |
int mrmailbox_set_chat_image | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id, | -
- | - | const char * | -new_image | -
- | ) | -- |
Set group image.
-If the group is already promoted (any message was sent to the group), all group members are informed by a special message that is sent automatically by this function.
-mailbox | Mailbox object as created by mrmailbox_new(). |
chat_id | The chat ID to set the image for. |
new_image | Full path of the image to use as the group image. If you pass NULL here, the group image is deleted (for promoted groups, all members are informed about this change anyway). |
int mrmailbox_set_chat_name | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id, | -
- | - | const char * | -new_name | -
- | ) | -- |
Set group name.
-If the group is already promoted (any message was sent to the group), all group members are informed by a special message that is sent automatically by this function.
-chat_id | The chat ID to set the name for. Must be a group chat. |
new_name | New name of the group. |
mailbox | Mailbox object as created by mrmailbox_new(). |
int mrmailbox_set_config | -( | -mrmailbox_t * | -ths, | -
- | - | const char * | -key, | -
- | - | const char * | -value | -
- | ) | -- |
Configure the mailbox.
-The configuration is handled by key=value pairs. Typical configuration options are:
-ths | the mailbox object |
key | the option to change, typically one of the strings listed above |
value | the value to save for "key" |
int mrmailbox_set_config_int | -( | -mrmailbox_t * | -ths, | -
- | - | const char * | -key, | -
- | - | int32_t | -value | -
- | ) | -- |
Configure the mailbox.
-Similar to mrmailbox_set_config() but sets an integer instead of a string. If there is already a key with a string set, this is overwritten by the given integer value.
- -void mrmailbox_set_draft | -( | -mrmailbox_t * | -mailbox, | -
- | - | uint32_t | -chat_id, | -
- | - | const char * | -msg | -
- | ) | -- |
Save a draft for a chat.
-To get the draft for a given chat ID, use mrchat_t::m_draft_text
-mailbox | The mailbox object as returned from mrmailbox_new(). |
chat_id | The chat ID to save the draft for. |
msg | The message text to save as a draft. |
void mrmailbox_unref | +void mrmailbox_delete_msgs | +( | +mrmailbox_t * | +mailbox, | +
+ | + | const uint32_t * | +msg_ids, | +|
+ | + | int | +msg_cnt | +|
+ | ) | ++ |
Delete messages.
+The messages are deleted on the current device and on the IMAP server.
+mailbox | the mailbox object as created by mrmailbox_new() |
msg_ids | an array of uint32_t containing all message IDs that should be deleted |
msg_cnt | the number of messages IDs in the msg_ids array |
void mrmailbox_markseen_msgs | +( | +mrmailbox_t * | +mailbox, | +
+ | + | const uint32_t * | +msg_ids, | +
+ | + | int | +msg_cnt | +
+ | ) | ++ |
Mark a message as seen, updates the IMAP state and sends MDNs.
+if the message is not in a real chat (eg. a contact request), the message is only marked as NOTICED and no IMAP/MDNs is done. See also mrmailbox_marknoticed_chat() and mrmailbox_marknoticed_contact()
+mailbox | The mailbox object. |
msg_ids | an array of uint32_t containing all the messages IDs that should be marked as seen. |
msg_cnt | The number of message IDs in msg_ids. |
int mrmailbox_configure_and_connect | ( | mrmailbox_t * | mailbox | ) | @@ -2640,31 +2437,241 @@ Public Attributes
Free a mailbox object.
-If app runs can only be terminated by a forced kill, this may be superfluous.
+Configure and connect a mailbox.
+addr
and mail_pw
using mrmailbox_set_config().mailbox | the mailbox object as created by mrmailbox_new(). |
There is no need to call this every program start, the result is saved in the database. Instead, you can use mrmailbox_connect() which reuses the configuration and is much faster:
+char* mrmailbox_t::m_blobdir | +void mrmailbox_configure_cancel | +( | +mrmailbox_t * | +mailbox | ) | +
Full path of the blob directory.
-This is the directory given to mrmailbox_new() or a directory in the same directory as mrmailbox_t::m_dbfile.
+Signal the configure-process to stop.
+After that, mrmailbox_configure_cancel() returns without waiting for mrmailbox_configure_and_connect() to return.
+mrmailbox_configure_and_connect() will return ASAP then, however, it may still take a moment. If in doubt, the caller may also decide the kill the thread after a few seconds; eg. the configuration process may hang in a function not under the control of the core (eg. MR_EVENT_HTTP_GET). Another reason for mrmailbox_configure_cancel() not to wait is that otherwise it would be GUI-blocking and should be started in another thread then; this would make things even more complicated.
+mailbox | The mailbox object as created by mrmailbox_new() |
int mrmailbox_is_configured | +( | +mrmailbox_t * | +mailbox | ) | ++ |
Check if the mailbox is already configured.
+Typically, for unconfigured mailboxes, the user is prompeted for to enter some settings and mrmailbox_configure_and_connect() is called in a thread then.
+mailbox | The mailbox object as created by mrmailbox_new(). |
char * mrmailbox_imex_has_backup | +( | +mrmailbox_t * | +mailbox, | +
+ | + | const char * | +dir_name | +
+ | ) | ++ |
Check if there is a backup file.
+May only be used on fresh installations (mrmailbox_is_configured() returns 0).
+mailbox | Mailbox object as created by mrmailbox_new(). |
dir_name | Directory to search backups in. |
void mrmailbox_imex | +( | +mrmailbox_t * | +mailbox, | +
+ | + | int | +what, | +
+ | + | const char * | +param1, | +
+ | + | const char * | +setup_code | +
+ | ) | ++ |
Import/export things.
+mrmailbox_imex() imports and exports export keys, backup etc. Function, sends MR_EVENT_IMEX_* events. To avoid double slashes, the given directory should not end with a slash. what to export is defined by a MR_IMEX_* constant.
+mailbox | Mailbox object as created by mrmailbox_new(). |
what | One of the MR_IMEX_* constants. |
param1 | Meaning depends on the MR_IMEX_* constants. |
setup_code | Setup-code to encrypt/decrypt data. |
int mrmailbox_check_password | +( | +mrmailbox_t * | +mailbox, | +
+ | + | const char * | +test_pw | +
+ | ) | ++ |
Check if the user is authorized by the given password in some way.
+This is to promt for the password eg. before exporting keys/backup.
+mailbox | Mailbox object as created by mrmailbox_new(). |
test_pw | Password to check. |
char * mrmailbox_create_setup_code | +( | +mrmailbox_t * | +mailbox | ) | ++ |
Create random setup code.
+The created "Autocrypt Level 1" setup code has the following form:
+Linebreaks and spaces are not added to the setup code, but the "-" are. Should be given to mrmailbox_imex() for encryption, should be wiped and free()'d after usage.
+mailbox | Mailbox object as created by mrmailbox_new(). |
void* mrmailbox_t::m_userdata | +
Use data, may be used for any purpose.
+The same pointer as given to mrmailbox_new(), may be used by the caller for any purpose.
void* mrmailbox_t::m_userdata | +char* mrmailbox_t::m_blobdir |
Use data, may be used for any purpose.
-The same pointer as given to mrmailbox_new(), may be used by the caller for any purpose.
+Full path of the blob directory.
+This is the directory given to mrmailbox_new() or a directory in the same directory as mrmailbox_t::m_dbfile.
@@ -187,6 +189,51 @@ Public Attributes |
mrmsg_t * mrmsg_new | +( | +) | ++ |
Create new message object.
+Message objects are needed eg. for sending messages using mrmailbox_send_msg(). Moreover, they are returned eg. from mrmailbox_get_msg(), set up with the current state of a message. The message object is not updated; to achieve this, you have to recreate it.
+void mrmsg_unref | +( | +mrmsg_t * | +msg | ) | ++ |
Free an mrmsg_t object created eg.
+by mrmsg_new() or mrmailbox_get_msg(). This also free()s all strings; so if you set up the object yourself, make sure to use strdup()!
+msg | The message object to free. |
void mrmsg_set_type | +( | +mrmsg_t * | +msg, | +
+ | + | int | +type | +
+ | ) | ++ |
Set the type of a message.
+See mrmailbox_send_msg() for some examples.
+msg | The message object to modify. |
type | Type to set for the message. Possible types are MR_MSG_TEXT (10), MR_MSG_IMAGE (20), MR_MSG_GIF (21), MR_MSG_AUDIO (40), MR_MSG_VOICE (41), MR_MSG_VIDEO (50) or MR_MSG_FILE (60). |
void mrmsg_set_text | +( | +mrmsg_t * | +msg, | +
+ | + | const char * | +text | +
+ | ) | ++ |
Set the text of a message object.
+The text is not modified in the database, this function is only a helper to set up a message object to be sent afterwards. The type of the message object is not changed implicitly to MR_MSG_TEXT when using this function. Previously set texts are free()'d.
+msg | Message to set the text for. |
text | Text to set. The function creates a copy of the given text so that it can be free()'d just after this function is called. |
void mrmsg_set_file | +( | +mrmsg_t * | +msg, | +
+ | + | const char * | +file | +
+ | ) | ++ |
Set the file belonging to a message.
+The file may be an image, a video, an audio file, an PDF and so on. This function is a shortcut for mrparam_set(msg->m_param, MRP_FILE, file)
+msg | The message object to modify. |
file | Path, filename and extension to set for the given message. |
int mrmsg_get_type | +( | +mrmsg_t * | +msg | ) | ++ |
Get the type of the message.
+msg | The message object. |
int mrmsg_get_state | +( | +mrmsg_t * | +msg | ) | ++ |
Get the state of a message.
+Incoming message states:
Outgoing message states:
The state of just created message objects is MR_STATE_UNDEFINED (0). The state is always set by the core-library, users of the library cannot set the state directly, but it is changed implicitly eg. when calling mrmailbox_marknoticed_chat() or mrmailbox_markseen_msgs().
+msg | The message object. |
char * mrmsg_get_text | +( | +mrmsg_t * | +msg | ) | ++ |
Get the text of the message.
+msg | The message object. |
char * mrmsg_get_filename | +( | +mrmsg_t * | +msg | ) | ++ |
Get base file name without path.
+The base file name includes the extension; the path is not returned. To get the full path, use mrmsg_get_file().
+msg | the message object |
int mrmsg_get_state | -( | -mrmsg_t * | -msg | ) | -- |
Get the state of a message.
-Incoming message states:
Outgoing message states:
The state of just created message objects is MR_STATE_UNDEFINED (0). The state is always set by the core-library, users of the library cannot set the state directly, but it is changed implicitly eg. when calling mrmailbox_marknoticed_chat() or mrmailbox_markseen_msgs().
-msg | The message object. |
char * mrmsg_get_text | -( | -mrmsg_t * | -msg | ) | -- |
Get the text of the message.
-msg | The message object. |
int mrmsg_get_type | -( | -mrmsg_t * | -msg | ) | -- |
Get the type of the message.
-msg | The message object. |
Check if a message is still in creation.
-The user can mark files as being in creation by simply creating a file <filename>.increation
. If <filename>
is created then, the user should just delete <filename>.increation
The user can mark files as being in creation by simply creating a file <filename>.increation
. If <filename>
is created then, the user should just delete <filename>.increation
.
Typically, this is used for videos that should be recoded by the user before they can be sent.
msg | the message object |
mrmsg_t * mrmsg_new | -( | -) | -- |
Create new message object.
-Message objects are needed eg. for sending messages using mrmailbox_send_msg(). Moreover, they are returned eg. from mrmailbox_get_msg(), set up with the current state of a message. The message object is not updated; to achieve this, you have to recreate it.
-void mrmsg_set_file | -( | -mrmsg_t * | -msg, | -
- | - | const char * | -file | -
- | ) | -- |
Set the file belonging to a message.
-The file may be an image, a video, an audio file, an PDF and so on. This function is a shortcut for mrparam_set(msg->m_param, MRP_FILE, file)
-msg | The message object to modify. |
file | Path, filename and extension to set for the given message. |
void mrmsg_set_text | -( | -mrmsg_t * | -msg, | -
- | - | const char * | -text | -
- | ) | -- |
Set the text of a message object.
-The text is not modified in the database, this function is only a helper to set up a message object to be sent afterwards. The type of the message object is not changed implicitly to MR_MSG_TEXT when using this function. Previously set texts are free()'d.
-msg | Message to set the text for. |
text | Text to set. The function creates a copy of the given text so that it can be free()'d just after this function is called. |
void mrmsg_set_type | -( | -mrmsg_t * | -msg, | -
- | - | int | -type | -
- | ) | -- |
Set the type of a message.
-See mrmailbox_send_msg() for some examples.
-msg | The message object to modify. |
type | Type to set for the message. Possible types are MR_MSG_TEXT (10), MR_MSG_IMAGE (20), MR_MSG_GIF (21), MR_MSG_AUDIO (40), MR_MSG_VOICE (41), MR_MSG_VIDEO (50) or MR_MSG_FILE (60). |
void mrmsg_unref | +void mrmsg_save_param_to_disk | ( | mrmsg_t * | msg | ) | @@ -622,11 +677,11 @@ Public Attributes
Free an mrmsg_t object created eg.
-by mrmsg_new() or mrmailbox_get_msg(). This also free()s all strings; so if you set up the object yourself, make sure to use strdup()!
+Add additional, persistent information to a message record.
+Normally, this function is not needed; message records are created by mrmailbox_send_msg() or mrmailbox_send_text_msg() and modified by actions of the user. However, for rare cases, it might be necessary to save an paramter later to disk. For this purpose, use this function.
msg | The message object to free. |
msg | The message object. |
uint32_t mrmsg_t::m_chat_id | -
Chat ID the message belongs to.
-0 if unset. See mrchat_t::m_id for special IDs. Use mrmailbox_get_chat() to load details about the chat.
- -uint32_t mrmsg_t::m_from_id | -
Contact ID of the sender.
-0 if unset. See mrcontact_t::m_id for special IDs. Use mrmailbox_get_contact() to load details about this contact.
- -int mrmsg_t::m_is_msgrmsg | +uint32_t mrmsg_t::m_from_id |
Set to 1 if the message was sent by another messenger.
-0 otherwise.
+Contact ID of the sender.
+0 if unset. See mrcontact_t::m_id for special IDs. Use mrmailbox_get_contact() to load details about this contact.
mrparam_t* mrmsg_t::m_param | +uint32_t mrmsg_t::m_to_id |
Additional paramter for the message.
-MRP_FILE, MRP_WIDTH, MRP_HEIGHT etc. depends on the type. Never a NULL-pointer.
+Contact ID of the recipient.
+0 if unset. See mrcontact_t::m_id for special IDs. Use mrmailbox_get_contact() to load details about this contact.
int mrmsg_t::m_starred | +uint32_t mrmsg_t::m_chat_id |
Starred-state of the message.
-0=no, 1=yes.
+Chat ID the message belongs to.
+0 if unset. See mrchat_t::m_id for special IDs. Use mrmailbox_get_chat() to load details about the chat.
+ +time_t mrmsg_t::m_timestamp | +
Unix time the message was sended or received.
+0 if unset.
+ +int mrmsg_t::m_type | +
Message type.
+It is recommended to use mrmsg_set_type() and mrmsg_get_type() to access this field.
time_t mrmsg_t::m_timestamp | +mrparam_t* mrmsg_t::m_param |
Unix time the message was sended or received.
-0 if unset.
+Additional paramter for the message.
+MRP_FILE, MRP_WIDTH, MRP_HEIGHT etc. depends on the type. Never a NULL-pointer.
uint32_t mrmsg_t::m_to_id | +int mrmsg_t::m_starred |
Contact ID of the recipient.
-0 if unset. See mrcontact_t::m_id for special IDs. Use mrmailbox_get_contact() to load details about this contact.
+Starred-state of the message.
+0=no, 1=yes.
int mrmsg_t::m_type | +int mrmsg_t::m_is_msgrmsg |
Message type.
-It is recommended to use mrmsg_set_type() and mrmsg_get_type() to access this field.
+Set to 1 if the message was sent by another messenger.
+0 otherwise.
int mrpoortext_t::m_state | -
Typically a MR_MSG_STATE_* constant.
-May be 0.
- -char* mrpoortext_t::m_text1 | -
The meaning is defined by m_text1_meaning and by the creator of the object.
-May be NULL.
- -char* mrpoortext_t::m_text1 | +
The meaning is defined by m_text1_meaning and by the creator of the object.
+May be NULL.
+Typically a message timestamp.
The concrete meaning is defined by the creator of the object. May be 0.
+ + + +int mrpoortext_t::m_state | +
Typically a MR_MSG_STATE_* constant.
+May be 0.
+