Removed logging subsystem from webcit. It's all syslog now.
[citadel.git] / webcit / roomops.c
1 /*
2  * Lots of different room-related operations.
3  */
4
5 #include "webcit.h"
6 #include "webserver.h"
7
8
9 ConstStr QRFlagList[] = {
10         {HKEY(strof(QR_PERMANENT))},
11         {HKEY(strof(QR_INUSE))},
12         {HKEY(strof(QR_PRIVATE))},
13         {HKEY(strof(QR_PASSWORDED))},
14         {HKEY(strof(QR_GUESSNAME))},
15         {HKEY(strof(QR_DIRECTORY))},
16         {HKEY(strof(QR_UPLOAD))},
17         {HKEY(strof(QR_DOWNLOAD))},
18         {HKEY(strof(QR_VISDIR))},
19         {HKEY(strof(QR_ANONONLY))},
20         {HKEY(strof(QR_ANONOPT))},
21         {HKEY(strof(QR_NETWORK))},
22         {HKEY(strof(QR_PREFONLY))},
23         {HKEY(strof(QR_READONLY))},
24         {HKEY(strof(QR_MAILBOX))}
25 };
26 ConstStr QR2FlagList[] = {
27         {HKEY(strof(QR2_SYSTEM))},
28         {HKEY(strof(QR2_SELFLIST))},
29         {HKEY(strof(QR2_COLLABDEL))},
30         {HKEY(strof(QR2_SUBJECTREQ))},
31         {HKEY(strof(QR2_SMTP_PUBLIC))},
32         {HKEY(strof(QR2_MODERATED))},
33         {HKEY("")}, 
34         {HKEY("")}, 
35         {HKEY("")}, 
36         {HKEY("")}, 
37         {HKEY("")}, 
38         {HKEY("")}, 
39         {HKEY("")}, 
40         {HKEY("")}, 
41         {HKEY("")}
42 };
43
44 void _DBG_QR(long QR)
45 {
46         int i = 1;
47         int j=0;
48         StrBuf *QRVec;
49
50         QRVec = NewStrBufPlain(NULL, 256);
51         while (i != 0)
52         {
53                 if ((QR & i) != 0) {
54                         if (StrLength(QRVec) > 0)
55                                 StrBufAppendBufPlain(QRVec, HKEY(" | "), 0);
56                         StrBufAppendBufPlain(QRVec, CKEY(QRFlagList[j]), 0);
57                 }
58                 i = i << 1;
59                 j++;
60         }
61         syslog(9, "DBG: QR-Vec [%ld] [%s]\n", QR, ChrPtr(QRVec));
62         FreeStrBuf(&QRVec);
63 }
64
65
66
67 void _DBG_QR2(long QR2)
68 {
69         int i = 1;
70         int j=0;
71         StrBuf *QR2Vec;
72
73         QR2Vec = NewStrBufPlain(NULL, 256);
74         while (i != 0)
75         {
76                 if ((QR2 & i) != 0) {
77                         if (StrLength(QR2Vec) > 0)
78                                 StrBufAppendBufPlain(QR2Vec, HKEY(" | "), 0);
79                         StrBufAppendBufPlain(QR2Vec, CKEY(QR2FlagList[j]), 0);
80                 }
81                 i = i << 1;
82                 j++;
83         }
84         syslog(9, "DBG: QR2-Vec [%ld] [%s]\n", QR2, ChrPtr(QR2Vec));
85         FreeStrBuf(&QR2Vec);
86 }
87
88
89
90
91
92
93
94
95
96
97
98 /*******************************************************************************
99  ***************************** Goto Commands ***********************************
100  ******************************************************************************/
101 void dotgoto(void) {
102         if (!havebstr("room")) {
103                 readloop(readnew, eUseDefault);
104                 return;
105         }
106         if (WC->CurRoom.view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
107                 slrp_highest();
108         }
109         smart_goto(sbstr("room"));
110 }
111
112 /*
113  * goto next room
114  */
115 void smart_goto(const StrBuf *next_room) {
116         gotoroom(next_room);
117         readloop(readnew, eUseDefault);
118 }
119
120 /*
121  * goto a private room
122  */
123 void goto_private(void)
124 {
125         char hold_rm[SIZ];
126         StrBuf *Buf;
127         const StrBuf *gr_name;
128         long err;
129
130         if (!havebstr("ok_button")) {
131                 display_main_menu();
132                 return;
133         }
134         gr_name = sbstr("gr_name");
135         Buf = NewStrBuf();
136         strcpy(hold_rm, ChrPtr(WC->CurRoom.name));
137         serv_printf("GOTO %s|%s",
138                     ChrPtr(gr_name),
139                     bstr("gr_pass"));
140         StrBuf_ServGetln(Buf);
141         if  (GetServerStatus(Buf, &err) == 2) {
142                 FlushRoomlist();
143                 smart_goto(gr_name);
144                 FreeStrBuf(&Buf);
145                 return;
146         }
147         if (err == 540) {
148                 DoTemplate(HKEY("room_display_private"), NULL, &NoCtx);
149                 FreeStrBuf(&Buf);
150                 return;
151         }
152         StrBufCutLeft(Buf, 4);
153         AppendImportantMessage (SKEY(Buf));
154         Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
155         smart_goto(Buf);
156         FreeStrBuf(&Buf);
157         return;
158 }
159
160 /*
161  * back end routine to take the session to a new room
162  */
163 long gotoroom(const StrBuf *gname)
164 {
165         wcsession *WCC = WC;
166         StrBuf *Buf;
167         static long ls = (-1L);
168         long err = 0;
169
170         /* store ungoto information */
171         if (StrLength(gname) > 0)
172                 strcpy(WCC->ugname, ChrPtr(WCC->CurRoom.name));
173         WCC->uglsn = ls;
174         Buf = NewStrBuf();
175
176         /* move to the new room */
177         if (StrLength(gname) > 0)
178                 serv_printf("GOTO %s", ChrPtr(gname));
179         else /* or just refresh the current state... */
180                 serv_printf("GOTO 00000000000000000000");
181         StrBuf_ServGetln(Buf);
182         if  (GetServerStatus(Buf, &err) != 2) {
183                 serv_puts("GOTO _BASEROOM_");
184                 StrBuf_ServGetln(Buf);
185                 /* 
186                  * well, we know that this is the fallback case, 
187                  * but we're interested that the first command 
188                  * didn't work out in first place.
189                  */
190                 if (GetServerStatus(Buf, NULL) != 2) {
191                         FreeStrBuf(&Buf);
192                         return err;
193                 }
194         }
195         FlushFolder(&WCC->CurRoom);
196         ParseGoto(&WCC->CurRoom, Buf);
197
198         if (StrLength(gname) > 0)
199         {
200                 remove_march(WCC->CurRoom.name);
201                 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
202                         remove_march(gname);
203         }
204         FreeStrBuf(&Buf);
205
206         return err;
207 }
208
209
210
211 void ParseGoto(folder *room, StrBuf *Line)
212 {
213         wcsession *WCC = WC;
214         const char *Pos;
215         int flag;
216         void *vFloor = NULL;
217         StrBuf *pBuf;
218
219         if (StrLength(Line) < 4) {
220                 return;
221         }
222         
223         /* ignore the commandstate... */
224         Pos = ChrPtr(Line) + 4;
225
226         if (room->RoomNameParts != NULL)
227         {
228                 int i;
229                 for (i=0; i < room->nRoomNameParts; i++)
230                         FreeStrBuf(&room->RoomNameParts[i]);
231                 free(room->RoomNameParts);
232                 room->RoomNameParts = NULL;
233         }
234
235         pBuf = room->name;  
236         if (pBuf == NULL)
237                 pBuf = NewStrBufPlain(NULL, StrLength(Line));
238         else
239                 FlushStrBuf(pBuf);
240         memset(room, 0, sizeof(folder));
241         room->name = pBuf;
242
243         StrBufExtract_NextToken(room->name, Line, &Pos, '|'); // WC->CurRoom->name
244
245         room->nNewMessages = StrBufExtractNext_long(Line, &Pos, '|'); 
246         if (room->nNewMessages > 0)
247                 room->RAFlags |= UA_HASNEWMSGS;
248
249         room->nTotalMessages = StrBufExtractNext_long(Line, &Pos, '|');
250
251         room->ShowInfo =  StrBufExtractNext_long(Line, &Pos, '|');
252         
253         room->QRFlags = StrBufExtractNext_long(Line, &Pos, '|'); //CurRoom->QRFlags
254
255         DBG_QR(room->QRFlags);
256
257         room->HighestRead = StrBufExtractNext_long(Line, &Pos, '|');
258         room->LastMessageRead = StrBufExtractNext_long(Line, &Pos, '|');
259
260         room->is_inbox = StrBufExtractNext_long(Line, &Pos, '|'); // is_mailbox
261
262         flag = StrBufExtractNext_long(Line, &Pos, '|');
263         if (WCC->is_aide || flag) {
264                 room->RAFlags |= UA_ADMINALLOWED;
265         }
266
267         room->UsersNewMAilboxMessages = StrBufExtractNext_long(Line, &Pos, '|');
268
269         room->floorid = StrBufExtractNext_int(Line, &Pos, '|'); // wc_floor
270
271         room->view = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->view
272
273         room->defview = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->defview
274
275         flag = StrBufExtractNext_long(Line, &Pos, '|');
276         if (flag)
277                 room->RAFlags |= UA_ISTRASH; // wc_is_trash
278
279         room->QRFlags2 = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->QRFlags2
280         DBG_QR2(room->QRFlags2);
281
282         /* find out, whether we are in a sub-room */
283         room->nRoomNameParts = StrBufNum_tokens(room->name, '\\');
284         if (room->nRoomNameParts > 1)
285         {
286                 int i;
287                 
288                 Pos = NULL;
289                 room->RoomNameParts = malloc(sizeof(StrBuf*) * (room->nRoomNameParts + 1));
290                 memset(room->RoomNameParts, 0, sizeof(StrBuf*) * (room->nRoomNameParts + 1));
291                 for (i=0; i < room->nRoomNameParts; i++)
292                 {
293                         room->RoomNameParts[i] = NewStrBuf();
294                         StrBufExtract_NextToken(room->RoomNameParts[i],
295                                                 room->name, &Pos, '\\');
296                 }
297         }
298
299         /* Private mailboxes on the main floor get remapped to the personal folder */
300         if ((room->QRFlags & QR_MAILBOX) && 
301             (room->floorid == 0))
302         {
303                 room->floorid = VIRTUAL_MY_FLOOR;
304                 if ((room->nRoomNameParts == 1) && 
305                     (StrLength(room->name) == 4) && 
306                     (strcmp(ChrPtr(room->name), "Mail") == 0))
307                 {
308                         room->is_inbox = 1;
309                 }
310                 
311         }
312         /* get a pointer to the floor we're on: */
313         if (WCC->Floors == NULL)
314                 GetFloorListHash(NULL, NULL);
315
316         GetHash(WCC->Floors, IKEY(room->floorid), &vFloor);
317         room->Floor = (const Floor*) vFloor;
318 }
319
320 /**
321  * \brief Delete the current room
322  */
323 void delete_room(void)
324 {
325         char buf[SIZ];
326
327         
328         serv_puts("KILL 1");
329         serv_getln(buf, sizeof buf);
330
331         if (buf[0] != '2') {
332                 strcpy(WC->ImportantMessage, &buf[4]);
333                 display_main_menu();
334                 return;
335         } else {
336                 StrBuf *Buf;
337                 
338                 FlushRoomlist ();
339                 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
340                 smart_goto(Buf);
341                 FreeStrBuf(&Buf);
342         }
343 }
344
345 /**
346  * \brief zap a room
347  */
348 void zap(void)
349 {
350         char buf[SIZ];
351         StrBuf *final_destination;
352
353         /**
354          * If the forget-room routine fails for any reason, we fall back
355          * to the current room; otherwise, we go to the Lobby
356          */
357         final_destination = NewStrBufDup(WC->CurRoom.name);
358
359         if (havebstr("ok_button")) {
360                 serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
361                 serv_getln(buf, sizeof buf);
362                 if (buf[0] == '2') {
363                         serv_puts("FORG");
364                         serv_getln(buf, sizeof buf);
365                         if (buf[0] == '2') {
366                                 FlushStrBuf(final_destination);
367                                 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
368                         }
369                 }
370                 FlushRoomlist ();
371         }
372         smart_goto(final_destination);
373         FreeStrBuf(&final_destination);
374 }
375
376
377 /*
378  * mark all messages in current room as having been read
379  */
380 void slrp_highest(void)
381 {
382         char buf[256];
383
384         serv_puts("SLRP HIGHEST");
385         serv_getln(buf, sizeof buf);
386 }
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401 /*******************************************************************************
402  ***************************** Modify Rooms ************************************
403  ******************************************************************************/
404
405
406
407
408
409 void LoadRoomAide(void)
410 {
411         wcsession *WCC = WC;
412         StrBuf *Buf;
413         
414         if (WCC->CurRoom.RoomAideLoaded)
415                 return;
416
417         WCC->CurRoom.RoomAideLoaded = 1;
418         Buf = NewStrBuf();
419         serv_puts("GETA");
420         StrBuf_ServGetln(Buf);
421         if (GetServerStatus(Buf, NULL) != 2) {
422                 FlushStrBuf(WCC->CurRoom.RoomAide);
423                 AppendImportantMessage (ChrPtr(Buf) + 4, 
424                                         StrLength(Buf) - 4);
425         } else {
426                 const char *Pos;
427
428                 Pos = ChrPtr(Buf) + 4;
429
430                 FreeStrBuf(&WCC->CurRoom.RoomAide);
431                 WCC->CurRoom.RoomAide = NewStrBufPlain (NULL, StrLength (Buf));
432
433                 StrBufExtract_NextToken(WCC->CurRoom.RoomAide, Buf, &Pos, '|'); 
434         }
435         FreeStrBuf (&Buf);
436 }
437
438 int SaveRoomAide(folder *Room)
439 {
440         StrBuf *Buf;
441         Buf = NewStrBuf ();
442         serv_printf("SETA %s", ChrPtr(Room->RoomAide));
443         StrBuf_ServGetln(Buf);
444         if (GetServerStatus(Buf, NULL) != 2) {
445                 StrBufCutLeft(Buf, 4);
446                 AppendImportantMessage (SKEY(Buf));
447                 FreeStrBuf(&Buf);
448                 return 0;
449         }
450         FreeStrBuf(&Buf);
451         return 1;
452 }
453
454
455 int GetCurrentRoomFlags(folder *Room)
456 {
457         StrBuf *Buf;
458
459         Buf = NewStrBuf();
460         serv_puts("GETR");
461         StrBuf_ServGetln(Buf);
462         if (GetServerStatus(Buf, NULL) != 2) {
463                 FlushStrBuf(Room->XAPass);
464                 FlushStrBuf(Room->Directory);
465                 StrBufCutLeft(Buf, 4);
466                 AppendImportantMessage (SKEY(Buf));
467                 FreeStrBuf(&Buf);
468                 return 0;
469         } else {
470                 const char *Pos;
471
472                 Pos = ChrPtr(Buf) + 4;
473
474                 FreeStrBuf(&Room->XAPass);
475                 FreeStrBuf(&Room->Directory);
476
477                 Room->XAPass = NewStrBufPlain (NULL, StrLength (Buf));
478                 Room->Directory = NewStrBufPlain (NULL, StrLength (Buf));
479
480                 FreeStrBuf(&Room->name);
481                 Room->name = NewStrBufPlain(NULL, StrLength(Buf));
482                 StrBufExtract_NextToken(Room->name, Buf, &Pos, '|'); 
483                                         
484                 StrBufExtract_NextToken(Room->XAPass, Buf, &Pos, '|'); 
485                 StrBufExtract_NextToken(Room->Directory, Buf, &Pos, '|'); 
486                 
487                 Room->QRFlags = StrBufExtractNext_long(Buf, &Pos, '|');
488                 Room->floorid = StrBufExtractNext_long(Buf, &Pos, '|');
489                 Room->Order = StrBufExtractNext_long(Buf, &Pos, '|');
490                 Room->defview = StrBufExtractNext_long(Buf, &Pos, '|');
491                 Room->QRFlags2 = StrBufExtractNext_long(Buf, &Pos, '|');
492                 FreeStrBuf (&Buf);
493                 Room->XALoaded = 1;
494                 return 1;
495         }
496 }
497
498
499 int SetCurrentRoomFlags(folder *Room)
500 {
501         StrBuf *Buf;
502
503         Buf = NewStrBuf();
504         DBG_QR(Room->QRFlags);
505         DBG_QR2(Room->QRFlags2);
506
507         serv_printf("SETR %s|%s|%s|%ld|%d|%d|%ld|%ld|%ld",
508                     ChrPtr(Room->name),
509                     ChrPtr(Room->XAPass),
510                     ChrPtr(Room->Directory),
511                     Room->QRFlags, 
512                     Room->BumpUsers,
513                     Room->floorid, 
514                     Room->Order,
515                     Room->defview,
516                     Room->QRFlags2);
517
518         StrBuf_ServGetln(Buf);
519         if (GetServerStatus(Buf, NULL) != 2) {
520                 StrBufCutLeft(Buf, 4);
521                 AppendImportantMessage (SKEY(Buf));
522                 FreeStrBuf(&Buf);
523                 return 0;
524         } else {
525                 FreeStrBuf(&Buf);
526                 return 1;
527         }
528 }
529
530 void LoadRoomXA (void)
531 {
532         wcsession *WCC = WC;
533                 
534         if (WCC->CurRoom.XALoaded)
535                 return;
536
537         GetCurrentRoomFlags(&WCC->CurRoom);
538 }
539
540
541 void LoadXRoomPic(void)
542 {
543         wcsession *WCC = WC;
544         StrBuf *Buf;
545         
546         if (WCC->CurRoom.XHaveRoomPicLoaded)
547                 return;
548
549         WCC->CurRoom.XHaveRoomPicLoaded = 1;
550         Buf = NewStrBuf();
551         serv_puts("OIMG _roompic_");
552         StrBuf_ServGetln(Buf);
553         if (GetServerStatus(Buf, NULL) != 2) {
554                 WCC->CurRoom.XHaveRoomPic = 0;
555         } else {
556                 WCC->CurRoom.XHaveRoomPic = 1;
557         }
558         serv_puts("CLOS");
559         StrBuf_ServGetln(Buf);
560         GetServerStatus(Buf, NULL);
561         FreeStrBuf (&Buf);
562 }
563
564
565 void LoadXRoomInfoText(void)
566 {
567         wcsession *WCC = WC;
568         StrBuf *Buf;
569         int Done = 0;
570         
571         if (WCC->CurRoom.XHaveInfoTextLoaded) {
572                 return;
573         }
574
575         WCC->CurRoom.XHaveInfoTextLoaded = 1;
576         Buf = NewStrBuf();
577
578         serv_puts("RINF");
579
580         StrBuf_ServGetln(Buf);
581         if (GetServerStatus(Buf, NULL) == 1) {
582                 WCC->CurRoom.XInfoText = NewStrBuf ();
583                 
584                 while (!Done && StrBuf_ServGetln(Buf)>=0) {
585                         if ( (StrLength(Buf)==3) && 
586                              !strcmp(ChrPtr(Buf), "000")) 
587                                 Done = 1;
588                         else 
589                                 StrBufAppendBuf(WCC->CurRoom.XInfoText, Buf, 0);
590                 }
591         }
592
593         FreeStrBuf(&Buf);
594 }
595
596
597 void LoadXRoomXCountFiles(void)
598 {
599         wcsession *WCC = WC;
600         StrBuf *Buf;
601         int Done = 0;
602         
603         if (WCC->CurRoom.XHaveDownloadCount)
604                 return;
605
606         WCC->CurRoom.XHaveDownloadCount = 1;
607
608         Buf = NewStrBuf();
609         serv_puts("RDIR");
610         StrBuf_ServGetln(Buf);
611         if (GetServerStatus(Buf, NULL) == 1) {
612                 
613                 while (!Done && StrBuf_ServGetln(Buf)>=0) {
614                         if ( (StrLength(Buf)==3) && 
615                              !strcmp(ChrPtr(Buf), "000")) 
616                                 Done = 1;
617                         else 
618                                 WCC->CurRoom.XDownloadCount++;
619                 }
620         }
621
622         FreeStrBuf (&Buf);
623 }
624
625
626 /* 
627  * Toggle self-service list subscription
628  */
629 void toggle_self_service(void) {
630         wcsession *WCC = WC;
631
632         if (GetCurrentRoomFlags (&WCC->CurRoom) == 0)
633                 return;
634
635         if (yesbstr("QR2_SelfList")) 
636                 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SELFLIST;
637         else 
638                 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SELFLIST;
639
640         if (yesbstr("QR2_SMTP_PUBLIC")) 
641                 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SMTP_PUBLIC;
642         else
643                 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SMTP_PUBLIC;
644
645         if (yesbstr("QR2_Moderated")) 
646                 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_MODERATED;
647         else
648                 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_MODERATED;
649         if (yesbstr("QR2_SubsOnly")) 
650                 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SMTP_PUBLIC;
651         else
652                 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SMTP_PUBLIC;
653
654         SetCurrentRoomFlags (&WCC->CurRoom);
655         
656         http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
657 }
658
659
660
661 /*
662  * save new parameters for a room
663  */
664 void editroom(void)
665 {
666         wcsession *WCC = WC;
667         const StrBuf *Ptr;
668         const StrBuf *er_name;
669         const StrBuf *er_password;
670         const StrBuf *er_dirname;
671         const StrBuf *er_roomaide;
672         unsigned er_flags;
673         unsigned er_flags2;
674         int succ1, succ2;
675
676         if (!havebstr("ok_button")) {
677                 strcpy(WC->ImportantMessage,
678                        _("Cancelled.  Changes were not saved."));
679                 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
680                 return;
681         }
682         if (GetCurrentRoomFlags (&WCC->CurRoom) == 0)
683                 return;
684
685         LoadRoomAide();
686
687         er_flags = WCC->CurRoom.QRFlags;
688         er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
689
690         er_flags2 = WCC->CurRoom.QRFlags2;
691
692         Ptr = sbstr("type");
693         if (!strcmp(ChrPtr(Ptr), "invonly")) {
694                 er_flags |= (QR_PRIVATE);
695         }
696         if (!strcmp(ChrPtr(Ptr), "hidden")) {
697                 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
698         }
699         if (!strcmp(ChrPtr(Ptr), "passworded")) {
700                 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
701         }
702         if (!strcmp(ChrPtr(Ptr), "personal")) {
703                 er_flags |= QR_MAILBOX;
704         } else {
705                 er_flags &= ~QR_MAILBOX;
706         }
707
708
709         
710         if (yesbstr("prefonly")) {
711                 er_flags |= QR_PREFONLY;
712         } else {
713                 er_flags &= ~QR_PREFONLY;
714         }
715
716         if (yesbstr("readonly")) {
717                 er_flags |= QR_READONLY;
718         } else {
719                 er_flags &= ~QR_READONLY;
720         }
721
722         
723         if (yesbstr("collabdel")) {
724                 er_flags2 |= QR2_COLLABDEL;
725         } else {
726                 er_flags2 &= ~QR2_COLLABDEL;
727         }
728
729         if (yesbstr("permanent")) {
730                 er_flags |= QR_PERMANENT;
731         } else {
732                 er_flags &= ~QR_PERMANENT;
733         }
734
735         if (yesbstr("subjectreq")) {
736                 er_flags2 |= QR2_SUBJECTREQ;
737         } else {
738                 er_flags2 &= ~QR2_SUBJECTREQ;
739         }
740
741         if (yesbstr("network")) {
742                 er_flags |= QR_NETWORK;
743         } else {
744                 er_flags &= ~QR_NETWORK;
745         }
746
747         if (yesbstr("directory")) {
748                 er_flags |= QR_DIRECTORY;
749         } else {
750                 er_flags &= ~QR_DIRECTORY;
751         }
752
753         if (yesbstr("ulallowed")) {
754                 er_flags |= QR_UPLOAD;
755         } else {
756                 er_flags &= ~QR_UPLOAD;
757         }
758
759         if (yesbstr("dlallowed")) {
760                 er_flags |= QR_DOWNLOAD;
761         } else {
762                 er_flags &= ~QR_DOWNLOAD;
763         }
764
765         if (yesbstr("visdir")) {
766                 er_flags |= QR_VISDIR;
767         } else {
768                 er_flags &= ~QR_VISDIR;
769         }
770
771
772         Ptr = sbstr("anon");
773
774         er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
775         if (!strcmp(ChrPtr(Ptr), "anononly"))
776                 er_flags |= QR_ANONONLY;
777         if (!strcmp(ChrPtr(Ptr), "anon2"))
778                 er_flags |= QR_ANONOPT;
779
780         er_name     = sbstr("er_name");
781         er_dirname  = sbstr("er_dirname");
782         er_roomaide = sbstr("er_roomaide");
783         er_password = sbstr("er_password");
784
785         FlushStrBuf(WCC->CurRoom.name);
786         StrBufAppendBuf(WCC->CurRoom.name, er_name, 0);
787
788         FlushStrBuf(WCC->CurRoom.Directory);
789         StrBufAppendBuf(WCC->CurRoom.Directory, er_dirname, 0);
790
791         FlushStrBuf(WCC->CurRoom.RoomAide);
792         StrBufAppendBuf(WCC->CurRoom.RoomAide, er_roomaide, 0);
793
794         FlushStrBuf(WCC->CurRoom.XAPass);
795         StrBufAppendBuf(WCC->CurRoom.XAPass, er_password, 0);
796
797         WCC->CurRoom.BumpUsers = yesbstr("bump");
798
799         WCC->CurRoom.floorid = ibstr("er_floor");
800
801         succ1 = SetCurrentRoomFlags(&WCC->CurRoom);
802
803         succ2 = SaveRoomAide (&WCC->CurRoom);
804         
805         if (succ1 + succ2 == 0)
806                 AppendImportantMessage (_("Your changes have been saved."), -1);
807         http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
808         return;
809 }
810
811
812
813 /*
814  * Display form for Invite, Kick, and show Who Knows a room
815  */
816 void do_invt_kick(void) 
817 {
818         StrBuf *Buf, *User;
819         const StrBuf *UserNames;
820         int Kick, Invite;
821         wcsession *WCC = WC;
822
823
824         if (GetCurrentRoomFlags(&WCC->CurRoom) == 1)
825         {
826                 const char *Pos;
827                 UserNames = sbstr("username");
828                 Kick = havebstr("kick_button");
829                 Invite = havebstr("invite_button");
830
831                 User = NewStrBufPlain(NULL, StrLength(UserNames));
832                 Buf = NewStrBuf();
833                 
834                 Pos = ChrPtr(UserNames);
835                 while (Pos != StrBufNOTNULL)
836                 {
837                         StrBufExtract_NextToken(User, UserNames, &Pos, ',');
838                         StrBufTrim(User);
839                         if ((StrLength(User) > 0) && (Kick))
840                         {
841                                 serv_printf("KICK %s", ChrPtr(User));
842                                 StrBuf_ServGetln(Buf);
843                                 if (GetServerStatus(Buf, NULL) != 2) {
844                                         StrBufCutLeft(Buf, 4);
845                                         AppendImportantMessage(SKEY(Buf));
846                                 } else {
847                                         StrBufPrintf(Buf, 
848                                                      _("User '%s' kicked out of room '%s'."), 
849                                                      ChrPtr(User), 
850                                                      ChrPtr(WCC->CurRoom.name)
851                                                 );
852                                         AppendImportantMessage(SKEY(Buf));
853                                 }
854                         }
855                         else if ((StrLength(User) > 0) && (Invite))
856                         {
857                                 serv_printf("INVT %s", ChrPtr(User));
858                                 StrBuf_ServGetln(Buf);
859                                 if (GetServerStatus(Buf, NULL) != 2) {
860                                         StrBufCutLeft(Buf, 4);
861                                         AppendImportantMessage(SKEY(Buf));
862                                 } else {
863                                         StrBufPrintf(Buf, 
864                                                      _("User '%s' invited to room '%s'."), 
865                                                      ChrPtr(User), 
866                                                      ChrPtr(WCC->CurRoom.name)
867                                                 );
868                                         AppendImportantMessage(SKEY(Buf));
869                                 }
870                         }
871                 }
872         }
873
874         http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
875 }
876
877
878 /*
879  * Create a new room
880  */
881 void entroom(void)
882 {
883         char buf[SIZ];
884         const StrBuf *er_name;
885         const StrBuf *er_type;
886         const StrBuf *er_password;
887         int er_floor;
888         int er_num_type;
889         int er_view;
890         wcsession *WCC = WC;
891
892         if (!havebstr("ok_button")) {
893                 strcpy(WC->ImportantMessage,
894                        _("Cancelled.  No new room was created."));
895                 display_main_menu();
896                 return;
897         }
898         er_name = sbstr("er_name");
899         er_type = sbstr("type");
900         er_password = sbstr("er_password");
901         er_floor = ibstr("er_floor");
902         er_view = ibstr("er_view");
903
904         er_num_type = 0;
905         if (!strcmp(ChrPtr(er_type), "hidden"))
906                 er_num_type = 1;
907         else if (!strcmp(ChrPtr(er_type), "passworded"))
908                 er_num_type = 2;
909         else if (!strcmp(ChrPtr(er_type), "invonly"))
910                 er_num_type = 3;
911         else if (!strcmp(ChrPtr(er_type), "personal"))
912                 er_num_type = 4;
913
914         serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d", 
915                     ChrPtr(er_name), 
916                     er_num_type, 
917                     ChrPtr(er_password), 
918                     er_floor, 
919                     0, 
920                     er_view);
921
922         serv_getln(buf, sizeof buf);
923         if (buf[0] != '2') {
924                 strcpy(WCC->ImportantMessage, &buf[4]);
925                 display_main_menu();
926                 return;
927         }
928         /** TODO: Room created, now update the left hand icon bar for this user */
929         gotoroom(er_name);
930
931         serv_printf("VIEW %d", er_view);
932         serv_getln(buf, sizeof buf);
933         WCC->CurRoom.view = er_view;
934
935         if ( (WCC != NULL) && ( (WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) )  {
936                 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
937         } else {
938                 smart_goto(WCC->CurRoom.name);
939         }
940
941 }
942
943
944
945
946
947 /*
948  * Change the view for this room
949  */
950 void change_view(void) {
951         int newview;
952         char buf[SIZ];
953
954         newview = lbstr("view");
955         serv_printf("VIEW %d", newview);
956         serv_getln(buf, sizeof buf);
957         WC->CurRoom.view = newview;
958         smart_goto(WC->CurRoom.name);
959 }
960
961
962
963 /**
964  * \brief Set the message expire policy for this room and/or floor
965  */
966 void set_room_policy(void) {
967         char buf[SIZ];
968
969         if (!havebstr("ok_button")) {
970                 strcpy(WC->ImportantMessage,
971                        _("Cancelled.  Changes were not saved."));
972                 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
973                 return;
974         }
975
976         serv_printf("SPEX roompolicy|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
977         serv_getln(buf, sizeof buf);
978         strcpy(WC->ImportantMessage, &buf[4]);
979
980         if (WC->axlevel >= 6) {
981                 strcat(WC->ImportantMessage, "<br>\n");
982                 serv_printf("SPEX floorpolicy|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
983                 serv_getln(buf, sizeof buf);
984                 strcat(WC->ImportantMessage, &buf[4]);
985         }
986         ReloadCurrentRoom();
987         http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
988 }
989
990
991
992 /**
993  * \brief Perform changes to a room's network configuration
994  */
995 void netedit(void) {
996         FILE *fp;
997         char buf[SIZ];
998         char line[SIZ];
999         char cmpa0[SIZ];
1000         char cmpa1[SIZ];
1001         char cmpb0[SIZ];
1002         char cmpb1[SIZ];
1003         int i, num_addrs;
1004         StrBuf *Line;
1005         int Done;
1006
1007         /*/ TODO: do line dynamic! */
1008         if (havebstr("line_pop3host")) {
1009                 strcpy(line, bstr("prefix"));
1010                 strcat(line, bstr("line_pop3host"));
1011                 strcat(line, "|");
1012                 strcat(line, bstr("line_pop3user"));
1013                 strcat(line, "|");
1014                 strcat(line, bstr("line_pop3pass"));
1015                 strcat(line, "|");
1016                 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
1017                 strcat(line, "|");
1018                 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
1019                 strcat(line, bstr("suffix"));
1020         }
1021         else if (havebstr("line")) {
1022                 strcpy(line, bstr("prefix"));
1023                 strcat(line, bstr("line"));
1024                 strcat(line, bstr("suffix"));
1025         }
1026         else {
1027                 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1028                 return;
1029         }
1030
1031
1032         fp = tmpfile();
1033         if (fp == NULL) {
1034                 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1035                 return;
1036         }
1037
1038         Line = NewStrBuf();
1039         serv_puts("GNET");
1040         StrBuf_ServGetln(Line);
1041         if  (GetServerStatus(Line, NULL) != 1) {
1042                 fclose(fp);
1043                 AppendImportantMessage(SRV_STATUS_MSG(Line));   
1044                 FreeStrBuf(&Line);
1045                 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1046                 return;
1047         }
1048
1049         /** This loop works for add *or* remove.  Spiffy, eh? */
1050         Done = 0;
1051         extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
1052         extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
1053         while (!Done && StrBuf_ServGetln(Line)>=0) {
1054                 if ( (StrLength(Line)==3) && 
1055                      !strcmp(ChrPtr(Line), "000")) 
1056                 {
1057                         Done = 1;
1058                 }
1059                 else
1060                 {
1061                         extract_token(cmpa0, ChrPtr(Line), 0, '|', sizeof cmpa0);
1062                         extract_token(cmpa1, ChrPtr(Line), 1, '|', sizeof cmpa1);
1063                         if ( (strcasecmp(cmpa0, cmpb0)) 
1064                              || (strcasecmp(cmpa1, cmpb1)) ) {
1065                                 StrBufAppendBufPlain(Line, HKEY("\n"), 0);
1066                                 fwrite(SKEY(Line), 1, fp);
1067                         }
1068                 }
1069         }
1070
1071         rewind(fp);
1072         serv_puts("SNET");
1073         StrBuf_ServGetln(Line);
1074         if  (GetServerStatus(Line, NULL) != 4) {
1075                 fclose(fp);
1076                 AppendImportantMessage(SRV_STATUS_MSG(Line));   
1077                 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1078                 FreeStrBuf(&Line);
1079                 return;
1080         }
1081
1082         while (fgets(buf, sizeof buf, fp) != NULL) {
1083                 buf[strlen(buf)-1] = 0;
1084                 serv_puts(buf);
1085         }
1086
1087         if (havebstr("add_button")) {
1088                 num_addrs = num_tokens(bstr("line"), ',');
1089                 if (num_addrs < 2) {
1090                         /* just adding one node or address */
1091                         serv_puts(line);
1092                 }
1093                 else {
1094                         /* adding multiple addresses separated by commas */
1095                         for (i=0; i<num_addrs; ++i) {
1096                                 strcpy(line, bstr("prefix"));
1097                                 extract_token(buf, bstr("line"), i, ',', sizeof buf);
1098                                 striplt(buf);
1099                                 strcat(line, buf);
1100                                 strcat(line, bstr("suffix"));
1101                                 serv_puts(line);
1102                         }
1103                 }
1104         }
1105
1106         serv_puts("000");
1107         fclose(fp);
1108         FlushIgnetCfgs(&WC->CurRoom);
1109         FreeStrBuf(&Line);
1110
1111         http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1112 }
1113
1114 /**
1115  * \brief Do either a known rooms list or a folders list, depending on the
1116  * user's preference
1117  */
1118 void knrooms(void)
1119 {
1120         StrBuf *ListView = NULL;
1121
1122         /** Determine whether the user is trying to change views */
1123         if (havebstr("view")) {
1124                 ListView = NewStrBufDup(SBSTR("view"));
1125                 set_preference("roomlistview", ListView, 1);
1126         }
1127         /** Sanitize the input so its safe */
1128         if ((get_preference("roomlistview", &ListView) == 0)||
1129             (
1130                     (strcasecmp(ChrPtr(ListView), "folders") != 0) &&
1131                     (strcasecmp(ChrPtr(ListView), "rooms") != 0)
1132                     )
1133                 )
1134         {
1135                 ListView = NewStrBufPlain(HKEY("rooms"));
1136                 set_preference("roomlistview", ListView, 0);
1137         }
1138         url_do_template();
1139 }
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158 /*******************************************************************************
1159  ********************** FLOOR Coomands *****************************************
1160  ******************************************************************************/
1161
1162
1163
1164 /*
1165  * delete the actual floor
1166  */
1167 void delete_floor(void) {
1168         int floornum;
1169         StrBuf *Buf;
1170         const char *Err;
1171                 
1172         floornum = ibstr("floornum");
1173         Buf = NewStrBuf();
1174         serv_printf("KFLR %d|1", floornum);
1175         
1176         StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err);
1177
1178         if (GetServerStatus(Buf, NULL) == 2) {
1179                 StrBufPlain(Buf, _("Floor has been deleted."),-1);
1180         }
1181         else {
1182                 StrBufCutLeft(Buf, 4);
1183         }
1184         AppendImportantMessage (SKEY(Buf));
1185
1186         FlushRoomlist();
1187         http_transmit_thing(ChrPtr(do_template("floors", NULL)), 0);
1188         FreeStrBuf(&Buf);
1189 }
1190
1191 /*
1192  * start creating a new floor
1193  */
1194 void create_floor(void) {
1195         StrBuf *Buf;
1196         const char *Err;
1197
1198         Buf = NewStrBuf();
1199         serv_printf("CFLR %s|1", bstr("floorname"));
1200         StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err);
1201
1202         if (GetServerStatus(Buf, NULL) == 2) {
1203                 StrBufPlain(Buf, _("New floor has been created."),-1);
1204         }
1205         else {
1206                 StrBufCutLeft(Buf, 4);
1207         }
1208         AppendImportantMessage (SKEY(Buf));
1209         FlushRoomlist();
1210         http_transmit_thing(ChrPtr(do_template("floors", NULL)), 0);
1211         FreeStrBuf(&Buf);
1212 }
1213
1214
1215 /*
1216  * rename this floor
1217  */
1218 void rename_floor(void) {
1219         StrBuf *Buf;
1220
1221         Buf = NewStrBuf();
1222         FlushRoomlist();
1223
1224         serv_printf("EFLR %d|%s", ibstr("floornum"), bstr("floorname"));
1225         StrBuf_ServGetln(Buf);
1226
1227         StrBufCutLeft(Buf, 4);
1228         AppendImportantMessage (SKEY(Buf));
1229
1230         http_transmit_thing(ChrPtr(do_template("floors", NULL)), 0);
1231         FreeStrBuf(&Buf);
1232 }
1233
1234
1235
1236 void jsonRoomFlr(void) 
1237 {
1238         /* Send as our own (application/json) content type */
1239         hprintf("HTTP/1.1 200 OK\r\n");
1240         hprintf("Content-type: application/json; charset=utf-8\r\n");
1241         hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
1242         hprintf("Connection: close\r\n");
1243         hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
1244         begin_burst();
1245         DoTemplate(HKEY("json_roomflr"),NULL,&NoCtx);
1246         end_burst(); 
1247 }
1248
1249 void _FlushRoomList(wcsession *WCC)
1250 {
1251         free_march_list(WCC);
1252         DeleteHash(&WCC->Floors);
1253         DeleteHash(&WCC->Rooms);
1254         DeleteHash(&WCC->FloorsByName);
1255         FlushFolder(&WCC->CurRoom);
1256 }
1257
1258 void ReloadCurrentRoom(void)
1259 {
1260         wcsession *WCC = WC;
1261         StrBuf *CurRoom;
1262
1263         CurRoom = WCC->CurRoom.name;
1264         WCC->CurRoom.name = NULL;
1265         _FlushRoomList(WCC);
1266         gotoroom(CurRoom);
1267         FreeStrBuf(&CurRoom);
1268 }
1269
1270 void FlushRoomlist(void)
1271 {
1272         wcsession *WCC = WC;
1273         _FlushRoomList(WCC);
1274 }
1275
1276
1277 void 
1278 InitModule_ROOMOPS
1279 (void)
1280 {
1281         RegisterPreference("roomlistview",
1282                            _("Room list view"),
1283                            PRF_STRING,
1284                            NULL);
1285         RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
1286
1287         
1288         WebcitAddUrlHandler(HKEY("json_roomflr"), "", 0, jsonRoomFlr, 0);
1289
1290         WebcitAddUrlHandler(HKEY("delete_floor"), "", 0, delete_floor, 0);
1291         WebcitAddUrlHandler(HKEY("rename_floor"), "", 0, rename_floor, 0);
1292         WebcitAddUrlHandler(HKEY("create_floor"), "", 0, create_floor, 0);
1293
1294         WebcitAddUrlHandler(HKEY("knrooms"), "", 0, knrooms, 0);
1295         WebcitAddUrlHandler(HKEY("dotgoto"), "", 0, dotgoto, NEED_URL);
1296         WebcitAddUrlHandler(HKEY("dotskip"), "", 0, dotskip, NEED_URL);
1297
1298         WebcitAddUrlHandler(HKEY("goto_private"), "", 0, goto_private, NEED_URL);
1299         WebcitAddUrlHandler(HKEY("zap"), "", 0, zap, 0);
1300         WebcitAddUrlHandler(HKEY("entroom"), "", 0, entroom, 0);
1301         WebcitAddUrlHandler(HKEY("do_invt_kick"), "", 0, do_invt_kick, 0);
1302         
1303         WebcitAddUrlHandler(HKEY("netedit"), "", 0, netedit, 0);
1304         WebcitAddUrlHandler(HKEY("editroom"), "", 0, editroom, 0);
1305         WebcitAddUrlHandler(HKEY("delete_room"), "", 0, delete_room, 0);
1306         WebcitAddUrlHandler(HKEY("set_room_policy"), "", 0, set_room_policy, 0);
1307         WebcitAddUrlHandler(HKEY("changeview"), "", 0, change_view, 0);
1308         WebcitAddUrlHandler(HKEY("toggle_self_service"), "", 0, toggle_self_service, 0);
1309
1310
1311         REGISTERTokenParamDefine(QR_PERMANENT);
1312         REGISTERTokenParamDefine(QR_INUSE);
1313         REGISTERTokenParamDefine(QR_PRIVATE);
1314         REGISTERTokenParamDefine(QR_PASSWORDED);
1315         REGISTERTokenParamDefine(QR_GUESSNAME);
1316         REGISTERTokenParamDefine(QR_DIRECTORY);
1317         REGISTERTokenParamDefine(QR_UPLOAD);
1318         REGISTERTokenParamDefine(QR_DOWNLOAD);
1319         REGISTERTokenParamDefine(QR_VISDIR);
1320         REGISTERTokenParamDefine(QR_ANONONLY);
1321         REGISTERTokenParamDefine(QR_ANONOPT);
1322         REGISTERTokenParamDefine(QR_NETWORK);
1323         REGISTERTokenParamDefine(QR_PREFONLY);
1324         REGISTERTokenParamDefine(QR_READONLY);
1325         REGISTERTokenParamDefine(QR_MAILBOX);
1326         REGISTERTokenParamDefine(QR2_SYSTEM);
1327         REGISTERTokenParamDefine(QR2_SELFLIST);
1328         REGISTERTokenParamDefine(QR2_COLLABDEL);
1329         REGISTERTokenParamDefine(QR2_SUBJECTREQ);
1330         REGISTERTokenParamDefine(QR2_SMTP_PUBLIC);
1331         REGISTERTokenParamDefine(QR2_MODERATED);
1332
1333         REGISTERTokenParamDefine(UA_KNOWN);
1334         REGISTERTokenParamDefine(UA_GOTOALLOWED);
1335         REGISTERTokenParamDefine(UA_HASNEWMSGS);
1336         REGISTERTokenParamDefine(UA_ZAPPED);
1337         REGISTERTokenParamDefine(UA_POSTALLOWED);
1338         REGISTERTokenParamDefine(UA_ADMINALLOWED);
1339         REGISTERTokenParamDefine(UA_DELETEALLOWED);
1340         REGISTERTokenParamDefine(UA_ISTRASH);
1341
1342         REGISTERTokenParamDefine(US_NEEDVALID);
1343         REGISTERTokenParamDefine(US_PERM);
1344         REGISTERTokenParamDefine(US_LASTOLD);
1345         REGISTERTokenParamDefine(US_EXPERT);
1346         REGISTERTokenParamDefine(US_UNLISTED);
1347         REGISTERTokenParamDefine(US_NOPROMPT);
1348         REGISTERTokenParamDefine(US_PROMPTCTL);
1349         REGISTERTokenParamDefine(US_DISAPPEAR);
1350         REGISTERTokenParamDefine(US_REGIS);
1351         REGISTERTokenParamDefine(US_PAGINATOR);
1352         REGISTERTokenParamDefine(US_INTERNET);
1353         REGISTERTokenParamDefine(US_FLOORS);
1354         REGISTERTokenParamDefine(US_COLOR);
1355         REGISTERTokenParamDefine(US_USER_SET);
1356
1357         REGISTERTokenParamDefine(VIEW_BBS);
1358         REGISTERTokenParamDefine(VIEW_MAILBOX); 
1359         REGISTERTokenParamDefine(VIEW_ADDRESSBOOK);
1360         REGISTERTokenParamDefine(VIEW_CALENDAR);        
1361         REGISTERTokenParamDefine(VIEW_TASKS);   
1362         REGISTERTokenParamDefine(VIEW_NOTES);           
1363         REGISTERTokenParamDefine(VIEW_WIKI);            
1364         REGISTERTokenParamDefine(VIEW_CALBRIEF);
1365         REGISTERTokenParamDefine(VIEW_JOURNAL);
1366         REGISTERTokenParamDefine(VIEW_BLOG);
1367
1368         /* GNET types: */
1369         /* server internal, we need to know but ignore them. */
1370         REGISTERTokenParamDefine(subpending);
1371         REGISTERTokenParamDefine(unsubpending);
1372         REGISTERTokenParamDefine(lastsent);
1373
1374         REGISTERTokenParamDefine(ignet_push_share);
1375         { /* these are the parts of an IGNET push config */
1376                 REGISTERTokenParamDefine(GNET_IGNET_NODE);
1377                 REGISTERTokenParamDefine(GNET_IGNET_ROOM);
1378         }
1379         REGISTERTokenParamDefine(listrecp);
1380         REGISTERTokenParamDefine(digestrecp);
1381         REGISTERTokenParamDefine(pop3client);
1382         { /* These are the parts of a pop3 client line... */
1383                 REGISTERTokenParamDefine(GNET_POP3_HOST);
1384                 REGISTERTokenParamDefine(GNET_POP3_USER);
1385                 REGISTERTokenParamDefine(GNET_POP3_DONT_DELETE_REMOTE);
1386                 REGISTERTokenParamDefine(GNET_POP3_INTERVAL);
1387         }
1388         REGISTERTokenParamDefine(rssclient);
1389         REGISTERTokenParamDefine(participate);
1390
1391
1392
1393 }
1394
1395
1396 void 
1397 SessionDestroyModule_ROOMOPS
1398 (wcsession *sess)
1399 {
1400         _FlushRoomList (sess);
1401 }
1402
1403
1404 /*@}*/