From 739d49d8bced108ce788ddd6ff72d34300f105c5 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 12 May 2009 03:29:57 +0000 Subject: [PATCH] * Got the Notes screen a little closer to displaying properly but it's still not quite there. --- webcit/notes.c | 49 +++++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/webcit/notes.c b/webcit/notes.c index 4870ea0b2..4222ed279 100644 --- a/webcit/notes.c +++ b/webcit/notes.c @@ -26,10 +26,9 @@ int pastel_palette[9][3] = { struct vnote *vnote_new_from_msg(long msgnum,int unread) { StrBuf *Buf; - StrBuf *Data; + StrBuf *Data = NULL; const char *bptr; int Done = 0; - char from[128] = ""; char uid_from_headers[256]; char mime_partnum[256]; char mime_filename[256]; @@ -70,16 +69,10 @@ struct vnote *vnote_new_from_msg(long msgnum,int unread) extract_token(mime_content_type, &bptr[5], 4, '|', sizeof mime_content_type); mime_length = extract_int(&bptr[5], 5); - if ( (!strcasecmp(mime_content_type, "text/calendar")) - || (!strcasecmp(mime_content_type, "application/ics")) - || (!strcasecmp(mime_content_type, "text/vtodo")) - ) { + if (!strcasecmp(mime_content_type, "text/vnote")) { strcpy(relevant_partnum, mime_partnum); } } - else if (!strncasecmp(bptr, "from=", 4)) { - extract_token(from, bptr, 1, '=', sizeof(from)); - } else if ((phase == 0) && (!strncasecmp(bptr, "text", 4))) { phase = 1; } @@ -104,26 +97,23 @@ struct vnote *vnote_new_from_msg(long msgnum,int unread) if ((msg4_content_length > 0) && ( !strcasecmp(msg4_content_encoding, "7bit")) - && ((!strcasecmp(mime_content_type, "text/calendar")) - || (!strcasecmp(mime_content_type, "application/ics")) - || (!strcasecmp(mime_content_type, "text/vtodo")) - ) - ) - { + && (!strcasecmp(mime_content_type, "text/vnote")) + ) { + /* shouldn't we do something here? */ } } - case 2: - Data = NewStrBufPlain(NULL, msg4_content_length * 2); - if (msg4_content_length > 0) { - StrBuf_ServGetBLOBBuffered(Data, msg4_content_length); - phase ++; - } - else { - StrBufAppendBuf(Data, Buf, 0); - StrBufAppendBufPlain(Data, "\r\n", 1, 0); - } - case 3: - StrBufAppendBuf(Data, Buf, 0); + //case 2: + //Data = NewStrBufPlain(NULL, msg4_content_length * 2); + //if (msg4_content_length > 0) { + //StrBuf_ServGetBLOBBuffered(Data, msg4_content_length); + //phase ++; + //} + //else { + //StrBufAppendBuf(Data, Buf, 0); + //StrBufAppendBufPlain(Data, "\r\n", 1, 0); + //} + //case 3: + //StrBufAppendBuf(Data, Buf, 0); } } FreeStrBuf(&Buf); @@ -135,8 +125,9 @@ struct vnote *vnote_new_from_msg(long msgnum,int unread) Data = load_mimepart(msgnum, relevant_partnum); } + lprintf(9, "Data is: %s\n", ChrPtr(Data)); - if ((IsEmptyStr(relevant_partnum)) && (StrLength(Data) > 0 )) { + if (StrLength(Data) > 0) { if (!IsEmptyStr(uid_from_headers)) { // Convert an old-style note to a vNote vnote_from_body = vnote_new(); @@ -147,10 +138,12 @@ struct vnote *vnote_new_from_msg(long msgnum,int unread) vnote_from_body->body = malloc(StrLength(Data) + 1); vnote_from_body->body[0] = 0; memcpy(vnote_from_body->body, ChrPtr(Data), StrLength(Data) + 1); + FreeStrBuf(&Data); return vnote_from_body; } else { struct vnote *v = vnote_new_from_str(ChrPtr(Data)); + FreeStrBuf(&Data); return(v); } } -- 2.30.2