示例#1
0
int CardDevice::at_response_no_dialtone()
{
    Debug(DebugAll, "[%s] Datacard reports 'NO DIALTONE'", c_str());
    m_needchup = 1;
    Hangup(DATACARD_CONGESTION);
    return 0;
}
示例#2
0
int CardDevice::at_response_no_carrier()
{
    Debug(DebugAll, "[%s] Datacard reports 'NO CARRIER'", c_str());
    m_needchup = 1;
    Hangup(DATACARD_CONGESTION);
    return 0;
}
示例#3
0
int CardDevice::at_response_cend(char* str, size_t len)
{
    int call_index = 0;
    int duration   = 0;
    int end_status = 0;
    int cc_cause   = 0;

    /*
     * parse CEND info in the following format:
     * ^CEND:<call_index>,<duration>,<end_status>[,<cc_cause>]
     */

    if (!sscanf (str, "^CEND:%d,%d,%d,%d", &call_index, &duration, &end_status, &cc_cause))
    {
    	Debug(DebugAll, "[%s] Could not parse all CEND parameters", c_str());
    }

    Debug(DebugAll, "[%s] CEND: call_index: %d", c_str(), call_index);
    Debug(DebugAll, "[%s] CEND: duration:   %d", c_str(), duration);
    Debug(DebugAll, "[%s] CEND: end_status: %d", c_str(), end_status);
    Debug(DebugAll, "[%s] CEND: cc_cause:   %d", c_str(), cc_cause);

    Debug(DebugAll, "[%s] Line disconnected", c_str());
	
    m_needchup = 0;
//TODO:

    if(m_conn)
    {
	Debug(DebugAll, "[%s] hanging up owner", c_str());
		
	int reason = getReason(end_status, cc_cause);
			
	if(Hangup(reason) == false)
	{
	    Debug(DebugAll, "[%s] Error on hangup...", c_str());
	    return -1;
	}
    }
    m_incoming = 0;
    m_outgoing = 0;
    m_needring = 0;
    
    return 0;
}
示例#4
0
void TERMWINDOWMEMBER Initport(void)
	{
	Hangup();

	pause(50);

#ifndef WINCIT
	CommPort->Enable();
#endif

	CommPort->SetSpeed(cfg.initbaud);

	CommPort->OutString(cfg.modsetup);
	CommPort->OutString(br);

	pause(100);

	StatusLine.Update(WC_TWp);
	}
示例#5
0
void TERMWINDOWMEMBER receiveFiles(const protocols *theProt)
	{
	cPrintf(getnetmsg(101));
	doccr();

	wxrcv(LocalTempPath, roomdataIn, theProt);

	if (!filexists(roomdataIn))
		{
		CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(685), getmsg(74));

		Hangup();
		netFailed = TRUE;

		if (w)
			{
			destroyCitWindow(w, FALSE);
			}
		}
	}
示例#6
0
文件: sched.c 项目: skoneka/screen
static int sgihack()
{
  fd_set r, w;
  struct timeval tv;

  debug("IRIX5.2 workaround: searching for bad display\n");
  for (display = displays; display; )
    {
      FD_ZERO(&r);
      FD_ZERO(&w);
      FD_SET(D_userfd, &r);
      FD_SET(D_userfd, &w);
      tv.tv_sec = tv.tv_usec = 0;
      if (select(FD_SETSIZE, &r, &w, (fd_set *)0, &tv) == -1)
	{
	  if (errno == EINTR)
	    continue;
	  Hangup();	/* goodbye display */
	  return 1;
	}
      display = display->d_next;
    }
  return 0;
}
示例#7
0
int CardDevice::at_response_busy()
{
    m_needchup = 1;
    Hangup(DATACARD_BUSY);
    return 0;
}
示例#8
0
void TERMWINDOWMEMBER greeting(void)
	{
	MRO.Verbose = FALSE;

	if (loggedIn)
		{
		terminate(FALSE);
		}

	OC.Echo = BOTH;
	OC.setio();

	setdefaultconfig(FALSE);

	pause(10);

	cls(SCROLL_SAVE);

	doccr();

	StatusLine.Update(WC_TWp);

	if (modStat)
		{
		if (cfg.connectwait)
			{
			CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(84));

			pause(cfg.connectwait * 100);

			if (w)
				{
				destroyCitWindow(w, FALSE);
				}
			}

		CommPort->FlushInput();
		}

	// make sure we want to talk to this baud rate
	if (modStat && (CommPort->GetModemSpeed() < cfg.minbaud))
		{
		dispBlb(B_TOOLOW);

		CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(82));

		Hangup();
		pause(200);

		if (w)
			{
			destroyCitWindow(w, FALSE);
			}
		}
	else
		{
		OC.User.SetCanControlD(TRUE);

		// set terminal
		autoansi();

		OC.SetOutFlag(OUTOK);

		if (modStat || debug)
			{
			hello();
			doCR();
			}

		OC.SetOutFlag(OUTOK);

		mPrintfCR(getmsg(683), cfg.nodeTitle, cfg.nodeRegion, cfg.nodeCountry);
		mPrintfCR(getmsg(682), cfg.softverb, *cfg.softverb ? spc : ns, programName, version);
		mPrintf(pcts, Author);

#if VERSION != RELEASE
		doCR();
#ifndef HARRY
		CRCRmPrintfCR(" 2=== 1NOTE02 ===0");
#else
        CRCRmPrintfCR(" 2=== NOTE ===0");
#endif
#ifndef NDEBUG
		CRmPrintf("This BBS is running pre-release software.  Because this is a test version ");
		mPrintf("of the software, it has extra code to assure that things are running as ");
		mPrintf("they should.  This may cause a noticeable slow-down in the operation of ");
		mPrintf("the board.  Also, because this is pre-release software, it may contain ");
		mPrintf("bugs that could cause a loss of data.  This is not likely, but it is best ");
		mPrintfCR("to be aware of potential problems before they surprise you.");
#else
		mPrintf("This BBS is running pre-release software.  Because this is pre-release ");
		mPrintf("software, it may contain ");
		mPrintf("bugs that could cause a loss of data.  This is not likely, but it is best ");
		mPrintfCR("to be aware of potential problems before they surprise you.");
#endif
#ifndef HARRY
		CRmPrintfCR(" 2=== 1NOTE02 ===0");
#else
        CRmPrintfCR(" 2=== NOTE ===0");
#endif
#endif


		char dtstr[80];
		strftime(dtstr, 79, cfg.vdatestamp, 0l);

		doCR();
		CRmPrintf(pcts, dtstr);

		if (!cfg.forcelogin)
			{
			CRmPrintf(getmsg(677));
			CRmPrintf(getmsg(678));
			CRmPrintf(getmsg(679));
			}

		CurrentRoom->Load(LOBBY);
		checkdir();
		thisRoom = LOBBY;

		const ulong messages = Talley->MessagesInRoom(thisRoom);

		CRmPrintfCR(getmsg(144), ltoac(messages), (messages == 1) ? cfg.Lmsg_nym : cfg.Lmsgs_nym);

		CommPort->FlushInput();
		}
	}
示例#9
0
int cdecl TERMWINDOWMEMBER GetOneKey(const char *prompt, const char *keys,
        const char dfault, BlurbFiles HelpBlurb, ...)
    {
    assert(strchr(keys, dfault));

    const char *FullNames[36];  // A-Z0-9 better be enough...

    va_list ap;

    int KeyCount = strlen(keys);
    if (KeyCount > 36)
        {
        KeyCount = 36;
        }

    va_start(ap, HelpBlurb);

    for (int n = 0; n < KeyCount; ++n)
        {
        FullNames[n] = va_arg(ap, const char *);
        }

    va_end(ap);

    Bool ShowFull = !CurrentUser->IsExpert();

    int RetVal;
    dowhattype oldDowhat = DoWhat;
    SetDoWhat(PROMPT);

    Bool DoAgain;

    do
        {
        doCR();

        OC.SetOutFlag(IMPERVIOUS);

        sprintf(gprompt, getmsg(52), prompt);

        if (ShowFull)
            {
            for (int i = 0; i < KeyCount; i++)
                {
                strcat(gprompt, FullNames[i]);
                strcat(gprompt, getmsg(138));
                }

            gprompt[strlen(gprompt) - 1] = 0;

            strcat(gprompt, getmsg(148));
            strcat(gprompt, FullNames[strpos(dfault, keys) - 1]);
            }
        else
            {
            // This whole bit is quite gross. cope.

            label Temp;
            Temp[1] = '/';
            Temp[2] = 0;

            for (int i = 0; i < KeyCount; i++)
                {
                Temp[0] = keys[i];
                strcat(gprompt, Temp);
                }

            gprompt[strlen(gprompt) - 1] = 0;

            Temp[0] = ')';
            Temp[1] = '[';
            Temp[2] = dfault;
            Temp[3] = 0;

            strcat(gprompt, Temp);
            }

        strcat(gprompt, getmsg(189));

        mPrintf(pcts, gprompt);

        int errors = 0;

        do
            {
            DoAgain = FALSE;
            int c = toupper(iCharNE());

            if ((c == '\n') || (c == '\r'))
                {
                c = dfault;
                }
            else if (c == ESC || (!c && !HaveConnectionToUser()))
                {
                doCR();
                RetVal = CERROR;
                break;
                }

            if (!c && HaveConnectionToUser())
                {
                continue;
                }

            if (strchr(keys, c))
                {
                RetVal = strpos((char) c, keys) - 1;
                mPrintfCR(pcts, FullNames[RetVal]);
                break;
                }
            else
                {
                if (c == '?')
                    {
                    DoAgain = TRUE;

                    if (ShowFull)
                        {
                        if (HelpBlurb == MAXBLBS)
                            {
                            CRmPrintfCR(getmsg(103));
                            }
                        else
                            {
                            doCR();
                            dispBlb(HelpBlurb);
                            }
                        }
                    else
                        {
                        ShowFull = TRUE;
                        doCR();
                        }

                    break;
                    }
                else
                    {
                    errors++;

                    if (errors > cfg.maxerror && !onConsole)
                        {
                        CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(685), getmsg(79));

                        Hangup();

                        if (w)
                            {
                            destroyCitWindow(w, FALSE);
                            }
                        }
                    }
                }
            } while (HaveConnectionToUser());
        } while (HaveConnectionToUser() && DoAgain);
                // This HaveConnectionToUser() is probably redundant, but safe

    OC.SetOutFlag(OUTOK);

    SetDoWhat(oldDowhat);

    if (!HaveConnectionToUser())
        {
        return (strpos(dfault, keys) - 1);
        }

    return (RetVal);
    }
