From ebb0d43ba773ec13e47d74b7baf035aaf7f0fb17 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Tue, 22 Jan 2019 13:23:54 +0100 Subject: openpgp-ffi: Wrap Fingerprint. --- ffi/lang/python/sequoia/glue.py | 7 +++++++ ffi/lang/python/sequoia/openpgp.py | 1 + ffi/src/lib.rs | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'ffi') diff --git a/ffi/lang/python/sequoia/glue.py b/ffi/lang/python/sequoia/glue.py index 11468dfd..ea40d20c 100644 --- a/ffi/lang/python/sequoia/glue.py +++ b/ffi/lang/python/sequoia/glue.py @@ -28,6 +28,7 @@ class SQObject(object): _clone = None _eq = None _str = None + _debug = None _hash = None def __init__(self, o, context=None, owner=None, references=None): @@ -96,6 +97,12 @@ class SQObject(object): def __hash__(self): return self._hash(self.ref()) + def debug(self): + if self._debug: + return _str(self._debug(self.ref())) + else: + raise NotImplementedError() + def sq_str(s): t = ffi.string(s).decode() lib.free(s) diff --git a/ffi/lang/python/sequoia/openpgp.py b/ffi/lang/python/sequoia/openpgp.py index 46cf50b5..4689baea 100644 --- a/ffi/lang/python/sequoia/openpgp.py +++ b/ffi/lang/python/sequoia/openpgp.py @@ -30,6 +30,7 @@ class Fingerprint(SQObject): _del = lib.pgp_fingerprint_free _clone = lib.pgp_fingerprint_clone _str = lib.pgp_fingerprint_to_string + _debug = lib.pgp_fingerprint_debug _eq = lib.pgp_fingerprint_equal _hash = lib.pgp_fingerprint_hash diff --git a/ffi/src/lib.rs b/ffi/src/lib.rs index 38b719f9..f183f9cc 100644 --- a/ffi/src/lib.rs +++ b/ffi/src/lib.rs @@ -114,7 +114,10 @@ extern crate libc; extern crate native_tls; extern crate sequoia_ffi_macros; -use sequoia_ffi_macros::ffi_catch_abort; +use sequoia_ffi_macros::{ + ffi_catch_abort, + ffi_wrapper_type, +}; extern crate sequoia_core; extern crate sequoia_net; extern crate sequoia_store; -- cgit v1.2.3