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