示例#10
0
void renameRoom(void)
{ 
    char    pathname[64];
    char    summary[500];
    label   roomname;
    label   oldname;
    label   groupname;
    char    line[80];
    char    waspublic;
    int     groupslot;
    char    description[13];
    int     roomslot;
    BOOL    prtMess = TRUE;
    BOOL    quit    = FALSE;
    int     c;
    char    oldEcho;
   
    strcpy(oldname,roomBuf.rbname);
    if (!roomBuf.rbflags.MSDOSDIR)
    {
	roomBuf.rbdirname[0] = '\0';
    }

    doCR();

    do 
    {
	if (prtMess)
	{
	    doCR();
	    outFlag = OUTOK;
	    mPrintf("<3N0> Name.............. %s", roomBuf.rbname);   doCR();
	    mPrintf("<3I0> Infoline.......... %s", roomBuf.descript); doCR();
	    mPrintf("<3D0> Directory......... %s",
			     roomBuf.rbflags.MSDOSDIR
			     ? roomBuf.rbdirname : "None");             doCR();
	    
	    mPrintf("<3L0> Application....... %s",
			     roomBuf.rbflags.APLIC
			     ? roomBuf.rbaplic   : "None");             doCR();
	    
	    mPrintf("<3F0> Description File.. %s", 
			     roomBuf.rbroomtell[0]
			     ? roomBuf.rbroomtell : "None");            doCR();
	    
	    mPrintf("<3G0> Access Group...... %s", 
			     roomBuf.rbflags.GROUPONLY
			     ? grpBuf.group[roomBuf.rbgrpno].groupname
			     : "None");                                 doCR();
	    
	    mPrintf("<3V0> PriVileges Group.. %s",
			     roomBuf.rbflags.PRIVGRP
			     ? grpBuf.group[roomBuf.rbPgrpno].groupname
			     : "None");                                 doCR();
			     
	    if (roomBuf.rbflags.PRIVGRP)
	    {
		mPrintf("    Download only..... %s", 
			     roomBuf.rbflags.DOWNONLY ? "Yes" : "No" ); doCR();
		
		mPrintf("    Upload only....... %s", 
			     roomBuf.rbflags.UPONLY   ? "Yes" : "No" ); doCR();
		
		mPrintf("    Read Only......... %s", 
			     roomBuf.rbflags.READONLY ? "Yes" : "No" ); doCR();
		
		mPrintf("    Group moderates... %s", 
			     roomBuf.rbflags.GRP_MOD  ? "Yes" : "No" ); doCR();
	    }
	    
	    mPrintf("<3H0> Hidden............ %s", 
			     roomBuf.rbflags.PUBLIC ? "No" : "Yes" );   doCR();
	    
	    mPrintf("<3Y0> Anonymous......... %s", 
			     roomBuf.rbflags.ANON ? "Yes" : "No" );     doCR();
	    
	    mPrintf("<3O0> BIO............... %s", 
			     roomBuf.rbflags.BIO ? "Yes" : "No" );      doCR();
						
	    mPrintf("<3M0> Moderated......... %s", 
			     roomBuf.rbflags.MODERATED ? "Yes" : "No" );doCR();
#ifdef NETWORK
	    mPrintf("<3E0> Networked/Shared.. %s", 
			     roomBuf.rbflags.SHARED ? "Yes" : "No" );   doCR();

	    if (roomBuf.rbflags.SHARED)
		{
		mPrintf ("<3W0> Shared With....... ") ;
		messWithShareList (SHORT_SEE_NO_MODIFY, oldname) ;
		doCR() ;
		}
#endif /* NETWORK */

	    mPrintf("<3P0> Permanent......... %s", 
			     roomBuf.rbflags.PERMROOM ? "Yes" : "No" ); doCR();
	    
	    mPrintf("<3U0> Subject........... %s", 
			     roomBuf.rbflags.SUBJECT ? "Yes" : "No" ); doCR();
	    
	    doCR();
	    mPrintf("<3S0> to save, <3A0> to abort."); doCR();
	    
	    prtMess = (BOOL)(!expert);
	}
	
	outFlag = IMPERVIOUS;

	doCR();
	mPrintf("2Change:0 ");
	
	oldEcho = echo;
	echo    = NEITHER;
	c       = iChar();
	echo    = oldEcho;

	if (!CARRIER)
	    return;

	switch(toupper(c))
	{
	case 'L':
	    mPrintf("Application"); doCR();
	    
	    if (sysop && onConsole)
	    {
		if ( getYesNo("Application", (uchar)(roomBuf.rbflags.APLIC) ) )
		{
		    getString("Application filename", description, 13, FALSE,
			    ECHO, (roomBuf.rbaplic[0]) ? roomBuf.rbaplic : "");

		    strcpy(roomBuf.rbaplic, description);

		    roomBuf.rbflags.APLIC = TRUE;
		}
		else
		{
		    roomBuf.rbaplic[0] = '\0';
		    roomBuf.rbflags.APLIC = FALSE;
		}
	    }
	    else
	    {
		mPrintf("Must be Sysop at console to enter application.");
		doCR();
	    }
	    break;
   
	case 'N':
	    mPrintf("Name"); doCR();
	    
	    getString("New room name", roomname, NAMESIZE, FALSE, ECHO, 
		      roomBuf.rbname);
	    normalizeString(roomname);
	    roomslot = roomExists(roomname);
	    if (roomslot >= 0  &&  roomslot != thisRoom)
	    {
		mPrintf("A \"%s\" room already exists.\n", roomname);
	    }
	    else 
	    {
		strcpy(roomBuf.rbname, roomname); /* also in room itself */
	    }
	    break;
    
	case 'I':
	    mPrintf("Info-line \n ");
	    getNormStr("New room Info-line", roomBuf.descript, 79, ECHO);
	    break;
    
	case 'D':
	    mPrintf("Directory"); doCR();

	    if (sysop)
	    {
		if (getYesNo("Directory room", (uchar)roomBuf.rbflags.MSDOSDIR))
		{
		    roomBuf.rbflags.MSDOSDIR = TRUE;

		    if (!roomBuf.rbdirname[0])
			mPrintf(" No drive and path");
		    else
			mPrintf(" Now space %s",roomBuf.rbdirname);

		    doCR();
		    getString("Path", pathname, 63, FALSE, ECHO,
		     (roomBuf.rbdirname[0]) ? roomBuf.rbdirname : cfg.dirpath);
		    pathname[0] = (char)toupper(pathname[0]);

		    doCR();
		    mPrintf("Checking pathname \"%s\"", pathname);
		    doCR();
		    
		    if (directory_l(pathname) && !onConsole)
		    {
			logBuf.VERIFIED = TRUE;

			sprintf(msgBuf->mbtext, 
				"Security violation on dirctory %s by %s\n "
				"User unverified.", pathname, logBuf.lbname);
			aideMessage();

			doCR();
			mPrintf("Security violation, your account is being "
				"held for sysop's review"); 
			doCR();
			Hangup();

			getRoom(thisRoom);
			return;
		    }

		    if (changedir(pathname) != -1)
		    {
			mPrintf(" Now space %s", pathname);
			doCR();
			strcpy(roomBuf.rbdirname, pathname);
		    }
		    else
		    {
			mPrintf("%s does not exist! ", pathname);
			if (getYesNo("Create", 0))
			{
			    if (mkdir(pathname) == -1)
			    {
				mPrintf("mkdir() ERROR!");
				strcpy(roomBuf.rbdirname, cfg.temppath);
			    }
			    else
			    {
				strcpy(roomBuf.rbdirname, pathname);
				mPrintf(" Now space %s",roomBuf.rbdirname);
				doCR();
			    }
			}
			else
			{
			    strcpy(roomBuf.rbdirname, cfg.temppath);
			}
		    }

		    if (roomBuf.rbflags.PRIVGRP && roomBuf.rbflags.MSDOSDIR)
		    {
			roomBuf.rbflags.DOWNONLY =
			    getYesNo("Download only", 
				    (uchar)roomBuf.rbflags.DOWNONLY);

			if (!roomBuf.rbflags.DOWNONLY)
			{
			    roomBuf.rbflags.UPONLY   =  getYesNo("Upload only", 
						 (uchar)roomBuf.rbflags.UPONLY);
			}
		    }
		}
		else
		{
		    roomBuf.rbflags.MSDOSDIR = FALSE;
		    roomBuf.rbflags.DOWNONLY = FALSE;
		}
		changedir(cfg.homepath);
	    }
	    else
	    {
		doCR();
		mPrintf("Must be Sysop to make directories.");
		doCR();
	    }
	    break;
    
	case 'F':
	    mPrintf("Description File"); doCR();

	    if (cfg.roomtell && sysop)
	    {
		if ( getYesNo("Display room description File",
			(uchar)(roomBuf.rbroomtell[0] != '\0') ) )
		{
		    getString("Description Filename", description, 13, FALSE,
		    ECHO, (roomBuf.rbroomtell[0]) ? roomBuf.rbroomtell : "");
		    strcpy(roomBuf.rbroomtell, description);
		}
		else roomBuf.rbroomtell[0] = '\0';
	    }
	    else
	    {
		doCR();
		mPrintf("Must be Sysop and have Room descriptions configured.");
		doCR();
	    }
	    break;
    
	case 'G':
	    mPrintf("Access Group"); doCR();
	    
	    if ((thisRoom > 2) || (thisRoom > 0 && sysop))
	    {
		if (getYesNo("Change Group", 0))
		{
		    getString("Group for room <CR> for no group",
				    groupname, NAMESIZE, FALSE, ECHO, "");

		    roomBuf.rbflags.GROUPONLY = TRUE;

		    groupslot = partialgroup(groupname);

		    if (!strlen(groupname) || (groupslot == ERROR) )
		    {
			roomBuf.rbflags.GROUPONLY = 0;

			if (groupslot == ERROR && strlen(groupname))
			    mPrintf("No such group.");
		    }

		    if (roomBuf.rbflags.GROUPONLY)
		    {
			roomBuf.rbgrpno  = (unsigned char)groupslot;
		     /* roomBuf.rbgrpgen = grpBuf.group[groupslot].groupgen;*/
		    }
		}
	    }
	    else
	    {
		if(thisRoom > 0)
		{
		    doCR();
		    mPrintf("Must be Sysop to change group for Mail> or Aide)");
		    doCR();
		}
		else
		{
		    doCR();
		    mPrintf("Lobby> can never be group only");
		    doCR();
		}
	    }
	    break;
	
	case 'V':
	    mPrintf("Privileges Group"); doCR();
	    
	    if (getYesNo("Change Group", 0))
	    {
		getString("Group for room <CR> for no group",
				groupname, NAMESIZE, FALSE, ECHO, "");

		roomBuf.rbflags.PRIVGRP = TRUE;

		groupslot = partialgroup(groupname);

		if (!strlen(groupname) || (groupslot == ERROR) )
		{
		    roomBuf.rbflags.PRIVGRP   = FALSE;
		    roomBuf.rbflags.READONLY  = FALSE;
		    roomBuf.rbflags.DOWNONLY  = FALSE;
		    roomBuf.rbflags.UPONLY    = FALSE;
		    roomBuf.rbflags.GRP_MOD   = FALSE;

		    if (groupslot == ERROR && strlen(groupname))
			mPrintf("No such group.");
		}

		if (roomBuf.rbflags.PRIVGRP )
		{
		    roomBuf.rbPgrpno  = (unsigned char)groupslot;
		 /* roomBuf.rbPgrpgen = grpBuf.group[groupslot].groupgen; */
		}
	    }
	    
	    if (roomBuf.rbflags.PRIVGRP)
	    {
		roomBuf.rbflags.READONLY =
		    getYesNo("Read only", (uchar)roomBuf.rbflags.READONLY);
		
		roomBuf.rbflags.GRP_MOD  =
		    getYesNo("Group Moderates", (uchar)roomBuf.rbflags.GRP_MOD);
	    
		if (roomBuf.rbflags.MSDOSDIR)
		{    
		    roomBuf.rbflags.DOWNONLY =
			getYesNo("Download only", 
				(uchar)roomBuf.rbflags.DOWNONLY);
    
		    if (!roomBuf.rbflags.DOWNONLY)
		    {
			roomBuf.rbflags.UPONLY   =  getYesNo("Upload only", 
					     (uchar)roomBuf.rbflags.UPONLY);
		    }
		}
	    }
	    
	    break;
	    
	case 'H':
	    mPrintf("Hidden Room"); doCR();
	    
	    if ((thisRoom > 2) || (thisRoom>0 && sysop))
	    {
		waspublic = (uchar)roomBuf.rbflags.PUBLIC;

		roomBuf.rbflags.PUBLIC =
		    !getYesNo("Hidden room", (uchar)(!roomBuf.rbflags.PUBLIC));

		if (waspublic && (!roomBuf.rbflags.PUBLIC))
		{
		    roomBuf.rbgen = (uchar)((roomBuf.rbgen +1) % MAXGEN);
		    logBuf.lbroom[thisRoom].lbgen = roomBuf.rbgen;
		}
	    }
	    else
	    {
		doCR();
		mPrintf("Must be Sysop to make Lobby>, Mail> or Aide) hidden.");
		doCR();
	    }
	    break;
    
	case 'Y':
	    mPrintf("Anonymous Room"); doCR();
	    
	    if ((thisRoom > 2) || (thisRoom>0 && sysop))
	    {
		roomBuf.rbflags.ANON =
		     getYesNo("Anonymous room", (uchar)(roomBuf.rbflags.ANON));
	    }
	    else
	    {
		doCR();
		mPrintf("Must be Sysop to make Lobby>, Mail> or Aide) Anonymous.");
		doCR();
	    }
	    break;
	
	case 'O':
	    mPrintf("BIO Room"); doCR();
	    
	    if ((thisRoom > 2) || (thisRoom>0 && sysop))
	    {
		roomBuf.rbflags.BIO =
		    getYesNo("BIO room", (uchar)(roomBuf.rbflags.BIO));
	    }
	    else
	    {
		doCR();
		mPrintf("Must be Sysop to make Lobby>, Mail> or Aide) BIO.");
		doCR();
	    }
	    break;
	    
	case 'M':
	    mPrintf("Moderated"); doCR();
	    
	    if (sysop)
	    {
		if (getYesNo("Moderated", (uchar)(roomBuf.rbflags.MODERATED) ))
		    roomBuf.rbflags.MODERATED = TRUE;
		else
		    roomBuf.rbflags.MODERATED = FALSE;
	    }
	    else
	    {
		doCR();
		mPrintf("Must be Sysop to make Moderated rooms.");
		doCR();
	    }
	    break;

#ifdef NETWORK

	case 'E':
	    mPrintf("Networked/Shared"); doCR();
	    
	    if (sysop)
	    {
		/* Perhaps rooms made shareable should also automatically */
		/* become permenant, as well.                             */

		BOOL fShared = (BOOL) roomBuf.rbflags.SHARED ;

		roomBuf.rbflags.SHARED = getYesNo("Networked/Shared room",
					 (uchar)fShared) ;

		if ((roomBuf.rbflags.SHARED) && (!fShared))
		    roomBuf.rbflags.PERMROOM = TRUE ;
	    }
	    else
	    {
		doCR();
		mPrintf("Must be Sysop to make Shared rooms.");
		doCR();
	    }
	    break;

	case 'W':
	    mPrintf ("Shared With");  doCR();

	    if (roomBuf.rbflags.SHARED)
		messWithShareList (SEE_WITH_MODIFY, oldname) ;
	    else
		{
		doCR() ;
		mPrintf ("Unshared rooms don't have share lists.") ;
		doCR() ;
		}
	    break ;

#endif /* NETWORK */

	case 'P':
	    mPrintf("Permanent");
	    doCR();
	    if (thisRoom > DUMP)
	    {
		if (!roomBuf.rbflags.MSDOSDIR)
		{
		    roomBuf.rbflags.PERMROOM =
			getYesNo("Permanent", (uchar)roomBuf.rbflags.PERMROOM);
		}
		else
		{
		    roomBuf.rbflags.PERMROOM = 1;
		    doCR();
		    mPrintf("Directory rooms are always Permanent.");
		    doCR();
		}
	    }
	    else
	    {
		doCR();
		mPrintf("Lobby> Mail> Aide) or Dump> always Permanent.");
		doCR();
	    }
	    break;
   
	case 'U':
	    mPrintf("Subject"); doCR();
	    
	    roomBuf.rbflags.SUBJECT = getYesNo("Ask for subject in room",
				     (uchar)roomBuf.rbflags.SUBJECT);
	    break;
	
	case 'S':
	    mPrintf("Save");  doCR();
	    if (getYesNo("Save changes", FALSE))
	    {
		noteRoom();
		putRoom(thisRoom);

		/* trap file line */
		sprintf(line, "Room \'%s\' changed to \'%s\' by %s",
				oldname, roomBuf.rbname, logBuf.lbname);
		trap(line, T_AIDE);

		/* Aide room */
		formatSummary(summary);
		sprintf(msgBuf->mbtext, "%s \n%s", line, summary);
		aideMessage();

		return;
	    }
	    break;
	
	case 'A':
	    mPrintf("Abort");  doCR();
	    if (getYesNo("Abort", TRUE))
	    {
		getRoom(thisRoom);
		return;
	    }
	    break;
    
	case '\r':
	case '\n':
	case '?':
	    mPrintf("Menu"); doCR();
	    prtMess = TRUE;
	    break;
    
	default:
	    mPrintf("%c ? for help", c); doCR();
	    break;
	
	}
    } while (!quit);
}
示例#11
0
void TERMWINDOWMEMBER Net1Cleanup(void)
	{
	int t, i;
	label fn, here, there;
	char line[100];

	CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(82));

	Hangup();

	if (w)
		{
		destroyCitWindow(w, FALSE);
		}

	if (cfg.offhook == 1)
		{
		offhook();
		}

	sprintf(line, sbs, cfg.transpath, node->GetMailFileName());
	unlink(line);

	OC.SetOutFlag(IMPERVIOUS);

	doccr();
	cPrintf(getnetmsg(22));
	doccr();
	cPrintf(getnetmsg(23));
	doccr();
	cPrintf(getnetmsg(24));
	doccr();

	int Rooms = 0, TotalNew = 0, TotalExpired = 0, TotalDuplicate = 0;
	int ThisNew, ThisExpired, ThisDuplicate, ThisError;

	for (t = get_first_room(here, there), i = 0; t; t = get_next_room(here, there), i++)
		{
		sprintf(fn, getnetmsg(127), i);

		KBReady();

		const r_slot rm = RoomExists(here);
		if (rm != CERROR && CurrentUser->CanAccessRoom(rm))
			{
			cPrintf(getnetmsg(166), deansi(here));

			if (ReadMsgFl(rm, fn, NULL, &ThisNew, &ThisExpired, &ThisDuplicate, &ThisError, CurrentUser))
				{
				if (ThisNew)
					{
					OC.ansiattr = cfg.cattr;
					}
				cPrintf(getnetmsg(133), ThisNew);
				OC.ansiattr = cfg.attr;
				cPrintf(getnetmsg(134));

				if (ThisExpired)
					{
					OC.ansiattr = cfg.cattr;
					}

				cPrintf(getnetmsg(133), ThisExpired);
				OC.ansiattr = cfg.attr;
				cPrintf(getnetmsg(134));

				if (ThisDuplicate)
					{
					OC.ansiattr = cfg.cattr;
					}
				cPrintf(getnetmsg(133), ThisDuplicate);
				OC.ansiattr = cfg.attr;

				TotalNew += ThisNew;
				TotalExpired += ThisExpired;
				TotalDuplicate += ThisDuplicate;
				Rooms++;
				}
			else
				{
				amPrintf(getnetmsg(28), there, bn);
				netError = TRUE;
				cPrintf(getnetmsg(29));
				}

			doccr();
			}
		else
			{
			cPrintf(getnetmsg(30), deansi(here));
			amPrintf(getnetmsg(31), here, bn);
			netError = TRUE;
			doccr();
			}

		unlink(fn);
		}

	cPrintf(getnetmsg(24));
	doccr();
	cPrintf(getnetmsg(32));

	if (Rooms)
		{
		OC.ansiattr = cfg.cattr;
		}
	cPrintf(getnetmsg(133), Rooms);
	OC.ansiattr = cfg.attr;

	cPrintf(getnetmsg(134));
	if (TotalNew)
		{
		OC.ansiattr = cfg.cattr;
		}
	cPrintf(getnetmsg(133), TotalNew);
	OC.ansiattr = cfg.attr;

	cPrintf(getnetmsg(134));
	if (TotalExpired)
		{
		OC.ansiattr = cfg.cattr;
		}
	cPrintf(getnetmsg(133), TotalExpired);
	OC.ansiattr = cfg.attr;

	cPrintf(getnetmsg(134));
	if (TotalDuplicate)
		{
		OC.ansiattr = cfg.cattr;
		}
	cPrintf(getnetmsg(133), dup);
	OC.ansiattr = cfg.attr;

	doccr();
	cPrintf(getnetmsg(33));
	doccr();
	doccr();
	cPrintf(getnetmsg(34));
	doccr();

	ReadMsgFl(MAILROOM, getnetmsg(164), NULL, &ThisNew, &ThisExpired, &ThisDuplicate, &ThisError, NULL);

	label New, Routed, Rejected;
	CopyStringToBuffer(New, ltoac(i == CERROR ? 0 : i));
	CopyStringToBuffer(Routed, ltoac(ThisExpired));
	CopyStringToBuffer(Rejected, ltoac(ThisDuplicate));

	cPrintf(getnetmsg(35), New, ThisNew == 1 ? cfg.Lmsg_nym : cfg.Lmsgs_nym, Routed, Rejected,
			ltoac(ThisNew + ThisExpired + ThisDuplicate));

	doccr();

	changedir(LocalTempPath);
	ambigUnlink(getnetmsg(162));
	ambigUnlink(getnetmsg(163));

	unlink(getnetmsg(164));

	changedir(cfg.homepath);

	MS.Expired = TotalExpired;
	MS.Duplicate = TotalDuplicate;
	MS.Entered = TotalNew + ThisNew;

	if (netError)
		{
		label Buffer;
		amPrintf(getnetmsg(36), bn, CurrentUser->GetName(Buffer, sizeof(Buffer)), bn);
		SaveAideMess(NULL);
		}

	readNetCmdTmp(CONSOLE);

	// we are no longer calling out...
	callout = FALSE;
	}
