Back to index

webcit  8.12-dfsg
roomops.c
Go to the documentation of this file.
00001 /*
00002  * Lots of different room-related operations.
00003  *
00004  * Copyright (c) 1996-2012 by the citadel.org team
00005  *
00006  * This program is open source software.  You can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License, version 3.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  */
00014 
00015 #include "webcit.h"
00016 #include "webserver.h"
00017 
00018 ConstStr QRFlagList[] = {
00019        {HKEY(strof(QR_PERMANENT))},
00020        {HKEY(strof(QR_INUSE))},
00021        {HKEY(strof(QR_PRIVATE))},
00022        {HKEY(strof(QR_PASSWORDED))},
00023        {HKEY(strof(QR_GUESSNAME))},
00024        {HKEY(strof(QR_DIRECTORY))},
00025        {HKEY(strof(QR_UPLOAD))},
00026        {HKEY(strof(QR_DOWNLOAD))},
00027        {HKEY(strof(QR_VISDIR))},
00028        {HKEY(strof(QR_ANONONLY))},
00029        {HKEY(strof(QR_ANONOPT))},
00030        {HKEY(strof(QR_NETWORK))},
00031        {HKEY(strof(QR_PREFONLY))},
00032        {HKEY(strof(QR_READONLY))},
00033        {HKEY(strof(QR_MAILBOX))}
00034 };
00035 ConstStr QR2FlagList[] = {
00036        {HKEY(strof(QR2_SYSTEM))},
00037        {HKEY(strof(QR2_SELFLIST))},
00038        {HKEY(strof(QR2_COLLABDEL))},
00039        {HKEY(strof(QR2_SUBJECTREQ))},
00040        {HKEY(strof(QR2_SMTP_PUBLIC))},
00041        {HKEY(strof(QR2_MODERATED))},
00042        {HKEY("")}, 
00043        {HKEY("")}, 
00044        {HKEY("")}, 
00045        {HKEY("")}, 
00046        {HKEY("")}, 
00047        {HKEY("")}, 
00048        {HKEY("")}, 
00049        {HKEY("")}, 
00050        {HKEY("")}
00051 };
00052 
00053 void _DBG_QR(long QR)
00054 {
00055        int i = 1;
00056        int j=0;
00057        StrBuf *QRVec;
00058 
00059        QRVec = NewStrBufPlain(NULL, 256);
00060        while (i != 0)
00061        {
00062               if ((QR & i) != 0) {
00063                      if (StrLength(QRVec) > 0)
00064                             StrBufAppendBufPlain(QRVec, HKEY(" | "), 0);
00065                      StrBufAppendBufPlain(QRVec, CKEY(QRFlagList[j]), 0);
00066               }
00067               i = i << 1;
00068               j++;
00069        }
00070        syslog(9, "DBG: QR-Vec [%ld] [%s]\n", QR, ChrPtr(QRVec));
00071        FreeStrBuf(&QRVec);
00072 }
00073 
00074 
00075 
00076 void _DBG_QR2(long QR2)
00077 {
00078        int i = 1;
00079        int j=0;
00080        StrBuf *QR2Vec;
00081 
00082        QR2Vec = NewStrBufPlain(NULL, 256);
00083        while (i != 0)
00084        {
00085               if ((QR2 & i) != 0) {
00086                      if (StrLength(QR2Vec) > 0)
00087                             StrBufAppendBufPlain(QR2Vec, HKEY(" | "), 0);
00088                      StrBufAppendBufPlain(QR2Vec, CKEY(QR2FlagList[j]), 0);
00089               }
00090               i = i << 1;
00091               j++;
00092        }
00093        syslog(9, "DBG: QR2-Vec [%ld] [%s]\n", QR2, ChrPtr(QR2Vec));
00094        FreeStrBuf(&QR2Vec);
00095 }
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 /*******************************************************************************
00108  ***************************** Goto Commands ***********************************
00109  ******************************************************************************/
00110 
00111 void dotskip(void) {
00112        smart_goto(sbstr("room"));
00113 }
00114 
00115 void dotgoto(void) {
00116        if (!havebstr("room")) {
00117               readloop(readnew, eUseDefault);
00118               return;
00119        }
00120        if (WC->CurRoom.view != VIEW_MAILBOX) {   /* dotgoto acts like dotskip when we're in a mailbox view */
00121               slrp_highest();
00122        }
00123        smart_goto(sbstr("room"));
00124 }
00125 
00126 /*
00127  * goto next room
00128  */
00129 void smart_goto(const StrBuf *next_room) {
00130        gotoroom(next_room);
00131        readloop(readnew, eUseDefault);
00132 }
00133 
00134 /*
00135  * goto a private room
00136  */
00137 void goto_private(void)
00138 {
00139        char hold_rm[SIZ];
00140        StrBuf *Buf;
00141        const StrBuf *gr_name;
00142        long err;
00143 
00144        if (!havebstr("ok_button")) {
00145               display_main_menu();
00146               return;
00147        }
00148        gr_name = sbstr("gr_name");
00149        Buf = NewStrBuf();
00150        strcpy(hold_rm, ChrPtr(WC->CurRoom.name));
00151        serv_printf("GOTO %s|%s",
00152                   ChrPtr(gr_name),
00153                   bstr("gr_pass"));
00154        StrBuf_ServGetln(Buf);
00155        if  (GetServerStatus(Buf, &err) == 2) {
00156               FlushRoomlist();
00157               smart_goto(gr_name);
00158               FreeStrBuf(&Buf);
00159               return;
00160        }
00161        if (err == 540) {
00162               DoTemplate(HKEY("room_display_private"), NULL, &NoCtx);
00163               FreeStrBuf(&Buf);
00164               return;
00165        }
00166        StrBufCutLeft(Buf, 4);
00167        AppendImportantMessage (SKEY(Buf));
00168        Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
00169        smart_goto(Buf);
00170        FreeStrBuf(&Buf);
00171        return;
00172 }
00173 
00174 /*
00175  * back end routine to take the session to a new room
00176  */
00177 long gotoroom(const StrBuf *gname)
00178 {
00179        wcsession *WCC = WC;
00180        StrBuf *Buf;
00181        static long ls = (-1L);
00182        long err = 0;
00183        int room_name_supplied = 0;
00184        int is_baseroom = 0;
00185 
00186        /* store ungoto information */
00187        if (StrLength(gname) > 0) {
00188               room_name_supplied = 1;
00189        }
00190        if (room_name_supplied) {
00191               strcpy(WCC->ugname, ChrPtr(WCC->CurRoom.name));
00192               if (!strcasecmp(ChrPtr(gname), "_BASEROOM_")) {
00193                      is_baseroom = 1;
00194               }
00195        }
00196        WCC->uglsn = ls;
00197        Buf = NewStrBuf();
00198 
00199        /* move to the new room */
00200        if (room_name_supplied) {
00201               serv_printf("GOTO %s", ChrPtr(gname));
00202        }
00203        else {
00204               /* or just refresh the current state... */
00205               serv_printf("GOTO 00000000000000000000");
00206        }
00207        StrBuf_ServGetln(Buf);
00208        if  (GetServerStatus(Buf, &err) != 2) {
00209               serv_puts("GOTO _BASEROOM_");
00210               StrBuf_ServGetln(Buf);
00211               /* 
00212                * well, we know that this is the fallback case, 
00213                * but we're interested that the first command 
00214                * didn't work out in first place.
00215                */
00216               if (GetServerStatus(Buf, NULL) != 2) {
00217                      FreeStrBuf(&Buf);
00218                      return err;
00219               }
00220        }
00221        FlushFolder(&WCC->CurRoom);
00222        ParseGoto(&WCC->CurRoom, Buf);
00223 
00224        if (room_name_supplied) {
00225               remove_march(WCC->CurRoom.name);
00226               if (is_baseroom) {
00227                      remove_march(gname);
00228               }
00229        }
00230        FreeStrBuf(&Buf);
00231 
00232        return err;
00233 }
00234 
00235 
00236 
00237 void ParseGoto(folder *room, StrBuf *Line)
00238 {
00239        wcsession *WCC = WC;
00240        const char *Pos;
00241        int flag;
00242        void *vFloor = NULL;
00243        StrBuf *pBuf;
00244 
00245        if (StrLength(Line) < 4) {
00246               return;
00247        }
00248        
00249        /* ignore the commandstate... */
00250        Pos = ChrPtr(Line) + 4;
00251 
00252        if (room->RoomNameParts != NULL)
00253        {
00254               int i;
00255               for (i=0; i < room->nRoomNameParts; i++)
00256                      FreeStrBuf(&room->RoomNameParts[i]);
00257               free(room->RoomNameParts);
00258               room->RoomNameParts = NULL;
00259        }
00260 
00261        pBuf = room->name;  
00262        if (pBuf == NULL)
00263               pBuf = NewStrBufPlain(NULL, StrLength(Line));
00264        else
00265               FlushStrBuf(pBuf);
00266        memset(room, 0, sizeof(folder));
00267        room->name = pBuf;
00268 
00269        StrBufExtract_NextToken(room->name, Line, &Pos, '|');
00270 
00271        room->nNewMessages = StrBufExtractNext_long(Line, &Pos, '|'); 
00272        if (room->nNewMessages > 0)
00273               room->RAFlags |= UA_HASNEWMSGS;
00274 
00275        room->nTotalMessages = StrBufExtractNext_long(Line, &Pos, '|');
00276 
00277        room->ShowInfo =  StrBufExtractNext_long(Line, &Pos, '|');
00278        
00279        room->QRFlags = StrBufExtractNext_long(Line, &Pos, '|');
00280 
00281        DBG_QR(room->QRFlags);
00282 
00283        room->HighestRead = StrBufExtractNext_long(Line, &Pos, '|');
00284        room->LastMessageRead = StrBufExtractNext_long(Line, &Pos, '|');
00285 
00286        room->is_inbox = StrBufExtractNext_long(Line, &Pos, '|');
00287 
00288        flag = StrBufExtractNext_long(Line, &Pos, '|');
00289        if (WCC->is_aide || flag) {
00290               room->RAFlags |= UA_ADMINALLOWED;
00291        }
00292 
00293        room->UsersNewMAilboxMessages = StrBufExtractNext_long(Line, &Pos, '|');
00294 
00295        room->floorid = StrBufExtractNext_int(Line, &Pos, '|');
00296 
00297        room->view = StrBufExtractNext_long(Line, &Pos, '|');
00298 
00299        room->defview = StrBufExtractNext_long(Line, &Pos, '|');
00300 
00301        flag = StrBufExtractNext_long(Line, &Pos, '|');
00302        if (flag)
00303               room->RAFlags |= UA_ISTRASH;
00304 
00305        room->QRFlags2 = StrBufExtractNext_long(Line, &Pos, '|');
00306        DBG_QR2(room->QRFlags2);
00307 
00308        /* find out, whether we are in a sub-room */
00309        room->nRoomNameParts = StrBufNum_tokens(room->name, '\\');
00310        if (room->nRoomNameParts > 1)
00311        {
00312               int i;
00313               
00314               Pos = NULL;
00315               room->RoomNameParts = malloc(sizeof(StrBuf*) * (room->nRoomNameParts + 1));
00316               memset(room->RoomNameParts, 0, sizeof(StrBuf*) * (room->nRoomNameParts + 1));
00317               for (i=0; i < room->nRoomNameParts; i++)
00318               {
00319                      room->RoomNameParts[i] = NewStrBuf();
00320                      StrBufExtract_NextToken(room->RoomNameParts[i],
00321                                           room->name, &Pos, '\\');
00322               }
00323        }
00324 
00325        /* Private mailboxes on the main floor get remapped to the personal folder */
00326        if ((room->QRFlags & QR_MAILBOX) && 
00327            (room->floorid == 0))
00328        {
00329               room->floorid = VIRTUAL_MY_FLOOR;
00330               if ((room->nRoomNameParts == 1) && 
00331                   (StrLength(room->name) == 4) && 
00332                   (strcmp(ChrPtr(room->name), "Mail") == 0))
00333               {
00334                      room->is_inbox = 1;
00335               }
00336               
00337        }
00338        /* get a pointer to the floor we're on: */
00339        if (WCC->Floors == NULL)
00340               GetFloorListHash(NULL, NULL);
00341 
00342        GetHash(WCC->Floors, IKEY(room->floorid), &vFloor);
00343        room->Floor = (const Floor*) vFloor;
00344 }
00345 
00346 /*
00347  * Delete the current room
00348  */
00349 void delete_room(void)
00350 {
00351        StrBuf *Line = NewStrBuf();
00352        const StrBuf *GoBstr;
00353        
00354        GoBstr = sbstr("go");
00355 
00356        if (GoBstr != NULL)
00357        {
00358               if (gotoroom(GoBstr) == 200)
00359               {
00360                      serv_puts("KILL 1");
00361                      StrBuf_ServGetln(Line);
00362                      if (GetServerStatusMsg(Line, NULL, 1, 2) == 2) {
00363                             StrBuf *Buf;
00364                             
00365                             FlushRoomlist ();
00366                             Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
00367                             smart_goto(Buf);
00368                             FreeStrBuf(&Buf);
00369                             FreeStrBuf(&Line);
00370                             return;
00371                      }
00372               }
00373        }
00374        display_main_menu();
00375        FreeStrBuf(&Line);
00376 }
00377 
00378 /*
00379  * zap a room
00380  */
00381 void zap(void)
00382 {
00383        char buf[SIZ];
00384        StrBuf *final_destination;
00385 
00390        final_destination = NewStrBufDup(WC->CurRoom.name);
00391 
00392        if (havebstr("ok_button")) {
00393               serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
00394               serv_getln(buf, sizeof buf);
00395               if (buf[0] == '2') {
00396                      serv_puts("FORG");
00397                      serv_getln(buf, sizeof buf);
00398                      if (buf[0] == '2') {
00399                             FlushStrBuf(final_destination);
00400                             StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
00401                      }
00402               }
00403               FlushRoomlist ();
00404        }
00405        smart_goto(final_destination);
00406        FreeStrBuf(&final_destination);
00407 }
00408 
00409 
00410 /*
00411  * mark all messages in current room as having been read
00412  */
00413 void slrp_highest(void)
00414 {
00415        char buf[256];
00416 
00417        serv_puts("SLRP HIGHEST");
00418        serv_getln(buf, sizeof buf);
00419 }
00420 
00421 
00422 
00423 
00424 
00425 
00426 
00427 
00428 
00429 
00430 
00431 
00432 
00433 
00434 /*******************************************************************************
00435  ***************************** Modify Rooms ************************************
00436  ******************************************************************************/
00437 
00438 
00439 
00440 
00441 
00442 void LoadRoomAide(void)
00443 {
00444        wcsession *WCC = WC;
00445        StrBuf *Buf;
00446        
00447        if (WCC->CurRoom.RoomAideLoaded)
00448               return;
00449 
00450        WCC->CurRoom.RoomAideLoaded = 1;
00451        Buf = NewStrBuf();
00452        serv_puts("GETA");
00453        StrBuf_ServGetln(Buf);
00454        if (GetServerStatus(Buf, NULL) != 2) {
00455               FlushStrBuf(WCC->CurRoom.RoomAide);
00456               AppendImportantMessage (ChrPtr(Buf) + 4, 
00457                                    StrLength(Buf) - 4);
00458        } else {
00459               const char *Pos;
00460 
00461               Pos = ChrPtr(Buf) + 4;
00462 
00463               FreeStrBuf(&WCC->CurRoom.RoomAide);
00464               WCC->CurRoom.RoomAide = NewStrBufPlain (NULL, StrLength (Buf));
00465 
00466               StrBufExtract_NextToken(WCC->CurRoom.RoomAide, Buf, &Pos, '|'); 
00467        }
00468        FreeStrBuf (&Buf);
00469 }
00470 
00471 int SaveRoomAide(folder *Room)
00472 {
00473        StrBuf *Buf;
00474        Buf = NewStrBuf ();
00475        serv_printf("SETA %s", ChrPtr(Room->RoomAide));
00476        StrBuf_ServGetln(Buf);
00477        if (GetServerStatus(Buf, NULL) != 2) {
00478               StrBufCutLeft(Buf, 4);
00479               AppendImportantMessage (SKEY(Buf));
00480               FreeStrBuf(&Buf);
00481               return 0;
00482        }
00483        FreeStrBuf(&Buf);
00484        return 1;
00485 }
00486 
00487 
00488 int GetCurrentRoomFlags(folder *Room, int CareForStatusMessage)
00489 {
00490        StrBuf *Buf;
00491 
00492        Buf = NewStrBuf();
00493        serv_puts("GETR");
00494        StrBuf_ServGetln(Buf);
00495        if (GetServerStatus(Buf, NULL) != 2) {
00496               FlushStrBuf(Room->XAPass);
00497               FlushStrBuf(Room->Directory);
00498               StrBufCutLeft(Buf, 4);
00499               if (CareForStatusMessage)
00500                      AppendImportantMessage (SKEY(Buf));
00501               FreeStrBuf(&Buf);
00502               Room->XALoaded = 2;
00503               return 0;
00504        } else {
00505               const char *Pos;
00506 
00507               Pos = ChrPtr(Buf) + 4;
00508 
00509               FreeStrBuf(&Room->XAPass);
00510               FreeStrBuf(&Room->Directory);
00511 
00512               Room->XAPass = NewStrBufPlain (NULL, StrLength (Buf));
00513               Room->Directory = NewStrBufPlain (NULL, StrLength (Buf));
00514 
00515               FreeStrBuf(&Room->name);
00516               Room->name = NewStrBufPlain(NULL, StrLength(Buf));
00517               StrBufExtract_NextToken(Room->name, Buf, &Pos, '|'); 
00518                                    
00519               StrBufExtract_NextToken(Room->XAPass, Buf, &Pos, '|'); 
00520               StrBufExtract_NextToken(Room->Directory, Buf, &Pos, '|'); 
00521               
00522               Room->QRFlags = StrBufExtractNext_long(Buf, &Pos, '|');
00523               Room->floorid = StrBufExtractNext_long(Buf, &Pos, '|');
00524               Room->Order = StrBufExtractNext_long(Buf, &Pos, '|');
00525               Room->defview = StrBufExtractNext_long(Buf, &Pos, '|');
00526               Room->QRFlags2 = StrBufExtractNext_long(Buf, &Pos, '|');
00527               FreeStrBuf (&Buf);
00528               Room->XALoaded = 1;
00529               return 1;
00530        }
00531 }
00532 
00533 
00534 int SetCurrentRoomFlags(folder *Room)
00535 {
00536        StrBuf *Buf;
00537 
00538        Buf = NewStrBuf();
00539        DBG_QR(Room->QRFlags);
00540        DBG_QR2(Room->QRFlags2);
00541 
00542        serv_printf("SETR %s|%s|%s|%ld|%d|%d|%ld|%ld|%ld",
00543                   ChrPtr(Room->name),
00544                   ChrPtr(Room->XAPass),
00545                   ChrPtr(Room->Directory),
00546                   Room->QRFlags, 
00547                   Room->BumpUsers,
00548                   Room->floorid, 
00549                   Room->Order,
00550                   Room->defview,
00551                   Room->QRFlags2);
00552 
00553        StrBuf_ServGetln(Buf);
00554        if (GetServerStatus(Buf, NULL) != 2) {
00555               StrBufCutLeft(Buf, 4);
00556               AppendImportantMessage (SKEY(Buf));
00557               FreeStrBuf(&Buf);
00558               return 0;
00559        } else {
00560               FreeStrBuf(&Buf);
00561               return 1;
00562        }
00563 }
00564 
00565 void LoadRoomXA (void)
00566 {
00567        wcsession *WCC = WC;
00568               
00569        if (WCC->CurRoom.XALoaded > 0)
00570               return;
00571 
00572        GetCurrentRoomFlags(&WCC->CurRoom, 0);
00573 }
00574 
00575 
00576 void LoadXRoomPic(void)
00577 {
00578        wcsession *WCC = WC;
00579        StrBuf *Buf;
00580        
00581        if (WCC->CurRoom.XHaveRoomPicLoaded)
00582               return;
00583 
00584        WCC->CurRoom.XHaveRoomPicLoaded = 1;
00585        Buf = NewStrBuf();
00586        serv_puts("OIMG _roompic_");
00587        StrBuf_ServGetln(Buf);
00588        if (GetServerStatus(Buf, NULL) != 2) {
00589               WCC->CurRoom.XHaveRoomPic = 0;
00590        } else {
00591               WCC->CurRoom.XHaveRoomPic = 1;
00592        }
00593        serv_puts("CLOS");
00594        StrBuf_ServGetln(Buf);
00595        GetServerStatus(Buf, NULL);
00596        FreeStrBuf (&Buf);
00597 }
00598 
00599 
00600 void LoadXRoomInfoText(void)
00601 {
00602        wcsession *WCC = WC;
00603        StrBuf *Buf;
00604        int Done = 0;
00605        
00606        if (WCC->CurRoom.XHaveInfoTextLoaded) {
00607               return;
00608        }
00609 
00610        WCC->CurRoom.XHaveInfoTextLoaded = 1;
00611        Buf = NewStrBuf();
00612 
00613        serv_puts("RINF");
00614 
00615        StrBuf_ServGetln(Buf);
00616        if (GetServerStatus(Buf, NULL) == 1) {
00617               WCC->CurRoom.XInfoText = NewStrBuf ();
00618               
00619               while (!Done && StrBuf_ServGetln(Buf)>=0) {
00620                      if ( (StrLength(Buf)==3) && 
00621                           !strcmp(ChrPtr(Buf), "000")) 
00622                             Done = 1;
00623                      else 
00624                             StrBufAppendBuf(WCC->CurRoom.XInfoText, Buf, 0);
00625               }
00626        }
00627 
00628        FreeStrBuf(&Buf);
00629 }
00630 
00631 
00632 void LoadXRoomXCountFiles(void)
00633 {
00634        wcsession *WCC = WC;
00635        StrBuf *Buf;
00636        int Done = 0;
00637        
00638        if (WCC->CurRoom.XHaveDownloadCount)
00639               return;
00640 
00641        WCC->CurRoom.XHaveDownloadCount = 1;
00642 
00643        Buf = NewStrBuf();
00644        serv_puts("RDIR");
00645        StrBuf_ServGetln(Buf);
00646        if (GetServerStatus(Buf, NULL) == 1) {
00647               
00648               while (!Done && StrBuf_ServGetln(Buf)>=0) {
00649                      if ( (StrLength(Buf)==3) && 
00650                           !strcmp(ChrPtr(Buf), "000")) 
00651                             Done = 1;
00652                      else 
00653                             WCC->CurRoom.XDownloadCount++;
00654               }
00655        }
00656 
00657        FreeStrBuf (&Buf);
00658 }
00659 
00660 
00661 /* 
00662  * Toggle self-service list subscription
00663  */
00664 void toggle_self_service(void) {
00665        wcsession *WCC = WC;
00666 
00667        if (GetCurrentRoomFlags (&WCC->CurRoom, 1) == 0)
00668               return;
00669 
00670        if (yesbstr("QR2_SelfList")) 
00671               WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SELFLIST;
00672        else 
00673               WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SELFLIST;
00674 
00675        if (yesbstr("QR2_SMTP_PUBLIC")) 
00676               WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SMTP_PUBLIC;
00677        else
00678               WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SMTP_PUBLIC;
00679 
00680        if (yesbstr("QR2_Moderated")) 
00681               WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_MODERATED;
00682        else
00683               WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_MODERATED;
00684        if (yesbstr("QR2_SubsOnly")) 
00685               WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SMTP_PUBLIC;
00686        else
00687               WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SMTP_PUBLIC;
00688 
00689        SetCurrentRoomFlags (&WCC->CurRoom);
00690 
00691        output_headers(1, 1, 1, 0, 0, 0);  
00692        do_template("room_edit");
00693        wDumpContent(1);
00694 }
00695 
00696 
00697 
00698 /*
00699  * save new parameters for a room
00700  */
00701 void editroom(void)
00702 {
00703        wcsession *WCC = WC;
00704        const StrBuf *Ptr;
00705        const StrBuf *er_name;
00706        const StrBuf *er_password;
00707        const StrBuf *er_dirname;
00708        const StrBuf *er_roomaide;
00709        int succ1, succ2;
00710 
00711        if (!havebstr("ok_button")) {
00712               AppendImportantMessage(_("Cancelled.  Changes were not saved."), -1);
00713               output_headers(1, 1, 1, 0, 0, 0);  
00714               do_template("room_edit");
00715               wDumpContent(1);
00716               return;
00717        }
00718 
00719        if (GetCurrentRoomFlags (&WCC->CurRoom, 1) == 0) {
00720               output_headers(1, 1, 1, 0, 0, 0);  
00721               do_template("room_edit");
00722               wDumpContent(1);
00723               return;
00724        }
00725 
00726        LoadRoomAide();
00727        WCC->CurRoom.QRFlags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
00728 
00729        Ptr = sbstr("type");
00730        if (!strcmp(ChrPtr(Ptr), "invonly")) {
00731               WCC->CurRoom.QRFlags |= (QR_PRIVATE);
00732        }
00733        if (!strcmp(ChrPtr(Ptr), "hidden")) {
00734               WCC->CurRoom.QRFlags |= (QR_PRIVATE | QR_GUESSNAME);
00735        }
00736        if (!strcmp(ChrPtr(Ptr), "passworded")) {
00737               WCC->CurRoom.QRFlags |= (QR_PRIVATE | QR_PASSWORDED);
00738        }
00739        if (!strcmp(ChrPtr(Ptr), "personal")) {
00740               WCC->CurRoom.QRFlags |= QR_MAILBOX;
00741        } else {
00742               WCC->CurRoom.QRFlags &= ~QR_MAILBOX;
00743        }
00744 
00745        if (yesbstr("prefonly")) {
00746               WCC->CurRoom.QRFlags |= QR_PREFONLY;
00747        } else {
00748               WCC->CurRoom.QRFlags &= ~QR_PREFONLY;
00749        }
00750 
00751        if (yesbstr("readonly")) {
00752               WCC->CurRoom.QRFlags |= QR_READONLY;
00753        } else {
00754               WCC->CurRoom.QRFlags &= ~QR_READONLY;
00755        }
00756 
00757        if (yesbstr("collabdel")) {
00758               WCC->CurRoom.QRFlags2 |= QR2_COLLABDEL;
00759        } else {
00760               WCC->CurRoom.QRFlags2 &= ~QR2_COLLABDEL;
00761        }
00762 
00763        if (yesbstr("permanent")) {
00764               WCC->CurRoom.QRFlags |= QR_PERMANENT;
00765        } else {
00766               WCC->CurRoom.QRFlags &= ~QR_PERMANENT;
00767        }
00768 
00769        if (yesbstr("subjectreq")) {
00770               WCC->CurRoom.QRFlags2 |= QR2_SUBJECTREQ;
00771        } else {
00772               WCC->CurRoom.QRFlags2 &= ~QR2_SUBJECTREQ;
00773        }
00774 
00775        if (yesbstr("network")) {
00776               WCC->CurRoom.QRFlags |= QR_NETWORK;
00777        } else {
00778               WCC->CurRoom.QRFlags &= ~QR_NETWORK;
00779        }
00780 
00781        if (yesbstr("directory")) {
00782               WCC->CurRoom.QRFlags |= QR_DIRECTORY;
00783        } else {
00784               WCC->CurRoom.QRFlags &= ~QR_DIRECTORY;
00785        }
00786 
00787        if (yesbstr("ulallowed")) {
00788               WCC->CurRoom.QRFlags |= QR_UPLOAD;
00789        } else {
00790               WCC->CurRoom.QRFlags &= ~QR_UPLOAD;
00791        }
00792 
00793        if (yesbstr("dlallowed")) {
00794               WCC->CurRoom.QRFlags |= QR_DOWNLOAD;
00795        } else {
00796               WCC->CurRoom.QRFlags &= ~QR_DOWNLOAD;
00797        }
00798 
00799        if (yesbstr("visdir")) {
00800               WCC->CurRoom.QRFlags |= QR_VISDIR;
00801        } else {
00802               WCC->CurRoom.QRFlags &= ~QR_VISDIR;
00803        }
00804 
00805        Ptr = sbstr("anon");
00806 
00807        WCC->CurRoom.QRFlags &= ~(QR_ANONONLY | QR_ANONOPT);
00808        if (!strcmp(ChrPtr(Ptr), "anononly"))
00809               WCC->CurRoom.QRFlags |= QR_ANONONLY;
00810        if (!strcmp(ChrPtr(Ptr), "anon2"))
00811               WCC->CurRoom.QRFlags |= QR_ANONOPT;
00812 
00813        er_name     = sbstr("er_name");
00814        er_dirname  = sbstr("er_dirname");
00815        er_roomaide = sbstr("er_roomaide");
00816        er_password = sbstr("er_password");
00817 
00818        FlushStrBuf(WCC->CurRoom.name);
00819        StrBufAppendBuf(WCC->CurRoom.name, er_name, 0);
00820 
00821        FlushStrBuf(WCC->CurRoom.Directory);
00822        StrBufAppendBuf(WCC->CurRoom.Directory, er_dirname, 0);
00823 
00824        FlushStrBuf(WCC->CurRoom.RoomAide);
00825        StrBufAppendBuf(WCC->CurRoom.RoomAide, er_roomaide, 0);
00826 
00827        FlushStrBuf(WCC->CurRoom.XAPass);
00828        StrBufAppendBuf(WCC->CurRoom.XAPass, er_password, 0);
00829 
00830        WCC->CurRoom.BumpUsers = yesbstr("bump");
00831 
00832        WCC->CurRoom.floorid = ibstr("er_floor");
00833 
00834        succ1 = SetCurrentRoomFlags(&WCC->CurRoom);
00835 
00836        succ2 = SaveRoomAide (&WCC->CurRoom);
00837        
00838        if (succ1 + succ2 == 0) {
00839               AppendImportantMessage (_("Your changes have been saved."), -1);
00840        }
00841        output_headers(1, 1, 1, 0, 0, 0);  
00842        do_template("room_edit");
00843        wDumpContent(1);
00844        return;
00845 }
00846 
00847 
00848 
00849 /*
00850  * Display form for Invite, Kick, and show Who Knows a room
00851  */
00852 void do_invt_kick(void) 
00853 {
00854        StrBuf *Buf, *User;
00855        const StrBuf *UserNames;
00856        int Kick, Invite;
00857        wcsession *WCC = WC;
00858 
00859 
00860        if (GetCurrentRoomFlags(&WCC->CurRoom, 1) == 1)
00861        {
00862               const char *Pos;
00863               UserNames = sbstr("username");
00864               Kick = havebstr("kick_button");
00865               Invite = havebstr("invite_button");
00866 
00867               User = NewStrBufPlain(NULL, StrLength(UserNames));
00868               Buf = NewStrBuf();
00869               
00870               Pos = ChrPtr(UserNames);
00871               while (Pos != StrBufNOTNULL)
00872               {
00873                      StrBufExtract_NextToken(User, UserNames, &Pos, ',');
00874                      StrBufTrim(User);
00875                      if ((StrLength(User) > 0) && (Kick))
00876                      {
00877                             serv_printf("KICK %s", ChrPtr(User));
00878                             if (StrBuf_ServGetln(Buf) < 0)
00879                                    break;
00880                             if (GetServerStatus(Buf, NULL) != 2) {
00881                                    StrBufCutLeft(Buf, 4);
00882                                    AppendImportantMessage(SKEY(Buf));
00883                             } else {
00884                                    StrBufPrintf(Buf, 
00885                                                _("User '%s' kicked out of room '%s'."), 
00886                                                ChrPtr(User), 
00887                                                ChrPtr(WCC->CurRoom.name)
00888                                           );
00889                                    AppendImportantMessage(SKEY(Buf));
00890                             }
00891                      }
00892                      else if ((StrLength(User) > 0) && (Invite))
00893                      {
00894                             serv_printf("INVT %s", ChrPtr(User));
00895                             if (StrBuf_ServGetln(Buf) < 0)
00896                                    break;
00897                             if (GetServerStatus(Buf, NULL) != 2) {
00898                                    StrBufCutLeft(Buf, 4);
00899                                    AppendImportantMessage(SKEY(Buf));
00900                             } else {
00901                                    StrBufPrintf(Buf, 
00902                                                _("User '%s' invited to room '%s'."), 
00903                                                ChrPtr(User), 
00904                                                ChrPtr(WCC->CurRoom.name)
00905                                           );
00906                                    AppendImportantMessage(SKEY(Buf));
00907                             }
00908                      }
00909                 }
00910         }
00911 
00912        output_headers(1, 1, 1, 0, 0, 0);  
00913        do_template("room_edit");
00914        wDumpContent(1);
00915 }
00916 
00917 
00918 /*
00919  * Create a new room
00920  */
00921 void entroom(void)
00922 {
00923        StrBuf *Line;
00924        const StrBuf *er_name;
00925        const StrBuf *er_type;
00926        const StrBuf *er_password;
00927        int er_floor;
00928        int er_num_type;
00929        int er_view;
00930        wcsession *WCC = WC;
00931 
00932        if (!havebstr("ok_button")) {
00933               AppendImportantMessage(_("Cancelled.  No new room was created."), -1);
00934               display_main_menu();
00935               return;
00936        }
00937        er_name = sbstr("er_name");
00938        er_type = sbstr("type");
00939        er_password = sbstr("er_password");
00940        er_floor = ibstr("er_floor");
00941        er_view = ibstr("er_view");
00942 
00943        er_num_type = 0;
00944        if (!strcmp(ChrPtr(er_type), "hidden"))
00945               er_num_type = 1;
00946        else if (!strcmp(ChrPtr(er_type), "passworded"))
00947               er_num_type = 2;
00948        else if (!strcmp(ChrPtr(er_type), "invonly"))
00949               er_num_type = 3;
00950        else if (!strcmp(ChrPtr(er_type), "personal"))
00951               er_num_type = 4;
00952 
00953        serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d", 
00954                   ChrPtr(er_name), 
00955                   er_num_type, 
00956                   ChrPtr(er_password), 
00957                   er_floor, 
00958                   0, 
00959                   er_view);
00960 
00961        Line = NewStrBuf();
00962        StrBuf_ServGetln(Line);
00963        if (GetServerStatusMsg(Line, NULL, 1, 2) != 2) {
00964               FreeStrBuf(&Line);
00965               display_main_menu();
00966               return;
00967        }
00969        gotoroom(er_name);
00970 
00971        serv_printf("VIEW %d", er_view);
00972        StrBuf_ServGetln(Line);
00973        FreeStrBuf(&Line); /* TODO: should we care about errors? */
00974        WCC->CurRoom.view = er_view;
00975 
00976        if ( (WCC != NULL) && ( (WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) )  {
00977               output_headers(1, 1, 1, 0, 0, 0);  
00978               do_template("room_edit");
00979               wDumpContent(1);
00980        } else {
00981               smart_goto(WCC->CurRoom.name);
00982        }
00983        FreeStrBuf(&Line);
00984 }
00985 
00986 
00987 
00988 
00989 
00990 /*
00991  * Change the view for this room
00992  */
00993 void change_view(void) {
00994        int newview;
00995        char buf[SIZ];
00996 
00997        newview = lbstr("view");
00998        serv_printf("VIEW %d", newview);
00999        serv_getln(buf, sizeof buf);
01000        WC->CurRoom.view = newview;
01001        smart_goto(WC->CurRoom.name);
01002 }
01003 
01004 
01005 
01006 /*
01007  * Set the message expire policy for this room and/or floor
01008  */
01009 void set_room_policy(void) {
01010 
01011        if (!havebstr("ok_button")) {
01012               AppendImportantMessage(_("Cancelled.  Changes were not saved."), -1);
01013               output_headers(1, 1, 1, 0, 0, 0);  
01014               do_template("room_edit");
01015               wDumpContent(1);
01016               return;
01017        }
01018 
01019        StrBuf *Line = NewStrBuf();
01020 
01021        serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
01022        StrBuf_ServGetln(Line);
01023        GetServerStatusMsg(Line, NULL, 1, 0);
01024        if (WC->axlevel >= 6) {
01025               serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
01026               StrBuf_ServGetln(Line);
01027               GetServerStatusMsg(Line, NULL, 1, 0);
01028        }
01029        FreeStrBuf(&Line);
01030        ReloadCurrentRoom();
01031 
01032        output_headers(1, 1, 1, 0, 0, 0);  
01033        do_template("room_edit");
01034        wDumpContent(1);
01035 }
01036 
01037 
01038 
01039 /*
01040  * Perform changes to a room's network configuration
01041  */
01042 void netedit(void) {
01043        char buf[SIZ];
01044        char line[SIZ];
01045        char cmpa0[SIZ];
01046        char cmpa1[SIZ];
01047        char cmpb0[SIZ];
01048        char cmpb1[SIZ];
01049        int i, num_addrs;
01050        StrBuf *Line;
01051        StrBuf *TmpBuf;
01052        int Done;
01053 
01054         if (havebstr("force_room")) {
01055                 gotoroom(sbstr("force_room"));
01056        }
01057        /*/ TODO: do line dynamic! */
01058        if (havebstr("line_pop3host")) {
01059               strcpy(line, bstr("prefix"));
01060               strcat(line, bstr("line_pop3host"));
01061               strcat(line, "|");
01062               strcat(line, bstr("line_pop3user"));
01063               strcat(line, "|");
01064               strcat(line, bstr("line_pop3pass"));
01065               strcat(line, "|");
01066               strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
01067               strcat(line, "|");
01068               sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
01069               strcat(line, bstr("suffix"));
01070        }
01071        else if (havebstr("line")) {
01072               strcpy(line, bstr("prefix"));
01073               strcat(line, bstr("line"));
01074               strcat(line, bstr("suffix"));
01075        }
01076        else {
01077               output_headers(1, 1, 1, 0, 0, 0);  
01078               do_template("room_edit");
01079               wDumpContent(1);
01080               return;
01081        }
01082 
01083        Line = NewStrBuf();
01084        TmpBuf = NewStrBuf();
01085        serv_puts("GNET");
01086        StrBuf_ServGetln(Line);
01087        if  (GetServerStatus(Line, NULL) != 1) {
01088               AppendImportantMessage(SRV_STATUS_MSG(Line));    
01089               FreeStrBuf(&Line);
01090               output_headers(1, 1, 1, 0, 0, 0);  
01091               do_template("room_edit");
01092               wDumpContent(1);
01093               return;
01094        }
01095 
01097        Done = 0;
01098        extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
01099        extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
01100        while (!Done && StrBuf_ServGetln(Line)>=0) {
01101               if ( (StrLength(Line)==3) && 
01102                    !strcmp(ChrPtr(Line), "000")) 
01103               {
01104                      Done = 1;
01105               }
01106               else
01107               {
01108                      extract_token(cmpa0, ChrPtr(Line), 0, '|', sizeof cmpa0);
01109                      extract_token(cmpa1, ChrPtr(Line), 1, '|', sizeof cmpa1);
01110                      if ( (strcasecmp(cmpa0, cmpb0)) 
01111                           || (strcasecmp(cmpa1, cmpb1)) ) {
01112                             StrBufAppendBufPlain(Line, HKEY("\n"), 0);
01113                             StrBufAppendBuf(TmpBuf, Line, 0);
01114                      }
01115               }
01116        }
01117 
01118        serv_puts("SNET");
01119        StrBuf_ServGetln(Line);
01120        if  (GetServerStatus(Line, NULL) != 4) {
01121 
01122               AppendImportantMessage(SRV_STATUS_MSG(Line));    
01123               output_headers(1, 1, 1, 0, 0, 0);  
01124               do_template("room_edit");
01125               wDumpContent(1);
01126               FreeStrBuf(&Line);
01127               FreeStrBuf(&TmpBuf);
01128               return;
01129        }
01130 
01131        serv_putbuf(TmpBuf);
01132        FreeStrBuf(&TmpBuf);
01133 
01134        if (havebstr("add_button")) {
01135               num_addrs = num_tokens(bstr("line"), ',');
01136               if (num_addrs < 2) {
01137                      /* just adding one node or address */
01138                      serv_puts(line);
01139               }
01140               else {
01141                      /* adding multiple addresses separated by commas */
01142                      for (i=0; i<num_addrs; ++i) {
01143                             strcpy(line, bstr("prefix"));
01144                             extract_token(buf, bstr("line"), i, ',', sizeof buf);
01145                             striplt(buf);
01146                             strcat(line, buf);
01147                             strcat(line, bstr("suffix"));
01148                             serv_puts(line);
01149                      }
01150               }
01151        }
01152 
01153        serv_puts("000");
01154        FlushIgnetCfgs(&WC->CurRoom);
01155        FreeStrBuf(&Line);
01156 
01157        output_headers(1, 1, 1, 0, 0, 0);  
01158        do_template("room_edit");
01159        wDumpContent(1);
01160 }
01161 
01162 /*
01163  * Known rooms list (box style)
01164  */
01165 void knrooms(void)
01166 {
01167        DeleteHash(&WC->Rooms);
01168        output_headers(1, 1, 1, 0, 0, 0); 
01169        do_template("knrooms");
01170        wDumpContent(1);
01171 }
01172 
01173 
01174 
01175 
01176 
01177 
01178 
01179 
01180 
01181 
01182 
01183 
01184 
01185 
01186 
01187 
01188 
01189 
01190 /*******************************************************************************
01191  ********************** FLOOR Coomands *****************************************
01192  ******************************************************************************/
01193 
01194 
01195 
01196 /*
01197  * delete the actual floor
01198  */
01199 void delete_floor(void) {
01200        int floornum;
01201        StrBuf *Buf;
01202        const char *Err;
01203               
01204        floornum = ibstr("floornum");
01205        Buf = NewStrBuf();
01206        serv_printf("KFLR %d|1", floornum);
01207        
01208        StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err);
01209 
01210        if (GetServerStatus(Buf, NULL) == 2) {
01211               StrBufPlain(Buf, _("Floor has been deleted."),-1);
01212        }
01213        else {
01214               StrBufCutLeft(Buf, 4);
01215        }
01216        AppendImportantMessage (SKEY(Buf));
01217 
01218        FlushRoomlist();
01219        http_transmit_thing(ChrPtr(do_template("floors")), 0);
01220        FreeStrBuf(&Buf);
01221 }
01222 
01223 /*
01224  * start creating a new floor
01225  */
01226 void create_floor(void) {
01227        StrBuf *Buf;
01228        const char *Err;
01229 
01230        Buf = NewStrBuf();
01231        serv_printf("CFLR %s|1", bstr("floorname"));
01232        StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err);
01233 
01234        if (GetServerStatus(Buf, NULL) == 2) {
01235               StrBufPlain(Buf, _("New floor has been created."),-1);
01236        }
01237        else {
01238               StrBufCutLeft(Buf, 4);
01239        }
01240        AppendImportantMessage (SKEY(Buf));
01241        FlushRoomlist();
01242        http_transmit_thing(ChrPtr(do_template("floors")), 0);
01243        FreeStrBuf(&Buf);
01244 }
01245 
01246 
01247 /*
01248  * rename this floor
01249  */
01250 void rename_floor(void) {
01251        StrBuf *Buf;
01252 
01253        Buf = NewStrBuf();
01254        FlushRoomlist();
01255 
01256        serv_printf("EFLR %d|%s", ibstr("floornum"), bstr("floorname"));
01257        StrBuf_ServGetln(Buf);
01258 
01259        StrBufCutLeft(Buf, 4);
01260        AppendImportantMessage (SKEY(Buf));
01261 
01262        http_transmit_thing(ChrPtr(do_template("floors")), 0);
01263        FreeStrBuf(&Buf);
01264 }
01265 
01266 
01267 
01268 void jsonRoomFlr(void) 
01269 {
01270        /* Send as our own (application/json) content type */
01271        hprintf("HTTP/1.1 200 OK\r\n");
01272        hprintf("Content-type: application/json; charset=utf-8\r\n");
01273        hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
01274        hprintf("Connection: close\r\n");
01275        hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
01276        begin_burst();
01277        DoTemplate(HKEY("json_roomflr"),NULL,&NoCtx);
01278        end_burst(); 
01279 }
01280 
01281 void _FlushRoomList(wcsession *WCC)
01282 {
01283        free_march_list(WCC);
01284        DeleteHash(&WCC->Floors);
01285        DeleteHash(&WCC->Rooms);
01286        DeleteHash(&WCC->FloorsByName);
01287        FlushFolder(&WCC->CurRoom);
01288 }
01289 
01290 void ReloadCurrentRoom(void)
01291 {
01292        wcsession *WCC = WC;
01293        StrBuf *CurRoom;
01294 
01295        CurRoom = WCC->CurRoom.name;
01296        WCC->CurRoom.name = NULL;
01297        _FlushRoomList(WCC);
01298        gotoroom(CurRoom);
01299        FreeStrBuf(&CurRoom);
01300 }
01301 
01302 void FlushRoomlist(void)
01303 {
01304        wcsession *WCC = WC;
01305        _FlushRoomList(WCC);
01306 }
01307 
01308 
01309 void 
01310 InitModule_ROOMOPS
01311 (void)
01312 {
01313        RegisterPreference("roomlistview",
01314                            _("Room list view"),
01315                            PRF_STRING,
01316                            NULL);
01317         RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
01318 
01319        WebcitAddUrlHandler(HKEY("json_roomflr"), "", 0, jsonRoomFlr, 0);
01320 
01321        WebcitAddUrlHandler(HKEY("delete_floor"), "", 0, delete_floor, 0);
01322        WebcitAddUrlHandler(HKEY("rename_floor"), "", 0, rename_floor, 0);
01323        WebcitAddUrlHandler(HKEY("create_floor"), "", 0, create_floor, 0);
01324 
01325        WebcitAddUrlHandler(HKEY("knrooms"), "", 0, knrooms, ANONYMOUS);
01326        WebcitAddUrlHandler(HKEY("dotgoto"), "", 0, dotgoto, NEED_URL);
01327        WebcitAddUrlHandler(HKEY("dotskip"), "", 0, dotskip, NEED_URL);
01328 
01329        WebcitAddUrlHandler(HKEY("goto_private"), "", 0, goto_private, NEED_URL);
01330        WebcitAddUrlHandler(HKEY("zap"), "", 0, zap, 0);
01331        WebcitAddUrlHandler(HKEY("entroom"), "", 0, entroom, 0);
01332        WebcitAddUrlHandler(HKEY("do_invt_kick"), "", 0, do_invt_kick, 0);
01333        
01334        WebcitAddUrlHandler(HKEY("netedit"), "", 0, netedit, 0);
01335        WebcitAddUrlHandler(HKEY("editroom"), "", 0, editroom, 0);
01336        WebcitAddUrlHandler(HKEY("delete_room"), "", 0, delete_room, 0);
01337        WebcitAddUrlHandler(HKEY("set_room_policy"), "", 0, set_room_policy, 0);
01338        WebcitAddUrlHandler(HKEY("changeview"), "", 0, change_view, 0);
01339        WebcitAddUrlHandler(HKEY("toggle_self_service"), "", 0, toggle_self_service, 0);
01340 
01341 
01342        REGISTERTokenParamDefine(QR_PERMANENT);
01343        REGISTERTokenParamDefine(QR_INUSE);
01344        REGISTERTokenParamDefine(QR_PRIVATE);
01345        REGISTERTokenParamDefine(QR_PASSWORDED);
01346        REGISTERTokenParamDefine(QR_GUESSNAME);
01347        REGISTERTokenParamDefine(QR_DIRECTORY);
01348        REGISTERTokenParamDefine(QR_UPLOAD);
01349        REGISTERTokenParamDefine(QR_DOWNLOAD);
01350        REGISTERTokenParamDefine(QR_VISDIR);
01351        REGISTERTokenParamDefine(QR_ANONONLY);
01352        REGISTERTokenParamDefine(QR_ANONOPT);
01353        REGISTERTokenParamDefine(QR_NETWORK);
01354        REGISTERTokenParamDefine(QR_PREFONLY);
01355        REGISTERTokenParamDefine(QR_READONLY);
01356        REGISTERTokenParamDefine(QR_MAILBOX);
01357        REGISTERTokenParamDefine(QR2_SYSTEM);
01358        REGISTERTokenParamDefine(QR2_SELFLIST);
01359        REGISTERTokenParamDefine(QR2_COLLABDEL);
01360        REGISTERTokenParamDefine(QR2_SUBJECTREQ);
01361        REGISTERTokenParamDefine(QR2_SMTP_PUBLIC);
01362        REGISTERTokenParamDefine(QR2_MODERATED);
01363 
01364        REGISTERTokenParamDefine(UA_KNOWN);
01365        REGISTERTokenParamDefine(UA_GOTOALLOWED);
01366        REGISTERTokenParamDefine(UA_HASNEWMSGS);
01367        REGISTERTokenParamDefine(UA_ZAPPED);
01368        REGISTERTokenParamDefine(UA_POSTALLOWED);
01369        REGISTERTokenParamDefine(UA_ADMINALLOWED);
01370        REGISTERTokenParamDefine(UA_DELETEALLOWED);
01371        REGISTERTokenParamDefine(UA_ISTRASH);
01372 
01373        REGISTERTokenParamDefine(US_NEEDVALID);
01374        REGISTERTokenParamDefine(US_PERM);
01375        REGISTERTokenParamDefine(US_LASTOLD);
01376        REGISTERTokenParamDefine(US_EXPERT);
01377        REGISTERTokenParamDefine(US_UNLISTED);
01378        REGISTERTokenParamDefine(US_NOPROMPT);
01379        REGISTERTokenParamDefine(US_PROMPTCTL);
01380        REGISTERTokenParamDefine(US_DISAPPEAR);
01381        REGISTERTokenParamDefine(US_REGIS);
01382        REGISTERTokenParamDefine(US_PAGINATOR);
01383        REGISTERTokenParamDefine(US_INTERNET);
01384        REGISTERTokenParamDefine(US_FLOORS);
01385        REGISTERTokenParamDefine(US_COLOR);
01386        REGISTERTokenParamDefine(US_USER_SET);
01387 
01388        REGISTERTokenParamDefine(VIEW_BBS);
01389        REGISTERTokenParamDefine(VIEW_MAILBOX);   
01390        REGISTERTokenParamDefine(VIEW_ADDRESSBOOK);
01391        REGISTERTokenParamDefine(VIEW_CALENDAR);  
01392        REGISTERTokenParamDefine(VIEW_TASKS);     
01393        REGISTERTokenParamDefine(VIEW_NOTES);            
01394        REGISTERTokenParamDefine(VIEW_WIKI);             
01395        REGISTERTokenParamDefine(VIEW_CALBRIEF);
01396        REGISTERTokenParamDefine(VIEW_JOURNAL);
01397        REGISTERTokenParamDefine(VIEW_BLOG);
01398 
01399        /* GNET types: */
01400        /* server internal, we need to know but ignore them. */
01401        REGISTERTokenParamDefine(subpending);
01402        REGISTERTokenParamDefine(unsubpending);
01403        REGISTERTokenParamDefine(lastsent);
01404 
01405        REGISTERTokenParamDefine(ignet_push_share);
01406        { /* these are the parts of an IGNET push config */
01407               REGISTERTokenParamDefine(GNET_IGNET_NODE);
01408               REGISTERTokenParamDefine(GNET_IGNET_ROOM);
01409        }
01410        REGISTERTokenParamDefine(listrecp);
01411        REGISTERTokenParamDefine(digestrecp);
01412        REGISTERTokenParamDefine(pop3client);
01413        { /* These are the parts of a pop3 client line... */
01414               REGISTERTokenParamDefine(GNET_POP3_HOST);
01415               REGISTERTokenParamDefine(GNET_POP3_USER);
01416               REGISTERTokenParamDefine(GNET_POP3_DONT_DELETE_REMOTE);
01417               REGISTERTokenParamDefine(GNET_POP3_INTERVAL);
01418        }
01419        REGISTERTokenParamDefine(rssclient);
01420        REGISTERTokenParamDefine(participate);
01421 
01422 
01423 
01424 }
01425 
01426 
01427 void 
01428 SessionDestroyModule_ROOMOPS
01429 (wcsession *sess)
01430 {
01431        _FlushRoomList (sess);
01432 }
01433