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