示例#12
0
Bool TERMWINDOWMEMBER Net1Master(void)
	{
	char line[100], line2[100];
	label here, there;
	FILE *file;
	int i, rms;
	time_t t;

	const protocols *theProt = GetProtocolByKey(node->GetProtocol(), TRUE);

	if (!theProt)
		{
		doccr();
		cPrintf(getnetmsg(8));
		doccr();
		return (FALSE);
		}

	if (!CommPort->HaveConnection())
		{
		return (FALSE);
		}

	cPrintf(getnetmsg(9));
	doccr();

	wxrcv(LocalTempPath, getnetmsg(164), theProt);

	if (!CommPort->HaveConnection())
		{
		return (FALSE);
		}

	sprintf(line, getnetmsg(168), LocalTempPath);
	if ((file = fopen(line, FO_WB)) == NULL)
		{
		perror(getnetmsg(1));
		return (FALSE);
		}

	for (i = get_first_room(here, there), rms = 0; i; i = get_next_room(here, there), rms++)
		{
		PutStr(file, there);
		}

	PutStr(file, ns);
	fclose(file);

	cPrintf(getnetmsg(10));
	doccr();

	wxsnd(LocalTempPath, getnetmsg(169), theProt, 0);
	unlink(line);

	if (!CommPort->HaveConnection())
		{
		return (FALSE);
		}

	CommPort->FlushInput();


	cPrintf(getnetmsg(11));
	// wait for them to get thier shit together
	t = time(NULL);
	while (CommPort->HaveConnection() && !CommPort->IsInputReady())
		{
		KBReady();
		if (time(NULL) > (t + (node->GetFetchTimeout() * 60)))
			{
			CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(685), getmsg(73));

			Hangup();

			if (w)
				{
				destroyCitWindow(w, FALSE);
				}
			}

		// instantaneous reaction time isn't critical here
		CitIsIdle();
		}
	doccr();

	if (!CommPort->HaveConnection())
		{
		return (FALSE);
		}

	cPrintf(getnetmsg(12), cfg.Lmsg_nym);
	doccr();

	wxrcv(LocalTempPath, ns, theProt);

	for (i = 0; i < rms; i++)
		{
		sprintf(line, getnetmsg(126), i);
		sprintf(line2, getnetmsg(127), i);
		rename(line, line2);
		}

	return (TRUE);
	}
