c2c7d5331cf2aaf04b7d9b11c5e948e6876674af
[citadel.git] / webcit / roomtokens.c
1 /*
2  * Lots of different room-related operations.
3  *
4  * Copyright (c) 1996-2012 by the citadel.org team
5  *
6  * This program is open source software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License, version 3.
8  * by 
9  * 
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  * 
17  * 
18  * 
19  */
20
21 #include "webcit.h"
22 #include "webserver.h"
23
24
25 /*
26  * Embed the room banner
27  *
28  * got                  The information returned from a GOTO server command
29  * navbar_style         Determines which navigation buttons to display
30  */
31 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
32 {
33         wcsession *WCC = WC;
34         
35         /* Refresh current room states.  Doesn't work? gotoroom(NULL); */
36
37         wc_printf("<div id=\"banner\">\n");
38
39         /* The browser needs some information for its own use */
40         wc_printf("<script type=\"text/javascript\">    \n"
41                   "     room_is_trash = %d;             \n"
42                   "</script>\n",
43                   ((WC->CurRoom.RAFlags & UA_ISTRASH) != 0)
44         );
45
46         /*
47          * If the user happens to select the "make this my start page" link,
48          * we want it to remember the URL as a "/dotskip" one instead of
49          * a "skip" or "gotonext" or something like that.
50          */
51         if (WCC->Hdr->this_page == NULL) {
52                 WCC->Hdr->this_page = NewStrBuf();
53         }
54         StrBufPrintf(WCC->Hdr->this_page, "dotskip?room=%s", ChrPtr(WC->CurRoom.name));
55
56         do_template("roombanner");
57
58         do_template("navbar");
59         wc_printf("</div>\n");
60 }
61
62
63 /*******************************************************************************
64  ********************** FLOOR Tokens *******************************************
65  *******************************************************************************/
66
67
68 void tmplput_FLOOR_ID(StrBuf *Target, WCTemplputParams *TP) 
69 {
70         Floor *myFloor = (Floor *)CTX;
71
72         StrBufAppendPrintf(Target, "%d", myFloor->ID);
73 }
74
75
76 void tmplput_ROOM_FLOORID(StrBuf *Target, WCTemplputParams *TP) 
77 {
78         folder *Folder = (folder *)CTX;
79         StrBufAppendPrintf(Target, "%d", Folder->floorid);
80 }
81
82
83 void tmplput_ROOM_FLOOR_ID(StrBuf *Target, WCTemplputParams *TP) 
84 {
85         folder *Folder = (folder *)CTX;
86         const Floor *pFloor = Folder->Floor;
87
88         if (pFloor == NULL)
89                 return;
90
91         StrBufAppendPrintf(Target, "%d", pFloor->ID);
92 }
93
94
95 void tmplput_ROOM_FLOOR_NAME(StrBuf *Target, WCTemplputParams *TP) 
96 {
97         folder *Folder = (folder *)CTX;
98         const Floor *pFloor = Folder->Floor;
99
100         if (pFloor == NULL)
101                 return;
102
103         StrBufAppendTemplate(Target, TP, pFloor->Name, 0);
104 }
105
106
107 void tmplput_ThisRoomFloorName(StrBuf *Target, WCTemplputParams *TP) 
108 {
109         wcsession *WCC = WC;
110         folder *Folder = &WCC->CurRoom;
111         const Floor *pFloor;
112
113         if (Folder == NULL)
114                 return;
115
116         pFloor = Folder->Floor;
117         if (pFloor == NULL)
118                 return;
119
120         StrBufAppendTemplate(Target, TP, pFloor->Name, 0);
121 }
122
123
124 void tmplput_FLOOR_NAME(StrBuf *Target, WCTemplputParams *TP) 
125 {
126         Floor *myFloor = (Floor *)CTX;
127
128         StrBufAppendTemplate(Target, TP, myFloor->Name, 0);
129 }
130
131
132 void tmplput_FLOOR_NROOMS(StrBuf *Target, WCTemplputParams *TP) 
133 {
134         Floor *myFloor = (Floor *)CTX;
135
136         StrBufAppendPrintf(Target, "%d", myFloor->NRooms);
137 }
138
139
140 void tmplput_ROOM_FLOOR_NROOMS(StrBuf *Target, WCTemplputParams *TP) 
141 {
142         folder *Folder = (folder *)CTX;
143         const Floor *pFloor = Folder->Floor;
144
145         if (pFloor == NULL)
146                 return;
147         StrBufAppendPrintf(Target, "%d", pFloor->NRooms);
148 }
149
150
151 int ConditionalFloorHaveNRooms(StrBuf *Target, WCTemplputParams *TP)
152 {
153         Floor *MyFloor = (Floor *)CTX;
154         int HaveN;
155
156         HaveN = GetTemplateTokenNumber(Target, TP, 0, 0);
157
158         return HaveN == MyFloor->NRooms;
159 }
160
161
162 int ConditionalFloorIsRESTSubFloor(StrBuf *Target, WCTemplputParams *TP)
163 {
164         wcsession  *WCC = WC;
165         Floor *MyFloor = (Floor *)CTX;
166         /** if we have dav_depth the client just wants the subfloors */
167         if ((WCC->Hdr->HR.dav_depth == 1) && 
168             (GetCount(WCC->Directory) == 0))
169                 return 1;
170         return WCC->CurrentFloor == MyFloor;
171 }
172
173
174 int ConditionalFloorIsSUBROOM(StrBuf *Target, WCTemplputParams *TP)
175 {
176         wcsession  *WCC = WC;
177         Floor *MyFloor = (Floor *)CTX;
178
179         return WCC->CurRoom.floorid == MyFloor->ID;
180 }
181
182
183 int ConditionalFloorIsVirtual(StrBuf *Target, WCTemplputParams *TP)
184 {
185         Floor *MyFloor = (Floor *)CTX;
186
187         return MyFloor->ID == VIRTUAL_MY_FLOOR;
188 }
189
190
191 /*******************************************************************************
192  ********************** ROOM Tokens ********************************************
193  *******************************************************************************/
194 /**** Name ******/
195
196
197 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
198 {
199         StrBufAppendTemplate(Target, TP, WC->CurRoom.name, 0);
200 }
201
202
203 void tmplput_current_room(StrBuf *Target, WCTemplputParams *TP)
204 {
205         wcsession *WCC = WC;
206
207         if (WCC != NULL) {
208                 StrBufAppendTemplate(Target, TP, 
209                      WCC->CurRoom.name, 
210                      0
211                 );
212         }
213 }
214
215
216 void tmplput_ROOM_NAME(StrBuf *Target, WCTemplputParams *TP) 
217 {
218         folder *Folder = (folder *)CTX;
219
220         if (Folder == NULL)
221         {
222                 wcsession *WCC = WC;
223
224                 if (WCC == NULL)
225                         return;
226                 Folder = &WCC->CurRoom;
227         }
228         StrBufAppendTemplate(Target, TP, Folder->name, 0);
229 }
230
231
232 void tmplput_ROOM_BASENAME(StrBuf *Target, WCTemplputParams *TP) 
233 {
234         folder *room = (folder *)CTX;
235
236         if (room->nRoomNameParts > 1)
237                 StrBufAppendTemplate(Target, TP, 
238                                       room->RoomNameParts[room->nRoomNameParts - 1], 0);
239         else 
240                 StrBufAppendTemplate(Target, TP, room->name, 0);
241 }
242
243
244 void tmplput_ROOM_LEVEL_N_TIMES(StrBuf *Target, WCTemplputParams *TP) 
245 {
246         folder *room = (folder *)CTX;
247         int i;
248         const char *AppendMe;
249         long AppendMeLen;
250
251
252         if (room->nRoomNameParts > 1)
253         {
254                 GetTemplateTokenString(Target, TP, 0, &AppendMe, &AppendMeLen);
255                 for (i = 0; i < room->nRoomNameParts; i++)
256                         StrBufAppendBufPlain(Target, AppendMe, AppendMeLen, 0);
257         }
258 }
259
260
261 int ConditionalRoomIsInbox(StrBuf *Target, WCTemplputParams *TP)
262 {
263         folder *Folder = (folder *)CTX;
264         return Folder->is_inbox;
265 }
266
267
268 /****** Properties ******/
269 int ConditionalRoom_MayEdit(StrBuf *Target, WCTemplputParams *TP)
270 {
271         wcsession *WCC = WC;
272
273         LoadRoomXA ();
274
275         return WCC->CurRoom.XALoaded == 1;
276 }
277
278 int ConditionalThisRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
279 {
280         long QR_CheckFlag;
281         wcsession *WCC = WC;
282         
283         QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
284         if (QR_CheckFlag == 0)
285                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
286                                  "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
287         
288         if (WCC == NULL)
289                 return 0;
290
291         if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
292             (TP->Tokens->Params[2]->MaskBy == eNO))
293                 return (WCC->CurRoom.QRFlags & QR_CheckFlag) != 0;
294         else
295                 return (WCC->CurRoom.QRFlags & QR_CheckFlag) == QR_CheckFlag;
296 }
297
298
299 int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
300 {
301         long QR_CheckFlag;
302         folder *Folder = (folder *)(TP->Context);
303
304         QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
305         if (QR_CheckFlag == 0)
306                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
307                                  "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
308
309         if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
310             (TP->Tokens->Params[2]->MaskBy == eNO))
311                 return (Folder->QRFlags & QR_CheckFlag) != 0;
312         else
313                 return (Folder->QRFlags & QR_CheckFlag) == QR_CheckFlag;
314 }
315
316
317 void tmplput_ROOM_QRFLAGS(StrBuf *Target, WCTemplputParams *TP) 
318 {
319         folder *Folder = (folder *)CTX;
320         StrBufAppendPrintf(Target, "%d", Folder->QRFlags);
321 }
322
323
324 int ConditionalThisRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
325 {
326         long QR2_CheckFlag;
327         wcsession *WCC = WC;
328         
329         QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
330         if (QR2_CheckFlag == 0)
331                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
332                                  "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
333
334         
335         if (WCC == NULL)
336                 return 0;
337
338         if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
339             (TP->Tokens->Params[2]->MaskBy == eNO))
340                 return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) != 0;
341         else
342                 return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) == QR2_CheckFlag;
343 }
344
345
346 int ConditionalRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
347 {
348         long QR2_CheckFlag;
349         folder *Folder = (folder *)(TP->Context);
350
351         QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
352         if (QR2_CheckFlag == 0)
353                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
354                                  "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
355         return ((Folder->QRFlags2 & QR2_CheckFlag) != 0);
356 }
357
358
359 int ConditionalRoomHas_UAFlag(StrBuf *Target, WCTemplputParams *TP)
360 {
361         folder *Folder = (folder *)(TP->Context);
362         long UA_CheckFlag;
363                 
364         UA_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
365         if (UA_CheckFlag == 0)
366                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
367                                  "requires one of the #\"UA_*\"- defines or an integer flag 0 is invalid!");
368
369         return ((Folder->RAFlags & UA_CheckFlag) != 0);
370 }
371
372
373 void tmplput_ROOM_ACL(StrBuf *Target, WCTemplputParams *TP) 
374 {
375         folder *Folder = (folder *)CTX;
376
377         StrBufAppendPrintf(Target, "%ld", Folder->RAFlags, 0);
378 }
379
380
381 void tmplput_ROOM_RAFLAGS(StrBuf *Target, WCTemplputParams *TP) 
382 {
383         folder *Folder = (folder *)(TP->Context);
384         StrBufAppendPrintf(Target, "%d", Folder->RAFlags);
385 }
386
387
388 void tmplput_ThisRoomAide(StrBuf *Target, WCTemplputParams *TP) 
389 {
390         wcsession *WCC = WC;
391
392         LoadRoomAide();
393
394         StrBufAppendTemplate(Target, TP, WCC->CurRoom.RoomAide, 0);
395 }
396
397
398 int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
399 {
400         wcsession *WCC = WC;
401         return (WCC != NULL)? 
402                 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) : 0;
403 }
404
405
406 int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
407 {
408         wcsession *WCC = WC;
409         return (WCC == NULL)? 0 : 
410                 ( ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
411                    (WCC->CurRoom.is_inbox) || 
412                    (WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) );
413 }
414
415
416 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
417 {
418         wcsession *WCC = WC;
419
420         return (        (WCC != NULL)
421                         && (WCC->logged_in)
422                         && (
423                                 (WCC->axlevel >= 6)
424                                 || ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0)
425                                 || (WCC->CurRoom.is_inbox)
426                         )
427                 );
428 }
429
430
431 void tmplput_ThisRoomPass(StrBuf *Target, WCTemplputParams *TP) 
432 {
433         wcsession *WCC = WC;
434
435         LoadRoomXA();
436         StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 0);
437 }
438
439
440 void tmplput_ThisRoom_nNewMessages(StrBuf *Target, WCTemplputParams *TP) 
441 {
442         wcsession *WCC = WC;
443
444         StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nNewMessages);
445 }
446
447
448 void tmplput_ThisRoom_nTotalMessages(StrBuf *Target, WCTemplputParams *TP) 
449 {
450         wcsession *WCC = WC;
451
452         StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nTotalMessages);
453 }
454
455
456 void tmplput_ThisRoomOrder(StrBuf *Target, WCTemplputParams *TP) 
457 {
458         wcsession *WCC = WC;
459
460         LoadRoomXA();
461
462         StrBufAppendPrintf(Target, "%d", WCC->CurRoom.Order);
463 }
464
465
466 int ConditionalThisRoomOrder(StrBuf *Target, WCTemplputParams *TP)
467 {
468         wcsession *WCC = WC;
469         long CheckThis;
470
471         if (WCC == NULL)
472                 return 0;
473
474         LoadRoomXA();
475
476         CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
477         return CheckThis == WCC->CurRoom.Order;
478 }
479
480
481 void tmplput_ROOM_LISTORDER(StrBuf *Target, WCTemplputParams *TP) 
482 {
483         folder *Folder = (folder *)CTX;
484         StrBufAppendPrintf(Target, "%d", Folder->Order);
485 }
486
487
488 int ConditionalThisRoomXHavePic(StrBuf *Target, WCTemplputParams *TP)
489 {
490         wcsession *WCC = WC;
491         
492         if (WCC == NULL)
493                 return 0;
494
495         LoadXRoomPic();
496         return WCC->CurRoom.XHaveRoomPic == 1;
497 }
498
499
500 int ConditionalThisRoomXHaveInfoText(StrBuf *Target, WCTemplputParams *TP)
501 {
502         wcsession *WCC = WC;
503         
504         if (WCC == NULL)
505                 return 0;
506
507         LoadXRoomInfoText();
508         return (StrLength(WCC->CurRoom.XInfoText)>0);
509 }
510
511
512 void tmplput_ThisRoomInfoText(StrBuf *Target, WCTemplputParams *TP) 
513 {
514         wcsession *WCC = WC;
515         long nchars = 0;
516
517         LoadXRoomInfoText();
518
519         nchars = GetTemplateTokenNumber(Target, TP, 0, 0);
520         if (!nchars) {
521                 /* the whole thing */
522                 StrBufAppendTemplate(Target, TP, WCC->CurRoom.XInfoText, 1);
523         }
524         else {
525                 /* only a certain number of characters */
526                 StrBuf *SubBuf;
527                 SubBuf = NewStrBufDup(WCC->CurRoom.XInfoText);
528                 if (StrLength(SubBuf) > nchars) {
529                         StrBuf_Utf8StrCut(SubBuf, nchars);
530                         StrBufAppendBufPlain(SubBuf, HKEY("..."), 0);
531                 }
532                 StrBufAppendTemplate(Target, TP, SubBuf, 1);
533                 FreeStrBuf(&SubBuf);
534         }
535 }
536
537
538 void tmplput_ROOM_LASTCHANGE(StrBuf *Target, WCTemplputParams *TP) 
539 {
540         folder *Folder = (folder *)CTX;
541         StrBufAppendPrintf(Target, "%d", Folder->lastchange);
542 }
543
544
545 void tmplput_ThisRoomDirectory(StrBuf *Target, WCTemplputParams *TP) 
546 {
547         wcsession *WCC = WC;
548
549         LoadRoomXA();
550
551         StrBufAppendTemplate(Target, TP, WCC->CurRoom.Directory, 0);
552 }
553
554
555 void tmplput_ThisRoomXNFiles(StrBuf *Target, WCTemplputParams *TP) 
556 {
557         wcsession *WCC = WC;
558
559         LoadXRoomXCountFiles();
560
561         StrBufAppendPrintf(Target, "%d", WCC->CurRoom.XDownloadCount);
562 }
563
564
565 void tmplput_ThisRoomX_FileString(StrBuf *Target, WCTemplputParams *TP) 
566 {
567         wcsession *WCC = WC;
568
569         LoadXRoomXCountFiles();
570
571         if (WCC->CurRoom.XDownloadCount == 1)
572                 StrBufAppendBufPlain(Target, _("file"), -1, 0);
573         else
574                 StrBufAppendBufPlain(Target, _("files"), -1, 0);
575 }
576
577
578 int ConditionalIsThisThatRoom(StrBuf *Target, WCTemplputParams *TP)
579 {
580         folder *Folder = (folder *)CTX;
581         wcsession *WCC = WC;
582
583         if (WCC == NULL)
584                 return 0;
585
586         return Folder == WCC->ThisRoom;
587 }
588
589
590 void 
591 InitModule_ROOMTOKENS
592 (void)
593 {
594         RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, NULL, CTX_NONE);
595
596         RegisterNamespace("FLOOR:ID", 0, 0, tmplput_FLOOR_ID, NULL, CTX_FLOORS);
597         RegisterNamespace("ROOM:INFO:FLOORID", 0, 1, tmplput_ROOM_FLOORID, NULL, CTX_ROOMS);
598         RegisterNamespace("ROOM:INFO:FLOOR:ID", 0, 0, tmplput_ROOM_FLOOR_ID, NULL, CTX_ROOMS);
599
600         RegisterNamespace("FLOOR:NAME", 0, 1, tmplput_FLOOR_NAME, NULL, CTX_FLOORS);
601         RegisterNamespace("ROOM:INFO:FLOOR:NAME", 0, 1, tmplput_ROOM_FLOOR_NAME, NULL, CTX_ROOMS);
602         RegisterNamespace("THISROOM:FLOOR:NAME", 0, 1, tmplput_ThisRoomFloorName, NULL, CTX_NONE);
603
604         RegisterNamespace("FLOOR:NROOMS", 0, 0, tmplput_FLOOR_NROOMS, NULL, CTX_FLOORS);
605         RegisterNamespace("ROOM:INFO:FLOOR:NROOMS", 0, 0, tmplput_ROOM_FLOOR_NROOMS, NULL, CTX_ROOMS);
606
607         RegisterConditional(HKEY("COND:FLOOR:ISSUBROOM"), 0, ConditionalFloorIsSUBROOM, CTX_FLOORS);
608         RegisterConditional(HKEY("COND:FLOOR:NROOMS"), 1, ConditionalFloorHaveNRooms, CTX_FLOORS);
609         RegisterConditional(HKEY("COND:ROOM:REST:ISSUBFLOOR"), 0, ConditionalFloorIsRESTSubFloor, CTX_FLOORS);
610         RegisterConditional(HKEY("COND:FLOOR:ISVIRTUAL"), 0, ConditionalFloorIsVirtual, CTX_FLOORS);
611
612         /**** Room... ******/
613         /**** Name ******/
614         RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, NULL, CTX_NONE);
615         RegisterNamespace("THISROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE);
616         RegisterNamespace("ROOM:INFO:NAME", 0, 1, tmplput_ROOM_NAME, NULL, CTX_ROOMS);
617         RegisterNamespace("ROOM:INFO:PRINT_NAME", 0, 1, tmplput_ROOM_NAME, NULL, CTX_NONE);
618         RegisterNamespace("ROOM:INFO:BASENAME", 0, 1, tmplput_ROOM_BASENAME, NULL, CTX_ROOMS);
619         RegisterNamespace("ROOM:INFO:LEVELNTIMES", 1, 2, tmplput_ROOM_LEVEL_N_TIMES, NULL, CTX_ROOMS);
620         RegisterConditional(HKEY("COND:ROOM:INFO:IS_INBOX"), 0, ConditionalRoomIsInbox, CTX_ROOMS);
621
622         /****** Properties ******/
623         RegisterNamespace("ROOM:INFO:QRFLAGS", 0, 1, tmplput_ROOM_QRFLAGS, NULL, CTX_ROOMS);
624         RegisterConditional(HKEY("COND:THISROOM:FLAG:QR"), 0, ConditionalThisRoomHas_QRFlag, CTX_NONE);
625         RegisterConditional(HKEY("COND:THISROOM:EDIT"), 0, ConditionalRoom_MayEdit, CTX_NONE);
626         RegisterConditional(HKEY("COND:ROOM:FLAG:QR"), 0, ConditionalRoomHas_QRFlag, CTX_ROOMS);
627
628         RegisterConditional(HKEY("COND:THISROOM:FLAG:QR2"), 0, ConditionalThisRoomHas_QRFlag2, CTX_NONE);
629         RegisterConditional(HKEY("COND:ROOM:FLAG:QR2"), 0, ConditionalRoomHas_QRFlag2, CTX_ROOMS);
630
631         RegisterConditional(HKEY("COND:ROOM:FLAG:UA"), 0, ConditionalRoomHas_UAFlag, CTX_ROOMS);
632         RegisterNamespace("ROOM:INFO:RAFLAGS", 0, 1, tmplput_ROOM_RAFLAGS, NULL, CTX_ROOMS);
633
634
635         RegisterNamespace("ROOM:INFO:LISTORDER", 0, 1, tmplput_ROOM_LISTORDER, NULL, CTX_ROOMS);
636         RegisterNamespace("THISROOM:ORDER", 0, 0, tmplput_ThisRoomOrder, NULL, CTX_NONE);
637         RegisterConditional(HKEY("COND:THISROOM:ORDER"), 0, ConditionalThisRoomOrder, CTX_NONE);
638
639         RegisterNamespace("ROOM:INFO:LASTCHANGE", 0, 1, tmplput_ROOM_LASTCHANGE, NULL, CTX_ROOMS);
640
641         RegisterNamespace("THISROOM:MSGS:NEW", 0, 0, tmplput_ThisRoom_nNewMessages, NULL, CTX_NONE);
642         RegisterNamespace("THISROOM:MSGS:TOTAL", 0, 0, tmplput_ThisRoom_nTotalMessages, NULL, CTX_NONE);
643
644         RegisterNamespace("THISROOM:PASS", 0, 1, tmplput_ThisRoomPass, NULL, CTX_NONE);
645         RegisterNamespace("THISROOM:AIDE", 0, 1, tmplput_ThisRoomAide, NULL, CTX_NONE);
646         RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide, CTX_NONE);
647         RegisterConditional(HKEY("COND:ACCESS:DELETE"), 2, ConditionalRoomAcessDelete, CTX_NONE);
648         RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
649
650         RegisterConditional(HKEY("COND:THISROOM:HAVE_PIC"), 0, ConditionalThisRoomXHavePic, CTX_NONE);
651
652         RegisterNamespace("THISROOM:INFOTEXT", 1, 2, tmplput_ThisRoomInfoText, NULL, CTX_NONE);
653         RegisterConditional(HKEY("COND:THISROOM:HAVE_INFOTEXT"), 0, ConditionalThisRoomXHaveInfoText, CTX_NONE);
654
655         RegisterNamespace("THISROOM:FILES:N", 0, 1, tmplput_ThisRoomXNFiles, NULL, CTX_NONE);
656         RegisterNamespace("THISROOM:FILES:STR", 0, 1, tmplput_ThisRoomX_FileString, NULL, CTX_NONE);
657         RegisterNamespace("THISROOM:DIRECTORY", 0, 1, tmplput_ThisRoomDirectory, NULL, CTX_NONE);
658
659         RegisterNamespace("ROOM:INFO:ACL", 0, 1, tmplput_ROOM_ACL, NULL, CTX_ROOMS);
660         RegisterConditional(HKEY("COND:THIS:THAT:ROOM"), 0, ConditionalIsThisThatRoom, CTX_ROOMS);
661 }