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