示例#13
0
void TERMWINDOWMEMBER terminate(Bool discon)
    {
    char dtstr[80];
    Bool initport = FALSE;

    if (!altF3Timeout && (cfg.chatmail == 2 && chatReq) || (cfg.chatmail == 3) || (cfg.chatmail == 4))
        {
        if (cfg.chatmail == 2)
            {
            dispBlb(B_CHATTED);
            }

        Message *Msg = new Message;

        if (Msg)
            {
            msgtosysop(Msg);
            delete Msg;
            }
        else
            {
            OutOfMemory(41);
            }
        }

    if (loggedIn && onConsole)
        {
        last_console_login_callno = cfg.callno;
        }

    chatReq = FALSE;
    const Bool doStore = HaveConnectionToUser();

    if (discon || !doStore)
        {
        sysopNew = FALSE;
        }

    const long balance = CurrentUser->GetCredits();

    OC.SetOutFlag(OUTOK);

    if ((doStore && (MRO.Verbose == 2)) || CurrentUser->IsAutoVerbose() || CurrentUser->IsVerboseLogOut() ||
            CurrentUser->IsNode())
        {
        if (CurrentUser->IsNode())
            {
            OC.SetOutFlag(IMPERVIOUS);  // no carrier
            }

        CRmPrintfCR(getmsg(119), ltoac(cfg.callno));
        if (loggedIn)
           {
           mPrintfCR(getmsg(118), diffstamp(logtimestamp));
           }
        label Entered, L;
        CopyStringToBuffer(Entered, ltoac(MS.Entered));
        mPrintfCR(getmsg(117), Entered, MS.Entered == 1 ? cfg.Lmsg_nym : cfg.Lmsgs_nym, ltoac(MS.Read));

        if (cfg.accounting && CurrentUser->IsAccounting())
            {
            long C = (CurrentUserAccount->GetBalanceAtLogin() - balance) / 60;

            mPrintfCR(getmsg(116), ltoac(C), (C == 1) ? cfg.Lcredit_nym : cfg.Lcredits_nym, L);

            C = balance / 60;

            mPrintfCR(getmsg(115), ltoac(C), (C == 1) ? cfg.Lcredit_nym : cfg.Lcredits_nym);
            }

        char Buffer[64];
        strftime(dtstr, 79, (loggedIn) ? CurrentUser->GetVerboseDateStamp(Buffer, sizeof(Buffer)) : cfg.vdatestamp, 0l);
        }

    if (doStore && MRO.Verbose)
        {
        goodbye();
        }

    OC.SetOutFlag(IMPERVIOUS);

    label Buffer;
    if (loggedIn)
        {
        if ((MRO.Verbose == 2) || CurrentUser->IsAutoVerbose() || CurrentUser->IsVerboseLogOut() || CurrentUser->IsNode())
            {
            CRmPrintfCR(getmsg(614), CurrentUser->GetName(Buffer, sizeof(Buffer)), dtstr);
            }
        else
            {
            CRmPrintfCR(getmsg(114), CurrentUser->GetName(Buffer, sizeof(Buffer)));
            }
        }

    // Go back to the default hall
    thisHall = HallData.GetDefault();

    if (discon)
        {
#ifdef WINCIT
        switch(CommPort->GetType())
            {
            case CT_SERIAL:
                {
                initport = TRUE;
                break;
                }

            case CT_TELNET:
                {
                initport = FALSE;
                break;
                }

            default:
                {
                initport = FALSE;
                break;
                }
            }
#endif

        if (CommPort->HaveConnection())
            {
            CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(82));

            Hangup();

            if (w)
                {
                destroyCitWindow(w, FALSE);
                }
            }

        //OC.whichIO = MODEM; // I really don't know
        //OC.setio();
        }

    if (!slv_door && !CommPort->HaveConnection())
        {
        CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(19));

#ifdef WINCIT
        if(initport)
