1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-05 10:39:27 +02:00

introduce get_config() helper

This commit is contained in:
holger krekel 2018-09-07 19:19:31 +02:00
parent c02abb8a61
commit a244393860
2 changed files with 9 additions and 4 deletions

View file

@ -27,6 +27,8 @@ class EventHandler:
def dc_event_http_get(self, data1, data2):
url = data1
content = self.read_url(url)
if not isinstance(content, bytes):
content = content.encode("utf8")
# we need to return a fresh pointer that the core owns
return capi.lib.dupstring_helper(content)
@ -53,6 +55,11 @@ class Account:
value = value.encode("utf8")
capi.lib.dc_set_config(self.dc_context, name, value)
def get_config(self, name):
name = name.encode("utf8")
res = capi.lib.dc_get_config(self.dc_context, name, b'')
return capi.ffi.string(res).decode("utf8")
def start(self):
deltachat.set_context_callback(self.dc_context, self.process_event)
capi.lib.dc_configure(self.dc_context)