\n");
}
- /* Look for a method */
+ // Look for a method
method = icalcomponent_get_first_property(cal, ICAL_METHOD_PROPERTY);
- /* See what we need to do with this */
+ // See what we need to do with this
if (method != NULL) {
- the_method = icalproperty_get_method(method);
char *title;
+ the_method = icalproperty_get_method(method);
- wprintf("
", divname);
- wprintf("
");
- wprintf("
");
+ StrBufAppendPrintf(Target, "", divname);
+ StrBufAppendPrintf(Target, "
");
+ StrBufAppendPrintf(Target, "
");
switch(the_method) {
case ICAL_METHOD_REQUEST:
title = _("Meeting invitation");
@@ -66,35 +80,33 @@ void cal_process_object(icalcomponent *cal,
title = _("This is an unknown type of calendar item.");
break;
}
- wprintf("");
+ StrBufAppendPrintf(Target, "");
- wprintf(" %s",title);
- wprintf("
");
+ StrBufAppendPrintf(Target, " %s",title);
+ StrBufAppendPrintf(Target, "");
}
- wprintf("
");
+ StrBufAppendPrintf(Target, "");
p = icalcomponent_get_first_property(cal, ICAL_SUMMARY_PROPERTY);
if (p != NULL) {
- wprintf("- ");
- wprintf(_("Summary:"));
- wprintf("
- ");
- escputs((char *)icalproperty_get_comment(p));
- wprintf("
\n");
+ StrBufAppendPrintf(Target, "- ");
+ StrBufAppendPrintf(Target, _("Summary:"));
+ StrBufAppendPrintf(Target, "
- ");
+ StrEscAppend(Target, NULL, (char *)icalproperty_get_comment(p), 0, 0);
+ StrBufAppendPrintf(Target, "
\n");
}
p = icalcomponent_get_first_property(cal, ICAL_LOCATION_PROPERTY);
if (p != NULL) {
- wprintf("- ");
- wprintf(_("Location:"));
- wprintf("
- ");
- escputs((char *)icalproperty_get_comment(p));
- wprintf("
\n");
+ StrBufAppendPrintf(Target, "- ");
+ StrBufAppendPrintf(Target, _("Location:"));
+ StrBufAppendPrintf(Target, "
- ");
+ StrEscAppend(Target, NULL, (char *)icalproperty_get_comment(p), 0, 0);
+ StrBufAppendPrintf(Target, "
\n");
}
- /*
- * Only show start/end times if we're actually looking at the VEVENT
- * component. Otherwise it shows bogus dates for things like timezone.
- */
+ // Only show start/end times if we're actually looking at the VEVENT
+ // component. Otherwise it shows bogus dates for things like timezone.
if (icalcomponent_isa(cal) == ICAL_VEVENT_COMPONENT) {
p = icalcomponent_get_first_property(cal, ICAL_DTSTART_PROPERTY);
@@ -109,16 +121,16 @@ void cal_process_object(icalcomponent *cal,
d_tm.tm_mon = t.month - 1;
d_tm.tm_mday = t.day;
wc_strftime(d_str, sizeof d_str, "%x", &d_tm);
- wprintf("- ");
- wprintf(_("Date:"));
- wprintf("
- %s
", d_str);
+ StrBufAppendPrintf(Target, "- ");
+ StrBufAppendPrintf(Target, _("Date:"));
+ StrBufAppendPrintf(Target, "
- %s
", d_str);
}
else {
tt = icaltime_as_timet(t);
- webcit_fmt_date(buf, tt, 0);
- wprintf("- ");
- wprintf(_("Starting date/time:"));
- wprintf("
- %s
", buf);
+ webcit_fmt_date(buf, 256, tt, DATEFMT_FULL);
+ StrBufAppendPrintf(Target, "- ");
+ StrBufAppendPrintf(Target, _("Starting date/time:"));
+ StrBufAppendPrintf(Target, "
- %s
", buf);
}
}
@@ -126,59 +138,68 @@ void cal_process_object(icalcomponent *cal,
if (p != NULL) {
t = icalproperty_get_dtend(p);
tt = icaltime_as_timet(t);
- webcit_fmt_date(buf, tt, 0);
- wprintf("- ");
- wprintf(_("Ending date/time:"));
- wprintf("
- %s
", buf);
+ webcit_fmt_date(buf, 256, tt, DATEFMT_FULL);
+ StrBufAppendPrintf(Target, "- ");
+ StrBufAppendPrintf(Target, _("Ending date/time:"));
+ StrBufAppendPrintf(Target, "
- %s
", buf);
}
}
p = icalcomponent_get_first_property(cal, ICAL_DESCRIPTION_PROPERTY);
if (p != NULL) {
- wprintf("- ");
- wprintf(_("Description:"));
- wprintf("
- ");
- escputs((char *)icalproperty_get_comment(p));
- wprintf("
\n");
+ StrBufAppendPrintf(Target, "- ");
+ StrBufAppendPrintf(Target, _("Description:"));
+ StrBufAppendPrintf(Target, "
- ");
+ StrEscAppend(Target, NULL, (char *)icalproperty_get_comment(p), 0, 0);
+ StrBufAppendPrintf(Target, "
\n");
+ }
+
+ if (icalcomponent_get_first_property(cal, ICAL_RRULE_PROPERTY)) {
+ // Unusual string syntax used here in order to re-use existing translations
+ StrBufAppendPrintf(Target, "- %s:
- %s.
\n",
+ _("Recurrence"),
+ _("This is a recurring event")
+ );
}
- /* If the component has attendees, iterate through them. */
+ // If the component has attendees, iterate through them.
for (p = icalcomponent_get_first_property(cal, ICAL_ATTENDEE_PROPERTY);
(p != NULL);
p = icalcomponent_get_next_property(cal, ICAL_ATTENDEE_PROPERTY)) {
- wprintf("- ");
- wprintf(_("Attendee:"));
- wprintf("
- ");
- safestrncpy(buf, icalproperty_get_attendee(p), sizeof buf);
- if (!strncasecmp(buf, "MAILTO:", 7)) {
-
- /** screen name or email address */
- strcpy(buf, &buf[7]);
- striplt(buf);
- escputs(buf);
- wprintf(" ");
-
- /** participant status */
+ StrBufAppendPrintf(Target, "
- ");
+ StrBufAppendPrintf(Target, _("Attendee:"));
+ StrBufAppendPrintf(Target, "
- ");
+ ch = icalproperty_get_attendee(p);
+ if ((ch != NULL) && !strncasecmp(ch, "MAILTO:", 7)) {
+
+ // screen name or email address
+ safestrncpy(buf, ch + 7, sizeof(buf));
+ string_trim(buf);
+ StrEscAppend(Target, NULL, buf, 0, 0);
+ StrBufAppendPrintf(Target, " ");
+
+ // participant status
partstat_as_string(buf, p);
- escputs(buf);
+ StrEscAppend(Target, NULL, buf, 0, 0);
}
- wprintf("
\n");
+ StrBufAppendPrintf(Target, "\n");
}
- /* If the component has subcomponents, recurse through them. */
+ // If the component has subcomponents, recurse through them.
for (c = icalcomponent_get_first_component(cal, ICAL_ANY_COMPONENT);
- (c != 0);
- c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT)) {
- /* Recursively process subcomponent */
- cal_process_object(c, recursion_level+1, msgnum, cal_partnum);
+ (c != 0);
+ c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT)
+ ) {
+ // Recursively process subcomponent
+ cal_process_object(Target, c, recursion_level+1, msgnum, cal_partnum);
}
- /* If this is a REQUEST, display conflicts and buttons */
+ // If this is a REQUEST, display conflicts and buttons
if (the_method == ICAL_METHOD_REQUEST) {
- /* Check for conflicts */
- lprintf(9, "Checking server calendar for conflicts...\n");
+ // Check for conflicts
+ syslog(LOG_DEBUG, "Checking server calendar for conflicts...");
serv_printf("ICAL conflicts|%ld|%s|", msgnum, cal_partnum);
serv_getln(buf, sizeof buf);
if (buf[0] == '1') {
@@ -195,23 +216,23 @@ void cal_process_object(icalcomponent *cal,
_("This event would conflict with '%s' which is already in your calendar."), conflict_name);
}
- wprintf("- %s",
+ StrBufAppendPrintf(Target, "
- %s",
(is_update ?
_("Update:") :
_("CONFLICT:")
)
);
- wprintf("
- ");
- escputs(conflict_message);
- wprintf("
\n");
+ StrBufAppendPrintf(Target, "- ");
+ StrEscAppend(Target, NULL, conflict_message, 0, 0);
+ StrBufAppendPrintf(Target, "
\n");
}
}
- lprintf(9, "...done.\n");
+ syslog(LOG_DEBUG, "...done.\n");
- wprintf("
");
+ StrBufAppendPrintf(Target, "
");
- /* Display the Accept/Decline buttons */
- wprintf("
"
+ // Display the Accept/Decline buttons
+ StrBufAppendPrintf(Target, "
"
"%s "
" "
"%s"
@@ -229,18 +250,11 @@ void cal_process_object(icalcomponent *cal,
}
- /* If this is a REPLY, display update button */
+ // If this is a REPLY, display update button
if (the_method == ICAL_METHOD_REPLY) {
- /* In the future, if we want to validate this object before
- * continuing, we can do it this way:
- serv_printf("ICAL whatever|%ld|%s|", msgnum, cal_partnum);
- serv_getln(buf, sizeof buf);
- }
- ***********/
-
- /* Display the update buttons */
- wprintf(""
+ // Display the update buttons
+ StrBufAppendPrintf(Target, "
"
"%s "
" "
"%s"
@@ -255,49 +269,34 @@ void cal_process_object(icalcomponent *cal,
}
- /* Trailing HTML for the display of this object */
+ // Trailing HTML for the display of this object
if (recursion_level == 0) {
- wprintf("