#endif
            {
            Initport();
            }

        if (w)
            {
            destroyCitWindow(w, FALSE);
            }
        }

    CurrentUser->SetInRoom(thisRoom, TRUE);

    if (!doStore) // if carrier dropped
        {
        if(!read_tr_messages())
            {
            errorDisp(getmsg(172));
            }

#ifdef WINCIT
        trap(T_CARRIER, WindowCaption, gettrmsg(19), WindowCaption);
#else
        trap(T_CARRIER, gettrmsg(19));
#endif
        dump_tr_messages();
        }

    // update new pointer only if carrier not dropped
    if (loggedIn && doStore)
        {
        CurrentUser->SetRoomNewPointer(thisRoom, MessageDat.NewestMessage());
        }

    if (loggedIn)
        {
        CurrentUser->SetCallNumber(cfg.callno);
        CurrentUser->SetCallTime(logtimestamp);

        // for the Minibin() function to calculate #new messages
        CurrentUser->SetLastMessage(MessageDat.NewestMessage());

        CurrentUser->SetTotalTime(CurrentUser->GetTotalTime() + (time(NULL) - logtimestamp));

        CurrentUser->SetLogins(CurrentUser->GetLogins() + 1);
        CurrentUser->SetPosted(CurrentUser->GetPosted() + MS.Entered);
        CurrentUser->SetRead(CurrentUser->GetRead() + MS.Read);

        CurrentUser->Save(ThisLog, thisRoom);

        // this stuff puts the current room at the end of jumpback,
        // so J will take you back here.
        jumpback jb;

        jb.hall = thisHall;
        jb.room = thisRoom;
        jb.newpointer = CurrentUser->GetRoomNewPointer(thisRoom);
        jb.bypass = Talley->Bypassed(thisRoom);
        jb.newMsgs = Talley->NewInRoom(thisRoom);

        CurrentUser->JumpbackPush(jb);

#ifdef MULTI
        char LogoffEvent[256];
        label NameBuffer;

        sprintf(LogoffEvent, doStore ? getmsg(665) : getmsg(29), CurrentUser->GetName(NameBuffer, sizeof(NameBuffer)));
        TermWindowCollection.SystemEvent(SE_LOGONOFF, FALSE, NULL, FALSE, LogoffEvent);
#endif

        loggedIn = FALSE;

        if (CurrentUser->IsPrintFile() && OC.Printing)
            {
            OC.Printing = OC.WasPrinting;

            if (!OC.Printing)
                {
                fclose(OC.PrintFile);
                }
            }

        // trap it
        if (CurrentUser->IsNode())
            {
            if (netError)
                {
                Bool OldTrapit = cfg.trapit[T_NETWORK];

                if (node->GetNetFail() > 0)
                    {
                    cfg.trapit[T_NETWORK] = TRUE;
                    }
                else if (node->GetNetFail() < 0)
                    {
                    cfg.trapit[T_NETWORK] = FALSE;
                    }

#ifdef WINCIT
                trap(T_NETWORK, WindowCaption, getmsg(606), CurrentUser->GetName(Buffer, sizeof(Buffer)));
#else
                trap(T_NETWORK, getmsg(606), CurrentUser->GetName(Buffer, sizeof(Buffer)));
#endif

                cfg.trapit[T_NETWORK] = OldTrapit;
                }
            else
                {
#ifdef WINCIT
                trap(T_NETWORK, WindowCaption, getmsg(22), CurrentUser->GetName(Buffer, sizeof(Buffer)));
#else
                trap(T_NETWORK, getmsg(22), CurrentUser->GetName(Buffer, sizeof(Buffer)));
#endif
                }
            }
        else
            {
            doEvent(EVT_LOGOUT);
            if(!read_tr_messages())
                {
                errorDisp(getmsg(172));
                }
#ifdef WINCIT
            trap(T_LOGIN, WindowCaption, gettrmsg(24), CurrentUser->GetName(Buffer, sizeof(Buffer)));
#else
            trap(T_LOGIN, gettrmsg(24), CurrentUser->GetName(Buffer, sizeof(Buffer)));
#endif
            dump_tr_messages();
            }

        const TrapKeywords TrapType = CurrentUser->IsNode() ? T_NETWORK : T_ACCOUNT;
        if(!read_tr_messages())
            {
            errorDisp(getmsg(172));
            }
#ifndef WINCIT
        trap(TrapType, gettrmsg(25), MS.Entered);
        trap(TrapType, gettrmsg(26), MS.Read);
#else
        trap(TrapType, WindowCaption, gettrmsg(25), MS.Entered);
        trap(TrapType, WindowCaption, gettrmsg(26), MS.Read);
#endif
        dump_tr_messages();

        if (CurrentUser->IsNode())
            {
            if(!read_tr_messages())
                {
                errorDisp(getmsg(172));
                }
#ifndef WINCIT
            trap(T_NETWORK, gettrmsg(20), MS.Expired);
            trap(T_NETWORK, gettrmsg(21), MS.Duplicate);
#else
            trap(T_NETWORK, WindowCaption, gettrmsg(20), MS.Expired);
            trap(T_NETWORK, WindowCaption, gettrmsg(21), MS.Duplicate);
#endif
            dump_tr_messages();
            }
        else if (cfg.accounting)    // There's just no accounting for nodes
            {
            if(!read_tr_messages())
                {
                errorDisp(getmsg(172));
                }
#ifdef WINCIT
            trap(T_ACCOUNT, WindowCaption, gettrmsg(27), CurrentUserAccount->GetBalanceAtLogin() - balance);
#else
            trap(T_ACCOUNT, gettrmsg(27), CurrentUserAccount->GetBalanceAtLogin() - balance);
#endif
            dump_tr_messages();
            }

        delete MS.AbortedMessage;
        MS.AbortedMessage = NULL;

#ifdef MULTI
        LoginList.Remove(ThisLog);
#endif
        }

    setdefaultconfig(FALSE);

    if (discon)
        {
        setdefaultTerm(TT_ANSI);
        }
    else
        {
        setdefaultTerm(TT_DUMB);
        }

    CurrentUser->SetCredits(discon ? 0L : cfg.unlogtimeout * 60L);
    StatusLine.Update(WC_TWp);

    Talley->Fill();

    CurrentRoom->Load(LOBBY);
    checkdir();
    thisRoom = LOBBY;

    AideQueueClear();
    clearFileQueue();
    MS.AutoMKC = AM_NONE;
    MS.MarkedID = 0L;

    freeNode(&node);
    netError = FALSE;   // just in case

    Cron.ResetTimer();
    }
