+
+
+
+
+
+/*
+ * Display a <div> containing a rendered sticky note.
+ */
+void display_vnote_div(struct vnote *v, long msgnum) {
+
+ wprintf("<div id=\"note%ld\" ", msgnum);
+ wprintf("style=\"position: relative; ");
+ wprintf("left: %dpx; ", v->pos_left);
+ wprintf("top: %dpx; ", v->pos_top);
+ wprintf("width: %dpx; ", v->pos_width);
+ wprintf("height: %dpx; ", v->pos_height);
+ wprintf("border: 1px solid black; ");
+ wprintf("background-color: #%02X%02X%02X ", v->color_red, v->color_green, v->color_blue);
+ wprintf("\">");
+
+ escputs(v->body);
+
+ wprintf("</div>\n");
+}
+
+
+
+
+/*
+ * display sticky notes
+ *
+ * msgnum = Message number on the local server of the note to be displayed
+ */
+void display_note_NEW(long msgnum, int unread) {
+ char buf[1024];
+ char mime_partnum[256];
+ char mime_filename[256];
+ char mime_content_type[256];
+ char mime_disposition[256];
+ int mime_length;
+ char relevant_partnum[256];
+ char *relevant_source = NULL;
+
+ relevant_partnum[0] = '\0';
+ sprintf(buf, "MSG4 %ld", msgnum); /* we need the mime headers */
+ serv_puts(buf);
+ serv_getln(buf, sizeof buf);
+ if (buf[0] != '1') return;
+
+ while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
+ if (!strncasecmp(buf, "part=", 5)) {
+ extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename);
+ extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum);
+ extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition);
+ extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type);
+ mime_length = extract_int(&buf[5], 5);
+
+ if (!strcasecmp(mime_content_type, "text/vnote")) {
+ strcpy(relevant_partnum, mime_partnum);
+ }
+ }
+ }
+
+ if (!IsEmptyStr(relevant_partnum)) {
+ relevant_source = load_mimepart(msgnum, relevant_partnum);
+ if (relevant_source != NULL) {
+ struct vnote *v = vnote_new_from_str(relevant_source);
+ free(relevant_source);
+ display_vnote_div(v, msgnum);
+ vnote_free(v);
+
+ /* FIXME remove these debugging messages when finished */
+ wprintf("<script type=\"text/javascript\">");
+ wprintf("document.write('L: ' + $('note%ld').style.left + '<br>');", msgnum);
+ wprintf("document.write('T: ' + $('note%ld').style.top + '<br>');", msgnum);
+ wprintf("document.write('W: ' + $('note%ld').style.width + '<br>');", msgnum);
+ wprintf("document.write('H: ' + $('note%ld').style.height + '<br>');", msgnum);
+ wprintf("</script>");
+ }
+ }
+}