}
else {
phase++;
-
if ((msg4_content_length > 0)
&& ( !strcasecmp(msg4_content_encoding, "7bit"))
- && (!strcasecmp(mime_content_type, "text/vnote"))
+ && (!strcasecmp(msg4_content_type, "text/vnote"))
) {
vnote_inline = 1;
}
if (StrLength(Data) > 0) {
if (IsEmptyStr(uid_from_headers)) {
- // Convert an old-style note to a vNote
+ /* Convert an old-style note to a vNote */
vnote_from_body = vnote_new();
vnote_from_body->uid = strdup(uid_from_headers);
vnote_from_body->color_red = pastel_palette[3][0];
return vnote_from_body;
}
else {
- struct vnote *v = vnote_new_from_str(ChrPtr(Data));
- FreeStrBuf(&Data);
+ char *Buf = SmashStrBuf(&Data);
+
+ struct vnote *v = vnote_new_from_str(Buf);
+ free(Buf);
return(v);
}
}
serv_printf("--%s", boundary);
serv_puts("Content-type: text/vnote");
+ serv_puts("Content-Transfer-Encoding: 7bit");
serv_puts("");
pch = vnote_serialize(v);
serv_puts(pch);
return;
}
- // lprintf(9, "Note UID = %s\n", bstr("note_uid"));
serv_printf("EUID %s", bstr("note_uid"));
serv_getln(buf, sizeof buf);
if (buf[0] != '2') {
return;
}
msgnum = atol(&buf[4]);
- // lprintf(9, "Note msg = %ld\n", msgnum);
-
- // Was this request a delete operation? If so, nuke it...
+
+ /* Was this request a delete operation? If so, nuke it... */
if (havebstr("deletenote")) {
if (!strcasecmp(bstr("deletenote"), "yes")) {
serv_printf("DELE %d", msgnum);
}
}
- // If we get to this point it's an update, not a delete
+ /* If we get to this point it's an update, not a delete */
v = vnote_new_from_msg(msgnum, 0);
if (!v) {
begin_ajax_response();
if (havebstr("blue")) {
v->color_blue = atoi(bstr("blue"));
}
- if (havebstr("value")) { // I would have preferred 'body' but InPlaceEditor hardcodes 'value'
+ if (havebstr("value")) { /* I would have preferred 'body' but InPlaceEditor hardcodes 'value' */
if (v->body) free(v->body);
v->body = strdup(bstr("value"));
}
*
* msgnum = Message number on the local server of the note to be displayed
*/
-void display_note(message_summary *Msg, int unread) {
+////TODO: falscher hook
+int notes_LoadMsgFromServer(SharedMessageStatus *Stat,
+ void **ViewSpecific,
+ message_summary* Msg,
+ int is_new,
+ int i)
+{
struct vnote *v;
WCTemplputParams TP;
memset(&TP, 0, sizeof(WCTemplputParams));
TP.Filter.ContextType = CTX_VNOTE;
- v = vnote_new_from_msg(Msg->msgnum, unread);
+ v = vnote_new_from_msg(Msg->msgnum, is_new);
if (v) {
TP.Context = v;
DoTemplate(HKEY("vnoteitem"),
vnote_free(v);
}
+ return 0;
}
StrBufAppendBufPlain(Target, v->uid, -1, 0);
}
+
+
+
+int notes_GetParamsGetServerCall(SharedMessageStatus *Stat,
+ void **ViewSpecific,
+ long oper,
+ char *cmd,
+ long len)
+{
+ strcpy(cmd, "MSGS ALL");
+ Stat->maxmsgs = 32767;
+ wprintf("<div id=\"new_notes_here\"></div>\n");
+ return 200;
+
+}
+
+int notes_Cleanup(void **ViewSpecific)
+{
+ end_burst();
+ return 0;
+}
+
+
void
InitModule_NOTES
(void)
{
+ RegisterReadLoopHandlerset(
+ VIEW_NOTES,
+ notes_GetParamsGetServerCall,
+ NULL,
+ notes_LoadMsgFromServer,
+ NULL,
+ notes_Cleanup);
+
WebcitAddUrlHandler(HKEY("add_new_note"), add_new_note, 0);
WebcitAddUrlHandler(HKEY("ajax_update_note"), ajax_update_note, 0);