Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2002 - 2007 Pekka Riikonen
+ Copyright (C) 2002 - 2014 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
unsigned char tmp[4], *str = NULL, *ret;
SilcUInt32 len;
+ if (ret_len)
+ *ret_len = 0;
+
/* Encode according to attribute type */
if (flags & SILC_ATTRIBUTE_FLAG_VALID) {
- if (!object && !object_size)
+ if (!object || !object_size)
return NULL;
switch (attribute) {
case SILC_ATTRIBUTE_USER_INFO:
{
+#ifdef SILC_DIST_VCARD
SilcVCard vcard = object;
if (object_size != sizeof(*vcard))
return NULL;
if (!str)
return NULL;
object = str;
+#endif /* SILC_DIST_VCARD */
}
break;
attr->data =
silc_attribute_payload_encode_int(attribute, flags, object,
object_size, &tmp_len);
- attr->data_len = (SilcUInt16)tmp_len;
if (!attr->data) {
silc_free(attr);
return NULL;
}
+ attr->data_len = (SilcUInt16)tmp_len;
return attr;
}
switch (payload->attribute) {
case SILC_ATTRIBUTE_USER_INFO:
{
+#ifdef SILC_DIST_VCARD
SilcVCard vcard = object;
if (object_size != sizeof(*vcard))
break;
if (!silc_vcard_decode(payload->data, payload->data_len, vcard))
break;
ret = TRUE;
+#endif /* SILC_DIST_VCARD */
}
break;