Moved the remaining else blocks
[citadel.git] / webcit-ng / room_functions.c
1 //
2 // Room functions
3 //
4 // Copyright (c) 1996-2021 by the citadel.org team
5 //
6 // This program is open source software.  It runs great on the
7 // Linux operating system (and probably elsewhere).  You can use,
8 // copy, and run it under the terms of the GNU General Public
9 // License version 3.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15
16 #include "webcit.h"
17
18
19 // Return a "zero-terminated" array of message numbers in the current room.
20 // Caller owns the memory and must free it.  Returns NULL if any problems.
21 long *get_msglist(struct ctdlsession *c, char *which_msgs) {
22         char buf[1024];
23         long *msglist = NULL;
24         int num_msgs = 0;
25         int num_alloc = 0;
26
27         ctdl_printf(c, "MSGS %s", which_msgs);
28         ctdl_readline(c, buf, sizeof(buf));
29         if (buf[0] == '1') {
30                 do {
31                         if (num_msgs >= num_alloc) {
32                                 if (num_alloc == 0) {
33                                         num_alloc = 1024;
34                                         msglist = malloc(num_alloc * sizeof(long));
35                                 }
36                                 else {
37                                         num_alloc *= 2;
38                                         msglist = realloc(msglist, num_alloc * sizeof(long));
39                                 }
40                         }
41                         ctdl_readline(c, buf, sizeof(buf));
42                         msglist[num_msgs++] = atol(buf);
43                 } while (strcmp(buf, "000"));   // this makes the last element a "0" terminator
44         }
45         return msglist;
46 }
47
48
49 // Supplied with a list of potential matches from an If-Match: or If-None-Match: header, and
50 // a message number (which we always use as the entity tag in Citadel), return nonzero if the
51 // message number matches any of the supplied tags in the string.
52 int match_etags(char *taglist, long msgnum) {
53         int num_tags = num_tokens(taglist, ',');
54         int i = 0;
55         char tag[1024];
56
57         if (msgnum <= 0) {                                      // no msgnum?  no match.
58                 return (0);
59         }
60
61         for (i = 0; i < num_tags; ++i) {
62                 extract_token(tag, taglist, i, ',', sizeof tag);
63                 striplt(tag);
64                 char *lq = (strchr(tag, '"'));
65                 char *rq = (strrchr(tag, '"'));
66                 if (lq < rq) {                                  // has two double quotes
67                         strcpy(rq, "");
68                         strcpy(tag, ++lq);
69                 }
70                 striplt(tag);
71                 if (!strcmp(tag, "*")) {                        // wildcard match
72                         return (1);
73                 }
74                 long tagmsgnum = atol(tag);
75                 if ((tagmsgnum > 0) && (tagmsgnum == msgnum)) { // match
76                         return (1);
77                 }
78         }
79
80         return (0);                                             // no match
81 }
82
83
84 // Client is requesting a message list
85 void json_msglist(struct http_transaction *h, struct ctdlsession *c, char *which) {
86         int i = 0;
87         long *msglist = get_msglist(c, which);
88         JsonValue *j = NewJsonArray(HKEY("msgs"));
89
90         if (msglist != NULL) {
91                 for (i = 0; msglist[i] > 0; ++i) {
92                         JsonArrayAppend(j, NewJsonNumber(HKEY("m"), msglist[i]));
93                 }
94                 free(msglist);
95         }
96
97         StrBuf *sj = NewStrBuf();
98         SerializeJson(sj, j, 1);        // '1' == free the source array
99
100         add_response_header(h, strdup("Content-type"), strdup("application/json"));
101         h->response_code = 200;
102         h->response_string = strdup("OK");
103         h->response_body_length = StrLength(sj);
104         h->response_body = SmashStrBuf(&sj);
105         return;
106 }
107
108
109 // Client requested an object in a room.
110 void object_in_room(struct http_transaction *h, struct ctdlsession *c) {
111         char buf[1024];
112         long msgnum = (-1);
113         char unescaped_euid[1024];
114
115         extract_token(buf, h->uri, 4, '/', sizeof buf);
116
117         if (!strncasecmp(buf, "msgs.", 5)) {    // Client is requesting a list of message numbers
118                 unescape_input(&buf[5]);
119                 json_msglist(h, c, &buf[5]);
120                 return;
121         }
122 #if 0
123         if (!strncasecmp(buf, "threads", 5)) {  // Client is requesting a threaded view (still kind of fuzzy here)
124                 threaded_view(h, c, &buf[5]);
125                 return;
126         }
127
128         if (!strncasecmp(buf, "flat", 5)) {     // Client is requesting a flat view (still kind of fuzzy here)
129                 flat_view(h, c, &buf[5]);
130                 return;
131         }
132 #endif
133
134         if ((c->room_default_view == VIEW_CALENDAR)     // room types where objects are referenced by EUID
135             || (c->room_default_view == VIEW_TASKS)
136             || (c->room_default_view == VIEW_ADDRESSBOOK)
137             ) {
138                 safestrncpy(unescaped_euid, buf, sizeof unescaped_euid);
139                 unescape_input(unescaped_euid);
140                 msgnum = locate_message_by_uid(c, unescaped_euid);
141         }
142         else {
143                 msgnum = atol(buf);
144         }
145
146         // All methods except PUT require the message to already exist
147         if ((msgnum <= 0) && (strcasecmp(h->method, "PUT"))) {
148                 do_404(h);
149         }
150
151         // If we get to this point we have a valid message number in an accessible room.
152         syslog(LOG_DEBUG, "msgnum is %ld, method is %s", msgnum, h->method);
153
154         // A sixth component in the URL can be one of two things:
155         // (1) a MIME part specifier, in which case the client wants to download that component within the message
156         // (2) a content-type, in which ase the client wants us to try to render it a certain way
157         if (num_tokens(h->uri, '/') == 6) {
158                 extract_token(buf, h->uri, 5, '/', sizeof buf);
159                 if (!IsEmptyStr(buf)) {
160                         if (!strcasecmp(buf, "json")) {
161                                 json_render_one_message(h, c, msgnum);
162                         }
163                         else {
164                                 download_mime_component(h, c, msgnum, buf);
165                         }
166                         return;
167                 }
168         }
169
170         // Ok, we want a full message, but first let's check for the if[-none]-match headers.
171         char *if_match = header_val(h, "If-Match");
172         if ((if_match != NULL) && (!match_etags(if_match, msgnum))) {
173                 do_412(h);
174                 return;
175         }
176
177         char *if_none_match = header_val(h, "If-None-Match");
178         if ((if_none_match != NULL) && (match_etags(if_none_match, msgnum))) {
179                 do_412(h);
180                 return;
181         }
182
183         // DOOOOOO ITTTTT!!!
184
185         if (!strcasecmp(h->method, "DELETE")) {
186                 dav_delete_message(h, c, msgnum);
187         }
188         else if (!strcasecmp(h->method, "GET")) {
189                 dav_get_message(h, c, msgnum);
190         }
191         else if (!strcasecmp(h->method, "PUT")) {
192                 dav_put_message(h, c, unescaped_euid, msgnum);
193         }
194         else {
195                 do_404(h);      // Got this far but the method made no sense?  Bummer.
196         }
197
198 }
199
200
201 // Called by the_room_itself() when the HTTP method is REPORT
202 void report_the_room_itself(struct http_transaction *h, struct ctdlsession *c) {
203         if (c->room_default_view == VIEW_CALENDAR) {
204                 caldav_report(h, c);    // CalDAV REPORTs ... fmgwac
205                 return;
206         }
207
208         do_404(h);              // future implementations like CardDAV will require code paths here
209 }
210
211
212 // Called by the_room_itself() when the HTTP method is OPTIONS
213 void options_the_room_itself(struct http_transaction *h, struct ctdlsession *c) {
214         h->response_code = 200;
215         h->response_string = strdup("OK");
216         if (c->room_default_view == VIEW_CALENDAR) {
217                 add_response_header(h, strdup("DAV"), strdup("1, calendar-access"));    // offer CalDAV
218         }
219         else if (c->room_default_view == VIEW_ADDRESSBOOK) {
220                 add_response_header(h, strdup("DAV"), strdup("1, addressbook"));        // offer CardDAV
221         }
222         else {
223                 add_response_header(h, strdup("DAV"), strdup("1"));     // ordinary WebDAV for all other room types
224         }
225         add_response_header(h, strdup("Allow"), strdup("OPTIONS, PROPFIND, GET, PUT, REPORT, DELETE"));
226 }
227
228
229 // Called by the_room_itself() when the HTTP method is PROPFIND
230 void propfind_the_room_itself(struct http_transaction *h, struct ctdlsession *c) {
231         char *e;
232         long timestamp;
233         int dav_depth = (header_val(h, "Depth") ? atoi(header_val(h, "Depth")) : INT_MAX);
234         syslog(LOG_DEBUG, "Client PROPFIND requested depth: %d", dav_depth);
235         StrBuf *Buf = NewStrBuf();
236
237         StrBufAppendPrintf(Buf, "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
238                            "<D:multistatus " "xmlns:D=\"DAV:\" " "xmlns:C=\"urn:ietf:params:xml:ns:caldav\"" ">");
239
240         // Transmit the collection resource
241         StrBufAppendPrintf(Buf, "<D:response>");
242         StrBufAppendPrintf(Buf, "<D:href>");
243         StrBufXMLEscAppend(Buf, NULL, h->site_prefix, strlen(h->site_prefix), 0);
244         StrBufAppendPrintf(Buf, "/ctdl/r/");
245         StrBufXMLEscAppend(Buf, NULL, c->room, strlen(c->room), 0);
246         StrBufAppendPrintf(Buf, "</D:href>");
247
248         StrBufAppendPrintf(Buf, "<D:propstat>");
249         StrBufAppendPrintf(Buf, "<D:status>HTTP/1.1 200 OK</D:status>");
250         StrBufAppendPrintf(Buf, "<D:prop>");
251         StrBufAppendPrintf(Buf, "<D:displayname>");
252         StrBufXMLEscAppend(Buf, NULL, c->room, strlen(c->room), 0);
253         StrBufAppendPrintf(Buf, "</D:displayname>");
254
255         StrBufAppendPrintf(Buf, "<D:owner />"); // empty owner ought to be legal; see rfc3744 section 5.1
256
257         StrBufAppendPrintf(Buf, "<D:resourcetype><D:collection />");
258         switch (c->room_default_view) {
259         case VIEW_CALENDAR:
260                 StrBufAppendPrintf(Buf, "<C:calendar />");      // RFC4791 section 4.2
261                 break;
262         }
263         StrBufAppendPrintf(Buf, "</D:resourcetype>");
264
265         int enumerate_by_euid = 0;      // nonzero if messages will be retrieved by euid instead of msgnum
266         switch (c->room_default_view) {
267         case VIEW_CALENDAR:             // RFC4791 section 5.2
268                 StrBufAppendPrintf(Buf, "<C:supported-calendar-component-set><C:comp name=\"VEVENT\"/></C:supported-calendar-component-set>");
269                 StrBufAppendPrintf(Buf, "<C:supported-calendar-data>");
270                 StrBufAppendPrintf(Buf, "<C:calendar-data content-type=\"text/calendar\" version=\"2.0\"/>");
271                 StrBufAppendPrintf(Buf, "</C:supported-calendar-data>");
272                 enumerate_by_euid = 1;
273                 break;
274         case VIEW_TASKS:                // RFC4791 section 5.2
275                 StrBufAppendPrintf(Buf, "<C:supported-calendar-component-set><C:comp name=\"VTODO\"/></C:supported-calendar-component-set>");
276                 StrBufAppendPrintf(Buf, "<C:supported-calendar-data>");
277                 StrBufAppendPrintf(Buf, "<C:calendar-data content-type=\"text/calendar\" version=\"2.0\"/>");
278                 StrBufAppendPrintf(Buf, "</C:supported-calendar-data>");
279                 enumerate_by_euid = 1;
280                 break;
281         case VIEW_ADDRESSBOOK:          // FIXME put some sort of CardDAV crapola here when we implement it
282                 enumerate_by_euid = 1;
283                 break;
284         case VIEW_WIKI:                 // FIXME invent "WikiDAV" ?
285                 enumerate_by_euid = 1;
286                 break;
287         }
288
289         // FIXME get the mtime
290         // StrBufAppendPrintf(Buf, "<D:getlastmodified>");
291         // escputs(datestring);
292         // StrBufAppendPrintf(Buf, "</D:getlastmodified>");
293
294         StrBufAppendPrintf(Buf, "</D:prop>");
295         StrBufAppendPrintf(Buf, "</D:propstat>");
296         StrBufAppendPrintf(Buf, "</D:response>\n");
297
298         // If a depth greater than zero was specified, transmit the collection listing
299         // BEGIN COLLECTION
300         if (dav_depth > 0) {
301                 long *msglist = get_msglist(c, "ALL");
302                 if (msglist) {
303                         int i;
304                         for (i = 0; (msglist[i] > 0); ++i) {
305                                 if ((i % 10) == 0)
306                                         syslog(LOG_DEBUG, "PROPFIND enumerated %d messages", i);
307                                 e = NULL;       // EUID gets stored here
308                                 timestamp = 0;
309
310                                 char cbuf[1024];
311                                 ctdl_printf(c, "MSG0 %ld|3", msglist[i]);
312                                 ctdl_readline(c, cbuf, sizeof(cbuf));
313                                 if (cbuf[0] == '1')
314                                         while (ctdl_readline(c, cbuf, sizeof(cbuf)), strcmp(cbuf, "000")) {
315                                                 if ((enumerate_by_euid) && (!strncasecmp(cbuf, "exti=", 5))) {
316                                                         // e = strdup(&cbuf[5]);
317                                                         int elen = (2 * strlen(&cbuf[5]));
318                                                         e = malloc(elen);
319                                                         urlesc(e, elen, &cbuf[5]);
320                                                 }
321                                                 if (!strncasecmp(cbuf, "time=", 5)) {
322                                                         timestamp = atol(&cbuf[5]);
323                                                 }
324                                         }
325                                 if (e == NULL) {
326                                         e = malloc(20);
327                                         sprintf(e, "%ld", msglist[i]);
328                                 }
329                                 StrBufAppendPrintf(Buf, "<D:response>");
330
331                                 // Generate the 'href' tag for this message
332                                 StrBufAppendPrintf(Buf, "<D:href>");
333                                 StrBufXMLEscAppend(Buf, NULL, h->site_prefix, strlen(h->site_prefix), 0);
334                                 StrBufAppendPrintf(Buf, "/ctdl/r/");
335                                 StrBufXMLEscAppend(Buf, NULL, c->room, strlen(c->room), 0);
336                                 StrBufAppendPrintf(Buf, "/");
337                                 StrBufXMLEscAppend(Buf, NULL, e, strlen(e), 0);
338                                 StrBufAppendPrintf(Buf, "</D:href>");
339                                 StrBufAppendPrintf(Buf, "<D:propstat>");
340                                 StrBufAppendPrintf(Buf, "<D:status>HTTP/1.1 200 OK</D:status>");
341                                 StrBufAppendPrintf(Buf, "<D:prop>");
342
343                                 switch (c->room_default_view) {
344                                 case VIEW_CALENDAR:
345                                         StrBufAppendPrintf(Buf,
346                                                            "<D:getcontenttype>text/calendar; component=vevent</D:getcontenttype>");
347                                         break;
348                                 case VIEW_TASKS:
349                                         StrBufAppendPrintf(Buf,
350                                                            "<D:getcontenttype>text/calendar; component=vtodo</D:getcontenttype>");
351                                         break;
352                                 case VIEW_ADDRESSBOOK:
353                                         StrBufAppendPrintf(Buf, "<D:getcontenttype>text/x-vcard</D:getcontenttype>");
354                                         break;
355                                 }
356
357                                 if (timestamp > 0) {
358                                         char *datestring = http_datestring(timestamp);
359                                         if (datestring) {
360                                                 StrBufAppendPrintf(Buf, "<D:getlastmodified>");
361                                                 StrBufXMLEscAppend(Buf, NULL, datestring, strlen(datestring), 0);
362                                                 StrBufAppendPrintf(Buf, "</D:getlastmodified>");
363                                                 free(datestring);
364                                         }
365                                         if (enumerate_by_euid) {        // FIXME ajc 2017oct30 should this be inside the timestamp conditional?
366                                                 StrBufAppendPrintf(Buf, "<D:getetag>\"%ld\"</D:getetag>", msglist[i]);
367                                         }
368                                 }
369                                 StrBufAppendPrintf(Buf, "</D:prop></D:propstat></D:response>\n");
370                                 free(e);
371                         }
372                         free(msglist);
373                 };
374         }
375         // END COLLECTION
376
377         StrBufAppendPrintf(Buf, "</D:multistatus>\n");
378
379         add_response_header(h, strdup("Content-type"), strdup("text/xml"));
380         h->response_code = 207;
381         h->response_string = strdup("Multi-Status");
382         h->response_body_length = StrLength(Buf);
383         h->response_body = SmashStrBuf(&Buf);
384 }
385
386 // some good examples here
387 // http://blogs.nologin.es/rickyepoderi/index.php?/archives/14-Introducing-CalDAV-Part-I.html
388
389
390 // Called by the_room_itself() when the HTTP method is PROPFIND
391 void get_the_room_itself(struct http_transaction *h, struct ctdlsession *c) {
392         JsonValue *j = NewJsonObject(HKEY("gotoroom"));
393
394         JsonObjectAppend(j, NewJsonPlainString(HKEY("name"), c->room, -1));
395         JsonObjectAppend(j, NewJsonNumber(HKEY("current_view"), c->room_current_view));
396         JsonObjectAppend(j, NewJsonNumber(HKEY("default_view"), c->room_default_view));
397         JsonObjectAppend(j, NewJsonNumber(HKEY("new_messages"), c->new_messages));
398         JsonObjectAppend(j, NewJsonNumber(HKEY("total_messages"), c->total_messages));
399         JsonObjectAppend(j, NewJsonNumber(HKEY("last_seen"), c->last_seen));
400
401         StrBuf *sj = NewStrBuf();
402         SerializeJson(sj, j, 1);        // '1' == free the source array
403
404         add_response_header(h, strdup("Content-type"), strdup("application/json"));
405         h->response_code = 200;
406         h->response_string = strdup("OK");
407         h->response_body_length = StrLength(sj);
408         h->response_body = SmashStrBuf(&sj);
409         return;
410 }
411
412
413 // Handle REST/DAV requests for the room itself (such as /ctdl/r/roomname
414 // or /ctdl/r/roomname/ but *not* specific objects within the room)
415 void the_room_itself(struct http_transaction *h, struct ctdlsession *c) {
416
417         // OPTIONS method on the room itself usually is a DAV client assessing what's here.
418         if (!strcasecmp(h->method, "OPTIONS")) {
419                 options_the_room_itself(h, c);
420                 return;
421         }
422
423         // PROPFIND method on the room itself could be looking for a directory
424         if (!strcasecmp(h->method, "PROPFIND")) {
425                 propfind_the_room_itself(h, c);
426                 return;
427         }
428
429         // REPORT method on the room itself is probably the dreaded CalDAV tower-of-crapola
430         if (!strcasecmp(h->method, "REPORT")) {
431                 report_the_room_itself(h, c);
432                 return;
433         }
434
435         // GET method on the room itself is an API call, possibly from our JavaScript front end
436         if (!strcasecmp(h->method, "get")) {
437                 get_the_room_itself(h, c);
438                 return;
439         }
440
441         // we probably want a "go to this room" for interactive access
442         do_404(h);
443 }
444
445
446 // Dispatcher for "/ctdl/r" and "/ctdl/r/" for the room list
447 void room_list(struct http_transaction *h, struct ctdlsession *c) {
448         char buf[1024];
449         char roomname[1024];
450
451         ctdl_printf(c, "LKRA");
452         ctdl_readline(c, buf, sizeof(buf));
453         if (buf[0] != '1') {
454                 do_502(h);
455                 return;
456         }
457
458         JsonValue *j = NewJsonArray(HKEY("lkra"));
459         while (ctdl_readline(c, buf, sizeof(buf)), strcmp(buf, "000")) {
460
461                 // name|QRflags|QRfloor|QRorder|QRflags2|ra|current_view|default_view|mtime
462                 JsonValue *jr = NewJsonObject(HKEY("room"));
463
464                 extract_token(roomname, buf, 0, '|', sizeof roomname);
465                 JsonObjectAppend(jr, NewJsonPlainString(HKEY("name"), roomname, -1));
466
467                 int ra = extract_int(buf, 5);
468                 JsonObjectAppend(jr, NewJsonBool(HKEY("known"), (ra & UA_KNOWN)));
469                 JsonObjectAppend(jr, NewJsonBool(HKEY("hasnewmsgs"), (ra & UA_HASNEWMSGS)));
470
471                 int floor = extract_int(buf, 2);
472                 JsonObjectAppend(jr, NewJsonNumber(HKEY("floor"), floor));
473
474                 int rorder = extract_int(buf, 3);
475                 JsonObjectAppend(jr, NewJsonNumber(HKEY("rorder"), rorder));
476
477                 JsonArrayAppend(j, jr); // add the room to the array
478         }
479
480         StrBuf *sj = NewStrBuf();
481         SerializeJson(sj, j, 1);        // '1' == free the source array
482
483         add_response_header(h, strdup("Content-type"), strdup("application/json"));
484         h->response_code = 200;
485         h->response_string = strdup("OK");
486         h->response_body_length = StrLength(sj);
487         h->response_body = SmashStrBuf(&sj);
488 }
489
490
491 // Dispatcher for paths starting with /ctdl/r/
492 void ctdl_r(struct http_transaction *h, struct ctdlsession *c) {
493         char requested_roomname[128];
494         char buf[1024];
495
496         // All room-related functions require being "in" the room specified.  Are we in that room already?
497         extract_token(requested_roomname, h->uri, 3, '/', sizeof requested_roomname);
498         unescape_input(requested_roomname);
499
500         if (IsEmptyStr(requested_roomname)) {   //      /ctdl/r/
501                 room_list(h, c);
502                 return;
503         }
504         // If not, try to go there.
505         if (strcasecmp(requested_roomname, c->room)) {
506                 ctdl_printf(c, "GOTO %s", requested_roomname);
507                 ctdl_readline(c, buf, sizeof(buf));
508                 if (buf[0] == '2') {
509                         // buf[3] will indicate whether any instant messages are waiting
510                         extract_token(c->room, &buf[4], 0, '|', sizeof c->room);
511                         c->new_messages = extract_int(&buf[4], 1);
512                         c->total_messages = extract_int(&buf[4], 2);
513                         //      3       (int)info                       Info flag: set to nonzero if the user needs to read this room's info file
514                         //      4       (int)CC->room.QRflags           Various flags associated with this room.
515                         //      5       (long)CC->room.QRhighest        The highest message number present in this room
516                         c->last_seen = extract_long(&buf[4], 6);        // The highest message number the user has read in this room
517                         //      7       (int)rmailflag                  Boolean flag: 1 if this is a Mail> room, 0 otherwise.
518                         //      8       (int)raideflag                  Nonzero if user is either Aide or a Room Aide in this room
519                         //      9       (int)newmailcount               The number of new Mail messages the user has
520                         //      10      (int)CC->room.QRfloor           The floor number this room resides on
521                         c->room_current_view = extract_int(&buf[4], 11);
522                         c->room_default_view = extract_int(&buf[4], 12);
523                         //      13      (int)is_trash                   Boolean flag: 1 if this is the user's Trash folder, 0 otherwise.
524                         //      14      (int)CC->room.QRflags2          More flags associated with this room
525                         //      15      (long)CC->room.QRmtime          Timestamp of the last write activity in this room
526                 }
527                 else {
528                         do_404(h);
529                         return;
530                 }
531         }
532         // At this point our Citadel client session is "in" the specified room.
533
534         if (num_tokens(h->uri, '/') == 4)       //      /ctdl/r/roomname
535         {
536                 the_room_itself(h, c);
537                 return;
538         }
539
540         extract_token(buf, h->uri, 4, '/', sizeof buf);
541         if (num_tokens(h->uri, '/') == 5) {
542                 if (IsEmptyStr(buf)) {
543                         the_room_itself(h, c);  //      /ctdl/r/roomname/       ( same as /ctdl/r/roomname )
544                 }
545                 else {
546                         object_in_room(h, c);   //      /ctdl/r/roomname/object
547                 }
548                 return;
549         }
550         if (num_tokens(h->uri, '/') == 6) {
551                 object_in_room(h, c);   //      /ctdl/r/roomname/object/ or possibly /ctdl/r/roomname/object/component
552                 return;
553         }
554         // If we get to this point, the client specified a valid room but requested an action we don't know how to perform.
555         do_404(h);
556 }