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

address the remaining comments

This commit is contained in:
holger krekel 2018-09-09 13:40:57 +02:00
parent 75153289ef
commit 49040f4e92
4 changed files with 18 additions and 6 deletions

View file

@ -79,9 +79,11 @@ class Contact:
def __init__(self, dc_context, contact_id):
self.dc_context = dc_context
self.id = contact_id
# XXX do we need to free dc_contact_t? (we own it according to API)
self.dc_contact_t = capi.lib.dc_get_contact(self.dc_context, contact_id)
def __del__(self):
capi.lib.free(self.dc_contact_t)
@property
def addr(self):
return ffi_unicode(capi.lib.dc_contact_get_addr(self.dc_contact_t))
@ -161,6 +163,8 @@ class Account:
return ffi_unicode(res)
def get_self_contact(self):
if not capi.lib.dc_is_configured(self.dc_context):
raise ValueError("need to configure first")
return Contact(self.dc_context, capi.lib.DC_CONTACT_ID_SELF)
def create_contact(self, email, name=ffi.NULL):