Comments.
authorPekka Riikonen <priikone@silcnet.org>
Mon, 14 Oct 2002 14:58:14 +0000 (14:58 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 14 Oct 2002 14:58:14 +0000 (14:58 +0000)
lib/silcutil/DIRECTORY
lib/silcutil/silcvcard.c
lib/silcutil/silcvcard.h

index 37b0a95e1f205c2170efc2be506658b13f59d93b..60e94a789b2d0c00fa8d852ca754009d91def821 100644 (file)
@@ -19,6 +19,7 @@
 @LINK=silcutil.html:SILC Util Interface
 @LINK=silclist.html:SILC List Interface
 @LINK=silcdlist.html:SILC Dynamic List Interface
+@LINK=silcvcard.html:SILC VCard Interface
 @LINK=silczip.html:SILC Zip API
 -->
 
index ca26ae28c61458252be64e316de1138a8e322f9b..3a008f687833c3ad1b119111697d7db75ad4d322 100644 (file)
@@ -16,6 +16,7 @@
   GNU General Public License for more details.
 
 */
+/* $Id$ */
 /* Implementation of the VCard (RFC 2426) */
 
 #include "silcincludes.h"
@@ -73,7 +74,7 @@ static void silc_vcard_free_internal(SilcVCard vcard)
 
 /* Encode VCard */
 
-char *silc_vcard_encode(SilcVCard vcard, SilcUInt32 *vcard_len)
+unsigned char *silc_vcard_encode(SilcVCard vcard, SilcUInt32 *vcard_len)
 {
   SilcBufferStruct buffer;
   int i;
@@ -171,6 +172,7 @@ char *silc_vcard_encode(SilcVCard vcard, SilcUInt32 *vcard_len)
   return buffer.head;
 }
 
+/* Take one token */
 #define VCARD_TOKEN(x)                         \
   if (!(x)) {                                  \
     (x) = silc_memdup(val + off, i - off);     \
@@ -178,6 +180,7 @@ char *silc_vcard_encode(SilcVCard vcard, SilcUInt32 *vcard_len)
     continue;                                  \
   }
 
+/* Take on TYPE= token and prepare for next token */
 #define VCARD_TYPETOKEN(x)                             \
   if (!(x)) {                                          \
     int tmpi;                                          \
@@ -187,6 +190,7 @@ char *silc_vcard_encode(SilcVCard vcard, SilcUInt32 *vcard_len)
     i = tmpi;                                          \
   }
 
+/* Take last token */
 #define VCARD_LASTTOKEN(x)                     \
   if (!(x)) {                                  \
     if (off < len)                             \
@@ -262,6 +266,7 @@ bool silc_vcard_decode(const unsigned char *data, SilcUInt32 data_len,
            break;
          }
        }
+       /* It's possible to have ORG without last ';', so check for it */
        if (!vcard->org_name) {
          VCARD_LASTTOKEN(vcard->org_name);
        } else {
index 91056904fbb95bf760aac58968633a2d831136cf..ec448086f355c8bfe3be44ec5c12c0081f597ea5 100644 (file)
@@ -59,8 +59,8 @@ typedef struct {
   char *bday;              /* birth day, UTC date string */
   char *title;             /* job title X.520, string */
   char *role;              /* job role X.520, string */
-  char *org_name;          /* organization name */
-  char *org_unit;          /* organization unit */
+  char *org_name;          /* organization name, string */
+  char *org_unit;          /* organization unit, string */
   char *categories;        /* application category, string */
   char *class;             /* class (public, private, confidental), string */
   char *url;               /* home page, URI string */
@@ -114,7 +114,7 @@ typedef struct {
  *    buffer.  Returns NULL on error.
  *
  ***/
-char *silc_vcard_encode(SilcVCard vcard, SilcUInt32 *vcard_len);
+unsigned char *silc_vcard_encode(SilcVCard vcard, SilcUInt32 *vcard_len);
 
 /****f* silcutil/SilcVCard/silc_vcard_decode
  *