mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-06 03:50:08 +02:00
quick try at adding DC_EVENT names and use them to deltachat bindings
This commit is contained in:
parent
eec2261cca
commit
0340dbe81c
3 changed files with 40 additions and 4 deletions
|
@ -2,6 +2,7 @@ from deltachat import capi
|
|||
|
||||
|
||||
_DC_CALLBACK_MAP = {}
|
||||
_DC_EVENTNAME_MAP = {}
|
||||
|
||||
|
||||
@capi.ffi.def_extern()
|
||||
|
@ -16,3 +17,11 @@ def py_dc_callback(ctx, evt, data1, data2):
|
|||
if ret is None:
|
||||
return 0
|
||||
return ret
|
||||
|
||||
|
||||
def get_dc_event_name(integer):
|
||||
if not _DC_EVENTNAME_MAP:
|
||||
for name, val in vars(capi.lib).items():
|
||||
if name.startswith("DC_EVENT_"):
|
||||
_DC_EVENTNAME_MAP[val] = name
|
||||
return _DC_EVENTNAME_MAP[integer]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue