9dc1b1629588a21c864c77650ed7df9e27939abb
[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->axlevel >= 6) || 
417                   ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
418                   (WCC->CurRoom.is_inbox) ));
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 }