/* * ZeroMsgBuffer() * * This function zeroes a message buffer. This includes clearing lists out * legally, etc. */ void ZeroMsgBuffer(MessageBuffer *msg) { memset(msg, 0, STATIC_MSG_SIZE); KillList(&msg->mbCC); KillList(&msg->mbOverride); KillList(&msg->mbForeign); KillList(&msg->mbInternal); msg->mbtext[0] = 0; }
/* * ResolveDLStuff() * * Resolves the DL list when a limit changes. Basically, we clear the list of * all users, but if someone is currently on, we wish to retain the user's * record. So, we make a copy of it, clear the list, and then restore the * user's record to the list. This code and related code elsewhere should * help minimize the 'cheating user' problem. */ void ResolveDLStuff() { TwoNumbers *tmp = NULL; extern int thisLog; /* entry currently in logBuf */ extern char loggedIn; if (!ResolveDls) { ResolveDls = TRUE; return; } if (loggedIn) /* this makes a copy if someone is on */ tmp = MakeTwo(thisLog, *DL_Total); KillList(&DL_List); /* Now clear the list */ if (tmp != NULL) { /* If someone is on, re-add to the list */ AddData(&DL_List, tmp, NULL, TRUE); DL_Total = &tmp->second; /* And keep pointing */ } }
BOOL DropDown::Init(CWindowID Window, CGadgetID Gadget) { if (Window) { wxWindow * pGadget = DialogManager::GetGadget(Window, Gadget); if (pGadget && pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox))) { if (!Initialised) // Only ever add myself to the list once { m_pPopup = new wxCamVListBoxComboPopup(this); ERROR2IF(!m_pPopup, FALSE, "Could not get new list popup"); ((wxOwnerDrawnComboBox *)pGadget)->SetPopupControl(m_pPopup); CurrentDropDowns.AddHead(this); } ParentDlg = Window; ParentGadget = Gadget; Initialised = TRUE; return(TRUE); } ERROR3("DropDown::Init failed - illegal Gadget"); return(FALSE); } else { // release all memory KillList(); ClearList(); ParentDlg=NULL; ParentGadget=0; Initialised=FALSE; CurrentDropDowns.RemoveItem(this); return TRUE; } }
BOOL DocumentFontDropDown::FillInFontList(Document * WorkDoc) { ERROR2IF(ParentDlg == NULL, FALSE, "FontDropDown not properly initialised"); BeginSlowJob(); SetListRedraw(FALSE); // Disable redraw while updating KillList(); // Delete combobox contents and empty the fonts list //ClearList(); // Delete combobox contents // Setup the static class pointer variable so we can add things to this dropdown... CurrentFontDropDown = (void *)this; //if(Fonts.GetCount() == 0) //{ if (WorkDoc == NULL) { // Fill in one item in the list which is no document fonts being used String_8 DashString(_R(IDS_K_FINFODLG_DASH)); TheTopItem.FontName = DashString; TheTopItem.Type = FC_UNDEFINED; //AddFontToList((TCHAR*)&TheTopItem.FontName, TheTopItem.Type); } else { // Build the font list for the specified document // This will NOT be alphabetical FontList DocFonts; DocFonts.Build(WorkDoc); FontListItem* FontItem = DocFonts.GetFirstItem(); if (FontItem == NULL) { // Fill in one item in the list which is no document fonts being used TheTopItem.FontName = _R(IDS_NO_FONTSINDOC); TheTopItem.Type = FC_UNDEFINED; //AddFontToList((TCHAR*)&TheTopItem.FontName, TheTopItem.Type); } else { //BOOL FirstInList = TRUE; // fill up the list while (FontItem != NULL) { // get the name String_64 Name = FontItem->GetFontName(); WORD Handle = FONTMANAGER->GetFontHandle(&Name); // check the style INT32 Style = FontItem->GetFontStyle(); if(Style & 1) Name += _T(" -Bold"); if(Style & 2) Name += _T(" -Italic"); if(Handle > 0) { if (FONTMANAGER->IsFontReplaced(Handle)) Name += _T(" *"); } FontClass Type = FontItem->GetFontClass(); AddFontToList(Name, Type); FontItem = DocFonts.GetNextItem(FontItem); ContinueSlowJob(); } } } //} // Work out the top item, if any, on the alphabetically sorted list // ready for putting in the top combo box item FontDropItem *pTopItem = (FontDropItem *)Fonts.GetHead(); if (pTopItem != NULL) { // Fill in the top item in the list TheTopItem.FontName = pTopItem->FontName; TheTopItem.Type = pTopItem->Type; } ListItem *Item = Fonts.GetHead(); while (Item != NULL) { // Add the font in the list to the combo box AddItem((void *) Item); // Try the next item Item = Fonts.GetNext(Item); } // Re-enable redraw SetListRedraw(TRUE); // We have no concept of a selected font SetSelectedIndex(-1); EndSlowJob(); return(TRUE); }
DocumentFontDropDown::~DocumentFontDropDown() { KillList(); }
/* * DoTimeouts() * * This is the function responsible for actual checking of timeouts. It * returns TRUE if you want modIn to break out, too. It should only be called * from modIn(). */ char DoTimeouts() { int yr, dy, hr, mn, temp, mon, secs, milli; static char warned = FALSE; #ifdef SYSTEM_CLOCK static int LastMinute = -1; #endif static int LastDay = 0; extern int PriorityMail; TwoNumbers *tmp; EvDoorRec *evtmp; extern SListBase UntilNetSessions; void Activate(); char Oldpage; getRawDate(&yr, &mon, &dy, &hr, &mn, &secs, &milli); #ifdef SYSTEM_CLOCK if (LastMinute != mn) { ScrTimeUpdate(hr, mn); LastMinute = mn; } #endif if (LastDay != dy) { LastDay = dy; RunListA(&DayBased, Activate, (void *) &LastDay); } ThisMinute = (WhatDay() * 1440) + (hr * 60) + mn; ThisAbsolute = (long) ThisMinute; ThisSecond = ThisAbsolute * 60 + secs; ThisAbsolute = CurAbsolute(); /* First we deal with events which are deactivating */ if ((tmp = GetFirst(&EventEnds)) != NULL) { if (ThisAbsolute >= tmp->second) { /* event is ending! */ ClassActive[tmp->first] = FALSE; KillData(&EventEnds, tmp); /* take it off the list */ if (tmp->first == CL_DL_TIME) ResolveDLStuff(); } } if ((evtmp = GetFirst(&AutoDoors)) != NULL) { if (ThisAbsolute >= evtmp->finish) { /* autodoor finish */ KillData(&AutoDoors, evtmp); } } if ((evtmp = GetFirst(&Redirected)) != NULL) { if (ThisAbsolute >= evtmp->finish) { /* redirection finish */ KillData(&Redirected, evtmp); } } /* Next we deal with preemptive events, which are Type 0 */ /* give a warning at T-5 */ if ((Cur = GetFirst(&Types[0].List)) != NULL && !warned && Types[0].NextAbs - ThisAbsolute < 300l && onLine()) { temp = Cur->EvMinutes % 1440; warned = TRUE; outFlag = IMPERVIOUS; Oldpage = Pageable; Pageable = FALSE; mPrintf("\n %cWARNING: System going down at %d:%02d for %s.\n ", BELL, temp/60, temp%60, Cur->EvWarn + cfg.codeBuf); outFlag = OUTOK; Pageable = Oldpage; return FALSE; } else if (Cur != NULL && Types[0].NextAbs < ThisAbsolute) { if (onLine()) { /* first boot off user, next time do event */ outFlag = IMPERVIOUS; PagingOff(); mPrintf("\n %cGoing to %s, bye!\n ", BELL, Cur->EvWarn + cfg.codeBuf); if (onConsole) { /* Ugly cheat */ onConsole = FALSE; whichIO = MODEM; justLostCarrier = TRUE; EnableModem(FALSE); } else HangUp(FALSE); outFlag = OUTOK; return TRUE; } warned = FALSE; return FigureEvent(0); } if (!onLine() && (Cur = GetFirst(&Types[1].List)) != NULL && Types[1].NextAbs < ThisAbsolute) return FigureEvent(1); if ((Cur = GetFirst(&Types[2].List)) != NULL && Types[2].NextAbs < ThisAbsolute) return FigureEvent(2); /* check priority mail -- odd place for the check, but wotthehell */ if (PriorityMail) { if (!onLine()) { netController((hr*60) + mn, 0, PRIORITY_MAIL, ANYTIME_NET, 0); PriorityMail = 0; } } /* handle anytime netting here - is special type of thing */ if (chkTimeSince(NEXT_ANYNET) > DeadTime || ForceNet) { if (ClassActive[CL_ANYTIME_NET]) { if (!onLine()) { netController((hr * 60) + mn, AnyNetLen, AnyTimeNets, ANYTIME_NET, 0); ScrNewUser(); ForceNet = FALSE; } } else ForceNet = FALSE; startTimer(NEXT_ANYNET); } /* * now see if we have any other net sessions due to be run. These are * sessions scheduled by the user from the Net menu. If so, run each of * them by killing the list (the kill function should run each). */ if (!onLine() && GetFirst(&UntilNetSessions) != NULL) { KillList(&UntilNetSessions); } return ExitToMsdos; }
/* * getModemId() * * This tries to read the baud id from modem. */ int getModemId() { NumToString *temp = NULL; char c; extern FILE *netLog; TimePacket ff; int i; void FindSpeed(); RunListA(&ReceivedResults, FindSpeed, &temp); KillList(&ReceivedResults); if (temp != NULL) { BaudFlags = temp->num2; if (R_FAX == temp->num) RunFax(); memset(IdBuffer, 0, sizeof IdBuffer); return temp->num; } setTimer(&ff); i = strlen(IdBuffer); while (timeSince(&ff) < 5l) { if (MIReady()) { if ((c = Citinp()) == '\r' || c == '\n') { IdBuffer[i] = 0; temp = SearchList(&ResList, IdBuffer); if (temp != NULL) switch (temp->num) { case R_300: case R_1200: case R_2400: case R_4800: case R_9600: case R_14400: case R_19200: BaudFlags = temp->num2; memset(IdBuffer, 0, sizeof IdBuffer); return temp->num; case R_FAX: RunFax(); IdBuffer[0] = 0; memset(IdBuffer, 0, sizeof IdBuffer); return ERROR; } else printf("Search for %s failed\n", IdBuffer); i = 0; /* restart buffer filling */ } else { if (c != '\n') { IdBuffer[i++] = c; } if (c == '\n' ||i >= BA_BUF_SIZE - 4) { /* Fudge factor */ memset(IdBuffer, 0, sizeof IdBuffer); i = 0; } } } } IdBuffer[i] = 0; /* debug for now */ splitF(netLog, "autobaud failure, modem spat -%s-\n", IdBuffer); memset(IdBuffer, 0, sizeof IdBuffer); return ERROR; }