From: Art Cancro Date: Wed, 29 Mar 2006 03:52:09 +0000 (+0000) Subject: FixedOutputHooks are now used _strictly_ for the MSG0 command. X-Git-Tag: v7.86~4082 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=1cfcbe21b6af38dd4666df9bc5294cc98f94f846 FixedOutputHooks are now used _strictly_ for the MSG0 command. This prevents vcard/icalendar dumps onto the screen, when the pretty rendering is already there. Since MSG0 is now only used for the full text search, the readability of vard/icalendar text dumps has been reduced in order to prevent mega-indices of words like 'vcard' and 'attendee'. Because of this, the wordbreaker ID has been incremented and your index will be forcibly rebuilt. --- diff --git a/citadel/ft_wordbreaker.h b/citadel/ft_wordbreaker.h index 73a37a68d..4ffc21760 100644 --- a/citadel/ft_wordbreaker.h +++ b/citadel/ft_wordbreaker.h @@ -9,7 +9,7 @@ * later on, or even if we update this one, we can use a different ID so the * system knows it needs to throw away the existing index and rebuild it. */ -#define FT_WORDBREAKER_ID 0x001e +#define FT_WORDBREAKER_ID 0x001f /* * Minimum and maximum length of words to index diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 186391bcd..73f38a931 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -1120,8 +1120,10 @@ void fixed_output(char *name, char *filename, char *partnum, char *disp, cprintf("\n"); } } + return; } - else if (!strcasecmp(cbtype, "text/html")) { + + if (!strcasecmp(cbtype, "text/html")) { ptr = html_to_ascii(content, length, 80, 0); wlen = strlen(ptr); client_write(ptr, wlen); @@ -1129,13 +1131,20 @@ void fixed_output(char *name, char *filename, char *partnum, char *disp, cprintf("\n"); } free(ptr); + return; } - else if (PerformFixedOutputHooks(cbtype, content, length)) { + + if (ma->use_fo_hooks) { + if (PerformFixedOutputHooks(cbtype, content, length)) { /* above function returns nonzero if it handled the part */ + return; + } } - else if (strncasecmp(cbtype, "multipart/", 10)) { + + if (strncasecmp(cbtype, "multipart/", 10)) { cprintf("Part %s: %s (%s) (%ld bytes)\r\n", partnum, filename, cbtype, (long)length); + return; } } @@ -1692,6 +1701,7 @@ START_TEXT: memset(&ma, 0, sizeof(struct ma_info)); if (mode == MT_MIME) { + ma.use_fo_hooks = 0; strcpy(ma.chosen_part, "1"); mime_parser(mptr, NULL, *choose_preferred, *fixed_output_pre, @@ -1700,6 +1710,7 @@ START_TEXT: *output_preferred, NULL, NULL, (void *)&ma, 0); } else { + ma.use_fo_hooks = 1; mime_parser(mptr, NULL, *fixed_output, *fixed_output_pre, *fixed_output_post, (void *)&ma, 0); diff --git a/citadel/msgbase.h b/citadel/msgbase.h index b5ba483f0..1f1500a03 100644 --- a/citadel/msgbase.h +++ b/citadel/msgbase.h @@ -35,6 +35,7 @@ struct ma_info { * digging through a subsection */ int did_print; /* One alternative has been displayed */ char chosen_part[128]; /* Which part of a m/a did we choose? */ + int use_fo_hooks; /* Use fixed output hooks */ }; diff --git a/citadel/serv_calendar.c b/citadel/serv_calendar.c index 6e53effbc..56d8294b1 100644 --- a/citadel/serv_calendar.c +++ b/citadel/serv_calendar.c @@ -2073,87 +2073,26 @@ void ical_fixed_output_backend(icalcomponent *cal, int recursion_level ) { icalcomponent *c; - icalproperty *method = NULL; - icalproperty_method the_method = ICAL_METHOD_NONE; icalproperty *p; - struct icaltimetype t; - time_t tt; char buf[256]; - /* Look for a method */ - method = icalcomponent_get_first_property(cal, ICAL_METHOD_PROPERTY); - - /* See what we need to do with this */ - if (method != NULL) { - the_method = icalproperty_get_method(method); - switch(the_method) { - case ICAL_METHOD_REQUEST: - cprintf("Meeting invitation\n"); - break; - case ICAL_METHOD_REPLY: - cprintf("Attendee's reply to your invitation\n"); - break; - case ICAL_METHOD_PUBLISH: - cprintf("Published event\n"); - break; - default: - cprintf("This is an unknown type of calendar item.\n"); - break; - } - } - p = icalcomponent_get_first_property(cal, ICAL_SUMMARY_PROPERTY); if (p != NULL) { - cprintf("Summary: %s\n", (const char *)icalproperty_get_comment(p)); + cprintf("%s\n", (const char *)icalproperty_get_comment(p)); } p = icalcomponent_get_first_property(cal, ICAL_LOCATION_PROPERTY); if (p != NULL) { - cprintf("Location: %s\n", (const char *)icalproperty_get_comment(p)); - } - - /* - * 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); - if (p != NULL) { - t = icalproperty_get_dtstart(p); - - if (t.is_date) { - cprintf("Date: %s %d, %d\n", - ascmonths[t.month - 1], - t.day, t.year - ); - } - else { - tt = icaltime_as_timet(t); - fmt_date(buf, sizeof buf, tt, 0); - cprintf("Starting date/time: %s\n", buf); - } - } - - p = icalcomponent_get_first_property(cal, ICAL_DTEND_PROPERTY); - if (p != NULL) { - t = icalproperty_get_dtend(p); - tt = icaltime_as_timet(t); - fmt_date(buf, sizeof buf, tt, 0); - cprintf("Ending date/time: %s\n", buf); - } - + cprintf("%s\n", (const char *)icalproperty_get_comment(p)); } p = icalcomponent_get_first_property(cal, ICAL_DESCRIPTION_PROPERTY); if (p != NULL) { - cprintf("Description: %s\n", (const char *)icalproperty_get_comment(p)); + cprintf("%s\n", (const char *)icalproperty_get_comment(p)); } /* 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)) { - cprintf("Attendee: "); safestrncpy(buf, icalproperty_get_attendee(p), sizeof buf); if (!strncasecmp(buf, "MAILTO:", 7)) { @@ -2177,7 +2116,7 @@ void ical_fixed_output_backend(icalcomponent *cal, /* - * Function to output a calendar item as plain text. Nobody uses MSG0 + * Function to output vcalendar data as plain text. Nobody uses MSG0 * anymore, so really this is just so we expose the vCard data to the full * text indexer. */ @@ -2191,7 +2130,6 @@ void ical_fixed_output(char *ptr, int len) { free(stringy_cal); if (cal == NULL) { - cprintf("There was an error parsing this calendar item.\n"); return; } diff --git a/citadel/serv_vcard.c b/citadel/serv_vcard.c index c7cc076a2..dd0457455 100644 --- a/citadel/serv_vcard.c +++ b/citadel/serv_vcard.c @@ -1073,7 +1073,7 @@ void store_harvested_addresses(void) { /* - * Function to output a vCard as plain text. Nobody uses MSG0 anymore, so + * Function to output vCard data as plain text. Nobody uses MSG0 anymore, so * really this is just so we expose the vCard data to the full text indexer. */ void vcard_fixed_output(char *ptr, int len) { @@ -1082,7 +1082,6 @@ void vcard_fixed_output(char *ptr, int len) { char *key, *value; int i = 0; - cprintf("vCard:\n"); serialized_vcard = malloc(len + 1); safestrncpy(serialized_vcard, ptr, len+1); v = vcard_load(serialized_vcard); @@ -1091,7 +1090,7 @@ void vcard_fixed_output(char *ptr, int len) { i = 0; while (key = vcard_get_prop(v, "", 0, i, 1), key != NULL) { value = vcard_get_prop(v, "", 0, i++, 0); - cprintf("%20s : %s\n", key, value); + cprintf("%s\n", value); } vcard_free(v);