7a993dd6af96d169e704c9c17f482c55916b77e2
[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(CTX_FLOORS);
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(CTX_ROOMS);
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(CTX_ROOMS);
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(CTX_ROOMS);
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(CTX_FLOORS);
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(CTX_FLOORS);
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(CTX_ROOMS);
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(CTX_FLOORS);
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(CTX_FLOORS);
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(CTX_FLOORS);
172
173         return WCC->CurRoom.floorid == MyFloor->ID;
174 }
175
176
177 int ConditionalFloorIsVirtual(StrBuf *Target, WCTemplputParams *TP)
178 {
179         Floor *MyFloor = (Floor *)CTX(CTX_FLOORS);
180
181         return MyFloor->ID == VIRTUAL_MY_FLOOR;
182 }
183
184
185 /*******************************************************************************
186  ********************** ROOM Tokens ********************************************
187  *******************************************************************************/
188 /**** Name ******/
189
190 void tmplput_ThisRoom(StrBuf *Target, WCTemplputParams *TP)
191 {
192         wcsession *WCC = WC;
193
194         if (WCC != NULL) {
195                 StrBufAppendTemplate(Target, TP, 
196                      WCC->CurRoom.name, 
197                      0
198                 );
199         }
200 }
201
202
203 void tmplput_ROOM_NAME(StrBuf *Target, WCTemplputParams *TP) 
204 {
205         folder *Folder = (folder *)CTX(CTX_ROOMS);
206
207         StrBufAppendTemplate(Target, TP, Folder->name, 0);
208 }
209
210
211 void tmplput_ROOM_BASENAME(StrBuf *Target, WCTemplputParams *TP) 
212 {
213         folder *room = (folder *)CTX(CTX_ROOMS);
214
215         if (room->nRoomNameParts > 1)
216                 StrBufAppendTemplate(Target, TP, 
217                                       room->RoomNameParts[room->nRoomNameParts - 1], 0);
218         else 
219                 StrBufAppendTemplate(Target, TP, room->name, 0);
220 }
221
222
223 void tmplput_ROOM_LEVEL_N_TIMES(StrBuf *Target, WCTemplputParams *TP) 
224 {
225         folder *room = (folder *)CTX(CTX_ROOMS);
226         int i;
227         const char *AppendMe;
228         long AppendMeLen;
229
230
231         if (room->nRoomNameParts > 1)
232         {
233                 GetTemplateTokenString(Target, TP, 0, &AppendMe, &AppendMeLen);
234                 for (i = 0; i < room->nRoomNameParts; i++)
235                         StrBufAppendBufPlain(Target, AppendMe, AppendMeLen, 0);
236         }
237 }
238
239
240 int ConditionalRoomIsInbox(StrBuf *Target, WCTemplputParams *TP)
241 {
242         folder *Folder = (folder *)CTX(CTX_ROOMS);
243         return Folder->is_inbox;
244 }
245
246
247 /****** Properties ******/
248 int ConditionalRoom_MayEdit(StrBuf *Target, WCTemplputParams *TP)
249 {
250         wcsession *WCC = WC;
251
252         LoadRoomXA ();
253
254         return WCC->CurRoom.XALoaded == 1;
255 }
256
257 int ConditionalThisRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
258 {
259         long QR_CheckFlag;
260         wcsession *WCC = WC;
261         
262         QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
263         if (QR_CheckFlag == 0)
264                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
265                                  "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
266         
267         if (WCC == NULL)
268                 return 0;
269
270         if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
271             (TP->Tokens->Params[2]->MaskBy == eNO))
272                 return (WCC->CurRoom.QRFlags & QR_CheckFlag) != 0;
273         else
274                 return (WCC->CurRoom.QRFlags & QR_CheckFlag) == QR_CheckFlag;
275 }
276
277
278 int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
279 {
280         long QR_CheckFlag;
281         folder *Folder = (folder *)(TP->Context);
282
283         QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
284         if (QR_CheckFlag == 0)
285                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
286                                  "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
287
288         if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
289             (TP->Tokens->Params[2]->MaskBy == eNO))
290                 return (Folder->QRFlags & QR_CheckFlag) != 0;
291         else
292                 return (Folder->QRFlags & QR_CheckFlag) == QR_CheckFlag;
293 }
294
295
296 void tmplput_ROOM_QRFLAGS(StrBuf *Target, WCTemplputParams *TP) 
297 {
298         folder *Folder = (folder *)CTX(CTX_ROOMS);
299         StrBufAppendPrintf(Target, "%d", Folder->QRFlags);
300 }
301
302
303 int ConditionalThisRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
304 {
305         long QR2_CheckFlag;
306         wcsession *WCC = WC;
307         
308         QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
309         if (QR2_CheckFlag == 0)
310                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
311                                  "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
312
313         
314         if (WCC == NULL)
315                 return 0;
316
317         if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
318             (TP->Tokens->Params[2]->MaskBy == eNO))
319                 return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) != 0;
320         else
321                 return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) == QR2_CheckFlag;
322 }
323
324
325 int ConditionalRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
326 {
327         long QR2_CheckFlag;
328         folder *Folder = (folder *)(TP->Context);
329
330         QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
331         if (QR2_CheckFlag == 0)
332                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
333                                  "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
334         return ((Folder->QRFlags2 & QR2_CheckFlag) != 0);
335 }
336
337
338 int ConditionalRoomHas_UAFlag(StrBuf *Target, WCTemplputParams *TP)
339 {
340         folder *Folder = (folder *)(TP->Context);
341         long UA_CheckFlag;
342                 
343         UA_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
344         if (UA_CheckFlag == 0)
345                 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
346                                  "requires one of the #\"UA_*\"- defines or an integer flag 0 is invalid!");
347
348         return ((Folder->RAFlags & UA_CheckFlag) != 0);
349 }
350
351
352 void tmplput_ROOM_ACL(StrBuf *Target, WCTemplputParams *TP) 
353 {
354         folder *Folder = (folder *)CTX(CTX_ROOMS);
355
356         StrBufAppendPrintf(Target, "%ld", Folder->RAFlags, 0);
357 }
358
359
360 void tmplput_ROOM_RAFLAGS(StrBuf *Target, WCTemplputParams *TP) 
361 {
362         folder *Folder = (folder *)(TP->Context);
363         StrBufAppendPrintf(Target, "%d", Folder->RAFlags);
364 }
365
366
367 void tmplput_ThisRoomAide(StrBuf *Target, WCTemplputParams *TP) 
368 {
369         wcsession *WCC = WC;
370
371         LoadRoomAide();
372
373         StrBufAppendTemplate(Target, TP, WCC->CurRoom.RoomAide, 0);
374 }
375
376
377 int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
378 {
379         wcsession *WCC = WC;
380         return (WCC != NULL)? 
381                 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) : 0;
382 }
383
384
385 int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
386 {
387         wcsession *WCC = WC;
388         return (WCC == NULL)? 0 : 
389                 ( ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
390                    (WCC->CurRoom.is_inbox) || 
391                    (WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) );
392 }
393
394
395 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
396 {
397         wcsession *WCC = WC;
398
399         return (        (WCC != NULL)
400                         && (WCC->logged_in)
401                         && (
402                                 (WCC->axlevel >= 6)
403                                 || ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0)
404                                 || (WCC->CurRoom.is_inbox)
405                         )
406                 );
407 }
408
409
410 void tmplput_ThisRoomPass(StrBuf *Target, WCTemplputParams *TP) 
411 {
412         wcsession *WCC = WC;
413
414         LoadRoomXA();
415         StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 0);
416 }
417
418
419 void tmplput_ThisRoom_nNewMessages(StrBuf *Target, WCTemplputParams *TP) 
420 {
421         wcsession *WCC = WC;
422
423         StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nNewMessages);
424 }
425
426
427 void tmplput_ThisRoom_nTotalMessages(StrBuf *Target, WCTemplputParams *TP) 
428 {
429         wcsession *WCC = WC;
430
431         StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nTotalMessages);
432 }
433
434
435 void tmplput_ThisRoomOrder(StrBuf *Target, WCTemplputParams *TP) 
436 {
437         wcsession *WCC = WC;
438
439         LoadRoomXA();
440
441         StrBufAppendPrintf(Target, "%d", WCC->CurRoom.Order);
442 }
443
444
445 int ConditionalThisRoomOrder(StrBuf *Target, WCTemplputParams *TP)
446 {
447         wcsession *WCC = WC;
448         long CheckThis;
449
450         if (WCC == NULL)
451                 return 0;
452
453         LoadRoomXA();
454
455         CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
456         return CheckThis == WCC->CurRoom.Order;
457 }
458
459
460 void tmplput_ROOM_LISTORDER(StrBuf *Target, WCTemplputParams *TP) 
461 {
462         folder *Folder = (folder *)CTX(CTX_ROOMS);
463         StrBufAppendPrintf(Target, "%d", Folder->Order);
464 }
465
466
467 int ConditionalThisRoomXHavePic(StrBuf *Target, WCTemplputParams *TP)
468 {
469         wcsession *WCC = WC;
470         
471         if (WCC == NULL)
472                 return 0;
473
474         LoadXRoomPic();
475         return WCC->CurRoom.XHaveRoomPic == 1;
476 }
477
478
479 int ConditionalThisRoomXHaveInfoText(StrBuf *Target, WCTemplputParams *TP)
480 {
481         wcsession *WCC = WC;
482         
483         if (WCC == NULL)
484                 return 0;
485
486         LoadXRoomInfoText();
487         return (StrLength(WCC->CurRoom.XInfoText)>0);
488 }
489
490
491 void tmplput_ThisRoomInfoText(StrBuf *Target, WCTemplputParams *TP) 
492 {
493         wcsession *WCC = WC;
494         long nchars = 0;
495
496         LoadXRoomInfoText();
497
498         nchars = GetTemplateTokenNumber(Target, TP, 0, 0);
499         if (!nchars) {
500                 /* the whole thing */
501                 StrBufAppendTemplate(Target, TP, WCC->CurRoom.XInfoText, 1);
502         }
503         else {
504                 /* only a certain number of characters */
505                 StrBuf *SubBuf;
506                 SubBuf = NewStrBufDup(WCC->CurRoom.XInfoText);
507                 if (StrLength(SubBuf) > nchars) {
508                         StrBuf_Utf8StrCut(SubBuf, nchars);
509                         StrBufAppendBufPlain(SubBuf, HKEY("..."), 0);
510                 }
511                 StrBufAppendTemplate(Target, TP, SubBuf, 1);
512                 FreeStrBuf(&SubBuf);
513         }
514 }
515
516
517 void tmplput_ROOM_LASTCHANGE(StrBuf *Target, WCTemplputParams *TP) 
518 {
519         folder *Folder = (folder *)CTX(CTX_ROOMS);
520         StrBufAppendPrintf(Target, "%d", Folder->lastchange);
521 }
522
523
524 void tmplput_ThisRoomDirectory(StrBuf *Target, WCTemplputParams *TP) 
525 {
526         wcsession *WCC = WC;
527
528         LoadRoomXA();
529
530         StrBufAppendTemplate(Target, TP, WCC->CurRoom.Directory, 0);
531 }
532
533
534 void tmplput_ThisRoomXNFiles(StrBuf *Target, WCTemplputParams *TP) 
535 {
536         wcsession *WCC = WC;
537
538         LoadXRoomXCountFiles();
539
540         StrBufAppendPrintf(Target, "%d", WCC->CurRoom.XDownloadCount);
541 }
542
543
544 void tmplput_ThisRoomX_FileString(StrBuf *Target, WCTemplputParams *TP) 
545 {
546         wcsession *WCC = WC;
547
548         LoadXRoomXCountFiles();
549
550         if (WCC->CurRoom.XDownloadCount == 1)
551                 StrBufAppendBufPlain(Target, _("file"), -1, 0);
552         else
553                 StrBufAppendBufPlain(Target, _("files"), -1, 0);
554 }
555
556
557 int ConditionalIsThisThatRoom(StrBuf *Target, WCTemplputParams *TP)
558 {
559         folder *Folder = (folder *)CTX(CTX_ROOMS);
560         wcsession *WCC = WC;
561
562         if (WCC == NULL)
563                 return 0;
564
565         return Folder == WCC->ThisRoom;
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("THISROOM:NAME", 0, 1, tmplput_ThisRoom, NULL, CTX_NONE);
594
595         RegisterNamespace("ROOM:INFO:NAME", 0, 1, tmplput_ROOM_NAME, NULL, CTX_ROOMS);
596         RegisterNamespace("ROOM:INFO:BASENAME", 0, 1, tmplput_ROOM_BASENAME, NULL, CTX_ROOMS);
597         RegisterNamespace("ROOM:INFO:LEVELNTIMES", 1, 2, tmplput_ROOM_LEVEL_N_TIMES, NULL, CTX_ROOMS);
598         RegisterConditional(HKEY("COND:ROOM:INFO:IS_INBOX"), 0, ConditionalRoomIsInbox, CTX_ROOMS);
599
600         /****** Properties ******/
601         RegisterNamespace("ROOM:INFO:QRFLAGS", 0, 1, tmplput_ROOM_QRFLAGS, NULL, CTX_ROOMS);
602         RegisterConditional(HKEY("COND:THISROOM:FLAG:QR"), 0, ConditionalThisRoomHas_QRFlag, CTX_NONE);
603         RegisterConditional(HKEY("COND:THISROOM:EDIT"), 0, ConditionalRoom_MayEdit, 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         RegisterConditional(HKEY("COND:THIS:THAT:ROOM"), 0, ConditionalIsThisThatRoom, CTX_ROOMS);
639 }