]> code.citadel.org Git - citadel.git/blobdiff - webcit-ng/server/room_functions.c
room_functions.c: remove diagnostic hex dump of recipient field
[citadel.git] / webcit-ng / server / room_functions.c
index 4abf0dbea0753d02481485733bd658217cb301a0..a58197120664519b7607f2bbae3c93aa1d9d61b3 100644 (file)
@@ -111,18 +111,21 @@ void json_mailbox(struct http_transaction *h, struct ctdlsession *c) {
        ctdl_readline(c, buf, sizeof(buf));
        if (buf[0] == '1') {
                while (ctdl_readline(c, buf, sizeof(buf)), (strcmp(buf, "000"))) {
-                       utf8ify_rfc822_string(buf);
                        JsonValue *jmsg = NewJsonObject(HKEY("message"));
                        JsonObjectAppend(jmsg, NewJsonNumber(HKEY("msgnum"), extract_long(buf, 0)));
                        JsonObjectAppend(jmsg, NewJsonNumber(HKEY("time"), extract_long(buf, 1)));
                        extract_token(field, buf, 2, '|', sizeof field);
+                       utf8ify_rfc822_string(field);
                        JsonObjectAppend(jmsg, NewJsonPlainString(HKEY("author"), field, -1));
                        extract_token(field, buf, 4, '|', sizeof field);
+                       utf8ify_rfc822_string(field);
                        JsonObjectAppend(jmsg, NewJsonPlainString(HKEY("addr"), field, -1));
                        extract_token(field, buf, 5, '|', sizeof field);
+                       utf8ify_rfc822_string(field);
                        JsonObjectAppend(jmsg, NewJsonPlainString(HKEY("subject"), field, -1));
                        JsonObjectAppend(jmsg, NewJsonNumber(HKEY("msgidhash"), extract_long(buf, 6)));
                        extract_token(field, buf, 7, '|', sizeof field);
+                       utf8ify_rfc822_string(field);
                        JsonObjectAppend(jmsg, NewJsonPlainString(HKEY("references"), field, -1));
                        JsonArrayAppend(j, jmsg);               // add the message to the array
                }
@@ -262,7 +265,7 @@ void object_in_room(struct http_transaction *h, struct ctdlsession *c) {
        // A sixth component in the URL can be one of two things:
        // (1) a MIME part specifier, in which case the client wants to download that component within the message
        // (2) a content-type, in which ase the client wants us to try to render it a certain way
-       if (num_tokens(h->url, '/') == 6) {
+       if (num_tokens(h->url, '/') >= 6) {
                extract_token(buf, h->url, 5, '/', sizeof buf);
                if (!IsEmptyStr(buf)) {
                        if (!strcasecmp(buf, "json")) {
@@ -512,6 +515,7 @@ void get_the_room_itself(struct http_transaction *h, struct ctdlsession *c) {
        JsonObjectAppend(j, NewJsonNumber(HKEY("current_view"), c->room_current_view));
        JsonObjectAppend(j, NewJsonNumber(HKEY("default_view"), c->room_default_view));
        JsonObjectAppend(j, NewJsonNumber(HKEY("is_room_aide"), c->is_room_aide));
+       JsonObjectAppend(j, NewJsonNumber(HKEY("is_trash_folder"), c->is_trash_folder));
        JsonObjectAppend(j, NewJsonNumber(HKEY("can_delete_messages"), c->can_delete_messages));
        JsonObjectAppend(j, NewJsonNumber(HKEY("new_messages"), c->new_messages));
        JsonObjectAppend(j, NewJsonNumber(HKEY("total_messages"), c->total_messages));
@@ -644,7 +648,7 @@ void ctdl_r(struct http_transaction *h, struct ctdlsession *c) {
                        //      10      (int)CC->room.QRfloor           The floor number this room resides on
                        c->room_current_view = extract_int(&buf[4], 11);
                        c->room_default_view = extract_int(&buf[4], 12);
-                       //      13      (int)is_trash                   Boolean flag: 1 if this is the user's Trash folder, 0 otherwise.
+                       c->is_trash_folder  = extract_int(&buf[4], 13); // Boolean flag: 1 if this is the user's Trash folder, 0 otherwise.
                        room_flags2 = extract_long(&buf[4], 14);        // More flags associated with this room.
                        c->room_mtime = extract_long(&buf[4], 15);      // Timestamp of the last write activity in this room
 
@@ -678,7 +682,7 @@ void ctdl_r(struct http_transaction *h, struct ctdlsession *c) {
                }
                return;
        }
-       if (num_tokens(h->url, '/') == 6) {
+       if (num_tokens(h->url, '/') >= 6) {
                object_in_room(h, c);   //      /ctdl/r/roomname/object/ or possibly /ctdl/r/roomname/object/component
                return;
        }