Fix spurious quotes in calendar events

Newer libical versions no longer require the parameters to be quoted. This
patch removes the quoting to avoid adding unnecessary quotes to the
attendee and organizer parameters. This resolves issue #108.

Signed-off-by: pschwabauer <pschwabauer@intevation.de>
pull/109/head
pschwabauer 9 months ago
parent 33ffa95233
commit cf6c82feb8
No known key found for this signature in database
GPG Key ID: 1244FE1E8FBB313B

@ -69,15 +69,6 @@ static void _dumpIcaltime( const icaltimetype& t)
} }
*/ */
static TQString quoteForParam( const TQString &text )
{
TQString tmp = text;
tmp.remove( '"' );
if ( tmp.contains( ';' ) || tmp.contains( ':' ) || tmp.contains( ',' ) )
return tmp; // libical quotes in this case already, see icalparameter_as_ical_string()
return TQString::fromLatin1( "\"" ) + tmp + TQString::fromLatin1( "\"" );
}
const int gSecondsPerMinute = 60; const int gSecondsPerMinute = 60;
const int gSecondsPerHour = gSecondsPerMinute * 60; const int gSecondsPerHour = gSecondsPerMinute * 60;
const int gSecondsPerDay = gSecondsPerHour * 24; const int gSecondsPerDay = gSecondsPerHour * 24;
@ -576,7 +567,7 @@ icalproperty *ICalFormatImpl::writeOrganizer( const Person &organizer )
icalproperty *p = icalproperty_new_organizer("MAILTO:" + organizer.email().utf8()); icalproperty *p = icalproperty_new_organizer("MAILTO:" + organizer.email().utf8());
if (!organizer.name().isEmpty()) { if (!organizer.name().isEmpty()) {
icalproperty_add_parameter( p, icalparameter_new_cn(quoteForParam(organizer.name()).utf8()) ); icalproperty_add_parameter( p, icalparameter_new_cn(organizer.name().utf8()) );
} }
// TODO: Write dir, sent-by and language // TODO: Write dir, sent-by and language
@ -589,7 +580,7 @@ icalproperty *ICalFormatImpl::writeAttendee(Attendee *attendee)
icalproperty *p = icalproperty_new_attendee("mailto:" + attendee->email().utf8()); icalproperty *p = icalproperty_new_attendee("mailto:" + attendee->email().utf8());
if (!attendee->name().isEmpty()) { if (!attendee->name().isEmpty()) {
icalproperty_add_parameter(p,icalparameter_new_cn(quoteForParam(attendee->name()).utf8())); icalproperty_add_parameter(p,icalparameter_new_cn(attendee->name().utf8()));
} }
@ -869,7 +860,7 @@ icalcomponent *ICalFormatImpl::writeAlarm(Alarm *alarm)
for (TQValueList<Person>::Iterator ad = addresses.begin(); ad != addresses.end(); ++ad) { for (TQValueList<Person>::Iterator ad = addresses.begin(); ad != addresses.end(); ++ad) {
icalproperty *p = icalproperty_new_attendee("MAILTO:" + (*ad).email().utf8()); icalproperty *p = icalproperty_new_attendee("MAILTO:" + (*ad).email().utf8());
if (!(*ad).name().isEmpty()) { if (!(*ad).name().isEmpty()) {
icalproperty_add_parameter(p,icalparameter_new_cn(quoteForParam((*ad).name()).utf8())); icalproperty_add_parameter(p,icalparameter_new_cn((*ad).name().utf8()));
} }
icalcomponent_add_property(a,p); icalcomponent_add_property(a,p);
} }

Loading…
Cancel
Save