示例#14
0
/* -------------------------------------------------------------------- */
void doLogin(char moreYet)
{
    int foundIt;
    char InitPw[NAMESIZE+NAMESIZE+2];
    char password[NAMESIZE+NAMESIZE+2];
    char initials[NAMESIZE+NAMESIZE+2];
    char *semicolon;

    Mflush();

    if (!CARRIER) return;

    if (login_user || login_pw) /* handle command line log-ins */
    {
        if (!modStat) 
            if (cfg.offhook)  offhook();

        /* login using initials and pw */
        if (login_pw)
        {
            normalizepw(cmd_login, initials, password);
            login_pw = FALSE;
        }
        else

        if (login_user)
        {
            normalizeString(cmd_login);
            if (findPerson(cmd_login, &logBuf) != ERROR)
            {
                strcpy(initials, logBuf.lbin);
                strcpy(password, logBuf.lbpw);
            }
            login_user = FALSE;
        }

    }
    else   /* ask user for initials and password */
    {


    if (moreYet == 2)
        moreYet = FALSE;
    else
    {
        /* dont print Login when hitting 'L' from console mode */
        if (!(!moreYet && !loggedIn && !modStat))
        {
            mPrintf("Login ");
        }
    }



    if (loggedIn)  
    {
        mPrintf("\n Already logged in!\n ");
        return;
    }

    if (!modStat) 
        if (cfg.offhook)  offhook();


  getNormStr((moreYet) ? "" : "your initials", InitPw, NAMESIZE+NAMESIZE+1, NO_ECHO);
    if (!CARRIER) return;

        dospCR();

        semicolon = strchr(InitPw, ';');

        if (!semicolon)
        {
            strcpy(initials, InitPw);
            getNormStr( "password",  password, NAMESIZE, NO_ECHO);
            dospCR();
        }     
        else  
        {
            normalizepw(InitPw, initials, password);
        }

        /* dont allow anything over 19 characters */
        initials[NAMESIZE] = '\0';
    }
    
    /* reset transmitted & received */
    transmitted = 0l;
    received    = 0l;

    /* reset read & entered */
    mread   = 0;
    entered = 0;

    foundIt = ((pwslot(initials, password)) != ERROR);

    if (foundIt && *password)
    {
        loggedIn    = TRUE;
        update25();

        /* trap it */
        if (!logBuf.lbflags.NODE) 
        {
            sprintf( msgBuf->mbtext, "Login %s", logBuf.lbname);
            if (onConsole)
                strcat(msgBuf->mbtext, " (Console)");

            trap(msgBuf->mbtext, T_LOGIN);
        }
        else
        {
            sprintf( msgBuf->mbtext, "NetLogin %s", logBuf.lbname);
            trap(msgBuf->mbtext, T_NETWORK);
        }
    }
    else
    {
        loginNew(initials, password);
    }

    if (!loggedIn)
        return;

    heldMessage = FALSE;

    setsysconfig();
    setgroupgen();
    setroomgen();
    setlbvisit();

    slideLTab(thisSlot);

    /* cant log in now. */
    if (cfg.accounting && !logBuf.lbflags.NOACCOUNT)
    {
        negotiate();
        logincrement();
        if (!logincheck()) 
        {
            Hangup();
            return;
        }
    }

    /* can't log in now. */
    if (logBuf.VERIFIED && !onConsole)
    {
        tutorial("verified.blb");
        Hangup();
        return;
    }

    if (logBuf.lbflags.NODE)
    {
#ifdef  TRASH       
        if (debug)
        {
            readnode();

            cPrintf("Node:  \"%s\" \"%s\"", node.ndname, node.ndregion);  doccr();
            cPrintf("Phone: \"%s\" %d", node.ndphone, node.nddialto);     doccr();
            cPrintf("Login: \"%s\" %d", node.ndlogin, node.ndwaitto);     doccr();
            cPrintf("Baud:  %d    Protocol: \"%s\"\n ", node.ndbaud, node.ndprotocol);
            cPrintf("Expire:%d    Waitout:  %d", node.ndexpire, node.ndwaitto); doccr();
            cPrintf("Network: %d  ZIP: %s UNZIP: %s", node.network, node.zip, node.unzip); doccr();
        }
#endif        
        
        time(&logtimestamp);
        return;
    }

    if (logBuf.PSYCHO)
    {
        backout = TRUE;
    }
    
    /* reverse engineering Minibin?!?! */
    if (logBuf.MINIBIN)
    {
        minibin();
    }
    
    changedir(cfg.helppath); 

    if ( filexists("bulletin.blb") )
    {
        tutorial("bulletin.blb");
    }
    
    gotodefaulthall();

    roomtalley();

    mf.mfLim = 0;   /* just to make sure. */
    mf.mfMai = 0;
    mf.mfPub = 0;
    mf.mfUser[0]=0;

    nochat(TRUE);       /* reset chats */
    
    /* verbose = FALSE; */
    verbose = logBuf.VERBOSE;

    /* hmmm... where to put this */
    if (roomBuf.rbflags.APLIC && roomBuf.rbflags.AUTOAPP )
        ExeAplic();

    showMessages(NEWoNLY, FALSE);

    verbose = FALSE;
    if (expert) listRooms(NEWRMS, FALSE);
    else        listRooms(OLDNEW, FALSE);

    outFlag = OUTOK;
    setio(whichIO, echo, outFlag);
    
    /* record login time, date */
    time(&logtimestamp);

    cfg.callno++;

    storeLog();
}
示例#15
0
/* -------------------------------------------------------------------- */
void loginNew(char *initials, char *password)
{
    int i; 
    ulong newpointer;
    
    if (getYesNo(cfg.l_verified ? " No record: Enter as new user" 
                                : " No record: Request access", 1))
    {
        if (!CARRIER) return;
        
        if (cfg.l_closedsys && (!sysopNew && !(onConsole && !debug)))
        {
            tutorial("closesys.blb");
            drop_dtr();
            return;
        }
        
        tutorial("userinfo.blb");
        
        if (cfg.l_create || sysopNew || (onConsole && !debug))
        {
            logBuf.VERIFIED = (onConsole && !debug) ? FALSE : !cfg.l_verified;
            newUser(initials, password);
            if (!loggedIn)
                return;
            newaccount();
            update25();
        }

        if (cfg.l_questionare && (!(onConsole && !debug)))
        {
            newUserFile();
        }

        if (cfg.l_application && (!(onConsole && !debug)))
        {
            if (changedir(cfg.aplpath) == ERROR)
            {
                mPrintf("  -- Can't find application directory.\n\n");
                changedir(cfg.homepath);
                return;
            }
            apsystem(cfg.newuserapp);
            changedir(cfg.homepath);
        }

        if (cfg.l_sysop_msg && (!(onConsole && !debug)))
        {
            tutorial("newmsg.blb");
            
            i = loggedIn;       /* force to sysop */
            loggedIn = FALSE; 
            mailFlag  = TRUE; 
            oldFlag   = FALSE;
            limitFlag = FALSE;
            linkMess  = FALSE;
            makeMessage();
            loggedIn = (uchar)i;
        }
        
        if (logBuf.VERIFIED && !sysopNew && loggedIn)
        {
            verbose = FALSE;
            terminate(TRUE);
            mPrintf("\n Thank you, Good Bye.\n");
            Hangup();
        }
    }



/**********************************************************************/
/* Icky Hack designed to make #oldcount functional                    */
/* this was moved here because for some reason making messages        */
/* was causing the pointers to get screwed up                         */
/**********************************************************************/

    if (cfg.oldcount)
    {
        newpointer = (cfg.newest - cfg.oldcount);
        if (newpointer < cfg.oldest)  newpointer = cfg.oldest;

        /* logBuf.lbvisit[0] = newpointer; */ /* pushed down later by setlbvisit() */

        for (i = 0; i < MAXROOMS;  i++)
        {
            logBuf.newpointer[i] = newpointer;

            /* logBuf.lbroom[i].lvisit = 0; */ /* becomes==1 later by setlbvisit() */
        }
    }

/**********************************************************************/
/* ^^^ Disgusting? Wasn't it?  ^^^ Hope it works!                     */
/**********************************************************************/
    
    sysopNew = FALSE;
    
    return;
}
示例#16
0
void Terminal::Dealloc() {
  AssertNoncritical();
  Hangup();
  delete this;
}
示例#17
0
Bool TERMWINDOWMEMBER dc15network(Bool master)
	{
	char line[100], line2[100];
	label here, there;
	FILE *file;
	int i, rms;
	Bool done = FALSE;

	netFailed = FALSE;

	const protocols *theProt = GetProtocolByKey(node->GetProtocol(), TRUE);

	if (!theProt)
		{
		doccr();
		cPrintf(getnetmsg(177));
		doCR();
		return (FALSE);
		}

	if (!CommPort->HaveConnection())
		{
		return (FALSE);
		}

	sprintf(line, sbs, LocalTempPath, mesgTmp);
	unlink(line);

	sprintf(line, getnetmsg(123), LocalTempPath);
	unlink(line);

	sprintf(line, getnetmsg(124), LocalTempPath);
	unlink(line);

	sprintf(line, getnetmsg(125), LocalTempPath);
	unlink(line);

	if ((file = fopen(line, FO_AB)) == NULL)
		{
		perror(getnetmsg(25));
		return (FALSE);
		}

	for (i = get_first_room(here, there), rms = 0; i; i = get_next_room(here, there), rms++)
		{
		PutStr(file, there);
		}

	PutStr(file, ns);
	fclose(file);

	if (master)
		{
		sendRequest(theProt);
		if (!CommPort->HaveConnection())
			{
			return (FALSE);
			}

		reciveRequest(theProt);
		}
	else
		{
		reciveRequest(theProt);
		if (!CommPort->HaveConnection())
			{
			return (FALSE);
			}

		sendRequest(theProt);
		}

	if (!CommPort->HaveConnection() || netFailed)
		{
		return (FALSE);
		}

	if (master)
		{
		// clear the buffer
		while (CommPort->HaveConnection() && CommPort->IsInputReady())
			{
			CommPort->Input();
			}
		}

	makeSendFile();

	if (!CommPort->HaveConnection() || netFailed)
		{
		return (FALSE);
		}

	// wait for them to get their shit together
	cPrintf(getnetmsg(11));

	CommPort->Output('X');

	time_t t2 = 0;
	const time_t t = time(NULL);

	while (CommPort->HaveConnection() && !done)
		{
		if (time(NULL) > (t + (node->GetFetchTimeout() * 60)))
			{
			CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(685), getmsg(73));

			Hangup();
			netFailed = TRUE;

			if (w)
				{
				destroyCitWindow(w, FALSE);
				}
			}

		KBReady();

		if (CommPort->IsInputReady())
			{
			i = CommPort->Input();
			if (i == 'X' || node->GetNetworkType() != NET_DCIT16)
				{
				done = TRUE;
				}
			else
				{
				DebugOut(pctc, i);
				}

			}

		// wake them up! (every second)
		if (time(NULL) != t2)
			{
			CommPort->Output('X');
			t2 = time(NULL);
			}

		// instantaneous reaction time isn't critical here
		CitIsIdle();
		}

	// wake them up!
	for (i = 0; i < 10; i++)
		{
		CommPort->Output('X');
		}

	doccr();

	if (!CommPort->HaveConnection() || netFailed)
		{
		return (FALSE);
		}

	if (master)
		{
		receiveFiles(theProt);
		if (!CommPort->HaveConnection() || netFailed)
			{
			return (FALSE);
			}

		sendFiles(theProt);
		}
	else
		{
		sendFiles(theProt);
		if (!CommPort->HaveConnection() || netFailed)
			{
			return (FALSE);
			}

		receiveFiles(theProt);
		}

	if (netFailed)
		{
		return (FALSE);
		}

	cPrintf(getnetmsg(84));
	doccr();

	CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(82));

	Hangup();

	if (w)
		{
		destroyCitWindow(w, FALSE);
		}

	OC.setio(); // hmmm

	cPrintf(getnetmsg(85), cfg.Lmsg_nym);
	doccr();

	sformat(line, node->GetExtractPacket(), getmsg(48), roomdataIn, 0);
	apsystem(line, TRUE);

	changedir(LocalTempPath);
	unlink(roomdataIn);

	for (i = 0; i < rms; i++)
		{
		sprintf(line, getnetmsg(126), i);
		sprintf(line2, getnetmsg(127), i);
		rename(line, line2);
		}

	sprintf(line, sbs, LocalTempPath, mesgTmp);
	sprintf(line2, getnetmsg(123), LocalTempPath);
	rename(line, line2);

	return (TRUE);
	}
