c++/lib c++/tests schemas/xCard.xsd
Christian Mollekopf
mollekopf at kolabsys.com
Wed Mar 7 01:50:53 CET 2012
c++/lib/xcardconversions.h | 15 ++++++++-------
c++/tests/bindingstest.cpp | 3 ++-
schemas/xCard.xsd | 2 +-
3 files changed, 11 insertions(+), 9 deletions(-)
New commits:
commit cb1ee40c6eac88e57fb6227724651f2bd6fda68a
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Wed Mar 7 01:50:44 2012 +0100
Made Affiliation::Logo optional.
BUG: 617
diff --git a/c++/lib/xcardconversions.h b/c++/lib/xcardconversions.h
index be129a0..5f7bbe8 100644
--- a/c++/lib/xcardconversions.h
+++ b/c++/lib/xcardconversions.h
@@ -263,13 +263,12 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
if (!contact.affiliations().empty()) {
vcard::group_sequence affiliations;
BOOST_FOREACH(const Affiliation &a, contact.affiliations()) {
- std::string encodedLogo;
- if (!a.logo().empty()) {
- encodedLogo = uriInlineEncoding(a.logo(), a.logoMimetype());
- }
affiliationPropType::org_type org;
org.text().push_back(a.organisation());
- vcard::group_type group(org, affiliationPropType::logo_type(encodedLogo));
+ vcard::group_type group(org);
+ if (!a.logo().empty()) {
+ group.logo(affiliationPropType::logo_type(uriInlineEncoding(a.logo(), a.logoMimetype())));
+ }
group.title(fromList<affiliationPropType::title_type >(a.titles()));
group.role(fromList<affiliationPropType::role_type>(a.roles()));
group.x_manager(fromList<affiliationPropType::x_manager_type>(a.managers()));
@@ -550,8 +549,10 @@ boost::shared_ptr<Kolab::Contact> readCard <Kolab::Contact> (const vcard_4_0::Vc
}
aff.setOrganisation(org);
std::string mimetype;
- const std::string &logo = uriInlineDecoding(group.logo().uri(), mimetype);
- aff.setLogo(logo, mimetype);
+ if (group.logo()) {
+ const std::string &logo = uriInlineDecoding((*group.logo()).uri(), mimetype);
+ aff.setLogo(logo, mimetype);
+ }
aff.setTitles(toTextList<vcard::group_type::title_type>(group.title()));
aff.setRoles(toTextList<vcard::group_type::role_type>(group.role()));
aff.setManagers(toTextList<vcard::group_type::x_manager_type>(group.x_manager()));
diff --git a/c++/tests/bindingstest.cpp b/c++/tests/bindingstest.cpp
index cb8e0dd..2ed8882 100644
--- a/c++/tests/bindingstest.cpp
+++ b/c++/tests/bindingstest.cpp
@@ -347,7 +347,8 @@ void BindingsTest::contactCompletness()
aff.setAssistants(stringlist);
aff.setOffices(stringlist);
list.push_back(aff);
- list.push_back(aff);
+ Kolab::Affiliation aff2;
+ list.push_back(aff2);
c.setAffiliations(list);
Kolab::Address address;
address.setCode("oiuoiu");
diff --git a/schemas/xCard.xsd b/schemas/xCard.xsd
index c523a80..1d23de6 100644
--- a/schemas/xCard.xsd
+++ b/schemas/xCard.xsd
@@ -260,7 +260,7 @@
<xs:extension base="xcard:BasePropertyType">
<xs:sequence>
<xs:element name="org" type="xcard:NonEmptyTextListPropertyType" />
- <xs:element name="logo" type="xcard:UriPropertyType" />
+ <xs:element name="logo" type="xcard:UriPropertyType" minOccurs="0" />
<xs:element name="title" type="xcard:TextPropertyType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="role" type="xcard:TextPropertyType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="x-manager" type="xcard:TextPropertyType" minOccurs="0" maxOccurs="unbounded"/>
More information about the commits
mailing list