FixedOutputHooks are now used _strictly_ for the MSG0 command.
authorArt Cancro <ajc@citadel.org>
Wed, 29 Mar 2006 03:52:09 +0000 (03:52 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 29 Mar 2006 03:52:09 +0000 (03:52 +0000)
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.

citadel/ft_wordbreaker.h
citadel/msgbase.c
citadel/msgbase.h
citadel/serv_calendar.c
citadel/serv_vcard.c

index 73a37a68dc49ceb775e09f90eaf3bdabcadeca09..4ffc2176031a6f9161f127a62b2abafe0d2454ac 100644 (file)
@@ -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
index 186391bcdd6f3ed083df467239328b7affd61f59..73f38a93187d677950a0efd5c2164cc6d1cfdca4 100644 (file)
@@ -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);
index b5ba483f0eab43651a45f67b82ab14aa2e3ef245..1f1500a035feab6e8e78699b8de2103a9c97b5ee 100644 (file)
@@ -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 */
 };
 
 
index 6e53effbcd3a492083922e5f055bfa8bbf4b30f4..56d8294b17feecf67f05b2121d5d014559956912 100644 (file)
@@ -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;
        }
 
index c7cc076a2759ad9f144e0981152b05a918fd6afc..dd0457455b5bb135b78327a5ff3c70f3bced553b 100644 (file)
@@ -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);