示例#18
0
Bool TERMWINDOWMEMBER getString(const char *prompt, char *buf, int lim, Bool QuestIsSpecial, Bool doEcho, const char *dfault)
    {
    char c;
    int errors = 0;
    int i;
    const EchoType oldEcho = OC.Echo;
    const dowhattype oldDowhat = DoWhat;
    int termPos = 0;
    label tempTerm;
    Bool useDefault = (dfault && *dfault);

    ansi(14);

    if (!HaveConnectionToUser())
        {
        buf[0] = 0;

        OC.MCI_goto = FALSE;

        return (FALSE);
        }

    Bool ToReturn = TRUE;
    OC.SetOutFlag(IMPERVIOUS);

    if (*prompt)
        {
        if (useDefault)
            {
            sprintf(gprompt, getmsg(493), prompt, hasansi(prompt) ? getmsg(214) : ns, hasansi(dfault) ? getmsg(213) : ns,
					dfault, hasansi(dfault) ? getmsg(214) : ns);
            }
        else
            {
            sprintf(gprompt, getmsg(489), prompt);
            }

        CRmPrintf(pcts, gprompt);

        SetDoWhat(PROMPT);
        }

    tempTerm[0] = 0;

    OC.Echo = NEITHER;
    OC.setio();

    if (!doEcho)
        {
        if (!cfg.nopwecho)
            {
            OC.EchoChar = 1;
            }
        else if (cfg.nopwecho == 1)
            {
            OC.EchoChar = 0;
            }
        else
            {
            OC.EchoChar = cfg.nopwecho;
            }
        }

    i = 0;

    for (c = (char) iChar(); c != '\n' && HaveConnectionToUser(); c = (char) iChar())
        {
        OC.SetOutFlag(OUTOK);

        if (c == 0 || c == CTRL_D)
            {
            if (!HaveConnectionToUser())
                {
                break;
                }
            }
        else if (c == ESC)
            {
            i = 0;
            useDefault = FALSE;
            ToReturn = FALSE;
            break;
            }
        else if (termPos)
            {
            if (c == '\b')
                {
                if (termPos > 2)
                    {
                    termPos -= 1;
                    }
                else
                    {
                    termPos = 0;
                    }
                }
            else
                {
                tempTerm[termPos++] = c;
                tempTerm[termPos] = 0;

                if (c == 'X')
                    {
                    if (i + termPos >= lim)
                        {
                        oChar(BELL);
                        }
                    else
                        {
                        buf[i] = 0;
                        strcat(buf, tempTerm);
                        i += termPos;
                        termCap(tempTerm + 1);
                        OC.MCI_goto = FALSE;
                        }

                    termPos = 0;
                    }
                else if (termPos >= LABELSIZE)
                    {
                    oChar(BELL);
                    termPos = 0;
                    }
                }
            }
        else if (c == '\b')
            {
            if (i != 0)
                {
                OC.Echo = oldEcho;
                OC.setio();

                doBS();

                OC.Echo = NEITHER;
                OC.setio();

                i--;

                if ((OC.EchoChar >= '0') && (OC.EchoChar <= '9'))
                    {
                    OC.EchoChar--;
                    if (OC.EchoChar < '0') OC.EchoChar = '9';
                    }
                }
            else
                {
                OC.Echo = oldEcho;
                OC.setio();

                oChar(BELL);

                OC.Echo = NEITHER;
                OC.setio();
                }
            }
        else
            {
            if (c == CTRL_A && (i < lim - 1) && cfg.colors)
                {
                // Control+A(nsi)

                const int d = iCharNE();

                if (d == '?')
                    {
                    OC.Echo = oldEcho;
                    OC.setio();
                    dispHlp(H_ANSI);

                    OC.SetOutFlag(IMPERVIOUS);

                    CRmPrintf(pcts, gprompt);

                    buf[i] = 0;
                    mPrintf(pcts, buf);

                    SetDoWhat(PROMPT);

                    OC.Echo = NEITHER;
                    OC.setio();
                    }
                else if (d == 'X')
                    {
                    tempTerm[0] = CTRL_A;
                    tempTerm[1] = 'X';
                    tempTerm[2] = 0;
                    termPos = 2;
                    }
                else if ((d >= '0' && d <= '8') ||
                        (d >= 'a' && d <= 'h')  ||
                        (d == TERM_DATE[0])     ||
                        (d == TERM_TIME[0])     ||
                        (d == TERM_USERNAME[0]) ||
                        (d == TERM_FIRSTNAME[0])||
                        (d == TERM_POOP[0])     ||
                        (d == TERM_RND_BACK[0]) ||
                        (d == TERM_RND_FORE[0]) ||
                        (d >= 'A' && d <= 'H'))
                    {
                    OC.Echo = oldEcho;
                    OC.setio();

                    tempTerm[0] = (char) d;
                    tempTerm[1] = 0;

                    termCap(tempTerm);

                    OC.Echo = NEITHER;
                    OC.setio();

                    buf[i++] = CTRL_A;
                    buf[i++] = (char) d;
                    }
                else
                    {
                    OC.Echo = oldEcho;
                    OC.setio();

                    oChar(BELL);

                    OC.Echo = NEITHER;
                    OC.setio();
                    }
                }
            else if (i < lim && c != '\t' && c != CTRL_A)
                {
                if ((OC.EchoChar >= '0') && (OC.EchoChar <= '9'))
                    {
                    OC.EchoChar++;
                    if (OC.EchoChar > '9') OC.EchoChar = '0';
                    }

                buf[i] = c;

                if (doEcho)
                    {
                    OC.Echo = oldEcho;
                    OC.setio();

                    oChar(c);

                    OC.Echo = NEITHER;
                    OC.setio();
                    }
                else
                    {
                    if (cfg.nopwecho == 0)
                        {
                        OC.Echo = CALLER;
                        OC.setio();
                        oChar(c);
                        }
                    else
                        {
                        OC.Echo = oldEcho;
                        OC.setio();
                        oChar((char) OC.EchoChar);
                        }

                    OC.Echo = NEITHER;
                    OC.setio();
                    }

                i++;
                }
            else
                {
                OC.Echo = oldEcho;
                OC.setio();

                oChar(BELL);

                OC.Echo = NEITHER;
                OC.setio();

                errors++;

                if (errors > cfg.maxerror && !onConsole)
                    {
                    CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(685), getmsg(79));

                    Hangup();

                    if (w)
                        {
                        destroyCitWindow(w, FALSE);
                        }
                    }
                }
            }

        // kludge to return immediately on single '?'
        if (QuestIsSpecial && *buf == '?')
            {
            break;
            }
        }

    if (!HaveConnectionToUser())
        {
        i = 0;
        useDefault = FALSE;
        ToReturn = FALSE;
        }

    OC.Echo = oldEcho;
    OC.setio();

    while (i && buf[i - 1] == CTRL_A)
        {
        buf[--i] = 0;
        }

    buf[i] = 0;
    OC.EchoChar = 0;

    if (useDefault && !*buf)
        {
        strcpy(buf, dfault);
        }

    SetDoWhat(oldDowhat);

    doCR();

    OC.MCI_goto = FALSE;

    return (ToReturn);
    }
