+/**
+ * \brief This gets called by the Ajax.InPlaceEditor when we save a note.
+ */
+void updatenote(void)
+{
+ char buf[SIZ];
+ char notetext[SIZ];
+ char display_notetext[SIZ];
+ long msgnum;
+ int in_text = 0;
+ int i;
+
+ serv_printf("ENT0 1||0|0||||||%s", bstr("eid"));
+ serv_getln(buf, sizeof buf);
+ if (buf[0] == '4') {
+ text_to_server(bstr("value"), 0);
+ serv_puts("000");
+ }
+
+ begin_ajax_response();
+ msgnum = locate_message_by_uid(bstr("eid"));
+ if (msgnum >= 0L) {
+ serv_printf("MSG0 %ld", msgnum);
+ serv_getln(buf, sizeof buf);
+ if (buf[0] == '1') {
+ while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
+
+ /** Fill the buffer */
+ if ( (in_text) && (strlen(notetext) < SIZ-256) ) {
+ strcat(notetext, buf);
+ }
+
+ if ( (!in_text) && (!strcasecmp(buf, "text")) ) {
+ in_text = 1;
+ }
+ }
+ /** Now sanitize the buffer */
+ for (i=0; i<strlen(notetext); ++i) {
+ if (isspace(notetext[i])) notetext[i] = ' ';
+ }
+
+ /** Make it HTML-happy and print it. */
+ stresc(display_notetext, notetext, 0, 0);
+ wprintf("%s\n", display_notetext);
+ }
+ }
+ else {
+ wprintf("%s", _("An error has occurred."));
+ }
+
+ end_ajax_response();
+}
+
+
+