/* * InitMsgBase() * * This function opens the msg base(s), inits the msg buffers. */ void InitMsgBase() { SYS_FILE name; makeSysName(name, "ctdlmsg.sys", &cfg.msgArea); openFile(name, &msgfl); if (cfg.BoolFlags.mirror) { makeSysName(name, "ctdlmsg.sys", &cfg.msg2Area); openFile(name, &msgfl2); } InitBuffers(); }
/* * InitExternEditors() * * This is an initialization function for outside editors. */ void InitExternEditors() { SYS_FILE fn; makeSysName(fn, "editors.sys", &cfg.roomArea); MakeList(&ExtEditors, fn, NULL); }
/* * RemoveUser() * * This function handles removing a user from the log. */ void RemoveUser(int logNo, logBuffer *lBuf) { extern SListBase Moderators; extern SListBase MailForward; SYS_FILE killHeld; void *RemoveModerator(); char heldbuf[20]; /* remove old held message */ if (cfg.BoolFlags.HoldOnLost) { sprintf(heldbuf, LCHeld, logNo); makeSysName(killHeld, heldbuf, &cfg.holdArea); unlink(killHeld); } /* remove mail forwarding */ KillData(&MailForward, lBuf->lbname); UpdateForwarding(); /* remove moderator listing */ AltKillData(&Moderators, RemoveModerator, lBuf->lbname); WriteAList(&Moderators, "ctdlmodr.sys", WrtNtoStr); /* remove bio */ ClearBio(logNo); /* clear ignore mail stuff */ IgMailRemoveEntries(logNo, -1); IgMailRemoveEntries(-1, logNo); }
/* * MakeDomainDirectory() * * This will make a domain directory. */ void DoDomainDirectory(int i, char kill) { char num[8]; DOMAIN_FILE name; sprintf(num, "%d", i); makeSysName(name, num, &cfg.domainArea); if (kill) rmdir(name); else mkdir(name); }
/* * UpdateSharedRooms() * * This function updates the disk version of the shared rooms with dirty records * in the RAM list. */ void UpdateSharedRooms() { char flag; SYS_FILE shared; void UpdateSR(), FindDirty(); flag = FALSE; RunListA(&SharedRooms, FindDirty, &flag); if (flag) { makeSysName(shared, "shared.sys", &cfg.netArea); if ((sharedfd = fopen(shared, R_W_ANY)) == NULL) { if ((sharedfd = fopen(shared, WRITE_ANY)) == NULL) { printf("CAN'T UPDATE SHARED ROOM FILE!\n"); return; } } RunList(&SharedRooms, UpdateSR); fclose(sharedfd); } }
/* * initSharedRooms() * * This function initializes the shared rooms of the system. It reads the * shared room information from shared.sys and places it in the internal list * SharedRooms, where each record is not a SharedRoom, but a SharedRoomData. * This data type includes a slot number and a flags field including a dirty * bit-flag, which indicates if the given record needs to be written. * * This list is periodically written out as needed, so we are basically * mirroring the the disk list with a RAM list. */ void initSharedRooms(char check) { SharedRoom *room; SharedRoomData *roomd; SYS_FILE shared; makeSysName(shared, "shared.sys", &cfg.netArea); if ((sharedfd = fopen(shared, READ_ANY)) != NULL) { room = GetDynamic(sizeof *room); while (fread(room, sizeof *room, 1, sharedfd) > 0) { roomd = GetDynamic(sizeof *roomd); roomd->slot = SR_Count++; roomd->srd_flags = 0; roomd->room = room; AddData(&SharedRooms, roomd, NULL, TRUE); room = GetDynamic(sizeof *room); } free(room); fclose(sharedfd); } }