示例#19
0
int CardDevice::at_response_error()
{
    if(m_lastcmd && (m_lastcmd->m_res == RES_OK || m_lastcmd->m_res == RES_ERROR || m_lastcmd->m_res == RES_CMS_ERROR || m_lastcmd->m_res == RES_SMS_PROMPT))
    {
	switch (m_lastcmd->m_cmd)
	{
	    /* initilization stuff */
	    case CMD_AT:
	    case CMD_AT_Z:
	    case CMD_AT_E:
	    case CMD_AT_U2DIAG:
		Debug(DebugAll,  "[%s] Command '%s' failed", c_str(), at_cmd2str (m_lastcmd->m_cmd));
		goto e_return;

	    case CMD_AT_CGMI:
		Debug(DebugAll, "[%s] Getting manufacturer info failed", c_str());
		goto e_return;

	    case CMD_AT_CGMM:
		Debug(DebugAll,  "[%s] Getting model info failed", c_str());
		goto e_return;

	    case CMD_AT_CGMR:
		Debug(DebugAll,  "[%s] Getting firmware info failed", c_str());
		goto e_return;

	    case CMD_AT_CMEE:
		Debug(DebugAll,  "[%s] Setting error verbosity level failed", c_str());
		goto e_return;

	    case CMD_AT_CGSN:
		Debug(DebugAll,  "[%s] Getting IMEI number failed", c_str());
		goto e_return;

	    case CMD_AT_CIMI:
		Debug(DebugAll,  "[%s] Getting IMSI number failed", c_str());
		goto e_return;

	    case CMD_AT_CPIN:
		Debug(DebugAll,  "[%s] Error checking PIN state", c_str());
		goto e_return;

	    case CMD_AT_CPIN_ENTER:
		Debug(DebugAll,  "[%s] Error enter PIN code", c_str());
		goto e_return;

	    case CMD_AT_COPS_INIT:
		Debug(DebugAll,  "[%s] Error setting operator select parameters", c_str());
		goto e_return;

	    case CMD_AT_CREG_INIT:
		Debug(DebugAll, "[%s] Error enableling registration info", c_str());
		goto e_return;

	    case CMD_AT_CREG:
		Debug(DebugAll, "[%s] Error getting registration info", c_str());
		if (!m_initialized)
		    m_commandQueue.append(new ATCommand("AT+CNUM", CMD_AT_CNUM));
		break;

	    case CMD_AT_CNUM:
		Debug(DebugAll, "[%s] Error checking subscriber phone number", c_str());
		Debug(DebugAll, "Datacard %s needs to be reinitialized. The SIM card is not ready yet", c_str());
		goto e_return;

	    case CMD_AT_CVOICE:
		Debug(DebugAll, "[%s] Datacard has NO voice support", c_str());
		m_has_voice = 0;
		if (!m_initialized)
		    m_commandQueue.append(new ATCommand("AT+CMGF=0", CMD_AT_CMGF));
		break;

	    case CMD_AT_CLIP:
		Debug(DebugAll, "[%s] Error enabling calling line indication", c_str());
		goto e_return;

	    case CMD_AT_CSSN:
		Debug(DebugAll, "[%s] Error Supplementary Service Notification activation failed", c_str());
		goto e_return;

	    case CMD_AT_CMGF:
	    case CMD_AT_CPMS:
	    case CMD_AT_CNMI:
		Debug(DebugAll, "[%s] Command '%s' failed", c_str(), at_cmd2str (m_lastcmd->m_cmd));
		Debug(DebugAll, "[%s] No SMS support", c_str());
		m_has_sms = 0;
		if (!m_initialized)
		{
		    if (m_has_voice)
		    {
			m_commandQueue.append(new ATCommand("AT+CSQ", CMD_AT_CSQ));
			m_initialized = 1;
			Debug(DebugAll, "Datacard %s initialized and ready", c_str());
		    }
		    goto e_return;
		}
		break;

	    case CMD_AT_CSCS:
		Debug(DebugAll, "[%s] No UCS-2 encoding support", c_str());
		m_use_ucs2_encoding = 0;
		/* set SMS storage location */
		if (!m_initialized)
		    m_commandQueue.append(new ATCommand("AT+CPMS=\"ME\",\"ME\",\"ME\"", CMD_AT_CPMS));
		break;
	    /* end initilization stuff */

	    case CMD_AT_A:
		Debug(DebugAll, "[%s] Answer failed", c_str());
		Hangup(DATACARD_FAILURE);
		break;

	    case CMD_AT_CLIR:
		Debug(DebugAll, "[%s] Setting CLIR failed", c_str());
		/* continue dialing */
		if(m_lastcmd->get())
		{
		    String* number = static_cast<String*>(m_lastcmd->get());
		    m_commandQueue.append(new ATCommand("ATD" + *number + ";", CMD_AT_D));
		}		
		break;

	    case CMD_AT_D:
		Debug(DebugAll, "[%s] Dial failed", c_str());
		m_outgoing = 0;
		m_needchup = 0;
		Hangup(DATACARD_CONGESTION);
		break;

	    case CMD_AT_DDSETEX:
		Debug(DebugAll, "[%s] AT^DDSETEX failed", c_str());
		break;

	    case CMD_AT_CHUP:
		Debug(DebugAll, "[%s] Error sending hangup, disconnecting", c_str());
		goto e_return;

	    case CMD_AT_CMGR:
		Debug(DebugAll, "[%s] Error reading SMS message", c_str());
		break;

	    case CMD_AT_CMGD:
		Debug(DebugAll, "[%s] Error deleting SMS message", c_str());
		break;

	    case CMD_AT_CMGS:
		Debug(DebugAll, "[%s] Error sending SMS message", c_str());
		break;

	    case CMD_AT_DTMF:
		Debug(DebugAll, "[%s] Error sending DTMF", c_str());
		break;

	    case CMD_AT_COPS:
		Debug(DebugAll, "[%s] Could not get provider name", c_str());
		break;

	    case CMD_AT_CLVL:
		Debug(DebugAll, "[%s] Error syncronizing audio level", c_str());
		m_volume_synchronized = 0;
		break;

	    case CMD_AT_CUSD:
		Debug(DebugAll, "[%s] Could not send USSD code", c_str());
		break;

	    default:
		Debug(DebugAll, "[%s] Received 'ERROR' for unhandled command '%s'", c_str(), at_cmd2str (m_lastcmd->m_cmd));
		break;
	}

	m_lastcmd->destruct();
	m_lastcmd = 0;
    }
    else if (m_lastcmd)
    {
	Debug(DebugAll, "[%s] Received 'ERROR' when expecting '%s', ignoring", c_str(), at_res2str (m_lastcmd->m_res));
    }
    else
    {
	Debug(DebugAll, "[%s] Received unexpected 'ERROR'", c_str());
    }

    return 0;

e_return:
    m_lastcmd->destruct();
    m_lastcmd = 0;
	
    return -1;
}
示例#20
0
void TERMWINDOWMEMBER getFmtString(const char *prompt, char *buf,
        Bool premature, Bool inclPrompt)
    {
    char c;
    int errors = 0;
    int entered, parsed = 0;

    const EchoType oldEcho = OC.Echo;
    const dowhattype oldDowhat = DoWhat;

    ansi(14);   // shut off music

    if (!HaveConnectionToUser())
        {
        *buf = 0;
        OC.MCI_goto = FALSE;
        return;
        }

    char *parsestr = new char[strlen(prompt) + 1];      // parsed characters
    char *notparsestr = new char[strlen(prompt) + 1];   // literal characters

    if (notparsestr && parsestr)
        {
        OC.SetOutFlag(IMPERVIOUS);

        SetDoWhat(PROMPT);

        for (int infmt = 0, i = 0; prompt[i]; i++)
            {
            if (prompt[i] == FT)
                {
                infmt = !infmt;
                }
            else if (infmt)
                {
                notparsestr[parsed] = prompt[i];
                parsestr[parsed] = FT;
                parsed++;
                }
            else if (strchr(getmsg(672), prompt[i]))
                {
                notparsestr[parsed] = FT;
                parsestr[parsed] = prompt[i];
                parsed++;
                }
            }

        notparsestr[parsed] = parsestr[parsed] = 0;  // tie off

        for (parsed = 0; parsestr[parsed] && FT == parsestr[parsed]; parsed++)
            {
            oChar(notparsestr[parsed]);
            if (inclPrompt)
                {
                buf[parsed] = notparsestr[parsed];
                }
            }

        OC.Echo = NEITHER;
        OC.setio();

        for (entered = 0, c = (char) iChar(); HaveConnectionToUser(); c = (char) iChar())
            {
            OC.SetOutFlag(OUTOK);
            OC.Echo = oldEcho;
            OC.setio();

            if (c == 0)
                {
                if (HaveConnectionToUser())
                    {
                    continue;
                    }
                else
                    {
                    entered = parsed = 0;
                    break;
                    }
                }
            else if (c == '\b' && entered)
                {
                for ( ; parsestr[parsed - 1] == FT; parsed--)
                    {
                    doBS();
                    }
                doBS();
                parsed--;
                entered--;
                }
            else if (c == '\n' && (premature || !parsestr[parsed]))
                {
                break;
                }
            else if (parsestr[parsed] && Isfunction(c, parsestr[parsed]))
                {
                oChar(c);
                buf[inclPrompt ? parsed : entered] = c;
                entered++;
                parsed++;
                for (; parsestr[parsed] && (FT == parsestr[parsed]); parsed++)
                    {
                    oChar(notparsestr[parsed]);
                    if (inclPrompt)
                        {
                        buf[parsed] = notparsestr[parsed];
                        }
                    }
                }
            else
                {
                oChar(BELL);

                if ('\b' != c && parsestr[parsed])
                    {
                    errors++;

                    if (errors > cfg.maxerror && !onConsole)
                        {
                        CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(685), getmsg(79));

                        Hangup();

                        if (w)
                            {
                            destroyCitWindow(w, FALSE);
                            }
                        }
                    }
                }

            OC.Echo = NEITHER;
            OC.setio();
            }

        OC.Echo = oldEcho;
        OC.setio();

        buf[inclPrompt ? parsed : entered] = 0;

        OC.EchoChar = 0;

        SetDoWhat(oldDowhat);

        doCR();

        OC.MCI_goto = FALSE;
        }
    else
        {
        OutOfMemory(81);
        *buf = 0;
        }

    delete [] notparsestr;
    delete [] parsestr;
    }
示例#21
0
Bool TERMWINDOWMEMBER net_callout(const char *nodenm)
    {
    Bool NetResult = FALSE;
    char String[80];

    if (!read_net_messages())
        {
        cPrintf(getmsg(59));
        return (FALSE);
        }

    SetDoWhat(NETWORKING);

    strftime(String, sizeof(String) - 1, cfg.vdatestamp, 0l);
    cPrintf(getnetmsg(170), String);
    doccr();

#ifdef WINCIT
    if (!ReadNodesCit(this, &node, nodenm, MODEM, FALSE))
#else
    if (!ReadNodesCit(&node, nodenm, MODEM, FALSE))
#endif
        {
        cPrintf(getmsg(206), nodenm);
        doccr();
        dump_net_messages();
        return (FALSE);
        }

    // login user
    MS.Read = 0;
    MS.Entered = 0;

    const l_slot slot = FindPersonByName(node->GetName());

    if (slot == CERROR)
        {
        cPrintf(getnetmsg(13));
        dump_net_messages();
        return (FALSE);
        }

    ThisSlot = slot;
    ThisLog = LTab(slot).GetLogIndex();
    loggedIn = TRUE;

    label Buffer;
    if (CurrentUser->Load(ThisLog))
        {
        setlbvisit();
        StatusLine.Update(WC_TWp);

        callout = TRUE;

#ifdef WINCIT
        trap(T_NETWORK, WindowCaption, getnetmsg(14), CurrentUser->GetName(Buffer, sizeof(Buffer)));
#else
        trap(T_NETWORK, getnetmsg(14), CurrentUser->GetName(Buffer, sizeof(Buffer)));
#endif

        // node logged in
        NetResult = net_master();

        // be sure to hang up
        if (CommPort->HaveConnection())
            {
            CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(82));

            Hangup();

            if (w)
                {
                destroyCitWindow(w, FALSE);
                }
            }

        // terminate user
        if (NetResult == TRUE)
            {
            CurrentUser->SetCallNumber(cfg.callno);
            time(&logtimestamp);
            CurrentUser->SetCallTime(logtimestamp);

            CurrentUser->SetLastMessage(MessageDat.NewestMessage());

            storeLog();

            loggedIn = FALSE;

            // trap it
#ifdef WINCIT
            trap(T_NETWORK, WindowCaption, getnetmsg(15), CurrentUser->GetName(Buffer, sizeof(Buffer)));
#else
            trap(T_NETWORK, getnetmsg(15), CurrentUser->GetName(Buffer, sizeof(Buffer)));
#endif


            OC.SetOutFlag(IMPERVIOUS);

            cPrintf(getnetmsg(16), CurrentUser->GetName(Buffer, sizeof(Buffer)));

            delete MS.AbortedMessage;
            MS.AbortedMessage = NULL;

#ifndef WINCIT
            trap(T_NETWORK, getnetmsg(17), MS.Entered);
            trap(T_NETWORK, getnetmsg(18), MS.Read);
            trap(T_NETWORK, getnetmsg(19), MS.Expired);
            trap(T_NETWORK, getnetmsg(20), MS.Duplicate);
#else
            trap(T_NETWORK, WindowCaption, getnetmsg(17), MS.Entered);
            trap(T_NETWORK, WindowCaption, getnetmsg(18), MS.Read);
            trap(T_NETWORK, WindowCaption, getnetmsg(19), MS.Expired);
            trap(T_NETWORK, WindowCaption, getnetmsg(20), MS.Duplicate);
#endif

            }
        else
            {
            loggedIn = FALSE;

            Bool SaveTrapit = cfg.trapit[T_NETWORK];

            if (node->GetNetFail() > 0)
                {
                cfg.trapit[T_NETWORK] = TRUE;
                }

            if (node->GetNetFail() < 0)
                {
                cfg.trapit[T_NETWORK] = FALSE;
                }

#ifdef WINCIT
            trap(T_NETWORK, WindowCaption, getnetmsg(21), CurrentUser->GetName(Buffer, sizeof(Buffer)));
#else
            trap(T_NETWORK, getnetmsg(21), CurrentUser->GetName(Buffer, sizeof(Buffer)));
#endif



            cfg.trapit[T_NETWORK] = SaveTrapit;
            }
        }
    else
        {
        loggedIn = FALSE;
        }

    setdefaultconfig(FALSE);

    // user terminated
    callout = FALSE;

    CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(19));

    Initport();

    if (w)
        {
        destroyCitWindow(w, FALSE);
        }

    freeNode(&node);

    dump_net_messages();
    return (NetResult);
    }