21653af5263fa203d2ed69a3eff3855f8c10225b
[citadel.git] / webcit / roomtokens.c
1 /*
2  * Lots of different room-related operations.
3  *
4  * Copyright (c) 1996-2011 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 as published
8  * by the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
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  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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 ConditionalThisRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
270 {
271         long QR_CheckFlag;
272         wcsession *WCC = WC;
273         
274         QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
275         if (QR_CheckFlag == 0)
276                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
277                                  "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
278         
279         if (WCC == NULL)
280                 return 0;
281
282         if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
283             (TP->Tokens->Params[2]->MaskBy == eNO))
284                 return (WCC->CurRoom.QRFlags & QR_CheckFlag) != 0;
285         else
286                 return (WCC->CurRoom.QRFlags & QR_CheckFlag) == QR_CheckFlag;
287 }
288
289
290 int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
291 {
292         long QR_CheckFlag;
293         folder *Folder = (folder *)(TP->Context);
294
295         QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
296         if (QR_CheckFlag == 0)
297                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
298                                  "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
299
300         if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
301             (TP->Tokens->Params[2]->MaskBy == eNO))
302                 return (Folder->QRFlags & QR_CheckFlag) != 0;
303         else
304                 return (Folder->QRFlags & QR_CheckFlag) == QR_CheckFlag;
305 }
306
307
308 void tmplput_ROOM_QRFLAGS(StrBuf *Target, WCTemplputParams *TP) 
309 {
310         folder *Folder = (folder *)CTX;
311         StrBufAppendPrintf(Target, "%d", Folder->QRFlags);
312 }
313
314
315 int ConditionalThisRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
316 {
317         long QR2_CheckFlag;
318         wcsession *WCC = WC;
319         
320         QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
321         if (QR2_CheckFlag == 0)
322                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
323                                  "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
324
325         
326         if (WCC == NULL)
327                 return 0;
328
329         if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
330             (TP->Tokens->Params[2]->MaskBy == eNO))
331                 return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) != 0;
332         else
333                 return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) == QR2_CheckFlag;
334 }
335
336
337 int ConditionalRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
338 {
339         long QR2_CheckFlag;
340         folder *Folder = (folder *)(TP->Context);
341
342         QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
343         if (QR2_CheckFlag == 0)
344                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
345                                  "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
346         return ((Folder->QRFlags2 & QR2_CheckFlag) != 0);
347 }
348
349
350 int ConditionalRoomHas_UAFlag(StrBuf *Target, WCTemplputParams *TP)
351 {
352         folder *Folder = (folder *)(TP->Context);
353         long UA_CheckFlag;
354                 
355         UA_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
356         if (UA_CheckFlag == 0)
357                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
358                                  "requires one of the #\"UA_*\"- defines or an integer flag 0 is invalid!");
359
360         return ((Folder->RAFlags & UA_CheckFlag) != 0);
361 }
362
363
364 void tmplput_ROOM_ACL(StrBuf *Target, WCTemplputParams *TP) 
365 {
366         folder *Folder = (folder *)CTX;
367
368         StrBufAppendPrintf(Target, "%ld", Folder->RAFlags, 0);
369 }
370
371
372 void tmplput_ROOM_RAFLAGS(StrBuf *Target, WCTemplputParams *TP) 
373 {
374         folder *Folder = (folder *)(TP->Context);
375         StrBufAppendPrintf(Target, "%d", Folder->RAFlags);
376 }
377
378
379 void tmplput_ThisRoomAide(StrBuf *Target, WCTemplputParams *TP) 
380 {
381         wcsession *WCC = WC;
382
383         LoadRoomAide();
384
385         StrBufAppendTemplate(Target, TP, WCC->CurRoom.RoomAide, 0);
386 }
387
388
389 int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
390 {
391         wcsession *WCC = WC;
392         return (WCC != NULL)? 
393                 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) : 0;
394 }
395
396
397 int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
398 {
399         wcsession *WCC = WC;
400         return (WCC == NULL)? 0 : 
401                 ( ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
402                    (WCC->CurRoom.is_inbox) || 
403                    (WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) );
404 }
405
406
407 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
408 {
409         wcsession *WCC = WC;
410
411         return (        (WCC != NULL)
412                         && (WCC->logged_in)
413                         && (
414                                 (WCC->axlevel >= 6)
415                                 || ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0)
416                                 || (WCC->CurRoom.is_inbox)
417                         )
418                 );
419 }
420
421
422 void tmplput_ThisRoomPass(StrBuf *Target, WCTemplputParams *TP) 
423 {
424         wcsession *WCC = WC;
425
426         LoadRoomXA();
427         StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 0);
428 }
429
430
431 void tmplput_ThisRoom_nNewMessages(StrBuf *Target, WCTemplputParams *TP) 
432 {
433         wcsession *WCC = WC;
434
435         StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nNewMessages);
436 }
437
438
439 void tmplput_ThisRoom_nTotalMessages(StrBuf *Target, WCTemplputParams *TP) 
440 {
441         wcsession *WCC = WC;
442
443         StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nTotalMessages);
444 }
445
446
447 void tmplput_ThisRoomOrder(StrBuf *Target, WCTemplputParams *TP) 
448 {
449         wcsession *WCC = WC;
450
451         LoadRoomXA();
452
453         StrBufAppendPrintf(Target, "%d", WCC->CurRoom.Order);
454 }
455
456
457 int ConditionalThisRoomOrder(StrBuf *Target, WCTemplputParams *TP)
458 {
459         wcsession *WCC = WC;
460         long CheckThis;
461
462         if (WCC == NULL)
463                 return 0;
464
465         LoadRoomXA();
466
467         CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
468         return CheckThis == WCC->CurRoom.Order;
469 }
470
471
472 void tmplput_ROOM_LISTORDER(StrBuf *Target, WCTemplputParams *TP) 
473 {
474         folder *Folder = (folder *)CTX;
475         StrBufAppendPrintf(Target, "%d", Folder->Order);
476 }
477
478
479 int ConditionalThisRoomXHavePic(StrBuf *Target, WCTemplputParams *TP)
480 {
481         wcsession *WCC = WC;
482         
483         if (WCC == NULL)
484                 return 0;
485
486         LoadXRoomPic();
487         return WCC->CurRoom.XHaveRoomPic == 1;
488 }
489
490
491 int ConditionalThisRoomXHaveInfoText(StrBuf *Target, WCTemplputParams *TP)
492 {
493         wcsession *WCC = WC;
494         
495         if (WCC == NULL)
496                 return 0;
497
498         LoadXRoomInfoText();
499         return (StrLength(WCC->CurRoom.XInfoText)>0);
500 }
501
502
503 void tmplput_ThisRoomInfoText(StrBuf *Target, WCTemplputParams *TP) 
504 {
505         wcsession *WCC = WC;
506         long nchars = 0;
507
508         LoadXRoomInfoText();
509
510         nchars = GetTemplateTokenNumber(Target, TP, 0, 0);
511         if (!nchars) {
512                 /* the whole thing */
513                 StrBufAppendTemplate(Target, TP, WCC->CurRoom.XInfoText, 1);
514         }
515         else {
516                 /* only a certain number of characters */
517                 StrBuf *SubBuf;
518                 SubBuf = NewStrBufDup(WCC->CurRoom.XInfoText);
519                 if (StrLength(SubBuf) > nchars) {
520                         StrBuf_Utf8StrCut(SubBuf, nchars);
521                         StrBufAppendBufPlain(SubBuf, HKEY("..."), 0);
522                 }
523                 StrBufAppendTemplate(Target, TP, SubBuf, 1);
524                 FreeStrBuf(&SubBuf);
525         }
526 }
527
528
529 void tmplput_ROOM_LASTCHANGE(StrBuf *Target, WCTemplputParams *TP) 
530 {
531         folder *Folder = (folder *)CTX;
532         StrBufAppendPrintf(Target, "%d", Folder->lastchange);
533 }
534
535
536 void tmplput_ThisRoomDirectory(StrBuf *Target, WCTemplputParams *TP) 
537 {
538         wcsession *WCC = WC;
539
540         LoadRoomXA();
541
542         StrBufAppendTemplate(Target, TP, WCC->CurRoom.Directory, 0);
543 }
544
545
546 void tmplput_ThisRoomXNFiles(StrBuf *Target, WCTemplputParams *TP) 
547 {
548         wcsession *WCC = WC;
549
550         LoadXRoomXCountFiles();
551
552         StrBufAppendPrintf(Target, "%d", WCC->CurRoom.XDownloadCount);
553 }
554
555
556 void tmplput_ThisRoomX_FileString(StrBuf *Target, WCTemplputParams *TP) 
557 {
558         wcsession *WCC = WC;
559
560         LoadXRoomXCountFiles();
561
562         if (WCC->CurRoom.XDownloadCount == 1)
563                 StrBufAppendBufPlain(Target, _("file"), -1, 0);
564         else
565                 StrBufAppendBufPlain(Target, _("files"), -1, 0);
566 }
567
568
569 void 
570 InitModule_ROOMTOKENS
571 (void)
572 {
573         RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, NULL, CTX_NONE);
574
575         RegisterNamespace("FLOOR:ID", 0, 0, tmplput_FLOOR_ID, NULL, CTX_FLOORS);
576         RegisterNamespace("ROOM:INFO:FLOORID", 0, 1, tmplput_ROOM_FLOORID, NULL, CTX_ROOMS);
577         RegisterNamespace("ROOM:INFO:FLOOR:ID", 0, 0, tmplput_ROOM_FLOOR_ID, NULL, CTX_ROOMS);
578
579         RegisterNamespace("FLOOR:NAME", 0, 1, tmplput_FLOOR_NAME, NULL, CTX_FLOORS);
580         RegisterNamespace("ROOM:INFO:FLOOR:NAME", 0, 1, tmplput_ROOM_FLOOR_NAME, NULL, CTX_ROOMS);
581         RegisterNamespace("THISROOM:FLOOR:NAME", 0, 1, tmplput_ThisRoomFloorName, NULL, CTX_NONE);
582
583         RegisterNamespace("FLOOR:NROOMS", 0, 0, tmplput_FLOOR_NROOMS, NULL, CTX_FLOORS);
584         RegisterNamespace("ROOM:INFO:FLOOR:NROOMS", 0, 0, tmplput_ROOM_FLOOR_NROOMS, NULL, CTX_ROOMS);
585
586         RegisterConditional(HKEY("COND:FLOOR:ISSUBROOM"), 0, ConditionalFloorIsSUBROOM, CTX_FLOORS);
587         RegisterConditional(HKEY("COND:FLOOR:NROOMS"), 1, ConditionalFloorHaveNRooms, CTX_FLOORS);
588         RegisterConditional(HKEY("COND:ROOM:REST:ISSUBFLOOR"), 0, ConditionalFloorIsRESTSubFloor, CTX_FLOORS);
589         RegisterConditional(HKEY("COND:FLOOR:ISVIRTUAL"), 0, ConditionalFloorIsVirtual, CTX_FLOORS);
590
591         /**** Room... ******/
592         /**** Name ******/
593         RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, NULL, CTX_NONE);
594         RegisterNamespace("CURRENT_ROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE);
595         RegisterNamespace("ROOM:INFO:NAME", 0, 1, tmplput_ROOM_NAME, NULL, CTX_ROOMS);
596         RegisterNamespace("ROOM:INFO:PRINT_NAME", 0, 1, tmplput_ROOM_NAME, NULL, CTX_NONE);
597         RegisterNamespace("ROOM:INFO:BASENAME", 0, 1, tmplput_ROOM_BASENAME, NULL, CTX_ROOMS);
598         RegisterNamespace("ROOM:INFO:LEVELNTIMES", 1, 2, tmplput_ROOM_LEVEL_N_TIMES, NULL, CTX_ROOMS);
599         RegisterConditional(HKEY("COND:ROOM:INFO:IS_INBOX"), 0, ConditionalRoomIsInbox, CTX_ROOMS);
600
601         /****** Properties ******/
602         RegisterNamespace("ROOM:INFO:QRFLAGS", 0, 1, tmplput_ROOM_QRFLAGS, NULL, CTX_ROOMS);
603         RegisterConditional(HKEY("COND:THISROOM:FLAG:QR"), 0, ConditionalThisRoomHas_QRFlag, CTX_NONE);
604         RegisterConditional(HKEY("COND:ROOM:FLAG:QR"), 0, ConditionalRoomHas_QRFlag, CTX_ROOMS);
605
606         RegisterConditional(HKEY("COND:THISROOM:FLAG:QR2"), 0, ConditionalThisRoomHas_QRFlag2, CTX_NONE);
607         RegisterConditional(HKEY("COND:ROOM:FLAG:QR2"), 0, ConditionalRoomHas_QRFlag2, CTX_ROOMS);
608
609         RegisterConditional(HKEY("COND:ROOM:FLAG:UA"), 0, ConditionalRoomHas_UAFlag, CTX_ROOMS);
610         RegisterNamespace("ROOM:INFO:RAFLAGS", 0, 1, tmplput_ROOM_RAFLAGS, NULL, CTX_ROOMS);
611
612
613         RegisterNamespace("ROOM:INFO:LISTORDER", 0, 1, tmplput_ROOM_LISTORDER, NULL, CTX_ROOMS);
614         RegisterNamespace("THISROOM:ORDER", 0, 0, tmplput_ThisRoomOrder, NULL, CTX_NONE);
615         RegisterConditional(HKEY("COND:THISROOM:ORDER"), 0, ConditionalThisRoomOrder, CTX_NONE);
616
617         RegisterNamespace("ROOM:INFO:LASTCHANGE", 0, 1, tmplput_ROOM_LASTCHANGE, NULL, CTX_ROOMS);
618
619         RegisterNamespace("THISROOM:MSGS:NEW", 0, 0, tmplput_ThisRoom_nNewMessages, NULL, CTX_NONE);
620         RegisterNamespace("THISROOM:MSGS:TOTAL", 0, 0, tmplput_ThisRoom_nTotalMessages, NULL, CTX_NONE);
621
622         RegisterNamespace("THISROOM:PASS", 0, 1, tmplput_ThisRoomPass, NULL, CTX_NONE);
623         RegisterNamespace("THISROOM:AIDE", 0, 1, tmplput_ThisRoomAide, NULL, CTX_NONE);
624         RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide, CTX_NONE);
625         RegisterConditional(HKEY("COND:ACCESS:DELETE"), 2, ConditionalRoomAcessDelete, CTX_NONE);
626         RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
627
628         RegisterConditional(HKEY("COND:THISROOM:HAVE_PIC"), 0, ConditionalThisRoomXHavePic, CTX_NONE);
629
630         RegisterNamespace("THISROOM:INFOTEXT", 1, 2, tmplput_ThisRoomInfoText, NULL, CTX_NONE);
631         RegisterConditional(HKEY("COND:THISROOM:HAVE_INFOTEXT"), 0, ConditionalThisRoomXHaveInfoText, CTX_NONE);
632
633         RegisterNamespace("THISROOM:FILES:N", 0, 1, tmplput_ThisRoomXNFiles, NULL, CTX_NONE);
634         RegisterNamespace("THISROOM:FILES:STR", 0, 1, tmplput_ThisRoomX_FileString, NULL, CTX_NONE);
635         RegisterNamespace("THISROOM:DIRECTORY", 0, 1, tmplput_ThisRoomDirectory, NULL, CTX_NONE);
636
637         RegisterNamespace("ROOM:INFO:ACL", 0, 1, tmplput_ROOM_ACL, NULL, CTX_ROOMS);
638 }