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;
26
27// Alias for backwards compatibility, use dc_event_emitter_t instead.
28typedef struct _dc_event_emitter dc_accounts_event_emitter_t;
29
181// create/open/config/information
182
198dc_context_t* dc_context_new (const char* os_name, const char* dbfile, const char* blobdir);
199
200
217
218
233int dc_context_open (dc_context_t *context, const char* passphrase);
234
235
244
245
258
259
271uint32_t dc_get_id (dc_context_t* context);
272
273
290
291
300char* dc_get_blobdir (const dc_context_t* context);
301
302
423int dc_set_config (dc_context_t* context, const char* key, const char* value);
424
425
451char* dc_get_config (dc_context_t* context, const char* key);
452
453
465int dc_set_stock_translation(dc_context_t* context, uint32_t stock_id, const char* stock_msg);
466
467
482int dc_set_config_from_qr (dc_context_t* context, const char* qr);
483
484
499char* dc_get_info (const dc_context_t* context);
500
501
531char* dc_get_oauth2_url (dc_context_t* context, const char* addr, const char* redirect_uri);
532
533
534#define DC_CONNECTIVITY_NOT_CONNECTED 1000
535#define DC_CONNECTIVITY_CONNECTING 2000
536#define DC_CONNECTIVITY_WORKING 3000
537#define DC_CONNECTIVITY_CONNECTED 4000
538
539
561
562
579
580
585int dc_all_work_done (dc_context_t* context);
586
587
588// connect
589
641
642
662int dc_is_configured (const dc_context_t* context);
663
664
675void dc_start_io (dc_context_t* context);
676
692
716
717
718
737int dc_preconfigure_keypair (dc_context_t* context, const char *addr, const char *public_data, const char *secret_data);
738
739
740// handle chatlists
741
742#define DC_GCL_ARCHIVED_ONLY 0x01
743#define DC_GCL_NO_SPECIALS 0x02
744#define DC_GCL_ADD_ALLDONE_HINT 0x04
745#define DC_GCL_FOR_FORWARDING 0x08
746
747
796dc_chatlist_t* dc_get_chatlist (dc_context_t* context, int flags, const char* query_str, uint32_t query_id);
797
798
799// handle chats
800
814uint32_t dc_create_chat_by_contact_id (dc_context_t* context, uint32_t contact_id);
815
816
828uint32_t dc_get_chat_id_by_contact_id (dc_context_t* context, uint32_t contact_id);
829
830
876uint32_t dc_prepare_msg (dc_context_t* context, uint32_t chat_id, dc_msg_t* msg);
877
878
916uint32_t dc_send_msg (dc_context_t* context, uint32_t chat_id, dc_msg_t* msg);
917
933uint32_t dc_send_msg_sync (dc_context_t* context, uint32_t chat_id, dc_msg_t* msg);
934
935
955uint32_t dc_send_text_msg (dc_context_t* context, uint32_t chat_id, const char* text_to_send);
956
957
991uint32_t dc_send_videochat_invitation (dc_context_t* context, uint32_t chat_id);
992
993
1021int dc_send_webxdc_status_update (dc_context_t* context, uint32_t msg_id, const char* json, const char* descr);
1022
1023
1054char* dc_get_webxdc_status_updates (dc_context_t* context, uint32_t msg_id, uint32_t serial);
1055
1079void dc_set_draft (dc_context_t* context, uint32_t chat_id, dc_msg_t* msg);
1080
1081
1129uint32_t dc_add_device_msg (dc_context_t* context, const char* label, dc_msg_t* msg);
1130
1141int dc_was_device_msg_ever_added (dc_context_t* context, const char* label);
1142
1143
1156dc_msg_t* dc_get_draft (dc_context_t* context, uint32_t chat_id);
1157
1158
1159#define DC_GCM_ADDDAYMARKER 0x01
1160#define DC_GCM_INFO_ONLY 0x02
1161
1162
1183dc_array_t* dc_get_chat_msgs (dc_context_t* context, uint32_t chat_id, uint32_t flags, uint32_t marker1before);
1184
1185
1194int dc_get_msg_cnt (dc_context_t* context, uint32_t chat_id);
1195
1196
1210int dc_get_fresh_msg_cnt (dc_context_t* context, uint32_t chat_id);
1211
1212
1213
1228int dc_estimate_deletion_cnt (dc_context_t* context, int from_server, int64_t seconds);
1229
1230
1250
1251
1265void dc_marknoticed_chat (dc_context_t* context, uint32_t chat_id);
1266
1267
1286dc_array_t* dc_get_chat_media (dc_context_t* context, uint32_t chat_id, int msg_type, int msg_type2, int msg_type3);
1287
1288
1309uint32_t dc_get_next_media (dc_context_t* context, uint32_t msg_id, int dir, int msg_type, int msg_type2, int msg_type3);
1310
1311
1327int dc_set_chat_protection (dc_context_t* context, uint32_t chat_id, int protect);
1328
1329
1341void dc_set_chat_visibility (dc_context_t* context, uint32_t chat_id, int visibility);
1342
1343
1369void dc_delete_chat (dc_context_t* context, uint32_t chat_id);
1370
1384void dc_block_chat (dc_context_t* context, uint32_t chat_id);
1385
1398void dc_accept_chat (dc_context_t* context, uint32_t chat_id);
1399
1422dc_array_t* dc_get_chat_contacts (dc_context_t* context, uint32_t chat_id);
1423
1434char* dc_get_chat_encrinfo (dc_context_t* context, uint32_t chat_id);
1435
1447uint32_t dc_get_chat_ephemeral_timer (dc_context_t* context, uint32_t chat_id);
1448
1471dc_array_t* dc_search_msgs (dc_context_t* context, uint32_t chat_id, const char* query);
1472
1473
1484dc_chat_t* dc_get_chat (dc_context_t* context, uint32_t chat_id);
1485
1486
1487// handle group chats
1488
1516uint32_t dc_create_group_chat (dc_context_t* context, int protect, const char* name);
1517
1518
1547
1548
1559int dc_is_contact_in_chat (dc_context_t* context, uint32_t chat_id, uint32_t contact_id);
1560
1561
1578int dc_add_contact_to_chat (dc_context_t* context, uint32_t chat_id, uint32_t contact_id);
1579
1580
1595int dc_remove_contact_from_chat (dc_context_t* context, uint32_t chat_id, uint32_t contact_id);
1596
1597
1612int dc_set_chat_name (dc_context_t* context, uint32_t chat_id, const char* name);
1613
1631int dc_set_chat_ephemeral_timer (dc_context_t* context, uint32_t chat_id, uint32_t timer);
1632
1652int dc_set_chat_profile_image (dc_context_t* context, uint32_t chat_id, const char* image);
1653
1654
1655
1677int dc_set_chat_mute_duration (dc_context_t* context, uint32_t chat_id, int64_t duration);
1678
1679// handle messages
1680
1693char* dc_get_msg_info (dc_context_t* context, uint32_t msg_id);
1694
1695
1743char* dc_get_msg_html (dc_context_t* context, uint32_t msg_id);
1744
1745
1765void dc_download_full_msg (dc_context_t* context, int msg_id);
1766
1767
1782char* dc_get_mime_headers (dc_context_t* context, uint32_t msg_id);
1783
1784
1794void dc_delete_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt);
1795
1796
1811void dc_forward_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt, uint32_t chat_id);
1812
1813
1830int dc_resend_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt);
1831
1832
1858void dc_markseen_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt);
1859
1860
1873dc_msg_t* dc_get_msg (dc_context_t* context, uint32_t msg_id);
1874
1875
1876// handle contacts
1877
1891int dc_may_be_valid_addr (const char* addr);
1892
1893
1907uint32_t dc_lookup_contact_id_by_addr (dc_context_t* context, const char* addr);
1908
1909
1930uint32_t dc_create_contact (dc_context_t* context, const char* name, const char* addr);
1931
1932
1933#define DC_GCL_VERIFIED_ONLY 0x01
1934#define DC_GCL_ADD_SELF 0x02
1935
1936
1960int dc_add_address_book (dc_context_t* context, const char* addr_book);
1961
1962
1979dc_array_t* dc_get_contacts (dc_context_t* context, uint32_t flags, const char* query);
1980
1981
1991
1992
2002
2003
2013void dc_block_contact (dc_context_t* context, uint32_t contact_id, int block);
2014
2015
2026char* dc_get_contact_encrinfo (dc_context_t* context, uint32_t contact_id);
2027
2028
2040int dc_delete_contact (dc_context_t* context, uint32_t contact_id);
2041
2042
2056dc_contact_t* dc_get_contact (dc_context_t* context, uint32_t contact_id);
2057
2058
2059// import/export and tools
2060
2061#define DC_IMEX_EXPORT_SELF_KEYS 1 // param1 is a directory where the keys are written to
2062#define DC_IMEX_IMPORT_SELF_KEYS 2 // param1 is a directory where the keys are searched in and read from
2063#define DC_IMEX_EXPORT_BACKUP 11 // param1 is a directory where the backup is written to, param2 is a passphrase to encrypt the backup
2064#define DC_IMEX_IMPORT_BACKUP 12 // param1 is the file with the backup to import, param2 is the backup's passphrase
2065
2066
2112void dc_imex (dc_context_t* context, int what, const char* param1, const char* param2);
2113
2114
2164char* dc_imex_has_backup (dc_context_t* context, const char* dir);
2165
2166
2212
2213
2234int dc_continue_key_transfer (dc_context_t* context, uint32_t msg_id, const char* setup_code);
2235
2236
2254
2255
2256// out-of-band verification
2257
2258#define DC_QR_ASK_VERIFYCONTACT 200 // id=contact
2259#define DC_QR_ASK_VERIFYGROUP 202 // text1=groupname
2260#define DC_QR_FPR_OK 210 // id=contact
2261#define DC_QR_FPR_MISMATCH 220 // id=contact
2262#define DC_QR_FPR_WITHOUT_ADDR 230 // test1=formatted fingerprint
2263#define DC_QR_ACCOUNT 250 // text1=domain
2264#define DC_QR_WEBRTC_INSTANCE 260 // text1=domain, text2=instance pattern
2265#define DC_QR_ADDR 320 // id=contact
2266#define DC_QR_TEXT 330 // text1=text
2267#define DC_QR_URL 332 // text1=URL
2268#define DC_QR_ERROR 400 // text1=error string
2269#define DC_QR_WITHDRAW_VERIFYCONTACT 500
2270#define DC_QR_WITHDRAW_VERIFYGROUP 502 // text1=groupname
2271#define DC_QR_REVIVE_VERIFYCONTACT 510
2272#define DC_QR_REVIVE_VERIFYGROUP 512 // text1=groupname
2273#define DC_QR_LOGIN 520 // text1=email_address
2274
2356dc_lot_t* dc_check_qr (dc_context_t* context, const char* qr);
2357
2358
2380char* dc_get_securejoin_qr (dc_context_t* context, uint32_t chat_id);
2381
2382
2395char* dc_get_securejoin_qr_svg (dc_context_t* context, uint32_t chat_id);
2396
2421uint32_t dc_join_securejoin (dc_context_t* context, const char* qr);
2422
2423
2424// location streaming
2425
2426
2443void dc_send_locations_to_chat (dc_context_t* context, uint32_t chat_id, int seconds);
2444
2445
2459int dc_is_sending_locations_to_chat (dc_context_t* context, uint32_t chat_id);
2460
2461
2489int dc_set_location (dc_context_t* context, double latitude, double longitude, double accuracy);
2490
2491
2552dc_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);
2553
2554
2566
2567
2582
2583
2596void dc_str_unref (char* str);
2597
2598
2646dc_accounts_t* dc_accounts_new (const char* os_name, const char* dir);
2647
2648
2656
2657
2674
2691
2706uint32_t dc_accounts_migrate_account (dc_accounts_t* accounts, const char* dbfile);
2707
2708
2720int dc_accounts_remove_account (dc_accounts_t* accounts, uint32_t account_id);
2721
2722
2732
2733
2745dc_context_t* dc_accounts_get_account (dc_accounts_t* accounts, uint32_t account_id);
2746
2747
2764
2765
2774int dc_accounts_select_account (dc_accounts_t* accounts, uint32_t account_id);
2775
2776
2792
2793
2804
2805
2815
2816
2827
2828
2842
2843
2864
2865
2885
2886
2894size_t dc_array_get_cnt (const dc_array_t* array);
2895
2896
2905uint32_t dc_array_get_id (const dc_array_t* array, size_t index);
2906
2907
2917double dc_array_get_latitude (const dc_array_t* array, size_t index);
2918
2919
2929double dc_array_get_longitude (const dc_array_t* array, size_t index);
2930
2931
2942double dc_array_get_accuracy (const dc_array_t* array, size_t index);
2943
2944
2954int64_t dc_array_get_timestamp (const dc_array_t* array, size_t index);
2955
2956
2966uint32_t dc_array_get_chat_id (const dc_array_t* array, size_t index);
2967
2968
2978uint32_t dc_array_get_contact_id (const dc_array_t* array, size_t index);
2979
2980
2990uint32_t dc_array_get_msg_id (const dc_array_t* array, size_t index);
2991
2992
3007char* dc_array_get_marker (const dc_array_t* array, size_t index);
3008
3009
3020int dc_array_is_independent (const dc_array_t* array, size_t index);
3021
3022
3032int dc_array_search_id (const dc_array_t* array, uint32_t needle, size_t* ret_index);
3033
3034
3077
3078
3086size_t dc_chatlist_get_cnt (const dc_chatlist_t* chatlist);
3087
3088
3100uint32_t dc_chatlist_get_chat_id (const dc_chatlist_t* chatlist, size_t index);
3101
3102
3114uint32_t dc_chatlist_get_msg_id (const dc_chatlist_t* chatlist, size_t index);
3115
3116
3143dc_lot_t* dc_chatlist_get_summary (const dc_chatlist_t* chatlist, size_t index, dc_chat_t* chat);
3144
3145
3165dc_lot_t* dc_chatlist_get_summary2 (dc_context_t* context, uint32_t chat_id, uint32_t msg_id);
3166
3167
3176
3177
3194char* dc_chat_get_info_json (dc_context_t* context, size_t chat_id);
3195
3206#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)
3207#define DC_CHAT_ID_ARCHIVED_LINK 6 // only an indicator in a chatlist
3208#define DC_CHAT_ID_ALLDONE_HINT 7 // only an indicator in a chatlist
3209#define DC_CHAT_ID_LAST_SPECIAL 9 // larger chat IDs are "real" chats, their messages are "real" messages
3210
3211
3220
3221
3234uint32_t dc_chat_get_id (const dc_chat_t* chat);
3235
3236
3267int dc_chat_get_type (const dc_chat_t* chat);
3268
3269
3281
3282
3294char* dc_chat_get_name (const dc_chat_t* chat);
3295
3296
3311
3312
3325uint32_t dc_chat_get_color (const dc_chat_t* chat);
3326
3327
3337
3338
3356
3357
3379
3380
3390
3391
3407
3408
3420int dc_chat_can_send (const dc_chat_t* chat);
3421
3422
3434
3435
3447
3448
3456int dc_chat_is_muted (const dc_chat_t* chat);
3457
3458
3467
3468
3478#define DC_MSG_ID_MARKER1 1 // this is used by iOS to mark things in the message list
3479#define DC_MSG_ID_DAYMARKER 9
3480#define DC_MSG_ID_LAST_SPECIAL 9
3481
3482
3495dc_msg_t* dc_msg_new (dc_context_t* context, int viewtype);
3496
3497
3506
3507
3516uint32_t dc_msg_get_id (const dc_msg_t* msg);
3517
3518
3533uint32_t dc_msg_get_from_id (const dc_msg_t* msg);
3534
3535
3544uint32_t dc_msg_get_chat_id (const dc_msg_t* msg);
3545
3546
3556
3557
3601
3602
3619int64_t dc_msg_get_timestamp (const dc_msg_t* msg);
3620
3621
3634
3635
3650
3651
3671char* dc_msg_get_text (const dc_msg_t* msg);
3672
3673
3691char* dc_msg_get_subject (const dc_msg_t* msg);
3692
3706char* dc_msg_get_file (const dc_msg_t* msg);
3707
3708
3720
3721
3733
3734
3747char* dc_msg_get_webxdc_blob (const dc_msg_t* msg, const char* filename, size_t* ret_bytes);
3748
3749
3783
3784
3795uint64_t dc_msg_get_filebytes (const dc_msg_t* msg);
3796
3797
3813
3814
3830
3831
3844
3845
3854
3864int dc_msg_is_bot (const dc_msg_t* msg);
3865
3878
3892
3893
3917
3918
3930char* dc_msg_get_summarytext (const dc_msg_t* msg, int approx_characters);
3931
3932
3962
3963
3964
3980
3981
3992
3993
4004int dc_msg_is_sent (const dc_msg_t* msg);
4005
4006
4024
4025
4046int dc_msg_is_info (const dc_msg_t* msg);
4047
4048
4068
4069
4070// DC_INFO* uses the same values as SystemMessage in rust-land
4071#define DC_INFO_PROTECTION_ENABLED 11
4072#define DC_INFO_PROTECTION_DISABLED 12
4073
4074
4088
4089
4105
4106
4122
4123
4138
4139
4159char* dc_msg_get_error (const dc_msg_t* msg);
4160
4161
4191
4192#define DC_VIDEOCHATTYPE_UNKNOWN 0
4193#define DC_VIDEOCHATTYPE_BASICWEBRTC 1
4194#define DC_VIDEOCHATTYPE_JITSI 2
4195
4196
4221
4222
4246
4247
4256void dc_msg_set_text (dc_msg_t* msg, const char* text);
4257
4258
4283void dc_msg_set_html (dc_msg_t* msg, const char* html);
4284
4285
4298void dc_msg_set_override_sender_name(dc_msg_t* msg, const char* name);
4299
4300
4313void dc_msg_set_file (dc_msg_t* msg, const char* file, const char* filemime);
4314
4315
4326void dc_msg_set_dimension (dc_msg_t* msg, int width, int height);
4327
4328
4338void dc_msg_set_duration (dc_msg_t* msg, int duration);
4339
4340
4357void dc_msg_set_location (dc_msg_t* msg, double latitude, double longitude);
4358
4359
4381void dc_msg_latefiling_mediasize (dc_msg_t* msg, int width, int height, int duration);
4382
4383
4398void dc_msg_set_quote (dc_msg_t* msg, const dc_msg_t* quote);
4399
4400
4416
4417
4440
4456
4457
4467
4489#define DC_CONTACT_ID_SELF 1
4490#define DC_CONTACT_ID_INFO 2 // centered messages as "member added", used in all chats
4491#define DC_CONTACT_ID_DEVICE 5 // messages "update info" in the device-chat
4492#define DC_CONTACT_ID_LAST_SPECIAL 9
4493
4494
4503
4504
4512uint32_t dc_contact_get_id (const dc_contact_t* contact);
4513
4514
4523char* dc_contact_get_addr (const dc_contact_t* contact);
4524
4525
4540char* dc_contact_get_name (const dc_contact_t* contact);
4541
4542
4563
4564
4581
4582
4583// dc_contact_get_first_name is removed,
4584// the following define is to make upgrading more smoothly.
4585#define dc_contact_get_first_name dc_contact_get_display_name
4586
4587
4603
4604
4617
4618
4630uint32_t dc_contact_get_color (const dc_contact_t* contact);
4631
4632
4645
4655
4656
4670
4671
4682
4683
4696
4697
4718dc_provider_t* dc_provider_new_from_email (const dc_context_t* context, const char* email);
4719
4720
4736
4737
4750
4751
4767
4768
4780
4781
4789
4790
4803#define DC_TEXT1_DRAFT 1
4804#define DC_TEXT1_USERNAME 2
4805#define DC_TEXT1_SELF 3
4806
4807
4818
4819
4829char* dc_lot_get_text1 (const dc_lot_t* lot);
4830
4831
4841char* dc_lot_get_text2 (const dc_lot_t* lot);
4842
4843
4854
4855
4864
4865
4873uint32_t dc_lot_get_id (const dc_lot_t* lot);
4874
4875
4885int64_t dc_lot_get_timestamp (const dc_lot_t* lot);
4886
4887
4917#define DC_MSG_TEXT 10
4918
4919
4931#define DC_MSG_IMAGE 20
4932
4933
4939#define DC_MSG_GIF 21
4940
4941
4947#define DC_MSG_STICKER 23
4948
4949
4955#define DC_MSG_AUDIO 40
4956
4957
4964#define DC_MSG_VOICE 41
4965
4966
4975#define DC_MSG_VIDEO 50
4976
4977
4983#define DC_MSG_FILE 60
4984
4985
4994#define DC_MSG_VIDEOCHAT_INVITATION 70
4995
4996
5002#define DC_MSG_WEBXDC 80
5003
5004
5024#define DC_STATE_UNDEFINED 0
5025
5029#define DC_STATE_IN_FRESH 10
5030
5034#define DC_STATE_IN_NOTICED 13
5035
5039#define DC_STATE_IN_SEEN 16
5040
5044#define DC_STATE_OUT_PREPARING 18
5045
5049#define DC_STATE_OUT_DRAFT 19
5050
5054#define DC_STATE_OUT_PENDING 20
5055
5059#define DC_STATE_OUT_FAILED 24
5060
5065#define DC_STATE_OUT_DELIVERED 26
5066
5070#define DC_STATE_OUT_MDN_RCVD 28
5071
5092#define DC_CHAT_TYPE_UNDEFINED 0
5093
5097#define DC_CHAT_TYPE_SINGLE 100
5098
5102#define DC_CHAT_TYPE_GROUP 120
5103
5107#define DC_CHAT_TYPE_MAILINGLIST 140
5108
5112#define DC_CHAT_TYPE_BROADCAST 160
5113
5133#define DC_SOCKET_AUTO 0
5134
5135
5139#define DC_SOCKET_SSL 1
5140
5141
5145#define DC_SOCKET_STARTTLS 2
5146
5147
5151#define DC_SOCKET_PLAIN 3
5152
5176#define DC_LP_AUTH_OAUTH2 0x2
5177
5178
5183#define DC_LP_AUTH_NORMAL 0x4
5184
5185
5190#define DC_LP_AUTH_FLAGS (DC_LP_AUTH_OAUTH2|DC_LP_AUTH_NORMAL) // if none of these flags are set, the default is chosen
5191
5207#define DC_CERTCK_AUTO 0
5208
5213#define DC_CERTCK_STRICT 1
5214
5219#define DC_CERTCK_ACCEPT_INVALID_CERTIFICATES 3
5220
5243
5252
5262void dc_jsonrpc_request(dc_jsonrpc_instance_t* jsonrpc_instance, const char* request);
5263
5274
5295
5296// Alias for backwards compatibility, use dc_get_next_event instead.
5297#define dc_accounts_get_next_event dc_get_next_event
5298
5307
5308// Alias for backwards compatibility, use dc_event_emtitter_unref instead.
5309#define dc_accounts_event_emitter_unref dc_event_emitter_unref
5310
5330
5331
5344
5345
5358
5359
5373
5374
5385
5386
5395
5396
5419#define DC_EVENT_INFO 100
5420
5421
5428#define DC_EVENT_SMTP_CONNECTED 101
5429
5430
5437#define DC_EVENT_IMAP_CONNECTED 102
5438
5445#define DC_EVENT_SMTP_MESSAGE_SENT 103
5446
5453#define DC_EVENT_IMAP_MESSAGE_DELETED 104
5454
5461#define DC_EVENT_IMAP_MESSAGE_MOVED 105
5462
5469#define DC_EVENT_NEW_BLOB_FILE 150
5470
5477#define DC_EVENT_DELETED_BLOB_FILE 151
5478
5487#define DC_EVENT_WARNING 300
5488
5489
5507#define DC_EVENT_ERROR 400
5508
5509
5520#define DC_EVENT_ERROR_SELF_NOT_IN_GROUP 410
5521
5522
5533#define DC_EVENT_MSGS_CHANGED 2000
5534
5535
5545#define DC_EVENT_INCOMING_MSG 2005
5546
5547
5560#define DC_EVENT_MSGS_NOTICED 2008
5561
5562
5570#define DC_EVENT_MSG_DELIVERED 2010
5571
5572
5581#define DC_EVENT_MSG_FAILED 2012
5582
5583
5591#define DC_EVENT_MSG_READ 2015
5592
5593
5603#define DC_EVENT_CHAT_MODIFIED 2020
5604
5611#define DC_EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED 2021
5612
5613
5620#define DC_EVENT_CONTACTS_CHANGED 2030
5621
5622
5623
5632#define DC_EVENT_LOCATION_CHANGED 2035
5633
5634
5641#define DC_EVENT_CONFIGURE_PROGRESS 2041
5642
5643
5650#define DC_EVENT_IMEX_PROGRESS 2051
5651
5652
5663#define DC_EVENT_IMEX_FILE_WRITTEN 2052
5664
5665
5680#define DC_EVENT_SECUREJOIN_INVITER_PROGRESS 2060
5681
5682
5695#define DC_EVENT_SECUREJOIN_JOINER_PROGRESS 2061
5696
5697
5707#define DC_EVENT_CONNECTIVITY_CHANGED 2100
5708
5709
5714#define DC_EVENT_SELFAVATAR_CHANGED 2110
5715
5716
5731#define DC_EVENT_WEBXDC_STATUS_UPDATE 2120
5732
5739#define DC_EVENT_WEBXDC_INSTANCE_DELETED 2121
5740
5741
5747#define DC_EVENT_DATA1_IS_STRING(e) 0 // not used anymore
5748#define DC_EVENT_DATA2_IS_STRING(e) ((e)==DC_EVENT_CONFIGURE_PROGRESS || (e)==DC_EVENT_IMEX_FILE_WRITTEN || ((e)>=100 && (e)<=499))
5749
5750
5751/*
5752 * Values for dc_get|set_config("show_emails")
5753 */
5754#define DC_SHOW_EMAILS_OFF 0
5755#define DC_SHOW_EMAILS_ACCEPTED_CONTACTS 1
5756#define DC_SHOW_EMAILS_ALL 2
5757
5758
5759/*
5760 * Values for dc_get|set_config("media_quality")
5761 */
5762#define DC_MEDIA_QUALITY_BALANCED 0
5763#define DC_MEDIA_QUALITY_WORSE 1
5764
5765
5766/*
5767 * Values for dc_get|set_config("key_gen_type")
5768 */
5769#define DC_KEY_GEN_DEFAULT 0
5770#define DC_KEY_GEN_RSA2048 1
5771#define DC_KEY_GEN_ED25519 2
5772
5773
5795#define DC_PROVIDER_STATUS_OK 1
5796
5808#define DC_PROVIDER_STATUS_PREPARATION 2
5809
5822#define DC_PROVIDER_STATUS_BROKEN 3
5823
5844#define DC_CHAT_VISIBILITY_NORMAL 0
5845
5858#define DC_CHAT_VISIBILITY_ARCHIVED 1
5859
5864#define DC_CHAT_VISIBILITY_PINNED 2
5865
5885#define DC_DOWNLOAD_DONE 0
5886
5890#define DC_DOWNLOAD_AVAILABLE 10
5891
5895#define DC_DOWNLOAD_FAILURE 20
5896
5900#define DC_DOWNLOAD_IN_PROGRESS 1000
5901
5902
5903
5931#define DC_STR_NOMESSAGES 1
5932
5936#define DC_STR_SELF 2
5937
5941#define DC_STR_DRAFT 3
5942
5946#define DC_STR_VOICEMESSAGE 7
5947
5951#define DC_STR_IMAGE 9
5952
5956#define DC_STR_VIDEO 10
5957
5961#define DC_STR_AUDIO 11
5962
5966#define DC_STR_FILE 12
5967
5975#define DC_STR_MSGGRPNAME 15
5976
5982#define DC_STR_MSGGRPIMGCHANGED 16
5983
5990#define DC_STR_MSGADDMEMBER 17
5991
5998#define DC_STR_MSGDELMEMBER 18
5999
6005#define DC_STR_MSGGROUPLEFT 19
6006
6010#define DC_STR_GIF 23
6011
6015#define DC_STR_ENCRYPTEDMSG 24
6016
6020#define DC_STR_E2E_AVAILABLE 25
6021
6023#define DC_STR_ENCR_TRANSP 27
6024
6028#define DC_STR_ENCR_NONE 28
6029
6033#define DC_STR_CANTDECRYPT_MSG_BODY 29
6034
6038#define DC_STR_FINGERPRINTS 30
6039
6043#define DC_STR_READRCPT 31
6044
6049#define DC_STR_READRCPT_MAILBODY 32
6050
6052#define DC_STR_MSGGRPIMGDELETED 33
6053
6057#define DC_STR_E2E_PREFERRED 34
6058
6063#define DC_STR_CONTACT_VERIFIED 35
6064
6069#define DC_STR_CONTACT_NOT_VERIFIED 36
6070
6075#define DC_STR_CONTACT_SETUP_CHANGED 37
6076
6080#define DC_STR_ARCHIVEDCHATS 40
6081
6085#define DC_STR_AC_SETUP_MSG_SUBJECT 42
6086
6090#define DC_STR_AC_SETUP_MSG_BODY 43
6091
6096#define DC_STR_CANNOT_LOGIN 60
6097
6106#define DC_STR_MSGACTIONBYUSER 62
6107
6115#define DC_STR_MSGACTIONBYME 63
6116
6120#define DC_STR_MSGLOCATIONENABLED 64
6121
6125#define DC_STR_MSGLOCATIONDISABLED 65
6126
6130#define DC_STR_LOCATION 66
6131
6135#define DC_STR_STICKER 67
6136
6140#define DC_STR_DEVICE_MESSAGES 68
6141
6145#define DC_STR_SAVED_MESSAGES 69
6146
6150#define DC_STR_DEVICE_MESSAGES_HINT 70
6151
6155#define DC_STR_WELCOME_MESSAGE 71
6156
6160#define DC_STR_UNKNOWN_SENDER_FOR_CHAT 72
6161
6167#define DC_STR_SUBJECT_FOR_NEW_CONTACT 73
6168
6173#define DC_STR_FAILED_SENDING_TO 74
6174
6180#define DC_STR_EPHEMERAL_DISABLED 75
6181
6189#define DC_STR_EPHEMERAL_SECONDS 76
6190
6196#define DC_STR_EPHEMERAL_MINUTE 77
6197
6203#define DC_STR_EPHEMERAL_HOUR 78
6204
6210#define DC_STR_EPHEMERAL_DAY 79
6211
6217#define DC_STR_EPHEMERAL_WEEK 80
6218
6220#define DC_STR_EPHEMERAL_FOUR_WEEKS 81
6221
6225#define DC_STR_VIDEOCHAT_INVITATION 82
6226
6231#define DC_STR_VIDEOCHAT_INVITE_MSG_BODY 83
6232
6237#define DC_STR_CONFIGURATION_FAILED 84
6238
6243#define DC_STR_BAD_TIME_MSG_BODY 85
6244
6248#define DC_STR_UPDATE_REMINDER_MSG_BODY 86
6249
6253#define DC_STR_ERROR_NO_NETWORK 87
6254
6257
6259#define DC_STR_PROTECTION_ENABLED 88
6260
6262#define DC_STR_PROTECTION_DISABLED 89
6263
6268#define DC_STR_REPLY_NOUN 90
6269
6273#define DC_STR_SELF_DELETED_MSG_BODY 91
6274
6278#define DC_STR_SERVER_TURNED_OFF 92
6279
6287#define DC_STR_EPHEMERAL_MINUTES 93
6288
6296#define DC_STR_EPHEMERAL_HOURS 94
6297
6305#define DC_STR_EPHEMERAL_DAYS 95
6306
6314#define DC_STR_EPHEMERAL_WEEKS 96
6315
6319#define DC_STR_FORWARDED 97
6320
6326#define DC_STR_QUOTA_EXCEEDING_MSG_BODY 98
6327
6335#define DC_STR_PARTIAL_DOWNLOAD_MSG_BODY 99
6336
6342#define DC_STR_DOWNLOAD_AVAILABILITY 100
6343
6347#define DC_STR_SYNC_MSG_SUBJECT 101
6348
6357#define DC_STR_SYNC_MSG_BODY 102
6358
6362#define DC_STR_INCOMING_MESSAGES 103
6363
6367#define DC_STR_OUTGOING_MESSAGES 104
6368
6374#define DC_STR_STORAGE_ON_DOMAIN 105
6375
6377#define DC_STR_ONE_MOMENT 106
6378
6382#define DC_STR_CONNECTED 107
6383
6387#define DC_STR_CONNTECTING 108
6388
6392#define DC_STR_UPDATING 109
6393
6397#define DC_STR_SENDING 110
6398
6402#define DC_STR_LAST_MSG_SENT_SUCCESSFULLY 111
6403
6409#define DC_STR_ERROR 112
6410
6414#define DC_STR_NOT_SUPPORTED_BY_PROVIDER 113
6415
6419#define DC_STR_MESSAGES 114
6420
6424#define DC_STR_BROADCAST_LIST 115
6425
6429#define DC_STR_PART_OF_TOTAL_USED 116
6430
6439#define DC_STR_SECURE_JOIN_STARTED 117
6440
6449#define DC_STR_SECURE_JOIN_REPLIES 118
6450
6456#define DC_STR_SETUP_CONTACT_QR_DESC 119
6457
6463#define DC_STR_SECURE_JOIN_GROUP_QR_DESC 120
6464
6468#define DC_STR_NOT_CONNECTED 121
6469
6473#define DC_STR_AEAP_ADDR_CHANGED 122
6474
6486#define DC_STR_AEAP_EXPLANATION_AND_LINK 123
6487
6492#define DC_STR_GROUP_NAME_CHANGED_BY_YOU 124
6493
6499#define DC_STR_GROUP_NAME_CHANGED_BY_OTHER 125
6500
6502#define DC_STR_GROUP_IMAGE_CHANGED_BY_YOU 126
6503
6507#define DC_STR_GROUP_IMAGE_CHANGED_BY_OTHER 127
6508
6512#define DC_STR_ADD_MEMBER_BY_YOU 128
6513
6520#define DC_STR_ADD_MEMBER_BY_OTHER 129
6521
6527#define DC_STR_REMOVE_MEMBER_BY_YOU 130
6528
6535#define DC_STR_REMOVE_MEMBER_BY_OTHER 131
6536
6540#define DC_STR_GROUP_LEFT_BY_YOU 132
6541
6547#define DC_STR_GROUP_LEFT_BY_OTHER 133
6548
6552#define DC_STR_GROUP_IMAGE_DELETED_BY_YOU 134
6553
6559#define DC_STR_GROUP_IMAGE_DELETED_BY_OTHER 135
6560
6564#define DC_STR_LOCATION_ENABLED_BY_YOU 136
6565
6571#define DC_STR_LOCATION_ENABLED_BY_OTHER 137
6572
6576#define DC_STR_EPHEMERAL_TIMER_DISABLED_BY_YOU 138
6577
6583#define DC_STR_EPHEMERAL_TIMER_DISABLED_BY_OTHER 139
6584
6590#define DC_STR_EPHEMERAL_TIMER_SECONDS_BY_YOU 140
6591
6598#define DC_STR_EPHEMERAL_TIMER_SECONDS_BY_OTHER 141
6599
6603#define DC_STR_EPHEMERAL_TIMER_1_MINUTE_BY_YOU 142
6604
6610#define DC_STR_EPHEMERAL_TIMER_1_MINUTE_BY_OTHER 143
6611
6615#define DC_STR_EPHEMERAL_TIMER_1_HOUR_BY_YOU 144
6616
6622#define DC_STR_EPHEMERAL_TIMER_1_HOUR_BY_OTHER 145
6623
6627#define DC_STR_EPHEMERAL_TIMER_1_DAY_BY_YOU 146
6628
6634#define DC_STR_EPHEMERAL_TIMER_1_DAY_BY_OTHER 147
6635
6639#define DC_STR_EPHEMERAL_TIMER_1_WEEK_BY_YOU 148
6640
6646#define DC_STR_EPHEMERAL_TIMER_1_WEEK_BY_OTHER 149
6647
6653#define DC_STR_EPHEMERAL_TIMER_MINUTES_BY_YOU 150
6654
6661#define DC_STR_EPHEMERAL_TIMER_MINUTES_BY_OTHER 151
6662
6668#define DC_STR_EPHEMERAL_TIMER_HOURS_BY_YOU 152
6669
6676#define DC_STR_EPHEMERAL_TIMER_HOURS_BY_OTHER 153
6677
6683#define DC_STR_EPHEMERAL_TIMER_DAYS_BY_YOU 154
6684
6691#define DC_STR_EPHEMERAL_TIMER_DAYS_BY_OTHER 155
6692
6698#define DC_STR_EPHEMERAL_TIMER_WEEKS_BY_YOU 156
6699
6706#define DC_STR_EPHEMERAL_TIMER_WEEKS_BY_OTHER 157
6707
6711#define DC_STR_PROTECTION_ENABLED_BY_YOU 158
6712
6718#define DC_STR_PROTECTION_ENABLED_BY_OTHER 159
6719
6721#define DC_STR_PROTECTION_DISABLED_BY_YOU 160
6722
6726#define DC_STR_PROTECTION_DISABLED_BY_OTHER 161
6727
6733#ifdef PY_CFFI_INC
6734/* Helper utility to locate the header file when building python bindings. */
6735char* _dc_header_file_location(void) {
6736 return __FILE__;
6737}
6738#endif
6739
6740
6741#ifdef __cplusplus
6742}
6743#endif
6744#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_accounts_t * dc_accounts_new(const char *os_name, const char *dir)
Create a new account manager.
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.
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.
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:
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 a contact was verified.
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.
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.
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_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.
int dc_set_chat_protection(dc_context_t *context, uint32_t chat_id, int protect)
Enable or disable protection against active attacks.
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.
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.
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.
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.
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.
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 a base file name 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.
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, file name and extension 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.