typedef struct {
PyObject_HEAD
PyObject *account_name;
+ PyObject *address;
PrefsAccount *account;
} clawsmail_AccountObject;
Py_INCREF(Py_None);
self->account_name = Py_None;
+ Py_INCREF(Py_None);
+ self->address = Py_None;
+
self->account = NULL;
return 0;
}
static void Account_dealloc(clawsmail_AccountObject* self)
{
Py_XDECREF(self->account_name);
+ Py_XDECREF(self->address);
self->ob_type->tp_free((PyObject*)self);
}
static PyMemberDef Account_members[] = {
{"account_name", T_OBJECT_EX, offsetof(clawsmail_AccountObject, account_name), 0,
- "account name - name of the corresponding account"},
+ "account name - name of the account"},
+
+ {"address", T_OBJECT_EX, offsetof(clawsmail_AccountObject, address), 0,
+ "address - address of the account"},
{NULL}
};
static gboolean update_members(clawsmail_AccountObject *self, PrefsAccount *account)
{
- PyObject *str;
+ if(account->account_name) {
+ Py_XDECREF(self->account_name);
+ self->account_name = PyString_FromString(account->account_name);
+ if(!self->account_name)
+ goto err;
+ }
- str = PyString_FromString(account->account_name);
- if(!str)
- goto err;
- self->account_name = str;
+ if(account->address) {
+ Py_XDECREF(self->address);
+ self->address = PyString_FromString(account->address);
+ if(!self->address)
+ goto err;
+ }
self->account = account;
return TRUE;
err:
Py_XDECREF(self->account_name);
+ Py_XDECREF(self->address);
return FALSE;
}