Delta Chat Core C Interface
Loading...
Searching...
No Matches
deltachat.h
1#ifndef __DELTACHAT_H__
2#define __DELTACHAT_H__
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7
8#ifndef PY_CFFI
9#include <stdint.h>
10#include <time.h>
11#endif
12
13
14typedef struct _dc_context dc_context_t;
15typedef struct _dc_accounts dc_accounts_t;
16typedef struct _dc_array dc_array_t;
17typedef struct _dc_chatlist dc_chatlist_t;
18typedef struct _dc_chat dc_chat_t;
19typedef struct _dc_msg dc_msg_t;
20typedef struct _dc_reactions dc_reactions_t;
21typedef struct _dc_contact dc_contact_t;
22typedef struct _dc_lot dc_lot_t;
23typedef struct _dc_provider dc_provider_t;
24typedef struct _dc_event dc_event_t;
25typedef struct _dc_event_emitter dc_event_emitter_t;
26typedef struct _dc_jsonrpc_instance dc_jsonrpc_instance_t;
27typedef struct _dc_backup_provider dc_backup_provider_t;
28
29// Alias for backwards compatibility, use dc_event_emitter_t instead.
30typedef struct _dc_event_emitter dc_accounts_event_emitter_t;
31
248// create/open/config/information
249
265dc_context_t* dc_context_new (const char* os_name, const char* dbfile, const char* blobdir);
266
267
284
285
300int dc_context_open (dc_context_t *context, const char* passphrase);
301
302
313int dc_context_change_passphrase (dc_context_t* context, const char* passphrase);
314
315
324
325
338
339
351uint32_t dc_get_id (dc_context_t* context);
352
353
370
371
380char* dc_get_blobdir (const dc_context_t* context);
381
382
534int dc_set_config (dc_context_t* context, const char* key, const char* value);
535
536
562char* dc_get_config (dc_context_t* context, const char* key);
563
564
576int dc_set_stock_translation(dc_context_t* context, uint32_t stock_id, const char* stock_msg);
577
578
593int dc_set_config_from_qr (dc_context_t* context, const char* qr);
594
595
610char* dc_get_info (const dc_context_t* context);
611
612
642char* dc_get_oauth2_url (dc_context_t* context, const char* addr, const char* redirect_uri);
643
644
645#define DC_CONNECTIVITY_NOT_CONNECTED 1000
646#define DC_CONNECTIVITY_CONNECTING 2000
647#define DC_CONNECTIVITY_WORKING 3000
648#define DC_CONNECTIVITY_CONNECTED 4000
649
650
672
673
690
691
696int dc_all_work_done (dc_context_t* context);
697
698
699// connect
700
752
753
773int dc_is_configured (const dc_context_t* context);
774
775
786void dc_start_io (dc_context_t* context);
787
803
827
828
829
848int dc_preconfigure_keypair (dc_context_t* context, const char *addr, const char *public_data, const char *secret_data);
849
850
851// handle chatlists
852
853#define DC_GCL_ARCHIVED_ONLY 0x01
854#define DC_GCL_NO_SPECIALS 0x02
855#define DC_GCL_ADD_ALLDONE_HINT 0x04
856#define DC_GCL_FOR_FORWARDING 0x08
857
858
908dc_chatlist_t* dc_get_chatlist (dc_context_t* context, int flags, const char* query_str, uint32_t query_id);
909
910
911// handle chats
912
926uint32_t dc_create_chat_by_contact_id (dc_context_t* context, uint32_t contact_id);
927
928
940uint32_t dc_get_chat_id_by_contact_id (dc_context_t* context, uint32_t contact_id);
941
942
988uint32_t dc_prepare_msg (dc_context_t* context, uint32_t chat_id, dc_msg_t* msg);
989
990
1028uint32_t dc_send_msg (dc_context_t* context, uint32_t chat_id, dc_msg_t* msg);
1029
1045uint32_t dc_send_msg_sync (dc_context_t* context, uint32_t chat_id, dc_msg_t* msg);
1046
1047
1067uint32_t dc_send_text_msg (dc_context_t* context, uint32_t chat_id, const char* text_to_send);
1068
1069
1103uint32_t dc_send_videochat_invitation (dc_context_t* context, uint32_t chat_id);
1104
1105
1121uint32_t dc_send_reaction (dc_context_t* context, uint32_t msg_id, char *reaction);
1122
1123
1134
1135
1163int dc_send_webxdc_status_update (dc_context_t* context, uint32_t msg_id, const char* json, const char* descr);
1164
1165
1196char* dc_get_webxdc_status_updates (dc_context_t* context, uint32_t msg_id, uint32_t serial);
1197
1221void dc_set_draft (dc_context_t* context, uint32_t chat_id, dc_msg_t* msg);
1222
1223
1271uint32_t dc_add_device_msg (dc_context_t* context, const char* label, dc_msg_t* msg);
1272
1283int dc_was_device_msg_ever_added (dc_context_t* context, const char* label);
1284
1285
1298dc_msg_t* dc_get_draft (dc_context_t* context, uint32_t chat_id);
1299
1300
1301#define DC_GCM_ADDDAYMARKER 0x01
1302#define DC_GCM_INFO_ONLY 0x02
1303
1304
1325dc_array_t* dc_get_chat_msgs (dc_context_t* context, uint32_t chat_id, uint32_t flags, uint32_t marker1before);
1326
1327
1336int dc_get_msg_cnt (dc_context_t* context, uint32_t chat_id);
1337
1338
1356int dc_get_fresh_msg_cnt (dc_context_t* context, uint32_t chat_id);
1357
1358
1372
1373
1388int dc_estimate_deletion_cnt (dc_context_t* context, int from_server, int64_t seconds);
1389
1390
1410
1411
1435
1436
1460
1461
1475void dc_marknoticed_chat (dc_context_t* context, uint32_t chat_id);
1476
1477
1496dc_array_t* dc_get_chat_media (dc_context_t* context, uint32_t chat_id, int msg_type, int msg_type2, int msg_type3);
1497
1498
1520uint32_t dc_get_next_media (dc_context_t* context, uint32_t msg_id, int dir, int msg_type, int msg_type2, int msg_type3);
1521
1522
1534void dc_set_chat_visibility (dc_context_t* context, uint32_t chat_id, int visibility);
1535
1536
1562void dc_delete_chat (dc_context_t* context, uint32_t chat_id);
1563
1577void dc_block_chat (dc_context_t* context, uint32_t chat_id);
1578
1591void dc_accept_chat (dc_context_t* context, uint32_t chat_id);
1592
1615dc_array_t* dc_get_chat_contacts (dc_context_t* context, uint32_t chat_id);
1616
1627char* dc_get_chat_encrinfo (dc_context_t* context, uint32_t chat_id);
1628
1640uint32_t dc_get_chat_ephemeral_timer (dc_context_t* context, uint32_t chat_id);
1641
1664dc_array_t* dc_search_msgs (dc_context_t* context, uint32_t chat_id, const char* query);
1665
1666
1677dc_chat_t* dc_get_chat (dc_context_t* context, uint32_t chat_id);
1678
1679
1680// handle group chats
1681
1709uint32_t dc_create_group_chat (dc_context_t* context, int protect, const char* name);
1710
1711
1728
1729
1740int dc_is_contact_in_chat (dc_context_t* context, uint32_t chat_id, uint32_t contact_id);
1741
1742
1759int dc_add_contact_to_chat (dc_context_t* context, uint32_t chat_id, uint32_t contact_id);
1760
1761
1776int dc_remove_contact_from_chat (dc_context_t* context, uint32_t chat_id, uint32_t contact_id);
1777
1778
1793int dc_set_chat_name (dc_context_t* context, uint32_t chat_id, const char* name);
1794
1812int dc_set_chat_ephemeral_timer (dc_context_t* context, uint32_t chat_id, uint32_t timer);
1813
1833int dc_set_chat_profile_image (dc_context_t* context, uint32_t chat_id, const char* image);
1834
1835
1836
1858int dc_set_chat_mute_duration (dc_context_t* context, uint32_t chat_id, int64_t duration);
1859
1860// handle messages
1861
1874char* dc_get_msg_info (dc_context_t* context, uint32_t msg_id);
1875
1876
1924char* dc_get_msg_html (dc_context_t* context, uint32_t msg_id);
1925
1926
1946void dc_download_full_msg (dc_context_t* context, int msg_id);
1947
1948
1963char* dc_get_mime_headers (dc_context_t* context, uint32_t msg_id);
1964
1965
1975void dc_delete_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt);
1976
1977
1992void dc_forward_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt, uint32_t chat_id);
1993
1994
2011int dc_resend_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt);
2012
2013
2044void dc_markseen_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt);
2045
2046
2059dc_msg_t* dc_get_msg (dc_context_t* context, uint32_t msg_id);
2060
2061
2062// handle contacts
2063
2077int dc_may_be_valid_addr (const char* addr);
2078
2079
2093uint32_t dc_lookup_contact_id_by_addr (dc_context_t* context, const char* addr);
2094
2095
2116uint32_t dc_create_contact (dc_context_t* context, const char* name, const char* addr);
2117
2118
2119#define DC_GCL_VERIFIED_ONLY 0x01
2120#define DC_GCL_ADD_SELF 0x02
2121
2122
2146int dc_add_address_book (dc_context_t* context, const char* addr_book);
2147
2148
2165dc_array_t* dc_get_contacts (dc_context_t* context, uint32_t flags, const char* query);
2166
2167
2177
2178
2188
2189
2199void dc_block_contact (dc_context_t* context, uint32_t contact_id, int block);
2200
2201
2212char* dc_get_contact_encrinfo (dc_context_t* context, uint32_t contact_id);
2213
2214
2227int dc_delete_contact (dc_context_t* context, uint32_t contact_id);
2228
2229
2243dc_contact_t* dc_get_contact (dc_context_t* context, uint32_t contact_id);
2244
2245
2246// import/export and tools
2247
2248#define DC_IMEX_EXPORT_SELF_KEYS 1 // param1 is a directory where the keys are written to
2249#define DC_IMEX_IMPORT_SELF_KEYS 2 // param1 is a directory where the keys are searched in and read from
2250#define DC_IMEX_EXPORT_BACKUP 11 // param1 is a directory where the backup is written to, param2 is a passphrase to encrypt the backup
2251#define DC_IMEX_IMPORT_BACKUP 12 // param1 is the file with the backup to import, param2 is the backup's passphrase
2252
2253
2298void dc_imex (dc_context_t* context, int what, const char* param1, const char* param2);
2299
2300
2350char* dc_imex_has_backup (dc_context_t* context, const char* dir);
2351
2352
2398
2399
2420int dc_continue_key_transfer (dc_context_t* context, uint32_t msg_id, const char* setup_code);
2421
2422
2440
2441
2442// out-of-band verification
2443
2444#define DC_QR_ASK_VERIFYCONTACT 200 // id=contact
2445#define DC_QR_ASK_VERIFYGROUP 202 // text1=groupname
2446#define DC_QR_FPR_OK 210 // id=contact
2447#define DC_QR_FPR_MISMATCH 220 // id=contact
2448#define DC_QR_FPR_WITHOUT_ADDR 230 // test1=formatted fingerprint
2449#define DC_QR_ACCOUNT 250 // text1=domain
2450#define DC_QR_BACKUP 251
2451#define DC_QR_WEBRTC_INSTANCE 260 // text1=domain, text2=instance pattern
2452#define DC_QR_ADDR 320 // id=contact
2453#define DC_QR_TEXT 330 // text1=text
2454#define DC_QR_URL 332 // text1=URL
2455#define DC_QR_ERROR 400 // text1=error string
2456#define DC_QR_WITHDRAW_VERIFYCONTACT 500
2457#define DC_QR_WITHDRAW_VERIFYGROUP 502 // text1=groupname
2458#define DC_QR_REVIVE_VERIFYCONTACT 510
2459#define DC_QR_REVIVE_VERIFYGROUP 512 // text1=groupname
2460#define DC_QR_LOGIN 520 // text1=email_address
2461
2547dc_lot_t* dc_check_qr (dc_context_t* context, const char* qr);
2548
2549
2571char* dc_get_securejoin_qr (dc_context_t* context, uint32_t chat_id);
2572
2573
2586char* dc_get_securejoin_qr_svg (dc_context_t* context, uint32_t chat_id);
2587
2612uint32_t dc_join_securejoin (dc_context_t* context, const char* qr);
2613
2614
2615// location streaming
2616
2617
2634void dc_send_locations_to_chat (dc_context_t* context, uint32_t chat_id, int seconds);
2635
2636
2650int dc_is_sending_locations_to_chat (dc_context_t* context, uint32_t chat_id);
2651
2652
2680int dc_set_location (dc_context_t* context, double latitude, double longitude, double accuracy);
2681
2682
2743dc_array_t* dc_get_locations (dc_context_t* context, uint32_t chat_id, uint32_t contact_id, int64_t timestamp_begin, int64_t timestamp_end);
2744
2745
2757
2758
2773
2774
2787void dc_str_unref (char* str);
2788
2789
2819
2820
2839
2840
2855
2866
2881
2905int dc_receive_backup (dc_context_t* context, const char* qr);
2906
2956dc_accounts_t* dc_accounts_new (const char* dir, int writable);
2957
2958
2966
2967
2984
3001
3016uint32_t dc_accounts_migrate_account (dc_accounts_t* accounts, const char* dbfile);
3017
3018
3030int dc_accounts_remove_account (dc_accounts_t* accounts, uint32_t account_id);
3031
3032
3042
3043
3055dc_context_t* dc_accounts_get_account (dc_accounts_t* accounts, uint32_t account_id);
3056
3057
3074
3075
3084int dc_accounts_select_account (dc_accounts_t* accounts, uint32_t account_id);
3085
3086
3102
3103
3114
3115
3125
3126
3137
3138
3152
3153
3174
3175
3195
3196
3204size_t dc_array_get_cnt (const dc_array_t* array);
3205
3206
3215uint32_t dc_array_get_id (const dc_array_t* array, size_t index);
3216
3217
3227double dc_array_get_latitude (const dc_array_t* array, size_t index);
3228
3229
3239double dc_array_get_longitude (const dc_array_t* array, size_t index);
3240
3241
3252double dc_array_get_accuracy (const dc_array_t* array, size_t index);
3253
3254
3264int64_t dc_array_get_timestamp (const dc_array_t* array, size_t index);
3265
3266
3276uint32_t dc_array_get_chat_id (const dc_array_t* array, size_t index);
3277
3278
3288uint32_t dc_array_get_contact_id (const dc_array_t* array, size_t index);
3289
3290
3300uint32_t dc_array_get_msg_id (const dc_array_t* array, size_t index);
3301
3302
3317char* dc_array_get_marker (const dc_array_t* array, size_t index);
3318
3319
3330int dc_array_is_independent (const dc_array_t* array, size_t index);
3331
3332
3342int dc_array_search_id (const dc_array_t* array, uint32_t needle, size_t* ret_index);
3343
3344
3387
3388
3396size_t dc_chatlist_get_cnt (const dc_chatlist_t* chatlist);
3397
3398
3410uint32_t dc_chatlist_get_chat_id (const dc_chatlist_t* chatlist, size_t index);
3411
3412
3424uint32_t dc_chatlist_get_msg_id (const dc_chatlist_t* chatlist, size_t index);
3425
3426
3453dc_lot_t* dc_chatlist_get_summary (const dc_chatlist_t* chatlist, size_t index, dc_chat_t* chat);
3454
3455
3475dc_lot_t* dc_chatlist_get_summary2 (dc_context_t* context, uint32_t chat_id, uint32_t msg_id);
3476
3477
3486
3487
3504char* dc_chat_get_info_json (dc_context_t* context, size_t chat_id);
3505
3516#define DC_CHAT_ID_TRASH 3 // messages that should be deleted get this chat ID; the messages are deleted from the working thread later then. This is also needed as rfc724_mid should be preset as long as the message is not deleted on the server (otherwise it is downloaded again)
3517#define DC_CHAT_ID_ARCHIVED_LINK 6 // only an indicator in a chatlist
3518#define DC_CHAT_ID_ALLDONE_HINT 7 // only an indicator in a chatlist
3519#define DC_CHAT_ID_LAST_SPECIAL 9 // larger chat IDs are "real" chats, their messages are "real" messages
3520
3521
3530
3531
3544uint32_t dc_chat_get_id (const dc_chat_t* chat);
3545
3546
3577int dc_chat_get_type (const dc_chat_t* chat);
3578
3579
3591
3592
3604char* dc_chat_get_name (const dc_chat_t* chat);
3605
3606
3621
3622
3635uint32_t dc_chat_get_color (const dc_chat_t* chat);
3636
3637
3647
3648
3666
3667
3689
3690
3700
3701
3717
3718
3730int dc_chat_can_send (const dc_chat_t* chat);
3731
3732
3757
3758
3777
3778
3790
3791
3799int dc_chat_is_muted (const dc_chat_t* chat);
3800
3801
3810
3811
3821#define DC_MSG_ID_MARKER1 1 // this is used by iOS to mark things in the message list
3822#define DC_MSG_ID_DAYMARKER 9
3823#define DC_MSG_ID_LAST_SPECIAL 9
3824
3825
3838dc_msg_t* dc_msg_new (dc_context_t* context, int viewtype);
3839
3840
3849
3850
3859uint32_t dc_msg_get_id (const dc_msg_t* msg);
3860
3861
3876uint32_t dc_msg_get_from_id (const dc_msg_t* msg);
3877
3878
3887uint32_t dc_msg_get_chat_id (const dc_msg_t* msg);
3888
3889
3899
3900
3944
3945
3962int64_t dc_msg_get_timestamp (const dc_msg_t* msg);
3963
3964
3977
3978
3993
3994
4014char* dc_msg_get_text (const dc_msg_t* msg);
4015
4016
4034char* dc_msg_get_subject (const dc_msg_t* msg);
4035
4036
4050char* dc_msg_get_file (const dc_msg_t* msg);
4051
4052
4063
4064
4076
4077
4090char* dc_msg_get_webxdc_blob (const dc_msg_t* msg, const char* filename, size_t* ret_bytes);
4091
4092
4126
4127
4138uint64_t dc_msg_get_filebytes (const dc_msg_t* msg);
4139
4140
4156
4157
4173
4174
4187
4188
4197
4207int dc_msg_is_bot (const dc_msg_t* msg);
4208
4221
4235
4236
4260
4261
4273char* dc_msg_get_summarytext (const dc_msg_t* msg, int approx_characters);
4274
4275
4305
4306
4307
4323
4324
4335
4336
4347int dc_msg_is_sent (const dc_msg_t* msg);
4348
4349
4367
4368
4389int dc_msg_is_info (const dc_msg_t* msg);
4390
4391
4411
4412
4413// DC_INFO* uses the same values as SystemMessage in rust-land
4414#define DC_INFO_UNKNOWN 0
4415#define DC_INFO_GROUP_NAME_CHANGED 2
4416#define DC_INFO_GROUP_IMAGE_CHANGED 3
4417#define DC_INFO_MEMBER_ADDED_TO_GROUP 4
4418#define DC_INFO_MEMBER_REMOVED_FROM_GROUP 5
4419#define DC_INFO_AUTOCRYPT_SETUP_MESSAGE 6
4420#define DC_INFO_SECURE_JOIN_MESSAGE 7
4421#define DC_INFO_LOCATIONSTREAMING_ENABLED 8
4422#define DC_INFO_LOCATION_ONLY 9
4423#define DC_INFO_EPHEMERAL_TIMER_CHANGED 10
4424#define DC_INFO_PROTECTION_ENABLED 11
4425#define DC_INFO_PROTECTION_DISABLED 12
4426#define DC_INFO_WEBXDC_INFO_MESSAGE 32
4427
4441
4442
4458
4459
4475
4476
4491
4492
4512char* dc_msg_get_error (const dc_msg_t* msg);
4513
4514
4544
4545#define DC_VIDEOCHATTYPE_UNKNOWN 0
4546#define DC_VIDEOCHATTYPE_BASICWEBRTC 1
4547#define DC_VIDEOCHATTYPE_JITSI 2
4548
4549
4574
4575
4602
4603
4612void dc_msg_set_text (dc_msg_t* msg, const char* text);
4613
4614
4639void dc_msg_set_html (dc_msg_t* msg, const char* html);
4640
4641
4651void dc_msg_set_subject (dc_msg_t* msg, const char* subject);
4652
4653
4666void dc_msg_set_override_sender_name(dc_msg_t* msg, const char* name);
4667
4668
4681void dc_msg_set_file (dc_msg_t* msg, const char* file, const char* filemime);
4682
4683
4694void dc_msg_set_dimension (dc_msg_t* msg, int width, int height);
4695
4696
4706void dc_msg_set_duration (dc_msg_t* msg, int duration);
4707
4708
4725void dc_msg_set_location (dc_msg_t* msg, double latitude, double longitude);
4726
4727
4749void dc_msg_latefiling_mediasize (dc_msg_t* msg, int width, int height, int duration);
4750
4751
4766void dc_msg_set_quote (dc_msg_t* msg, const dc_msg_t* quote);
4767
4768
4784
4785
4808
4824
4825
4835
4857#define DC_CONTACT_ID_SELF 1
4858#define DC_CONTACT_ID_INFO 2 // centered messages as "member added", used in all chats
4859#define DC_CONTACT_ID_DEVICE 5 // messages "update info" in the device-chat
4860#define DC_CONTACT_ID_LAST_SPECIAL 9
4861
4862
4871
4872
4880uint32_t dc_contact_get_id (const dc_contact_t* contact);
4881
4882
4891char* dc_contact_get_addr (const dc_contact_t* contact);
4892
4893
4908char* dc_contact_get_name (const dc_contact_t* contact);
4909
4910
4931
4932
4949
4950
4951// dc_contact_get_first_name is removed,
4952// the following define is to make upgrading more smoothly.
4953#define dc_contact_get_first_name dc_contact_get_display_name
4954
4955
4971
4972
4985
4986
4998uint32_t dc_contact_get_color (const dc_contact_t* contact);
4999
5000
5013
5023
5024
5038
5039
5050
5051
5070
5071
5094
5095
5116dc_provider_t* dc_provider_new_from_email (const dc_context_t* context, const char* email);
5117
5118
5134
5135
5148
5149
5165
5166
5178
5179
5187
5188
5201#define DC_TEXT1_DRAFT 1
5202#define DC_TEXT1_USERNAME 2
5203#define DC_TEXT1_SELF 3
5204
5205
5216
5217
5227char* dc_lot_get_text1 (const dc_lot_t* lot);
5228
5229
5239char* dc_lot_get_text2 (const dc_lot_t* lot);
5240
5241
5252
5253
5262
5263
5271uint32_t dc_lot_get_id (const dc_lot_t* lot);
5272
5273
5283int64_t dc_lot_get_timestamp (const dc_lot_t* lot);
5284
5285
5303
5304
5316char* dc_reactions_get_by_contact_id(dc_reactions_t* reactions, uint32_t contact_id);
5317
5318
5330
5331
5361#define DC_MSG_TEXT 10
5362
5363
5375#define DC_MSG_IMAGE 20
5376
5377
5383#define DC_MSG_GIF 21
5384
5385
5391#define DC_MSG_STICKER 23
5392
5393
5399#define DC_MSG_AUDIO 40
5400
5401
5408#define DC_MSG_VOICE 41
5409
5410
5419#define DC_MSG_VIDEO 50
5420
5421
5427#define DC_MSG_FILE 60
5428
5429
5438#define DC_MSG_VIDEOCHAT_INVITATION 70
5439
5440
5446#define DC_MSG_WEBXDC 80
5447
5448
5468#define DC_STATE_UNDEFINED 0
5469
5473#define DC_STATE_IN_FRESH 10
5474
5478#define DC_STATE_IN_NOTICED 13
5479
5483#define DC_STATE_IN_SEEN 16
5484
5488#define DC_STATE_OUT_PREPARING 18
5489
5493#define DC_STATE_OUT_DRAFT 19
5494
5498#define DC_STATE_OUT_PENDING 20
5499
5503#define DC_STATE_OUT_FAILED 24
5504
5509#define DC_STATE_OUT_DELIVERED 26
5510
5514#define DC_STATE_OUT_MDN_RCVD 28
5515
5536#define DC_CHAT_TYPE_UNDEFINED 0
5537
5541#define DC_CHAT_TYPE_SINGLE 100
5542
5546#define DC_CHAT_TYPE_GROUP 120
5547
5551#define DC_CHAT_TYPE_MAILINGLIST 140
5552
5556#define DC_CHAT_TYPE_BROADCAST 160
5557
5577#define DC_SOCKET_AUTO 0
5578
5579
5583#define DC_SOCKET_SSL 1
5584
5585
5589#define DC_SOCKET_STARTTLS 2
5590
5591
5595#define DC_SOCKET_PLAIN 3
5596
5620#define DC_LP_AUTH_OAUTH2 0x2
5621
5622
5627#define DC_LP_AUTH_NORMAL 0x4
5628
5629
5634#define DC_LP_AUTH_FLAGS (DC_LP_AUTH_OAUTH2|DC_LP_AUTH_NORMAL) // if none of these flags are set, the default is chosen
5635
5651#define DC_CERTCK_AUTO 0
5652
5657#define DC_CERTCK_STRICT 1
5658
5663#define DC_CERTCK_ACCEPT_INVALID_CERTIFICATES 3
5664
5686
5695
5705void dc_jsonrpc_request(dc_jsonrpc_instance_t* jsonrpc_instance, const char* request);
5706
5717
5727char* dc_jsonrpc_blocking_call(dc_jsonrpc_instance_t* jsonrpc_instance, const char *input);
5728
5749
5750// Alias for backwards compatibility, use dc_get_next_event instead.
5751#define dc_accounts_get_next_event dc_get_next_event
5752
5761
5762// Alias for backwards compatibility, use dc_event_emtitter_unref instead.
5763#define dc_accounts_event_emitter_unref dc_event_emitter_unref
5764
5784
5785
5798
5799
5812
5813
5827
5828
5839
5840
5849
5850
5873#define DC_EVENT_INFO 100
5874
5875
5882#define DC_EVENT_SMTP_CONNECTED 101
5883
5884
5891#define DC_EVENT_IMAP_CONNECTED 102
5892
5899#define DC_EVENT_SMTP_MESSAGE_SENT 103
5900
5907#define DC_EVENT_IMAP_MESSAGE_DELETED 104
5908
5915#define DC_EVENT_IMAP_MESSAGE_MOVED 105
5916
5923#define DC_EVENT_IMAP_INBOX_IDLE 106
5924
5931#define DC_EVENT_NEW_BLOB_FILE 150
5932
5939#define DC_EVENT_DELETED_BLOB_FILE 151
5940
5949#define DC_EVENT_WARNING 300
5950
5951
5969#define DC_EVENT_ERROR 400
5970
5971
5982#define DC_EVENT_ERROR_SELF_NOT_IN_GROUP 410
5983
5984
5995#define DC_EVENT_MSGS_CHANGED 2000
5996
5997
6004#define DC_EVENT_REACTIONS_CHANGED 2001
6005
6006
6016#define DC_EVENT_INCOMING_MSG 2005
6017
6027#define DC_EVENT_INCOMING_MSG_BUNCH 2006
6028
6029
6042#define DC_EVENT_MSGS_NOTICED 2008
6043
6044
6052#define DC_EVENT_MSG_DELIVERED 2010
6053
6054
6063#define DC_EVENT_MSG_FAILED 2012
6064
6065
6073#define DC_EVENT_MSG_READ 2015
6074
6075
6082#define DC_EVENT_MSG_DELETED 2016
6083
6084
6094#define DC_EVENT_CHAT_MODIFIED 2020
6095
6102#define DC_EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED 2021
6103
6104
6111#define DC_EVENT_CONTACTS_CHANGED 2030
6112
6113
6114
6123#define DC_EVENT_LOCATION_CHANGED 2035
6124
6125
6132#define DC_EVENT_CONFIGURE_PROGRESS 2041
6133
6134
6141#define DC_EVENT_IMEX_PROGRESS 2051
6142
6143
6154#define DC_EVENT_IMEX_FILE_WRITTEN 2052
6155
6156
6171#define DC_EVENT_SECUREJOIN_INVITER_PROGRESS 2060
6172
6173
6187#define DC_EVENT_SECUREJOIN_JOINER_PROGRESS 2061
6188
6189
6199#define DC_EVENT_CONNECTIVITY_CHANGED 2100
6200
6201
6206#define DC_EVENT_SELFAVATAR_CHANGED 2110
6207
6208
6223#define DC_EVENT_WEBXDC_STATUS_UPDATE 2120
6224
6231#define DC_EVENT_WEBXDC_INSTANCE_DELETED 2121
6232
6233
6239#define DC_EVENT_DATA1_IS_STRING(e) 0 // not used anymore
6240#define DC_EVENT_DATA2_IS_STRING(e) ((e)==DC_EVENT_CONFIGURE_PROGRESS || (e)==DC_EVENT_IMEX_FILE_WRITTEN || ((e)>=100 && (e)<=499))
6241
6242
6243/*
6244 * Values for dc_get|set_config("show_emails")
6245 */
6246#define DC_SHOW_EMAILS_OFF 0
6247#define DC_SHOW_EMAILS_ACCEPTED_CONTACTS 1
6248#define DC_SHOW_EMAILS_ALL 2
6249
6250
6251/*
6252 * Values for dc_get|set_config("media_quality")
6253 */
6254#define DC_MEDIA_QUALITY_BALANCED 0
6255#define DC_MEDIA_QUALITY_WORSE 1
6256
6257
6258/*
6259 * Values for dc_get|set_config("key_gen_type")
6260 */
6261#define DC_KEY_GEN_DEFAULT 0
6262#define DC_KEY_GEN_RSA2048 1
6263#define DC_KEY_GEN_ED25519 2
6264#define DC_KEY_GEN_RSA4096 3
6265
6266
6288#define DC_PROVIDER_STATUS_OK 1
6289
6301#define DC_PROVIDER_STATUS_PREPARATION 2
6302
6315#define DC_PROVIDER_STATUS_BROKEN 3
6316
6337#define DC_CHAT_VISIBILITY_NORMAL 0
6338
6351#define DC_CHAT_VISIBILITY_ARCHIVED 1
6352
6357#define DC_CHAT_VISIBILITY_PINNED 2
6358
6378#define DC_DOWNLOAD_DONE 0
6379
6383#define DC_DOWNLOAD_AVAILABLE 10
6384
6388#define DC_DOWNLOAD_FAILURE 20
6389
6393#define DC_DOWNLOAD_UNDECIPHERABLE 30
6394
6398#define DC_DOWNLOAD_IN_PROGRESS 1000
6399
6400
6401
6429#define DC_STR_NOMESSAGES 1
6430
6434#define DC_STR_SELF 2
6435
6439#define DC_STR_DRAFT 3
6440
6444#define DC_STR_VOICEMESSAGE 7
6445
6449#define DC_STR_IMAGE 9
6450
6454#define DC_STR_VIDEO 10
6455
6459#define DC_STR_AUDIO 11
6460
6464#define DC_STR_FILE 12
6465
6473#define DC_STR_MSGGRPNAME 15
6474
6480#define DC_STR_MSGGRPIMGCHANGED 16
6481
6488#define DC_STR_MSGADDMEMBER 17
6489
6496#define DC_STR_MSGDELMEMBER 18
6497
6503#define DC_STR_MSGGROUPLEFT 19
6504
6508#define DC_STR_GIF 23
6509
6513#define DC_STR_ENCRYPTEDMSG 24
6514
6518#define DC_STR_E2E_AVAILABLE 25
6519
6521#define DC_STR_ENCR_TRANSP 27
6522
6526#define DC_STR_ENCR_NONE 28
6527
6531#define DC_STR_CANTDECRYPT_MSG_BODY 29
6532
6536#define DC_STR_FINGERPRINTS 30
6537
6541#define DC_STR_READRCPT 31
6542
6547#define DC_STR_READRCPT_MAILBODY 32
6548
6550#define DC_STR_MSGGRPIMGDELETED 33
6551
6555#define DC_STR_E2E_PREFERRED 34
6556
6561#define DC_STR_CONTACT_VERIFIED 35
6562
6567#define DC_STR_CONTACT_NOT_VERIFIED 36
6568
6573#define DC_STR_CONTACT_SETUP_CHANGED 37
6574
6578#define DC_STR_ARCHIVEDCHATS 40
6579
6583#define DC_STR_AC_SETUP_MSG_SUBJECT 42
6584
6588#define DC_STR_AC_SETUP_MSG_BODY 43
6589
6594#define DC_STR_CANNOT_LOGIN 60
6595
6604#define DC_STR_MSGACTIONBYUSER 62
6605
6613#define DC_STR_MSGACTIONBYME 63
6614
6618#define DC_STR_MSGLOCATIONENABLED 64
6619
6623#define DC_STR_MSGLOCATIONDISABLED 65
6624
6628#define DC_STR_LOCATION 66
6629
6633#define DC_STR_STICKER 67
6634
6638#define DC_STR_DEVICE_MESSAGES 68
6639
6643#define DC_STR_SAVED_MESSAGES 69
6644
6648#define DC_STR_DEVICE_MESSAGES_HINT 70
6649
6653#define DC_STR_WELCOME_MESSAGE 71
6654
6658#define DC_STR_UNKNOWN_SENDER_FOR_CHAT 72
6659
6665#define DC_STR_SUBJECT_FOR_NEW_CONTACT 73
6666
6671#define DC_STR_FAILED_SENDING_TO 74
6672
6678#define DC_STR_EPHEMERAL_DISABLED 75
6679
6687#define DC_STR_EPHEMERAL_SECONDS 76
6688
6694#define DC_STR_EPHEMERAL_MINUTE 77
6695
6701#define DC_STR_EPHEMERAL_HOUR 78
6702
6708#define DC_STR_EPHEMERAL_DAY 79
6709
6715#define DC_STR_EPHEMERAL_WEEK 80
6716
6718#define DC_STR_EPHEMERAL_FOUR_WEEKS 81
6719
6723#define DC_STR_VIDEOCHAT_INVITATION 82
6724
6729#define DC_STR_VIDEOCHAT_INVITE_MSG_BODY 83
6730
6735#define DC_STR_CONFIGURATION_FAILED 84
6736
6741#define DC_STR_BAD_TIME_MSG_BODY 85
6742
6746#define DC_STR_UPDATE_REMINDER_MSG_BODY 86
6747
6751#define DC_STR_ERROR_NO_NETWORK 87
6752
6757#define DC_STR_REPLY_NOUN 90
6758
6762#define DC_STR_SELF_DELETED_MSG_BODY 91
6763
6767#define DC_STR_SERVER_TURNED_OFF 92
6768
6776#define DC_STR_EPHEMERAL_MINUTES 93
6777
6785#define DC_STR_EPHEMERAL_HOURS 94
6786
6794#define DC_STR_EPHEMERAL_DAYS 95
6795
6803#define DC_STR_EPHEMERAL_WEEKS 96
6804
6808#define DC_STR_FORWARDED 97
6809
6815#define DC_STR_QUOTA_EXCEEDING_MSG_BODY 98
6816
6824#define DC_STR_PARTIAL_DOWNLOAD_MSG_BODY 99
6825
6831#define DC_STR_DOWNLOAD_AVAILABILITY 100
6832
6836#define DC_STR_SYNC_MSG_SUBJECT 101
6837
6846#define DC_STR_SYNC_MSG_BODY 102
6847
6851#define DC_STR_INCOMING_MESSAGES 103
6852
6856#define DC_STR_OUTGOING_MESSAGES 104
6857
6863#define DC_STR_STORAGE_ON_DOMAIN 105
6864
6866#define DC_STR_ONE_MOMENT 106
6867
6871#define DC_STR_CONNECTED 107
6872
6876#define DC_STR_CONNTECTING 108
6877
6881#define DC_STR_UPDATING 109
6882
6886#define DC_STR_SENDING 110
6887
6891#define DC_STR_LAST_MSG_SENT_SUCCESSFULLY 111
6892
6898#define DC_STR_ERROR 112
6899
6903#define DC_STR_NOT_SUPPORTED_BY_PROVIDER 113
6904
6908#define DC_STR_MESSAGES 114
6909
6913#define DC_STR_BROADCAST_LIST 115
6914
6918#define DC_STR_PART_OF_TOTAL_USED 116
6919
6928#define DC_STR_SECURE_JOIN_STARTED 117
6929
6938#define DC_STR_SECURE_JOIN_REPLIES 118
6939
6945#define DC_STR_SETUP_CONTACT_QR_DESC 119
6946
6952#define DC_STR_SECURE_JOIN_GROUP_QR_DESC 120
6953
6957#define DC_STR_NOT_CONNECTED 121
6958
6962#define DC_STR_AEAP_ADDR_CHANGED 122
6963
6975#define DC_STR_AEAP_EXPLANATION_AND_LINK 123
6976
6981#define DC_STR_GROUP_NAME_CHANGED_BY_YOU 124
6982
6988#define DC_STR_GROUP_NAME_CHANGED_BY_OTHER 125
6989
6991#define DC_STR_GROUP_IMAGE_CHANGED_BY_YOU 126
6992
6996#define DC_STR_GROUP_IMAGE_CHANGED_BY_OTHER 127
6997
7001#define DC_STR_ADD_MEMBER_BY_YOU 128
7002
7009#define DC_STR_ADD_MEMBER_BY_OTHER 129
7010
7016#define DC_STR_REMOVE_MEMBER_BY_YOU 130
7017
7024#define DC_STR_REMOVE_MEMBER_BY_OTHER 131
7025
7029#define DC_STR_GROUP_LEFT_BY_YOU 132
7030
7036#define DC_STR_GROUP_LEFT_BY_OTHER 133
7037
7041#define DC_STR_GROUP_IMAGE_DELETED_BY_YOU 134
7042
7048#define DC_STR_GROUP_IMAGE_DELETED_BY_OTHER 135
7049
7053#define DC_STR_LOCATION_ENABLED_BY_YOU 136
7054
7060#define DC_STR_LOCATION_ENABLED_BY_OTHER 137
7061
7065#define DC_STR_EPHEMERAL_TIMER_DISABLED_BY_YOU 138
7066
7072#define DC_STR_EPHEMERAL_TIMER_DISABLED_BY_OTHER 139
7073
7079#define DC_STR_EPHEMERAL_TIMER_SECONDS_BY_YOU 140
7080
7087#define DC_STR_EPHEMERAL_TIMER_SECONDS_BY_OTHER 141
7088
7092#define DC_STR_EPHEMERAL_TIMER_1_MINUTE_BY_YOU 142
7093
7099#define DC_STR_EPHEMERAL_TIMER_1_MINUTE_BY_OTHER 143
7100
7104#define DC_STR_EPHEMERAL_TIMER_1_HOUR_BY_YOU 144
7105
7111#define DC_STR_EPHEMERAL_TIMER_1_HOUR_BY_OTHER 145
7112
7116#define DC_STR_EPHEMERAL_TIMER_1_DAY_BY_YOU 146
7117
7123#define DC_STR_EPHEMERAL_TIMER_1_DAY_BY_OTHER 147
7124
7128#define DC_STR_EPHEMERAL_TIMER_1_WEEK_BY_YOU 148
7129
7135#define DC_STR_EPHEMERAL_TIMER_1_WEEK_BY_OTHER 149
7136
7142#define DC_STR_EPHEMERAL_TIMER_MINUTES_BY_YOU 150
7143
7150#define DC_STR_EPHEMERAL_TIMER_MINUTES_BY_OTHER 151
7151
7157#define DC_STR_EPHEMERAL_TIMER_HOURS_BY_YOU 152
7158
7165#define DC_STR_EPHEMERAL_TIMER_HOURS_BY_OTHER 153
7166
7172#define DC_STR_EPHEMERAL_TIMER_DAYS_BY_YOU 154
7173
7180#define DC_STR_EPHEMERAL_TIMER_DAYS_BY_OTHER 155
7181
7187#define DC_STR_EPHEMERAL_TIMER_WEEKS_BY_YOU 156
7188
7195#define DC_STR_EPHEMERAL_TIMER_WEEKS_BY_OTHER 157
7196
7200#define DC_STR_BACKUP_TRANSFER_QR 162
7201
7205#define DC_STR_BACKUP_TRANSFER_MSG_BODY 163
7206
7210#define DC_STR_CHAT_PROTECTION_ENABLED 170
7211
7215#define DC_STR_CHAT_PROTECTION_DISABLED 171
7216
7220#define DC_STR_NEW_GROUP_SEND_FIRST_MESSAGE 172
7221
7227#ifdef PY_CFFI_INC
7228/* Helper utility to locate the header file when building python bindings. */
7229char* _dc_header_file_location(void) {
7230 return __FILE__;
7231}
7232#endif
7233
7234
7235#ifdef __cplusplus
7236}
7237#endif
7238#endif // __DELTACHAT_H__
This class provides functionality that can be used to manage several dc_context_t objects running at ...
int dc_accounts_select_account(dc_accounts_t *accounts, uint32_t account_id)
Change the selected account.
void dc_accounts_unref(dc_accounts_t *accounts)
Free an account manager object.
dc_event_emitter_t * dc_accounts_get_event_emitter(dc_accounts_t *accounts)
Create the event emitter that is used to receive events.
int dc_accounts_all_work_done(dc_accounts_t *accounts)
This is meant especially for iOS, because iOS needs to tell the system when its background work is do...
dc_context_t * dc_accounts_get_selected_account(dc_accounts_t *accounts)
Get the currently selected account.
void dc_accounts_maybe_network(dc_accounts_t *accounts)
This function should be called when there is a hint that the network is available again.
uint32_t dc_accounts_migrate_account(dc_accounts_t *accounts, const char *dbfile)
Migrate independent accounts into accounts managed by the account manager.
dc_context_t * dc_accounts_get_account(dc_accounts_t *accounts, uint32_t account_id)
Get an account context from an account ID.
dc_array_t * dc_accounts_get_all(dc_accounts_t *accounts)
List all accounts.
dc_jsonrpc_instance_t * dc_jsonrpc_init(dc_accounts_t *account_manager)
Create the jsonrpc instance that is used to call the jsonrpc.
void dc_accounts_start_io(dc_accounts_t *accounts)
Start job and IMAP/SMTP tasks for all accounts managed by the account manager.
void dc_accounts_stop_io(dc_accounts_t *accounts)
Stop job and IMAP/SMTP tasks for all accounts and return when they are finished.
void dc_accounts_maybe_network_lost(dc_accounts_t *accounts)
This function can be called when there is a hint that the network is lost.
uint32_t dc_accounts_add_account(dc_accounts_t *accounts)
Add a new account to the account manager.
dc_accounts_t * dc_accounts_new(const char *dir, int writable)
Create a new account manager.
uint32_t dc_accounts_add_closed_account(dc_accounts_t *accounts)
Add a new closed account to the account manager.
int dc_accounts_remove_account(dc_accounts_t *accounts, uint32_t account_id)
Remove an account from the account manager.
An object containing a simple array.
void dc_array_unref(dc_array_t *array)
Free an array object.
double dc_array_get_accuracy(const dc_array_t *array, size_t index)
Return the accuracy of the item at the given index.
int64_t dc_array_get_timestamp(const dc_array_t *array, size_t index)
Return the timestamp of the item at the given index.
uint32_t dc_array_get_chat_id(const dc_array_t *array, size_t index)
Return the chat ID of the item at the given index.
int dc_array_is_independent(const dc_array_t *array, size_t index)
Return the independent-state of the location at the given index.
uint32_t dc_array_get_msg_id(const dc_array_t *array, size_t index)
Return the message ID of the item at the given index.
uint32_t dc_array_get_contact_id(const dc_array_t *array, size_t index)
Return the contact ID of the item at the given index.
double dc_array_get_longitude(const dc_array_t *array, size_t index)
Return the longitude of the item at the given index.
size_t dc_array_get_cnt(const dc_array_t *array)
Find out the number of items in an array.
uint32_t dc_array_get_id(const dc_array_t *array, size_t index)
Get the item at the given index as an ID.
char * dc_array_get_marker(const dc_array_t *array, size_t index)
Return the marker-character of the item at the given index.
double dc_array_get_latitude(const dc_array_t *array, size_t index)
Return the latitude of the item at the given index.
Set up another device.
char * dc_backup_provider_get_qr(const dc_backup_provider_t *backup_provider)
Returns the QR code text that will offer the backup to other devices.
void dc_backup_provider_unref(dc_backup_provider_t *backup_provider)
Frees a dc_backup_provider_t object.
void dc_backup_provider_wait(dc_backup_provider_t *backup_provider)
Waits for the sending to finish.
char * dc_backup_provider_get_qr_svg(const dc_backup_provider_t *backup_provider)
Returns the QR code SVG image that will offer the backup to other devices.
dc_backup_provider_t * dc_backup_provider_new(dc_context_t *context)
Creates an object for sending a backup to another device.
An object representing a single chat in memory.
char * dc_chat_get_name(const dc_chat_t *chat)
Get name of a chat.
int dc_chat_is_sending_locations(const dc_chat_t *chat)
Check if locations are sent to the chat at the time the object was created using dc_get_chat().
int dc_chat_get_type(const dc_chat_t *chat)
Get chat type as one of the DC_CHAT_TYPE constants:
int dc_chat_is_protection_broken(const dc_chat_t *chat)
Checks if the chat was protected, and then an incoming message broke this protection.
char * dc_chat_get_mailinglist_addr(const dc_chat_t *chat)
Returns the address where messages are sent to if the chat is a mailing list.
uint32_t dc_chat_get_id(const dc_chat_t *chat)
Get the chat ID.
int dc_chat_is_device_talk(const dc_chat_t *chat)
Check if a chat is a device-talk.
int64_t dc_chat_get_remaining_mute_duration(const dc_chat_t *chat)
Get the exact state of the mute of a chat.
int dc_chat_is_contact_request(const dc_chat_t *chat)
Check if a chat is a contact request chat.
int dc_chat_get_visibility(const dc_chat_t *chat)
Get visibility of chat.
void dc_chat_unref(dc_chat_t *chat)
Free a chat object.
int dc_chat_is_unpromoted(const dc_chat_t *chat)
Check if a group chat is still unpromoted.
uint32_t dc_chat_get_color(const dc_chat_t *chat)
Get a color for the chat.
int dc_chat_can_send(const dc_chat_t *chat)
Check if messages can be sent to a given chat.
int dc_chat_is_self_talk(const dc_chat_t *chat)
Check if a chat is a self talk.
char * dc_chat_get_profile_image(const dc_chat_t *chat)
Get the chat's profile image.
int dc_chat_is_protected(const dc_chat_t *chat)
Check if a chat is protected.
int dc_chat_is_muted(const dc_chat_t *chat)
Check whether the chat is currently muted (can be changed by dc_set_chat_mute_duration()).
An object representing a single chatlist in memory.
uint32_t dc_chatlist_get_msg_id(const dc_chatlist_t *chatlist, size_t index)
Get a single message ID of a chatlist.
void dc_chatlist_unref(dc_chatlist_t *chatlist)
Free a chatlist object.
dc_lot_t * dc_chatlist_get_summary(const dc_chatlist_t *chatlist, size_t index, dc_chat_t *chat)
Get a summary for a chatlist index.
dc_context_t * dc_chatlist_get_context(dc_chatlist_t *chatlist)
Helper function to get the associated context object.
uint32_t dc_chatlist_get_chat_id(const dc_chatlist_t *chatlist, size_t index)
Get a single chat ID of a chatlist.
size_t dc_chatlist_get_cnt(const dc_chatlist_t *chatlist)
Find out the number of chats in a chatlist.
An object representing a single contact in memory.
char * dc_contact_get_addr(const dc_contact_t *contact)
Get the e-mail address of a contact.
char * dc_contact_get_name_n_addr(const dc_contact_t *contact)
Get a summary of name and address.
int dc_contact_is_verified(dc_contact_t *contact)
Check if the contact can be added to verified chats, i.e.
char * dc_contact_get_profile_image(const dc_contact_t *contact)
Get the contact's profile image.
void dc_contact_unref(dc_contact_t *contact)
Free a contact object.
char * dc_contact_get_auth_name(const dc_contact_t *contact)
Get original contact name.
int64_t dc_contact_get_last_seen(const dc_contact_t *contact)
Get the contact's last seen timestamp.
uint32_t dc_contact_get_verifier_id(dc_contact_t *contact)
Return the contact ID that verified a contact.
char * dc_contact_get_status(const dc_contact_t *contact)
Get the contact's status.
int dc_contact_is_blocked(const dc_contact_t *contact)
Check if a contact is blocked.
char * dc_contact_get_name(const dc_contact_t *contact)
Get the edited contact name.
char * dc_contact_get_display_name(const dc_contact_t *contact)
Get display name.
uint32_t dc_contact_get_color(const dc_contact_t *contact)
Get a color for the contact.
uint32_t dc_contact_get_id(const dc_contact_t *contact)
Get the ID of a contact.
int dc_contact_was_seen_recently(const dc_contact_t *contact)
Check if the contact was seen recently.
An object representing a single account.
char * dc_imex_has_backup(dc_context_t *context, const char *dir)
Check if there is a backup file.
int dc_add_address_book(dc_context_t *context, const char *addr_book)
Add a number of contacts.
int dc_get_msg_cnt(dc_context_t *context, uint32_t chat_id)
Get the total number of messages in a chat.
dc_context_t * dc_context_new_closed(const char *dbfile)
Create a new context object.
int dc_preconfigure_keypair(dc_context_t *context, const char *addr, const char *public_data, const char *secret_data)
Save a keypair as the default keys for the user.
dc_array_t * dc_get_contacts(dc_context_t *context, uint32_t flags, const char *query)
Returns known and unblocked contacts.
void dc_set_draft(dc_context_t *context, uint32_t chat_id, dc_msg_t *msg)
Save a draft for a chat in the database.
uint32_t dc_add_device_msg(dc_context_t *context, const char *label, dc_msg_t *msg)
Add a message to the device-chat.
dc_chatlist_t * dc_get_chatlist(dc_context_t *context, int flags, const char *query_str, uint32_t query_id)
Get a list of chats.
dc_array_t * dc_get_next_msgs(dc_context_t *context)
Returns the message IDs of all messages of any chat with a database ID higher than last_msg_id config...
char * dc_get_contact_encrinfo(dc_context_t *context, uint32_t contact_id)
Get encryption info for a contact.
uint32_t dc_lookup_contact_id_by_addr(dc_context_t *context, const char *addr)
Check if an e-mail address belongs to a known and unblocked contact.
int dc_set_chat_profile_image(dc_context_t *context, uint32_t chat_id, const char *image)
Set group profile image.
uint32_t dc_send_text_msg(dc_context_t *context, uint32_t chat_id, const char *text_to_send)
Send a simple text message a given chat.
void dc_maybe_network(dc_context_t *context)
This function should be called when there is a hint that the network is available again,...
int dc_was_device_msg_ever_added(dc_context_t *context, const char *label)
Check if a device-message with a given label was ever added.
uint32_t dc_get_chat_ephemeral_timer(dc_context_t *context, uint32_t chat_id)
Get the chat's ephemeral message timer.
dc_array_t * dc_get_chat_media(dc_context_t *context, uint32_t chat_id, int msg_type, int msg_type2, int msg_type3)
Returns all message IDs of the given types in a given chat or any chat.
dc_lot_t * dc_check_qr(dc_context_t *context, const char *qr)
Check a scanned QR code.
dc_array_t * dc_get_locations(dc_context_t *context, uint32_t chat_id, uint32_t contact_id, int64_t timestamp_begin, int64_t timestamp_end)
Get shared locations from the database.
void dc_send_locations_to_chat(dc_context_t *context, uint32_t chat_id, int seconds)
Enable or disable location streaming for a chat.
dc_contact_t * dc_get_contact(dc_context_t *context, uint32_t contact_id)
Get a single contact object.
void dc_stop_io(dc_context_t *context)
Stop job, IMAP, SMTP and other tasks and return when they are finished.
dc_msg_t * dc_get_draft(dc_context_t *context, uint32_t chat_id)
Get draft for a chat, if any.
char * dc_get_blobdir(const dc_context_t *context)
Get the blob directory.
dc_array_t * dc_get_blocked_contacts(dc_context_t *context)
Get blocked contacts.
void dc_context_unref(dc_context_t *context)
Free a context object.
void dc_stop_ongoing_process(dc_context_t *context)
Signal an ongoing process to stop.
dc_msg_t * dc_get_msg(dc_context_t *context, uint32_t msg_id)
Get a single message object of the type dc_msg_t.
uint32_t dc_send_reaction(dc_context_t *context, uint32_t msg_id, char *reaction)
Send a reaction to message.
dc_array_t * dc_get_chat_msgs(dc_context_t *context, uint32_t chat_id, uint32_t flags, uint32_t marker1before)
Get all message IDs belonging to a chat.
char * dc_get_info(const dc_context_t *context)
Get information about the context.
int dc_receive_backup(dc_context_t *context, const char *qr)
Gets a backup offered by a dc_backup_provider_t object on another device.
int dc_is_sending_locations_to_chat(dc_context_t *context, uint32_t chat_id)
Check if location streaming is enabled.
void dc_block_chat(dc_context_t *context, uint32_t chat_id)
Block a chat.
char * dc_get_securejoin_qr(dc_context_t *context, uint32_t chat_id)
Get QR code text that will offer an Setup-Contact or Verified-Group invitation.
int dc_continue_key_transfer(dc_context_t *context, uint32_t msg_id, const char *setup_code)
Continue the Autocrypt Key Transfer on another device.
dc_array_t * dc_get_fresh_msgs(dc_context_t *context)
Returns the message IDs of all fresh messages of any chat.
int dc_set_stock_translation(dc_context_t *context, uint32_t stock_id, const char *stock_msg)
Set stock string translation.
int dc_set_chat_mute_duration(dc_context_t *context, uint32_t chat_id, int64_t duration)
Set mute duration of a chat.
dc_array_t * dc_wait_next_msgs(dc_context_t *context)
Waits for notification of new messages and returns an array of new message IDs.
int dc_get_fresh_msg_cnt(dc_context_t *context, uint32_t chat_id)
Get the number of fresh messages in a chat.
int dc_set_chat_name(dc_context_t *context, uint32_t chat_id, const char *name)
Set group name.
uint32_t dc_create_broadcast_list(dc_context_t *context)
Create a new broadcast list.
void dc_marknoticed_chat(dc_context_t *context, uint32_t chat_id)
Mark all messages in a chat as noticed.
int dc_set_chat_ephemeral_timer(dc_context_t *context, uint32_t chat_id, uint32_t timer)
Set the chat's ephemeral message timer.
int dc_remove_contact_from_chat(dc_context_t *context, uint32_t chat_id, uint32_t contact_id)
Remove a member from a group.
dc_array_t * dc_search_msgs(dc_context_t *context, uint32_t chat_id, const char *query)
Search messages containing the given query string.
int dc_may_be_valid_addr(const char *addr)
Rough check if a string may be a valid e-mail address.
int dc_is_configured(const dc_context_t *context)
Check if the context is already configured.
int dc_estimate_deletion_cnt(dc_context_t *context, int from_server, int64_t seconds)
Estimate the number of messages that will be deleted by the dc_set_config()-options delete_device_aft...
int dc_get_connectivity(dc_context_t *context)
Get the current connectivity, i.e.
char * dc_get_last_error(dc_context_t *context)
Get last error string.
char * dc_get_oauth2_url(dc_context_t *context, const char *addr, const char *redirect_uri)
Get URL that can be used to initiate an OAuth2 authorization.
uint32_t dc_get_chat_id_by_contact_id(dc_context_t *context, uint32_t contact_id)
Check, if there is a normal chat with a given contact.
char * dc_get_config(dc_context_t *context, const char *key)
Get a configuration option.
int dc_set_location(dc_context_t *context, double latitude, double longitude, double accuracy)
Set current location.
void dc_set_chat_visibility(dc_context_t *context, uint32_t chat_id, int visibility)
Set chat visibility to pinned, archived or normal.
int dc_add_contact_to_chat(dc_context_t *context, uint32_t chat_id, uint32_t contact_id)
Add a member to a group.
uint32_t dc_prepare_msg(dc_context_t *context, uint32_t chat_id, dc_msg_t *msg)
Prepare a message for sending.
char * dc_get_msg_info(dc_context_t *context, uint32_t msg_id)
Get an informational text for a single message.
char * dc_get_connectivity_html(dc_context_t *context)
Get an overview of the current connectivity, and possibly more statistics.
dc_array_t * dc_get_chat_contacts(dc_context_t *context, uint32_t chat_id)
Get the contact IDs belonging to a chat.
uint32_t dc_get_next_media(dc_context_t *context, uint32_t msg_id, int dir, int msg_type, int msg_type2, int msg_type3)
Search next/previous message based on a given message and a list of types.
dc_chat_t * dc_get_chat(dc_context_t *context, uint32_t chat_id)
Get a chat object by a chat ID.
uint32_t dc_get_id(dc_context_t *context)
Get the ID of a context object.
dc_context_t * dc_context_new(const char *os_name, const char *dbfile, const char *blobdir)
Create a new context object and try to open it without passphrase.
uint32_t dc_send_videochat_invitation(dc_context_t *context, uint32_t chat_id)
Send invitation to a videochat.
uint32_t dc_send_msg_sync(dc_context_t *context, uint32_t chat_id, dc_msg_t *msg)
Send a message defined by a dc_msg_t object to a chat, synchronously.
uint32_t dc_create_contact(dc_context_t *context, const char *name, const char *addr)
Add a single contact as a result of an explicit user action.
uint32_t dc_send_msg(dc_context_t *context, uint32_t chat_id, dc_msg_t *msg)
Send a message defined by a dc_msg_t object to a chat.
void dc_download_full_msg(dc_context_t *context, int msg_id)
Asks the core to start downloading a message fully.
char * dc_get_msg_html(dc_context_t *context, uint32_t msg_id)
Get uncut message, if available.
dc_event_emitter_t * dc_get_event_emitter(dc_context_t *context)
Create the event emitter that is used to receive events.
void dc_start_io(dc_context_t *context)
Start job and IMAP/SMTP tasks.
void dc_imex(dc_context_t *context, int what, const char *param1, const char *param2)
Import/export things.
char * dc_get_securejoin_qr_svg(dc_context_t *context, uint32_t chat_id)
Get QR code image from the QR code text generated by dc_get_securejoin_qr().
char * dc_get_webxdc_status_updates(dc_context_t *context, uint32_t msg_id, uint32_t serial)
Get webxdc status updates.
dc_lot_t * dc_chatlist_get_summary2(dc_context_t *context, uint32_t chat_id, uint32_t msg_id)
Create a chatlist summary item when the chatlist object is already unref()'d.
uint32_t dc_create_chat_by_contact_id(dc_context_t *context, uint32_t contact_id)
Create a normal chat with a single user.
void dc_forward_msgs(dc_context_t *context, const uint32_t *msg_ids, int msg_cnt, uint32_t chat_id)
Forward messages to another chat.
dc_reactions_t * dc_get_msg_reactions(dc_context_t *context, int msg_id)
Get a structure with reactions to the message.
int dc_send_webxdc_status_update(dc_context_t *context, uint32_t msg_id, const char *json, const char *descr)
A webxdc instance sends a status update to its other members.
dc_chatlist_t * dc_get_similar_chatlist(dc_context_t *context, uint32_t chat_id)
Returns a list of similar chats.
int dc_set_config_from_qr(dc_context_t *context, const char *qr)
Set configuration values from a QR code.
void dc_str_unref(char *str)
Release a string returned by another deltachat-core function.
int dc_delete_contact(dc_context_t *context, uint32_t contact_id)
Delete a contact so that it disappears from the corresponding lists.
char * dc_get_mime_headers(dc_context_t *context, uint32_t msg_id)
Get the raw mime-headers of the given message.
void dc_delete_chat(dc_context_t *context, uint32_t chat_id)
Delete a chat.
void dc_block_contact(dc_context_t *context, uint32_t contact_id, int block)
Block or unblock a contact.
int dc_resend_msgs(dc_context_t *context, const uint32_t *msg_ids, int msg_cnt)
Resend messages and make information available for newly added chat members.
void dc_delete_msgs(dc_context_t *context, const uint32_t *msg_ids, int msg_cnt)
Delete messages.
void dc_configure(dc_context_t *context)
Configure a context.
uint32_t dc_join_securejoin(dc_context_t *context, const char *qr)
Continue a Setup-Contact or Verified-Group-Invite protocol started on another device with dc_get_secu...
void dc_markseen_msgs(dc_context_t *context, const uint32_t *msg_ids, int msg_cnt)
Mark messages as presented to the user.
uint32_t dc_create_group_chat(dc_context_t *context, int protect, const char *name)
Create a new group chat.
void dc_delete_all_locations(dc_context_t *context)
Delete all locations on the current device.
int dc_is_contact_in_chat(dc_context_t *context, uint32_t chat_id, uint32_t contact_id)
Check if a given contact ID is a member of a group chat.
int dc_context_is_open(dc_context_t *context)
Returns 1 if database is open.
void dc_accept_chat(dc_context_t *context, uint32_t chat_id)
Accept a contact request chat.
int dc_context_open(dc_context_t *context, const char *passphrase)
Opens the database with the given passphrase.
char * dc_initiate_key_transfer(dc_context_t *context)
Initiate Autocrypt Setup Transfer.
int dc_get_blocked_cnt(dc_context_t *context)
Get the number of blocked contacts.
int dc_context_change_passphrase(dc_context_t *context, const char *passphrase)
Changes the passphrase on the open database.
char * dc_get_chat_encrinfo(dc_context_t *context, uint32_t chat_id)
Get encryption info for a chat.
int dc_set_config(dc_context_t *context, const char *key, const char *value)
Configure the context.
Opaque object that is used to get events from a single context.
void dc_event_emitter_unref(dc_event_emitter_t *emitter)
Free a context event emitter object.
dc_event_t * dc_get_next_event(dc_event_emitter_t *emitter)
Get the next event from a context event emitter object.
Opaque object describing a single event.
void dc_event_unref(dc_event_t *event)
Free memory used by an event object.
int dc_event_get_data2_int(dc_event_t *event)
Get data associated with an event object.
char * dc_event_get_data2_str(dc_event_t *event)
Get data associated with an event object.
uint32_t dc_event_get_account_id(dc_event_t *event)
Get the account ID this event belongs to.
int dc_event_get_id(dc_event_t *event)
Get the event ID from an event object.
int dc_event_get_data1_int(dc_event_t *event)
Get data associated with an event object.
Opaque object for using the json rpc api from the cffi bindings.
char * dc_jsonrpc_next_response(dc_jsonrpc_instance_t *jsonrpc_instance)
Get the next json_rpc response, blocks until there is a new event, so call this in a loop from a thre...
void dc_jsonrpc_unref(dc_jsonrpc_instance_t *jsonrpc_instance)
Free a jsonrpc instance.
char * dc_jsonrpc_blocking_call(dc_jsonrpc_instance_t *jsonrpc_instance, const char *input)
Make a JSON-RPC call and return a response.
void dc_jsonrpc_request(dc_jsonrpc_instance_t *jsonrpc_instance, const char *request)
Makes an asynchronous jsonrpc request, returns immediately and once the result is ready it can be ret...
An object containing a set of values.
int64_t dc_lot_get_timestamp(const dc_lot_t *lot)
Get the associated timestamp.
int dc_lot_get_state(const dc_lot_t *lot)
Get the associated state.
uint32_t dc_lot_get_id(const dc_lot_t *lot)
Get the associated ID.
int dc_lot_get_text1_meaning(const dc_lot_t *lot)
Get the meaning of the first string.
void dc_lot_unref(dc_lot_t *lot)
Frees an object containing a set of parameters.
char * dc_lot_get_text1(const dc_lot_t *lot)
Get first string.
char * dc_lot_get_text2(const dc_lot_t *lot)
Get second string.
An object representing a single message in memory.
void dc_msg_set_html(dc_msg_t *msg, const char *html)
Set the HTML part of a message object.
char * dc_msg_get_webxdc_blob(const dc_msg_t *msg, const char *filename, size_t *ret_bytes)
Return a file from inside a webxdc message.
uint32_t dc_msg_get_ephemeral_timer(const dc_msg_t *msg)
Get the ephemeral timer duration for a message.
char * dc_msg_get_filename(const dc_msg_t *msg)
Get an original attachment filename, with extension but without the path.
void dc_msg_set_override_sender_name(dc_msg_t *msg, const char *name)
Set different sender name for a message.
char * dc_msg_get_summarytext(const dc_msg_t *msg, int approx_characters)
Get a message summary as a single line of text.
int dc_msg_get_showpadlock(const dc_msg_t *msg)
Check if a padlock should be shown beside the message.
dc_lot_t * dc_msg_get_summary(const dc_msg_t *msg, const dc_chat_t *chat)
Get a summary for a message.
uint32_t dc_msg_get_chat_id(const dc_msg_t *msg)
Get the ID of the chat the message belongs to.
void dc_msg_set_quote(dc_msg_t *msg, const dc_msg_t *quote)
Set the message replying to.
int dc_msg_has_location(const dc_msg_t *msg)
Check if a message has a location bound to it.
char * dc_msg_get_text(const dc_msg_t *msg)
Get the text of the message.
uint32_t dc_msg_get_from_id(const dc_msg_t *msg)
Get the ID of the contact who wrote the message.
int64_t dc_msg_get_ephemeral_timestamp(const dc_msg_t *msg)
Get the timestamp of the ephemeral message removal.
int dc_msg_get_download_state(const dc_msg_t *msg)
Check if the message is completely downloaded or if some further action is needed.
void dc_msg_set_duration(dc_msg_t *msg, int duration)
Set the duration associated with message object.
void dc_msg_set_text(dc_msg_t *msg, const char *text)
Set the text of a message object.
int64_t dc_msg_get_timestamp(const dc_msg_t *msg)
Get the message sending time.
char * dc_msg_get_quoted_text(const dc_msg_t *msg)
Get quoted text, if any.
char * dc_msg_get_override_sender_name(const dc_msg_t *msg)
Get the name that should be shown over the message (in a group chat) instead of the contact display n...
char * dc_msg_get_videochat_url(const dc_msg_t *msg)
Get URL of a videochat invitation.
void dc_msg_set_subject(dc_msg_t *msg, const char *subject)
Sets the email's subject.
int dc_msg_get_width(const dc_msg_t *msg)
Get the width of an image or a video.
char * dc_msg_get_filemime(const dc_msg_t *msg)
Get the MIME type of a file.
void dc_msg_unref(dc_msg_t *msg)
Free a message object.
int dc_msg_is_bot(const dc_msg_t *msg)
Check if an incoming message is a bot message, i.e.
char * dc_msg_get_setupcodebegin(const dc_msg_t *msg)
Get the first characters of the setup code.
void dc_msg_set_dimension(dc_msg_t *msg, int width, int height)
Set the dimensions associated with message object.
int dc_msg_is_forwarded(const dc_msg_t *msg)
Check if the message is a forwarded message.
int dc_msg_has_deviating_timestamp(const dc_msg_t *msg)
Check if a message has a deviating timestamp.
int dc_msg_is_info(const dc_msg_t *msg)
Check if the message is an informational message, created by the device or by another users.
void dc_msg_latefiling_mediasize(dc_msg_t *msg, int width, int height, int duration)
Late filing information to a message.
int dc_msg_get_state(const dc_msg_t *msg)
Get the state of a message.
void dc_msg_set_location(dc_msg_t *msg, double latitude, double longitude)
Set any location that should be bound to the message object.
int dc_msg_is_setupmessage(const dc_msg_t *msg)
Check if the message is an Autocrypt Setup Message.
uint64_t dc_msg_get_filebytes(const dc_msg_t *msg)
Get the size of the file.
char * dc_msg_get_subject(const dc_msg_t *msg)
Get the subject of the e-mail.
dc_msg_t * dc_msg_get_quoted_msg(const dc_msg_t *msg)
Get quoted message, if available.
dc_msg_t * dc_msg_get_parent(const dc_msg_t *msg)
Get parent message, if available.
dc_msg_t * dc_msg_new(dc_context_t *context, int viewtype)
Create new message object.
void dc_msg_force_plaintext(dc_msg_t *msg)
Force the message to be sent in plain text.
int dc_msg_has_html(dc_msg_t *msg)
Checks if the message has a full HTML version.
int dc_msg_get_duration(const dc_msg_t *msg)
Get the duration of audio or video.
uint32_t dc_msg_get_id(const dc_msg_t *msg)
Get the ID of the message.
int dc_msg_get_info_type(const dc_msg_t *msg)
Get the type of an informational message.
int dc_msg_get_viewtype(const dc_msg_t *msg)
Get the type of the message.
int dc_msg_is_increation(const dc_msg_t *msg)
Check if a message is still in creation.
int64_t dc_msg_get_sort_timestamp(const dc_msg_t *msg)
Get the message time used for sorting.
int dc_msg_get_videochat_type(const dc_msg_t *msg)
Get type of videochat.
void dc_msg_set_file(dc_msg_t *msg, const char *file, const char *filemime)
Set the file associated with a message object.
int dc_msg_get_height(const dc_msg_t *msg)
Get the height of an image or a video.
char * dc_msg_get_error(const dc_msg_t *msg)
Gets the error status of the message.
int dc_msg_is_sent(const dc_msg_t *msg)
Check if a message was sent successfully.
char * dc_msg_get_file(const dc_msg_t *msg)
Find out full path of the file associated with a message.
int64_t dc_msg_get_received_timestamp(const dc_msg_t *msg)
Get the message receive time.
char * dc_msg_get_webxdc_info(const dc_msg_t *msg)
Get info from a webxdc message, in JSON format.
Opaque object containing information about one single e-mail provider.
int dc_provider_get_status(const dc_provider_t *provider)
Whether DC works with this provider.
char * dc_provider_get_before_login_hint(const dc_provider_t *provider)
Get hints to be shown to the user on the login screen.
char * dc_provider_get_overview_page(const dc_provider_t *provider)
URL of the overview page.
dc_provider_t * dc_provider_new_from_email_with_dns(const dc_context_t *context, const char *email)
Create a provider struct for the given e-mail address by local and DNS lookup.
dc_provider_t * dc_provider_new_from_email(const dc_context_t *context, const char *email)
Create a provider struct for the given e-mail address by local lookup.
void dc_provider_unref(dc_provider_t *provider)
Free the provider info struct.
char * dc_reactions_get_by_contact_id(dc_reactions_t *reactions, uint32_t contact_id)
Returns a string containing space-separated reactions of a single contact.
void dc_reactions_unref(dc_reactions_t *reactions)
Frees an object containing message reactions.
dc_array_t * dc_reactions_get_contacts(dc_reactions_t *reactions)
Returns array of contacts which reacted to the given message.