1
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
3
pygpgme - a Python wrapper for the gpgme library
4
Copyright (C) 2006 James Henstridge
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2.1 of the License, or (at your option) any later version.
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Lesser General Public License for more details.
16
You should have received a copy of the GNU Lesser General Public
17
License along with this library; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#include <structmember.h>
24
pygpgme_genkey_result_dealloc(PyGpgmeGenkeyResult *self)
26
Py_XDECREF(self->primary);
27
Py_XDECREF(self->sub);
28
Py_XDECREF(self->fpr);
32
static PyMemberDef pygpgme_genkey_result_members[] = {
33
{ "primary", T_OBJECT, offsetof(PyGpgmeGenkeyResult, primary), READONLY},
34
{ "sub", T_OBJECT, offsetof(PyGpgmeGenkeyResult, sub), READONLY},
35
{ "fpr", T_OBJECT, offsetof(PyGpgmeGenkeyResult, fpr), READONLY},
39
PyTypeObject PyGpgmeGenkeyResult_Type = {
40
PyVarObject_HEAD_INIT(NULL, 0)
42
sizeof(PyGpgmeGenkeyResult),
43
.tp_flags = Py_TPFLAGS_DEFAULT,
44
.tp_init = pygpgme_no_constructor,
45
.tp_dealloc = (destructor)pygpgme_genkey_result_dealloc,
46
.tp_members = pygpgme_genkey_result_members,
50
pygpgme_genkey_result(gpgme_ctx_t ctx)
52
gpgme_genkey_result_t result;
53
PyGpgmeGenkeyResult *self;
55
result = gpgme_op_genkey_result(ctx);
60
self = PyObject_New(PyGpgmeGenkeyResult, &PyGpgmeGenkeyResult_Type);
64
self->primary = PyBool_FromLong(result->primary);
65
self->sub = PyBool_FromLong(result->sub);
67
self->fpr = PyUnicode_DecodeASCII(result->fpr, strlen(result->fpr),
74
return (PyObject *) self;