|
|
@ -2,7 +2,7 @@
|
|
|
|
libvcard - vCard parsing library for vCard version 3.0
|
|
|
|
libvcard - vCard parsing library for vCard version 3.0
|
|
|
|
|
|
|
|
|
|
|
|
Copyright (C) 1998 Rik Hemsley rik@kde.org
|
|
|
|
Copyright (C) 1998 Rik Hemsley rik@kde.org
|
|
|
|
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to
|
|
|
|
of this software and associated documentation files (the "Software"), to
|
|
|
|
deal in the Software without restriction, including without limitation the
|
|
|
|
deal in the Software without restriction, including without limitation the
|
|
|
@ -29,6 +29,8 @@
|
|
|
|
using namespace VCARD;
|
|
|
|
using namespace VCARD;
|
|
|
|
|
|
|
|
|
|
|
|
// There are 31 possible types, not including extensions.
|
|
|
|
// There are 31 possible types, not including extensions.
|
|
|
|
|
|
|
|
// URI is a custom field designed to store the upstream URI for each contact
|
|
|
|
|
|
|
|
// in order to handle certain limited CardDAV systems such as Zimbra
|
|
|
|
const QCString
|
|
|
|
const QCString
|
|
|
|
VCARD::paramNames [] =
|
|
|
|
VCARD::paramNames [] =
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -62,7 +64,8 @@ VCARD::paramNames [] =
|
|
|
|
"URL",
|
|
|
|
"URL",
|
|
|
|
"VERSION",
|
|
|
|
"VERSION",
|
|
|
|
"CLASS",
|
|
|
|
"CLASS",
|
|
|
|
"KEY"
|
|
|
|
"KEY",
|
|
|
|
|
|
|
|
"URI"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const ParamType
|
|
|
|
const ParamType
|
|
|
@ -99,6 +102,7 @@ VCARD::paramTypesTable[] = {
|
|
|
|
ParamNone, // CLASS
|
|
|
|
ParamNone, // CLASS
|
|
|
|
ParamTextBin, // KEY
|
|
|
|
ParamTextBin, // KEY
|
|
|
|
ParamTextNS // X
|
|
|
|
ParamTextNS // X
|
|
|
|
|
|
|
|
ParamNone, // URI
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
ParamType
|
|
|
|
ParamType
|
|
|
@ -107,31 +111,31 @@ VCARD::EntityTypeToParamType(EntityType e)
|
|
|
|
ParamType t(ParamUnknown);
|
|
|
|
ParamType t(ParamUnknown);
|
|
|
|
|
|
|
|
|
|
|
|
switch (e) {
|
|
|
|
switch (e) {
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityAgent: t = ParamAgent; break;
|
|
|
|
case EntityAgent: t = ParamAgent; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntitySound: t = ParamSound; break;
|
|
|
|
case EntitySound: t = ParamSound; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntitySource: t = ParamSource; break;
|
|
|
|
case EntitySource: t = ParamSource; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityTelephone: t = ParamTel; break;
|
|
|
|
case EntityTelephone: t = ParamTel; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityEmail: t = ParamEmail; break;
|
|
|
|
case EntityEmail: t = ParamEmail; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityKey: t = ParamTextBin; break;
|
|
|
|
case EntityKey: t = ParamTextBin; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityExtension: t = ParamTextNS; break;
|
|
|
|
case EntityExtension: t = ParamTextNS; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityAddress:
|
|
|
|
case EntityAddress:
|
|
|
|
case EntityLabel: t = ParamAddrText; break;
|
|
|
|
case EntityLabel: t = ParamAddrText; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityBirthday:
|
|
|
|
case EntityBirthday:
|
|
|
|
case EntityRevision: t = ParamDate; break;
|
|
|
|
case EntityRevision: t = ParamDate; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityPhoto:
|
|
|
|
case EntityPhoto:
|
|
|
|
case EntityLogo: t = ParamImage; break;
|
|
|
|
case EntityLogo: t = ParamImage; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityOrganisation:
|
|
|
|
case EntityOrganisation:
|
|
|
|
case EntityTitle:
|
|
|
|
case EntityTitle:
|
|
|
|
case EntityRole:
|
|
|
|
case EntityRole:
|
|
|
@ -142,7 +146,7 @@ VCARD::EntityTypeToParamType(EntityType e)
|
|
|
|
case EntityNickname:
|
|
|
|
case EntityNickname:
|
|
|
|
case EntityCategories:
|
|
|
|
case EntityCategories:
|
|
|
|
case EntityNote: t = ParamText; break;
|
|
|
|
case EntityNote: t = ParamText; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityProductID:
|
|
|
|
case EntityProductID:
|
|
|
|
case EntityTimeZone:
|
|
|
|
case EntityTimeZone:
|
|
|
|
case EntityUID:
|
|
|
|
case EntityUID:
|
|
|
@ -152,11 +156,12 @@ VCARD::EntityTypeToParamType(EntityType e)
|
|
|
|
case EntityName:
|
|
|
|
case EntityName:
|
|
|
|
case EntityVersion:
|
|
|
|
case EntityVersion:
|
|
|
|
case EntityProfile:
|
|
|
|
case EntityProfile:
|
|
|
|
|
|
|
|
case EntityURI:
|
|
|
|
default: t = ParamNone; break;
|
|
|
|
default: t = ParamNone; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return t;
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -166,40 +171,40 @@ VCARD::EntityTypeToValueType(EntityType e)
|
|
|
|
ValueType t(ValueUnknown);
|
|
|
|
ValueType t(ValueUnknown);
|
|
|
|
|
|
|
|
|
|
|
|
switch (e) {
|
|
|
|
switch (e) {
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntitySound: t = ValueSound; break;
|
|
|
|
case EntitySound: t = ValueSound; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityAgent: t = ValueAgent; break;
|
|
|
|
case EntityAgent: t = ValueAgent; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityAddress: t = ValueAddress; break;
|
|
|
|
case EntityAddress: t = ValueAddress; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityTelephone: t = ValueTel; break;
|
|
|
|
case EntityTelephone: t = ValueTel; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityKey: t = ValueTextBin; break;
|
|
|
|
case EntityKey: t = ValueTextBin; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityOrganisation: t = ValueOrg; break;
|
|
|
|
case EntityOrganisation: t = ValueOrg; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityN: t = ValueN; break;
|
|
|
|
case EntityN: t = ValueN; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityTimeZone: t = ValueUTC; break;
|
|
|
|
case EntityTimeZone: t = ValueUTC; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityClass: t = ValueClass; break;
|
|
|
|
case EntityClass: t = ValueClass; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityGeo: t = ValueGeo; break;
|
|
|
|
case EntityGeo: t = ValueGeo; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntitySource:
|
|
|
|
case EntitySource:
|
|
|
|
case EntityURL: t = ValueURI; break;
|
|
|
|
case EntityURL: t = ValueURI; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityPhoto:
|
|
|
|
case EntityPhoto:
|
|
|
|
case EntityLogo: t = ValueImage; break;
|
|
|
|
case EntityLogo: t = ValueImage; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityBirthday:
|
|
|
|
case EntityBirthday:
|
|
|
|
case EntityRevision: t = ValueDate; break;
|
|
|
|
case EntityRevision: t = ValueDate; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityCategories:
|
|
|
|
case EntityCategories:
|
|
|
|
case EntityNickname: t = ValueTextList; break;
|
|
|
|
case EntityNickname: t = ValueTextList; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
case EntityLabel:
|
|
|
|
case EntityLabel:
|
|
|
|
case EntityExtension:
|
|
|
|
case EntityExtension:
|
|
|
|
case EntityEmail:
|
|
|
|
case EntityEmail:
|
|
|
@ -214,11 +219,12 @@ VCARD::EntityTypeToValueType(EntityType e)
|
|
|
|
case EntityProfile:
|
|
|
|
case EntityProfile:
|
|
|
|
case EntityUID:
|
|
|
|
case EntityUID:
|
|
|
|
case EntityNote:
|
|
|
|
case EntityNote:
|
|
|
|
|
|
|
|
case EntityURI:
|
|
|
|
default: t = ValueText; break;
|
|
|
|
default: t = ValueText; break;
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
//---------------------------------------------------------------//
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return t;
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -233,9 +239,9 @@ VCARD::EntityTypeToParamName(EntityType e)
|
|
|
|
VCARD::EntityNameToEntityType(const QCString & s)
|
|
|
|
VCARD::EntityNameToEntityType(const QCString & s)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (s.isEmpty()) return EntityUnknown;
|
|
|
|
if (s.isEmpty()) return EntityUnknown;
|
|
|
|
|
|
|
|
|
|
|
|
EntityType t(EntityUnknown);
|
|
|
|
EntityType t(EntityUnknown);
|
|
|
|
|
|
|
|
|
|
|
|
switch (s[0]) {
|
|
|
|
switch (s[0]) {
|
|
|
|
|
|
|
|
|
|
|
|
case 'A':
|
|
|
|
case 'A':
|
|
|
@ -288,7 +294,7 @@ VCARD::EntityNameToEntityType(const QCString & s)
|
|
|
|
if (s == "MAILER")
|
|
|
|
if (s == "MAILER")
|
|
|
|
t = EntityMailer;
|
|
|
|
t = EntityMailer;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'N':
|
|
|
|
case 'N':
|
|
|
|
if (s == "N")
|
|
|
|
if (s == "N")
|
|
|
|
t = EntityN;
|
|
|
|
t = EntityN;
|
|
|
@ -313,14 +319,14 @@ VCARD::EntityNameToEntityType(const QCString & s)
|
|
|
|
else if (s == "PROFILE")
|
|
|
|
else if (s == "PROFILE")
|
|
|
|
t = EntityProfile;
|
|
|
|
t = EntityProfile;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'R':
|
|
|
|
case 'R':
|
|
|
|
if (s == "REV")
|
|
|
|
if (s == "REV")
|
|
|
|
t = EntityRevision;
|
|
|
|
t = EntityRevision;
|
|
|
|
else if (s == "ROLE")
|
|
|
|
else if (s == "ROLE")
|
|
|
|
t = EntityRole;
|
|
|
|
t = EntityRole;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'S':
|
|
|
|
case 'S':
|
|
|
|
if (s == "SORT-STRING")
|
|
|
|
if (s == "SORT-STRING")
|
|
|
|
t = EntitySortString;
|
|
|
|
t = EntitySortString;
|
|
|
@ -344,6 +350,8 @@ VCARD::EntityNameToEntityType(const QCString & s)
|
|
|
|
t = EntityUID;
|
|
|
|
t = EntityUID;
|
|
|
|
else if (s == "URL")
|
|
|
|
else if (s == "URL")
|
|
|
|
t = EntityURL;
|
|
|
|
t = EntityURL;
|
|
|
|
|
|
|
|
else if (s == "URI")
|
|
|
|
|
|
|
|
t = EntityURI;
|
|
|
|
case 'V':
|
|
|
|
case 'V':
|
|
|
|
if (s == "VERSION")
|
|
|
|
if (s == "VERSION")
|
|
|
|
t = EntityVersion;
|
|
|
|
t = EntityVersion;
|
|
|
@ -353,12 +361,12 @@ VCARD::EntityNameToEntityType(const QCString & s)
|
|
|
|
if (s.left(2) == "X-")
|
|
|
|
if (s.left(2) == "X-")
|
|
|
|
t = EntityExtension;
|
|
|
|
t = EntityExtension;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
|
|
|
|
|
|
|
|
t = EntityUnknown;
|
|
|
|
t = EntityUnknown;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return t;
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -389,7 +397,7 @@ VCARD::EntityNameToEntityType(const QCString & s)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
static char B64[] =
|
|
|
|
static char B64[] =
|
|
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
|
|
|
|
|
|
|
|
|
|
// the mime base64 disctionary used for decoding
|
|
|
|
// the mime base64 disctionary used for decoding
|
|
|
|