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_contact dc_contact_t;
21typedef struct _dc_lot dc_lot_t;
22typedef struct _dc_provider dc_provider_t;
23typedef struct _dc_event dc_event_t;
24typedef struct _dc_event_emitter dc_event_emitter_t;
25typedef struct _dc_jsonrpc_instance dc_jsonrpc_instance_t;
26typedef struct _dc_backup_provider dc_backup_provider_t;
27
28// Alias for backwards compatibility, use dc_event_emitter_t instead.
29typedef struct _dc_event_emitter dc_accounts_event_emitter_t;
30
247// create/open/config/information
248
264dc_context_t* dc_context_new (const char* os_name, const char* dbfile, const char* blobdir);
265
266
283
284
299int dc_context_open (dc_context_t *context, const char* passphrase);
300
301
312int dc_context_change_passphrase (dc_context_t* context, const char* passphrase);
313
314
323
324
337
338
350uint32_t dc_get_id (dc_context_t* context);
351
352
373
374
383char* dc_get_blobdir (const dc_context_t* context);
384
385
544int dc_set_config (dc_context_t* context, const char* key, const char* value);
545
546
572char* dc_get_config (dc_context_t* context, const char* key);
573
574
586int dc_set_stock_translation(dc_context_t* context, uint32_t stock_id, const char* stock_msg);
587
588
603int dc_set_config_from_qr (dc_context_t* context, const char* qr);
604
605
620char* dc_get_info (const dc_context_t* context);
621
622
652char* dc_get_oauth2_url (dc_context_t* context, const char* addr, const char* redirect_uri);
653
654
655#define DC_CONNECTIVITY_NOT_CONNECTED 1000
656#define DC_CONNECTIVITY_CONNECTING 2000
657#define DC_CONNECTIVITY_WORKING 3000
658#define DC_CONNECTIVITY_CONNECTED 4000
659
660
682
683
700
701
702#define DC_PUSH_NOT_CONNECTED 0
703#define DC_PUSH_HEARTBEAT 1
704#define DC_PUSH_CONNECTED 2
705
718
719
723int dc_all_work_done (dc_context_t* context);
724
725
726// connect
727
779
780
800int dc_is_configured (const dc_context_t* context);
801
802
813void dc_start_io (dc_context_t* context);
814
830
854
855
856
875int dc_preconfigure_keypair (dc_context_t* context, const char *addr, const char *public_data, const char *secret_data);
876
877
878// handle chatlists
879
880#define DC_GCL_ARCHIVED_ONLY 0x01
881#define DC_GCL_NO_SPECIALS 0x02
882#define DC_GCL_ADD_ALLDONE_HINT 0x04
883#define DC_GCL_FOR_FORWARDING 0x08
884
885
935dc_chatlist_t* dc_get_chatlist (dc_context_t* context, int flags, const char* query_str, uint32_t query_id);
936
937
938// handle chats
939
953uint32_t dc_create_chat_by_contact_id (dc_context_t* context, uint32_t contact_id);
954
955
967uint32_t dc_get_chat_id_by_contact_id (dc_context_t* context, uint32_t contact_id);
968
969
1015uint32_t dc_prepare_msg (dc_context_t* context, uint32_t chat_id, dc_msg_t* msg);
1016
1017
1055uint32_t dc_send_msg (dc_context_t* context, uint32_t chat_id, dc_msg_t* msg);
1056
1072uint32_t dc_send_msg_sync (dc_context_t* context, uint32_t chat_id, dc_msg_t* msg);
1073
1074
1094uint32_t dc_send_text_msg (dc_context_t* context, uint32_t chat_id, const char* text_to_send);
1095
1096
1130uint32_t dc_send_videochat_invitation (dc_context_t* context, uint32_t chat_id);
1131
1132
1160int dc_send_webxdc_status_update (dc_context_t* context, uint32_t msg_id, const char* json, const char* descr);
1161
1162
1193char* dc_get_webxdc_status_updates (dc_context_t* context, uint32_t msg_id, uint32_t serial);
1194
1195
1206void dc_set_webxdc_integration (dc_context_t* context, const char* file);
1207
1208
1251uint32_t dc_init_webxdc_integration (dc_context_t* context, uint32_t chat_id);
1252
1253
1277void dc_set_draft (dc_context_t* context, uint32_t chat_id, dc_msg_t* msg);
1278
1279
1327uint32_t dc_add_device_msg (dc_context_t* context, const char* label, dc_msg_t* msg);
1328
1339int dc_was_device_msg_ever_added (dc_context_t* context, const char* label);
1340
1341
1354dc_msg_t* dc_get_draft (dc_context_t* context, uint32_t chat_id);
1355
1356
1357#define DC_GCM_ADDDAYMARKER 0x01
1358#define DC_GCM_INFO_ONLY 0x02
1359
1360
1381dc_array_t* dc_get_chat_msgs (dc_context_t* context, uint32_t chat_id, uint32_t flags, uint32_t marker1before);
1382
1383
1392int dc_get_msg_cnt (dc_context_t* context, uint32_t chat_id);
1393
1394
1412int dc_get_fresh_msg_cnt (dc_context_t* context, uint32_t chat_id);
1413
1414
1428
1429
1444int dc_estimate_deletion_cnt (dc_context_t* context, int from_server, int64_t seconds);
1445
1446
1466
1467
1491
1492
1516
1517
1531void dc_marknoticed_chat (dc_context_t* context, uint32_t chat_id);
1532
1533
1552dc_array_t* dc_get_chat_media (dc_context_t* context, uint32_t chat_id, int msg_type, int msg_type2, int msg_type3);
1553
1554
1576uint32_t dc_get_next_media (dc_context_t* context, uint32_t msg_id, int dir, int msg_type, int msg_type2, int msg_type3);
1577
1578
1590void dc_set_chat_visibility (dc_context_t* context, uint32_t chat_id, int visibility);
1591
1592
1618void dc_delete_chat (dc_context_t* context, uint32_t chat_id);
1619
1633void dc_block_chat (dc_context_t* context, uint32_t chat_id);
1634
1647void dc_accept_chat (dc_context_t* context, uint32_t chat_id);
1648
1671dc_array_t* dc_get_chat_contacts (dc_context_t* context, uint32_t chat_id);
1672
1683char* dc_get_chat_encrinfo (dc_context_t* context, uint32_t chat_id);
1684
1696uint32_t dc_get_chat_ephemeral_timer (dc_context_t* context, uint32_t chat_id);
1697
1720dc_array_t* dc_search_msgs (dc_context_t* context, uint32_t chat_id, const char* query);
1721
1722
1733dc_chat_t* dc_get_chat (dc_context_t* context, uint32_t chat_id);
1734
1735
1736// handle group chats
1737
1765uint32_t dc_create_group_chat (dc_context_t* context, int protect, const char* name);
1766
1767
1784
1785
1796int dc_is_contact_in_chat (dc_context_t* context, uint32_t chat_id, uint32_t contact_id);
1797
1798
1815int dc_add_contact_to_chat (dc_context_t* context, uint32_t chat_id, uint32_t contact_id);
1816
1817
1832int dc_remove_contact_from_chat (dc_context_t* context, uint32_t chat_id, uint32_t contact_id);
1833
1834
1849int dc_set_chat_name (dc_context_t* context, uint32_t chat_id, const char* name);
1850
1868int dc_set_chat_ephemeral_timer (dc_context_t* context, uint32_t chat_id, uint32_t timer);
1869
1889int dc_set_chat_profile_image (dc_context_t* context, uint32_t chat_id, const char* image);
1890
1891
1892
1914int dc_set_chat_mute_duration (dc_context_t* context, uint32_t chat_id, int64_t duration);
1915
1916// handle messages
1917
1930char* dc_get_msg_info (dc_context_t* context, uint32_t msg_id);
1931
1932
1980char* dc_get_msg_html (dc_context_t* context, uint32_t msg_id);
1981
1982
2002void dc_download_full_msg (dc_context_t* context, int msg_id);
2003
2004
2019char* dc_get_mime_headers (dc_context_t* context, uint32_t msg_id);
2020
2021
2031void dc_delete_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt);
2032
2033
2048void dc_forward_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt, uint32_t chat_id);
2049
2050
2067int dc_resend_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt);
2068
2069
2100void dc_markseen_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt);
2101
2102
2115dc_msg_t* dc_get_msg (dc_context_t* context, uint32_t msg_id);
2116
2117
2118// handle contacts
2119
2133int dc_may_be_valid_addr (const char* addr);
2134
2135
2149uint32_t dc_lookup_contact_id_by_addr (dc_context_t* context, const char* addr);
2150
2151
2172uint32_t dc_create_contact (dc_context_t* context, const char* name, const char* addr);
2173
2174
2175#define DC_GCL_VERIFIED_ONLY 0x01
2176#define DC_GCL_ADD_SELF 0x02
2177
2178
2202int dc_add_address_book (dc_context_t* context, const char* addr_book);
2203
2204
2221dc_array_t* dc_get_contacts (dc_context_t* context, uint32_t flags, const char* query);
2222
2223
2233
2234
2244
2245
2255void dc_block_contact (dc_context_t* context, uint32_t contact_id, int block);
2256
2257
2268char* dc_get_contact_encrinfo (dc_context_t* context, uint32_t contact_id);
2269
2270
2283int dc_delete_contact (dc_context_t* context, uint32_t contact_id);
2284
2285
2299dc_contact_t* dc_get_contact (dc_context_t* context, uint32_t contact_id);
2300
2301
2302// import/export and tools
2303
2304#define DC_IMEX_EXPORT_SELF_KEYS 1 // param1 is a directory where the keys are written to
2305#define DC_IMEX_IMPORT_SELF_KEYS 2 // param1 is a directory where the keys are searched in and read from
2306#define DC_IMEX_EXPORT_BACKUP 11 // param1 is a directory where the backup is written to, param2 is a passphrase to encrypt the backup
2307#define DC_IMEX_IMPORT_BACKUP 12 // param1 is the file with the backup to import, param2 is the backup's passphrase
2308
2309
2354void dc_imex (dc_context_t* context, int what, const char* param1, const char* param2);
2355
2356
2406char* dc_imex_has_backup (dc_context_t* context, const char* dir);
2407
2408
2454
2455
2476int dc_continue_key_transfer (dc_context_t* context, uint32_t msg_id, const char* setup_code);
2477
2478
2496
2497
2498// out-of-band verification
2499
2500#define DC_QR_ASK_VERIFYCONTACT 200 // id=contact
2501#define DC_QR_ASK_VERIFYGROUP 202 // text1=groupname
2502#define DC_QR_FPR_OK 210 // id=contact
2503#define DC_QR_FPR_MISMATCH 220 // id=contact
2504#define DC_QR_FPR_WITHOUT_ADDR 230 // test1=formatted fingerprint
2505#define DC_QR_ACCOUNT 250 // text1=domain
2506#define DC_QR_BACKUP 251
2507#define DC_QR_BACKUP2 252
2508#define DC_QR_WEBRTC_INSTANCE 260 // text1=domain, text2=instance pattern
2509#define DC_QR_ADDR 320 // id=contact
2510#define DC_QR_TEXT 330 // text1=text
2511#define DC_QR_URL 332 // text1=URL
2512#define DC_QR_ERROR 400 // text1=error string
2513#define DC_QR_WITHDRAW_VERIFYCONTACT 500
2514#define DC_QR_WITHDRAW_VERIFYGROUP 502 // text1=groupname
2515#define DC_QR_REVIVE_VERIFYCONTACT 510
2516#define DC_QR_REVIVE_VERIFYGROUP 512 // text1=groupname
2517#define DC_QR_LOGIN 520 // text1=email_address
2518
2605dc_lot_t* dc_check_qr (dc_context_t* context, const char* qr);
2606
2607
2629char* dc_get_securejoin_qr (dc_context_t* context, uint32_t chat_id);
2630
2631
2644char* dc_get_securejoin_qr_svg (dc_context_t* context, uint32_t chat_id);
2645
2669uint32_t dc_join_securejoin (dc_context_t* context, const char* qr);
2670
2671
2672// location streaming
2673
2674
2691void dc_send_locations_to_chat (dc_context_t* context, uint32_t chat_id, int seconds);
2692
2693
2707int dc_is_sending_locations_to_chat (dc_context_t* context, uint32_t chat_id);
2708
2709
2737int dc_set_location (dc_context_t* context, double latitude, double longitude, double accuracy);
2738
2739
2800dc_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);
2801
2802
2814
2815
2830
2831
2844void dc_str_unref (char* str);
2845
2846
2876
2877
2896
2897
2912
2923
2938
2962int dc_receive_backup (dc_context_t* context, const char* qr);
2963
3013dc_accounts_t* dc_accounts_new (const char* dir, int writable);
3014
3015
3023
3024
3041
3058
3073uint32_t dc_accounts_migrate_account (dc_accounts_t* accounts, const char* dbfile);
3074
3075
3087int dc_accounts_remove_account (dc_accounts_t* accounts, uint32_t account_id);
3088
3089
3099
3100
3112dc_context_t* dc_accounts_get_account (dc_accounts_t* accounts, uint32_t account_id);
3113
3114
3131
3132
3141int dc_accounts_select_account (dc_accounts_t* accounts, uint32_t account_id);
3142
3143
3154
3155
3165
3166
3177
3178
3192
3193
3209int dc_accounts_background_fetch (dc_accounts_t* accounts, uint64_t timeout);
3210
3211
3219void dc_accounts_set_push_device_token (dc_accounts_t* accounts, const char *token);
3220
3241
3242
3262
3263
3271size_t dc_array_get_cnt (const dc_array_t* array);
3272
3273
3282uint32_t dc_array_get_id (const dc_array_t* array, size_t index);
3283
3284
3294double dc_array_get_latitude (const dc_array_t* array, size_t index);
3295
3296
3306double dc_array_get_longitude (const dc_array_t* array, size_t index);
3307
3308
3319double dc_array_get_accuracy (const dc_array_t* array, size_t index);
3320
3321
3331int64_t dc_array_get_timestamp (const dc_array_t* array, size_t index);
3332
3333
3343uint32_t dc_array_get_chat_id (const dc_array_t* array, size_t index);
3344
3345
3355uint32_t dc_array_get_contact_id (const dc_array_t* array, size_t index);
3356
3357
3367uint32_t dc_array_get_msg_id (const dc_array_t* array, size_t index);
3368
3369
3384char* dc_array_get_marker (const dc_array_t* array, size_t index);
3385
3386
3397int dc_array_is_independent (const dc_array_t* array, size_t index);
3398
3399
3409int dc_array_search_id (const dc_array_t* array, uint32_t needle, size_t* ret_index);
3410
3411
3454
3455
3463size_t dc_chatlist_get_cnt (const dc_chatlist_t* chatlist);
3464
3465
3477uint32_t dc_chatlist_get_chat_id (const dc_chatlist_t* chatlist, size_t index);
3478
3479
3491uint32_t dc_chatlist_get_msg_id (const dc_chatlist_t* chatlist, size_t index);
3492
3493
3520dc_lot_t* dc_chatlist_get_summary (const dc_chatlist_t* chatlist, size_t index, dc_chat_t* chat);
3521
3522
3542dc_lot_t* dc_chatlist_get_summary2 (dc_context_t* context, uint32_t chat_id, uint32_t msg_id);
3543
3544
3553
3554
3571char* dc_chat_get_info_json (dc_context_t* context, size_t chat_id);
3572
3583#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)
3584#define DC_CHAT_ID_ARCHIVED_LINK 6 // only an indicator in a chatlist
3585#define DC_CHAT_ID_ALLDONE_HINT 7 // only an indicator in a chatlist
3586#define DC_CHAT_ID_LAST_SPECIAL 9 // larger chat IDs are "real" chats, their messages are "real" messages
3587
3588
3597
3598
3611uint32_t dc_chat_get_id (const dc_chat_t* chat);
3612
3613
3644int dc_chat_get_type (const dc_chat_t* chat);
3645
3646
3658
3659
3671char* dc_chat_get_name (const dc_chat_t* chat);
3672
3673
3688
3689
3702uint32_t dc_chat_get_color (const dc_chat_t* chat);
3703
3704
3714
3715
3733
3734
3756
3757
3767
3768
3784
3785
3797int dc_chat_can_send (const dc_chat_t* chat);
3798
3799
3824
3825
3844
3845
3857
3858
3866int dc_chat_is_muted (const dc_chat_t* chat);
3867
3868
3877
3878
3888#define DC_MSG_ID_MARKER1 1 // this is used by iOS to mark things in the message list
3889#define DC_MSG_ID_DAYMARKER 9
3890#define DC_MSG_ID_LAST_SPECIAL 9
3891
3892
3905dc_msg_t* dc_msg_new (dc_context_t* context, int viewtype);
3906
3907
3916
3917
3926uint32_t dc_msg_get_id (const dc_msg_t* msg);
3927
3928
3943uint32_t dc_msg_get_from_id (const dc_msg_t* msg);
3944
3945
3954uint32_t dc_msg_get_chat_id (const dc_msg_t* msg);
3955
3956
3966
3967
4011
4012
4029int64_t dc_msg_get_timestamp (const dc_msg_t* msg);
4030
4031
4044
4045
4060
4061
4081char* dc_msg_get_text (const dc_msg_t* msg);
4082
4083
4101char* dc_msg_get_subject (const dc_msg_t* msg);
4102
4103
4117char* dc_msg_get_file (const dc_msg_t* msg);
4118
4119
4130int dc_msg_save_file (const dc_msg_t* msg, const char* path);
4131
4132
4143
4144
4156
4157
4170char* dc_msg_get_webxdc_blob (const dc_msg_t* msg, const char* filename, size_t* ret_bytes);
4171
4172
4205
4206
4217uint64_t dc_msg_get_filebytes (const dc_msg_t* msg);
4218
4219
4235
4236
4252
4253
4266
4267
4276
4286int dc_msg_is_bot (const dc_msg_t* msg);
4287
4300
4314
4315
4339
4340
4352char* dc_msg_get_summarytext (const dc_msg_t* msg, int approx_characters);
4353
4354
4384
4385
4386
4402
4403
4414
4415
4426int dc_msg_is_sent (const dc_msg_t* msg);
4427
4428
4446
4447
4468int dc_msg_is_info (const dc_msg_t* msg);
4469
4470
4493
4494
4495// DC_INFO* uses the same values as SystemMessage in rust-land
4496#define DC_INFO_UNKNOWN 0
4497#define DC_INFO_GROUP_NAME_CHANGED 2
4498#define DC_INFO_GROUP_IMAGE_CHANGED 3
4499#define DC_INFO_MEMBER_ADDED_TO_GROUP 4
4500#define DC_INFO_MEMBER_REMOVED_FROM_GROUP 5
4501#define DC_INFO_AUTOCRYPT_SETUP_MESSAGE 6
4502#define DC_INFO_SECURE_JOIN_MESSAGE 7
4503#define DC_INFO_LOCATIONSTREAMING_ENABLED 8
4504#define DC_INFO_LOCATION_ONLY 9
4505#define DC_INFO_EPHEMERAL_TIMER_CHANGED 10
4506#define DC_INFO_PROTECTION_ENABLED 11
4507#define DC_INFO_PROTECTION_DISABLED 12
4508#define DC_INFO_INVALID_UNENCRYPTED_MAIL 13
4509#define DC_INFO_WEBXDC_INFO_MESSAGE 32
4510
4524
4525
4541
4542
4558
4559
4574
4575
4595char* dc_msg_get_error (const dc_msg_t* msg);
4596
4597
4627
4628#define DC_VIDEOCHATTYPE_UNKNOWN 0
4629#define DC_VIDEOCHATTYPE_BASICWEBRTC 1
4630#define DC_VIDEOCHATTYPE_JITSI 2
4631
4632
4657
4658
4685
4686
4695void dc_msg_set_text (dc_msg_t* msg, const char* text);
4696
4697
4722void dc_msg_set_html (dc_msg_t* msg, const char* html);
4723
4724
4734void dc_msg_set_subject (dc_msg_t* msg, const char* subject);
4735
4736
4749void dc_msg_set_override_sender_name(dc_msg_t* msg, const char* name);
4750
4751
4764void dc_msg_set_file (dc_msg_t* msg, const char* file, const char* filemime);
4765
4766
4777void dc_msg_set_dimension (dc_msg_t* msg, int width, int height);
4778
4779
4789void dc_msg_set_duration (dc_msg_t* msg, int duration);
4790
4791
4808void dc_msg_set_location (dc_msg_t* msg, double latitude, double longitude);
4809
4810
4832void dc_msg_latefiling_mediasize (dc_msg_t* msg, int width, int height, int duration);
4833
4834
4849void dc_msg_set_quote (dc_msg_t* msg, const dc_msg_t* quote);
4850
4851
4867
4868
4891
4907
4908
4918
4940#define DC_CONTACT_ID_SELF 1
4941#define DC_CONTACT_ID_INFO 2 // centered messages as "member added", used in all chats
4942#define DC_CONTACT_ID_DEVICE 5 // messages "update info" in the device-chat
4943#define DC_CONTACT_ID_LAST_SPECIAL 9
4944
4945
4954
4955
4963uint32_t dc_contact_get_id (const dc_contact_t* contact);
4964
4965
4974char* dc_contact_get_addr (const dc_contact_t* contact);
4975
4976
4991char* dc_contact_get_name (const dc_contact_t* contact);
4992
4993
5014
5015
5032
5033
5034// dc_contact_get_first_name is removed,
5035// the following define is to make upgrading more smoothly.
5036#define dc_contact_get_first_name dc_contact_get_display_name
5037
5038
5054
5055
5068
5069
5081uint32_t dc_contact_get_color (const dc_contact_t* contact);
5082
5083
5096
5106
5107
5121
5122
5133
5134
5153
5162
5163
5186
5187
5208dc_provider_t* dc_provider_new_from_email (const dc_context_t* context, const char* email);
5209
5210
5226
5227
5240
5241
5257
5258
5270
5271
5279
5280
5293#define DC_TEXT1_DRAFT 1
5294#define DC_TEXT1_USERNAME 2
5295#define DC_TEXT1_SELF 3
5296
5297
5308
5309
5319char* dc_lot_get_text1 (const dc_lot_t* lot);
5320
5321
5331char* dc_lot_get_text2 (const dc_lot_t* lot);
5332
5333
5344
5345
5354
5355
5363uint32_t dc_lot_get_id (const dc_lot_t* lot);
5364
5365
5375int64_t dc_lot_get_timestamp (const dc_lot_t* lot);
5376
5377
5407#define DC_MSG_TEXT 10
5408
5409
5421#define DC_MSG_IMAGE 20
5422
5423
5429#define DC_MSG_GIF 21
5430
5431
5437#define DC_MSG_STICKER 23
5438
5439
5445#define DC_MSG_AUDIO 40
5446
5447
5454#define DC_MSG_VOICE 41
5455
5456
5465#define DC_MSG_VIDEO 50
5466
5467
5473#define DC_MSG_FILE 60
5474
5475
5484#define DC_MSG_VIDEOCHAT_INVITATION 70
5485
5486
5492#define DC_MSG_WEBXDC 80
5493
5498#define DC_MSG_VCARD 90
5499
5519#define DC_STATE_UNDEFINED 0
5520
5524#define DC_STATE_IN_FRESH 10
5525
5529#define DC_STATE_IN_NOTICED 13
5530
5534#define DC_STATE_IN_SEEN 16
5535
5539#define DC_STATE_OUT_PREPARING 18
5540
5544#define DC_STATE_OUT_DRAFT 19
5545
5549#define DC_STATE_OUT_PENDING 20
5550
5554#define DC_STATE_OUT_FAILED 24
5555
5560#define DC_STATE_OUT_DELIVERED 26
5561
5565#define DC_STATE_OUT_MDN_RCVD 28
5566
5587#define DC_CHAT_TYPE_UNDEFINED 0
5588
5592#define DC_CHAT_TYPE_SINGLE 100
5593
5597#define DC_CHAT_TYPE_GROUP 120
5598
5602#define DC_CHAT_TYPE_MAILINGLIST 140
5603
5607#define DC_CHAT_TYPE_BROADCAST 160
5608
5628#define DC_SOCKET_AUTO 0
5629
5630
5634#define DC_SOCKET_SSL 1
5635
5636
5640#define DC_SOCKET_STARTTLS 2
5641
5642
5646#define DC_SOCKET_PLAIN 3
5647
5671#define DC_LP_AUTH_OAUTH2 0x2
5672
5673
5678#define DC_LP_AUTH_NORMAL 0x4
5679
5680
5685#define DC_LP_AUTH_FLAGS (DC_LP_AUTH_OAUTH2|DC_LP_AUTH_NORMAL) // if none of these flags are set, the default is chosen
5686
5702#define DC_CERTCK_AUTO 0
5703
5708#define DC_CERTCK_STRICT 1
5709
5714#define DC_CERTCK_ACCEPT_INVALID_CERTIFICATES 3
5715
5737
5746
5756void dc_jsonrpc_request(dc_jsonrpc_instance_t* jsonrpc_instance, const char* request);
5757
5768
5778char* dc_jsonrpc_blocking_call(dc_jsonrpc_instance_t* jsonrpc_instance, const char *input);
5779
5800
5801// Alias for backwards compatibility, use dc_get_next_event instead.
5802#define dc_accounts_get_next_event dc_get_next_event
5803
5812
5813// Alias for backwards compatibility, use dc_event_emtitter_unref instead.
5814#define dc_accounts_event_emitter_unref dc_event_emitter_unref
5815
5835
5836
5849
5850
5863
5864
5878
5879
5890
5891
5900
5901
5924#define DC_EVENT_INFO 100
5925
5926
5933#define DC_EVENT_SMTP_CONNECTED 101
5934
5935
5942#define DC_EVENT_IMAP_CONNECTED 102
5943
5950#define DC_EVENT_SMTP_MESSAGE_SENT 103
5951
5958#define DC_EVENT_IMAP_MESSAGE_DELETED 104
5959
5966#define DC_EVENT_IMAP_MESSAGE_MOVED 105
5967
5974#define DC_EVENT_IMAP_INBOX_IDLE 106
5975
5982#define DC_EVENT_NEW_BLOB_FILE 150
5983
5990#define DC_EVENT_DELETED_BLOB_FILE 151
5991
6000#define DC_EVENT_WARNING 300
6001
6002
6020#define DC_EVENT_ERROR 400
6021
6022
6033#define DC_EVENT_ERROR_SELF_NOT_IN_GROUP 410
6034
6035
6046#define DC_EVENT_MSGS_CHANGED 2000
6047
6048
6055#define DC_EVENT_REACTIONS_CHANGED 2001
6056
6057
6067#define DC_EVENT_INCOMING_MSG 2005
6068
6080#define DC_EVENT_INCOMING_MSG_BUNCH 2006
6081
6082
6095#define DC_EVENT_MSGS_NOTICED 2008
6096
6097
6105#define DC_EVENT_MSG_DELIVERED 2010
6106
6107
6116#define DC_EVENT_MSG_FAILED 2012
6117
6118
6126#define DC_EVENT_MSG_READ 2015
6127
6128
6135#define DC_EVENT_MSG_DELETED 2016
6136
6137
6147#define DC_EVENT_CHAT_MODIFIED 2020
6148
6155#define DC_EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED 2021
6156
6157
6164#define DC_EVENT_CONTACTS_CHANGED 2030
6165
6166
6167
6176#define DC_EVENT_LOCATION_CHANGED 2035
6177
6178
6185#define DC_EVENT_CONFIGURE_PROGRESS 2041
6186
6187
6194#define DC_EVENT_IMEX_PROGRESS 2051
6195
6196
6207#define DC_EVENT_IMEX_FILE_WRITTEN 2052
6208
6209
6224#define DC_EVENT_SECUREJOIN_INVITER_PROGRESS 2060
6225
6226
6240#define DC_EVENT_SECUREJOIN_JOINER_PROGRESS 2061
6241
6242
6252#define DC_EVENT_CONNECTIVITY_CHANGED 2100
6253
6254
6259#define DC_EVENT_SELFAVATAR_CHANGED 2110
6260
6261
6271#define DC_EVENT_CONFIG_SYNCED 2111
6272
6273
6288#define DC_EVENT_WEBXDC_STATUS_UPDATE 2120
6289
6296#define DC_EVENT_WEBXDC_INSTANCE_DELETED 2121
6297
6308#define DC_EVENT_WEBXDC_REALTIME_DATA 2150
6309
6319#define DC_EVENT_ACCOUNTS_BACKGROUND_FETCH_DONE 2200
6320
6327#define DC_EVENT_CHATLIST_CHANGED 2300
6328
6336#define DC_EVENT_CHATLIST_ITEM_CHANGED 2301
6337
6338
6344#define DC_EVENT_CHANNEL_OVERFLOW 2400
6345
6351#define DC_EVENT_DATA1_IS_STRING(e) 0 // not used anymore
6352#define DC_EVENT_DATA2_IS_STRING(e) ((e)==DC_EVENT_CONFIGURE_PROGRESS || (e)==DC_EVENT_IMEX_FILE_WRITTEN || ((e)>=100 && (e)<=499))
6353
6354
6355/*
6356 * Values for dc_get|set_config("show_emails")
6357 */
6358#define DC_SHOW_EMAILS_OFF 0
6359#define DC_SHOW_EMAILS_ACCEPTED_CONTACTS 1
6360#define DC_SHOW_EMAILS_ALL 2
6361
6362
6363/*
6364 * Values for dc_get|set_config("media_quality")
6365 */
6366#define DC_MEDIA_QUALITY_BALANCED 0
6367#define DC_MEDIA_QUALITY_WORSE 1
6368
6369
6370/*
6371 * Values for dc_get|set_config("key_gen_type")
6372 */
6373#define DC_KEY_GEN_DEFAULT 0
6374#define DC_KEY_GEN_RSA2048 1
6375#define DC_KEY_GEN_ED25519 2
6376#define DC_KEY_GEN_RSA4096 3
6377
6378
6400#define DC_PROVIDER_STATUS_OK 1
6401
6413#define DC_PROVIDER_STATUS_PREPARATION 2
6414
6427#define DC_PROVIDER_STATUS_BROKEN 3
6428
6449#define DC_CHAT_VISIBILITY_NORMAL 0
6450
6463#define DC_CHAT_VISIBILITY_ARCHIVED 1
6464
6469#define DC_CHAT_VISIBILITY_PINNED 2
6470
6490#define DC_DOWNLOAD_DONE 0
6491
6495#define DC_DOWNLOAD_AVAILABLE 10
6496
6500#define DC_DOWNLOAD_FAILURE 20
6501
6505#define DC_DOWNLOAD_UNDECIPHERABLE 30
6506
6510#define DC_DOWNLOAD_IN_PROGRESS 1000
6511
6512
6513
6541#define DC_STR_NOMESSAGES 1
6542
6546#define DC_STR_SELF 2
6547
6551#define DC_STR_DRAFT 3
6552
6556#define DC_STR_VOICEMESSAGE 7
6557
6561#define DC_STR_IMAGE 9
6562
6566#define DC_STR_VIDEO 10
6567
6571#define DC_STR_AUDIO 11
6572
6576#define DC_STR_FILE 12
6577
6585#define DC_STR_MSGGRPNAME 15
6586
6592#define DC_STR_MSGGRPIMGCHANGED 16
6593
6600#define DC_STR_MSGADDMEMBER 17
6601
6608#define DC_STR_MSGDELMEMBER 18
6609
6615#define DC_STR_MSGGROUPLEFT 19
6616
6620#define DC_STR_GIF 23
6621
6625#define DC_STR_ENCRYPTEDMSG 24
6626
6630#define DC_STR_E2E_AVAILABLE 25
6631
6633#define DC_STR_ENCR_TRANSP 27
6634
6638#define DC_STR_ENCR_NONE 28
6639
6643#define DC_STR_CANTDECRYPT_MSG_BODY 29
6644
6648#define DC_STR_FINGERPRINTS 30
6649
6655#define DC_STR_READRCPT 31
6656
6663#define DC_STR_READRCPT_MAILBODY 32
6664
6666#define DC_STR_MSGGRPIMGDELETED 33
6667
6671#define DC_STR_E2E_PREFERRED 34
6672
6677#define DC_STR_CONTACT_VERIFIED 35
6678
6683#define DC_STR_CONTACT_NOT_VERIFIED 36
6684
6689#define DC_STR_CONTACT_SETUP_CHANGED 37
6690
6694#define DC_STR_ARCHIVEDCHATS 40
6695
6699#define DC_STR_AC_SETUP_MSG_SUBJECT 42
6700
6704#define DC_STR_AC_SETUP_MSG_BODY 43
6705
6710#define DC_STR_CANNOT_LOGIN 60
6711
6720#define DC_STR_MSGACTIONBYUSER 62
6721
6729#define DC_STR_MSGACTIONBYME 63
6730
6734#define DC_STR_MSGLOCATIONENABLED 64
6735
6739#define DC_STR_MSGLOCATIONDISABLED 65
6740
6744#define DC_STR_LOCATION 66
6745
6749#define DC_STR_STICKER 67
6750
6754#define DC_STR_DEVICE_MESSAGES 68
6755
6759#define DC_STR_SAVED_MESSAGES 69
6760
6764#define DC_STR_DEVICE_MESSAGES_HINT 70
6765
6769#define DC_STR_WELCOME_MESSAGE 71
6770
6774#define DC_STR_UNKNOWN_SENDER_FOR_CHAT 72
6775
6781#define DC_STR_SUBJECT_FOR_NEW_CONTACT 73
6782
6787#define DC_STR_FAILED_SENDING_TO 74
6788
6794#define DC_STR_EPHEMERAL_DISABLED 75
6795
6803#define DC_STR_EPHEMERAL_SECONDS 76
6804
6810#define DC_STR_EPHEMERAL_MINUTE 77
6811
6817#define DC_STR_EPHEMERAL_HOUR 78
6818
6824#define DC_STR_EPHEMERAL_DAY 79
6825
6831#define DC_STR_EPHEMERAL_WEEK 80
6832
6834#define DC_STR_EPHEMERAL_FOUR_WEEKS 81
6835
6839#define DC_STR_VIDEOCHAT_INVITATION 82
6840
6845#define DC_STR_VIDEOCHAT_INVITE_MSG_BODY 83
6846
6851#define DC_STR_CONFIGURATION_FAILED 84
6852
6857#define DC_STR_BAD_TIME_MSG_BODY 85
6858
6862#define DC_STR_UPDATE_REMINDER_MSG_BODY 86
6863
6867#define DC_STR_ERROR_NO_NETWORK 87
6868
6873#define DC_STR_REPLY_NOUN 90
6874
6878#define DC_STR_SELF_DELETED_MSG_BODY 91
6879
6883#define DC_STR_SERVER_TURNED_OFF 92
6884
6892#define DC_STR_EPHEMERAL_MINUTES 93
6893
6901#define DC_STR_EPHEMERAL_HOURS 94
6902
6910#define DC_STR_EPHEMERAL_DAYS 95
6911
6919#define DC_STR_EPHEMERAL_WEEKS 96
6920
6924#define DC_STR_FORWARDED 97
6925
6931#define DC_STR_QUOTA_EXCEEDING_MSG_BODY 98
6932
6940#define DC_STR_PARTIAL_DOWNLOAD_MSG_BODY 99
6941
6947#define DC_STR_DOWNLOAD_AVAILABILITY 100
6948
6952#define DC_STR_SYNC_MSG_SUBJECT 101
6953
6962#define DC_STR_SYNC_MSG_BODY 102
6963
6967#define DC_STR_INCOMING_MESSAGES 103
6968
6972#define DC_STR_OUTGOING_MESSAGES 104
6973
6979#define DC_STR_STORAGE_ON_DOMAIN 105
6980
6982#define DC_STR_ONE_MOMENT 106
6983
6987#define DC_STR_CONNECTED 107
6988
6992#define DC_STR_CONNTECTING 108
6993
6997#define DC_STR_UPDATING 109
6998
7002#define DC_STR_SENDING 110
7003
7007#define DC_STR_LAST_MSG_SENT_SUCCESSFULLY 111
7008
7014#define DC_STR_ERROR 112
7015
7019#define DC_STR_NOT_SUPPORTED_BY_PROVIDER 113
7020
7024#define DC_STR_MESSAGES 114
7025
7029#define DC_STR_BROADCAST_LIST 115
7030
7034#define DC_STR_PART_OF_TOTAL_USED 116
7035
7044#define DC_STR_SECURE_JOIN_STARTED 117
7045
7054#define DC_STR_SECURE_JOIN_REPLIES 118
7055
7061#define DC_STR_SETUP_CONTACT_QR_DESC 119
7062
7068#define DC_STR_SECURE_JOIN_GROUP_QR_DESC 120
7069
7073#define DC_STR_NOT_CONNECTED 121
7074
7078#define DC_STR_AEAP_ADDR_CHANGED 122
7079
7091#define DC_STR_AEAP_EXPLANATION_AND_LINK 123
7092
7097#define DC_STR_GROUP_NAME_CHANGED_BY_YOU 124
7098
7104#define DC_STR_GROUP_NAME_CHANGED_BY_OTHER 125
7105
7107#define DC_STR_GROUP_IMAGE_CHANGED_BY_YOU 126
7108
7112#define DC_STR_GROUP_IMAGE_CHANGED_BY_OTHER 127
7113
7119#define DC_STR_ADD_MEMBER_BY_YOU 128
7120
7127#define DC_STR_ADD_MEMBER_BY_OTHER 129
7128
7134#define DC_STR_REMOVE_MEMBER_BY_YOU 130
7135
7142#define DC_STR_REMOVE_MEMBER_BY_OTHER 131
7143
7147#define DC_STR_GROUP_LEFT_BY_YOU 132
7148
7154#define DC_STR_GROUP_LEFT_BY_OTHER 133
7155
7159#define DC_STR_GROUP_IMAGE_DELETED_BY_YOU 134
7160
7166#define DC_STR_GROUP_IMAGE_DELETED_BY_OTHER 135
7167
7171#define DC_STR_LOCATION_ENABLED_BY_YOU 136
7172
7178#define DC_STR_LOCATION_ENABLED_BY_OTHER 137
7179
7183#define DC_STR_EPHEMERAL_TIMER_DISABLED_BY_YOU 138
7184
7190#define DC_STR_EPHEMERAL_TIMER_DISABLED_BY_OTHER 139
7191
7197#define DC_STR_EPHEMERAL_TIMER_SECONDS_BY_YOU 140
7198
7205#define DC_STR_EPHEMERAL_TIMER_SECONDS_BY_OTHER 141
7206
7210#define DC_STR_EPHEMERAL_TIMER_1_MINUTE_BY_YOU 142
7211
7217#define DC_STR_EPHEMERAL_TIMER_1_MINUTE_BY_OTHER 143
7218
7222#define DC_STR_EPHEMERAL_TIMER_1_HOUR_BY_YOU 144
7223
7229#define DC_STR_EPHEMERAL_TIMER_1_HOUR_BY_OTHER 145
7230
7234#define DC_STR_EPHEMERAL_TIMER_1_DAY_BY_YOU 146
7235
7241#define DC_STR_EPHEMERAL_TIMER_1_DAY_BY_OTHER 147
7242
7246#define DC_STR_EPHEMERAL_TIMER_1_WEEK_BY_YOU 148
7247
7253#define DC_STR_EPHEMERAL_TIMER_1_WEEK_BY_OTHER 149
7254
7260#define DC_STR_EPHEMERAL_TIMER_MINUTES_BY_YOU 150
7261
7268#define DC_STR_EPHEMERAL_TIMER_MINUTES_BY_OTHER 151
7269
7275#define DC_STR_EPHEMERAL_TIMER_HOURS_BY_YOU 152
7276
7283#define DC_STR_EPHEMERAL_TIMER_HOURS_BY_OTHER 153
7284
7290#define DC_STR_EPHEMERAL_TIMER_DAYS_BY_YOU 154
7291
7298#define DC_STR_EPHEMERAL_TIMER_DAYS_BY_OTHER 155
7299
7305#define DC_STR_EPHEMERAL_TIMER_WEEKS_BY_YOU 156
7306
7313#define DC_STR_EPHEMERAL_TIMER_WEEKS_BY_OTHER 157
7314
7318#define DC_STR_BACKUP_TRANSFER_QR 162
7319
7323#define DC_STR_BACKUP_TRANSFER_MSG_BODY 163
7324
7328#define DC_STR_CHAT_PROTECTION_ENABLED 170
7329
7333#define DC_STR_CHAT_PROTECTION_DISABLED 171
7334
7338#define DC_STR_NEW_GROUP_SEND_FIRST_MESSAGE 172
7339
7345#define DC_STR_MESSAGE_ADD_MEMBER 173
7346
7352#define DC_STR_INVALID_UNENCRYPTED_MAIL 174
7353
7360#define DC_STR_YOU_REACTED 176
7361
7369#define DC_STR_REACTED_BY 177
7370
7374#define DC_STR_SECUREJOIN_WAIT 190
7375
7379#define DC_STR_SECUREJOIN_WAIT_TIMEOUT 191
7380
7382#define DC_STR_CONTACT 200
7383
7389#ifdef PY_CFFI_INC
7390/* Helper utility to locate the header file when building python bindings. */
7391char* _dc_header_file_location(void) {
7392 return __FILE__;
7393}
7394#endif
7395
7396
7397#ifdef __cplusplus
7398}
7399#endif
7400#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.
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.
int dc_accounts_background_fetch(dc_accounts_t *accounts, uint64_t timeout)
Perform a background fetch for all accounts in parallel with a timeout.
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_set_push_device_token(dc_accounts_t *accounts, const char *token)
Sets device token for Apple Push Notification service.
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_is_bot(dc_contact_t *contact)
Returns whether contact is a bot.
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...
uint32_t dc_init_webxdc_integration(dc_context_t *context, uint32_t chat_id)
Init a Webxdc integration.
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.
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.
void dc_set_webxdc_integration(dc_context_t *context, const char *file)
Set Webxdc file as integration.
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_get_push_state(dc_context_t *context)
Get the current push notification state.
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.
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 POI 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.
int dc_msg_save_file(const dc_msg_t *msg, const char *path)
Save file copy at the user-provided path.
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.