Ejemplo n.º 1
0
l_slot FindPersonByName(const char *name, const l_slot *Order)
	{
	label alias;
	CopyStringToBuffer(alias, name);
	char *ptr = strchr(alias, '.');
	if (ptr)
		{
		*ptr = 0;	// tie off
		}

	// check to see if name is in log table
	for (l_slot i = 0; i < cfg.MAXLOGTAB; i++)
		{
		l_slot S = Order ? Order[i] : i;

		if (LogTab[S].IsInuse() &&
				(
				LogTab[S].IsSameName(name) || LogTab[S].IsSameAlias(alias)
				)
			)
			{
			return (i);
			}
		}

	return (CERROR);
	}
Ejemplo n.º 2
0
void TERMWINDOWMEMBER StartPrinting(const char *FileName)
    {
    if (OC.Printing)
        {
        fclose(OC.PrintFile);
        }

#ifdef WINCIT
	sprintf(OC.PrintfileName, "%s.%ld", FileName, GetCurrentThreadId());
#else
	CopyStringToBuffer(OC.PrintfileName, FileName);
#endif

    normalizeString(OC.PrintfileName);

    if (citOpen(OC.PrintfileName, CO_A, &OC.PrintFile))
        {
        if (cfg.VerboseConsole)
            {
            CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 37));
            }

        OC.Printing = TRUE;
        }
    else
        {
        if (cfg.VerboseConsole)
            {
            CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 38));
            }

        OC.Printing = FALSE;
        }
    }
Ejemplo n.º 3
0
void getdstamp(char *buffer, time_t stamp)
	{
	if (stamp == 0)
		{
		strcpy(buffer, getmsg(330));
		return;
		}

	struct tm *TM = localtime(&stamp);

	char month[4];
	CopyStringToBuffer(month, monthTab[TM->tm_mon]);

	sprintf(buffer, getmsg(329), TM->tm_year % 100, month, TM->tm_mday);
	}
Ejemplo n.º 4
0
int ambigUnlink(const char *filename, const char *directory)
    {
    int count = 0;

    if (directory && !changedir(directory))
        {
        return (0);
        }

    // keep going till it errors, which is end of directory
    FindFileC FF;
    if (FF.FindFirst(starstar))
        {
        do
            {
            if (FF.IsNormalFile())
                {
                // + 1 for strcat() call below
#ifdef WINCIT
                char Name[MAX_PATH + 1];
#else
                char Name[_MAX_PATH + 1];
#endif

                CopyStringToBuffer(Name, FF.GetFullName());

                if (!strpos('.', Name))
                    {
                    strcat(Name, getmsg(433));
                    }

                // filename match wildcard?
                if (u_match(Name, filename))
                    {
                    if (!unlink(Name))
                        {
                        count++;
                        }
                    }
                }
            } while (FF.FindNext());
        }

    return (count);
    }
Ejemplo n.º 5
0
Bool IsFilenameLegal(const char *filename, Bool AllowSpace)
#endif
    {
    char *s;
    FILE *fl;

#ifdef WINCIT
    const char *invalid = getmsg(338);
#else
    const char *invalid = getmsg(641);

    if (AllowSpace)
        {
        invalid++;
        }
#endif

    if (strpbrk(invalid, filename) != NULL)
        {
        return (FALSE);
        }

    char device[14];
    CopyStringToBuffer(device, filename);

    if ((s = strchr(device, '.')) != NULL)
        {
        *s = '\0';
        }

    if ((fl = fopen(filename, FO_RB)) == NULL)
        {
        return (TRUE);
        }

    if (isatty(fileno(fl)))
        {
        fclose(fl);
        return (FALSE);
        }

    fclose(fl);
    return (TRUE);
    }
Ejemplo n.º 6
0
void TERMWINDOWMEMBER DoDebugCmd(const char **ncmsg)
	{
	char str[128];

	NetCmdReplyMsg->SetTextWithFormat(ncmsg[5], programName, version);
	NetCmdReplyMsg->AppendText(bn);

#ifndef VISUALC
	sprintf(str, ncmsg[6], _osmajor, _osminor);
	AppendLineToNetCommandReply(str);
#endif

	if (LockMenu(MENU_READ))
		{
#ifndef WINCIT
		if (*vdDesc)
			{
			sprintf(str, getmenumsg(MENU_READ, 84), getmenumsg(MENU_READ, 85),
					vdDesc);
			AppendLineToNetCommandReply(str);
			}

		if (*cdDesc)
			{
			sprintf(str, getmenumsg(MENU_READ, 84), getmenumsg(MENU_READ, 86),
					cdDesc);
			AppendLineToNetCommandReply(str);
			}

		if (*kdDesc)
			{
			sprintf(str, getmenumsg(MENU_READ, 84), getmenumsg(MENU_READ, 87),
					kdDesc);
			AppendLineToNetCommandReply(str);
			}

		if (*sdDesc)
			{
			sprintf(str, getmenumsg(MENU_READ, 84), getmenumsg(MENU_READ, 88),
					sdDesc);
			AppendLineToNetCommandReply(str);
			}
#endif

#ifdef MSC
		r.h.ah = 0x48;	 // allocate memory
		r.h.al = 0;
		r.x.bx = 0xffff; // ask for an impossible amount

		intdos(&r, &r);

		sprintf(str, getmenumsg(MENU_READ, 90), _bios_memsize());
		NetCmdReplyMsg->AppendText(str);
		sprintf(str, getmenumsg(MENU_READ, 91), ltoac((long)r.x.bx*16L));
		AppendLineToNetCommandReply(str);
#else
	#ifdef WINCIT
		MEMORYSTATUS ms;
		ms.dwLength = sizeof(ms);
		GlobalMemoryStatus(&ms);

		label Avail;

		CopyStringToBuffer(Avail, ltoac(ms.dwAvailPhys / 1024));
		sprintf(str, getmenumsg(MENU_READ, 92), ltoac(ms.dwTotalPhys / 1024),
				Avail);
		AppendLineToNetCommandReply(str);

		CopyStringToBuffer(Avail, ltoac(ms.dwAvailPageFile / 1024));
		sprintf(str, getmenumsg(MENU_READ, 93),
				ltoac(ms.dwTotalPageFile / 1024), Avail);
		AppendLineToNetCommandReply(str);

		CopyStringToBuffer(Avail, ltoac(ms.dwAvailVirtual / 1024));
		sprintf(str, getmenumsg(MENU_READ, 107),
				ltoac(ms.dwTotalVirtual / 1024), Avail);
		AppendLineToNetCommandReply(str);

		sprintf(str, getmenumsg(MENU_READ, 108), ms.dwMemoryLoad);
		AppendLineToNetCommandReply(str);
	#else
		sprintf(str, getmenumsg(MENU_READ, 90), biosmemory());
		NetCmdReplyMsg->AppendText(str);
		sprintf(str, getmenumsg(MENU_READ, 91), ltoac(farcoreleft()));
		AppendLineToNetCommandReply(str);
	#endif
#endif

		if (*cmdLine)
			{
			sprintf(str, getmenumsg(MENU_READ, 94), cmdLine);
			AppendLineToNetCommandReply(str);
			}

		UnlockMenu(MENU_READ);
		}
	else
		{
		sprintf(str, getmsg(188), ncmsg[76]);
		AppendLineToNetCommandReply(str);
		}

	sprintf(str, ncmsg[7], cfg.sysop);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[8], cfg.mdata);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[9], cfg.dumbmodem);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[10], bauds[cfg.initbaud]);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[11], connectbauds[cfg.minbaud]);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[12], cfg.modsetup);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[13], cfg.modunsetup);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[14], cfg.downshift);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[15], cfg.dialsetup);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[16], cfg.dialpref);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[17], cfg.dialring);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[18], cfg.dialringwait);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[19], cfg.downshift);
	NetCmdReplyMsg->AppendText(str);
	for (int i = 0; i < 7; i++)
		{
		if (cfg.updays[i])
			{
			sprintf(str, ncmsg[38], i + 1);
			NetCmdReplyMsg->AppendText(str);
			}
		}
	NetCmdReplyMsg->AppendText(bn);

	sprintf(str, ncmsg[20], cfg.downshift);
	NetCmdReplyMsg->AppendText(str);
EXTRA_OPEN_BRACE	
	for (int i = 0; i < 24; i++)
		{
		if (cfg.uphours[i])
			{
			sprintf(str, ncmsg[38], i + 1);
			NetCmdReplyMsg->AppendText(str);
			}
		}
EXTRA_CLOSE_BRACE
	NetCmdReplyMsg->AppendText(bn);

	sprintf(str, ncmsg[21], cfg.hangupdelay);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[22], cfg.hangup);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[23], cfg.offhookstr);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[24], cfg.baudPause);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[26], cfg.autoansi);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[27], cfg.MsgDatSizeInK);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[28], cfg.maxfiles);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[29], cfg.MAXLOGTAB);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[30], cfg.maxrooms);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[31], cfg.maxhalls);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[32], cfg.maxgroups);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[33], cfg.maxborders);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[34], (ulong) cfg.nmessages);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[35], cfg.ovrEms);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[36], cfg.ovrExt);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[37], cfg.bios);
	AppendLineToNetCommandReply(str);

#ifdef AUXMEM
	sprintf(str, ncmsg[40], cfg.vmemfile);
	AppendLineToNetCommandReply(str);
#endif

	sprintf(str, ncmsg[41], cfg.checkCTS);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[42], cfg.scrollSize);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[43], cfg.scrollColors);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[44], cfg.maxjumpback);
	AppendLineToNetCommandReply(str);

	sprintf(str, ncmsg[45], cfg.statnum);
	AppendLineToNetCommandReply(str);
	}
Ejemplo n.º 7
0
Bool ReadNodesCit(NodesCitC **newNode, const char *NameOrAddrToFind, ModemConsoleE W, Bool option)
#endif
    {
    FILE *fBuf;
    char *words[256];
    int i;
    char path[80];
    int count;
    uint lineno = 0;
    l_slot logslot;

    if (!read_node_ddata())
        {
        TWwPrintf(W, getmsg(59));
        return (FALSE);
        }

    const char **nodekeywords = (const char **) nddd->aux;
    const char **nettypes = (const char **) nddd->next->aux;
    const char **nodemsgs = (const char **) nddd->next->next->aux;

    label NameToFind;
    CopyStringToBuffer(NameToFind, NameOrAddrToFind);

    if (SameString(NameOrAddrToFind, getnodemsg(2)))
        {
        // if default, start fresh
        if (!clearNode(newNode))
            {
            dump_node_ddata();
            return (FALSE);
            }
        }
    else
        {
        // else first read in default
#ifdef WINCIT
        ReadNodesCit(TW, newNode, getnodemsg(2), W, FALSE);
#else
        ReadNodesCit(newNode, getnodemsg(2), W, FALSE);
#endif

        if (*newNode)
            {
#ifdef WINCIT
            logslot = nodexists(NameOrAddrToFind, TW ? TW->LogOrder : NULL);
#else
            logslot = nodexists(NameOrAddrToFind);
#endif

            if (logslot == CERROR)
                {
                TWwDoCR(W);
                TWwPrintf(W, getnodemsg(3), NameOrAddrToFind);

                if (strlen(NameOrAddrToFind) < 4)
                    {
                    char temp[4];

                    CopyStringToBuffer(temp, NameOrAddrToFind);
                    strlwr(temp);
                    TWwPrintf(W, getnodemsg(4), temp, cfg.locID);
                    }

                dump_node_ddata();
                return (FALSE);
                }

            label Alias, LocID;

#ifdef WINCIT
            if (!*LogTab[TW ? TW->LogOrder[logslot] : logslot].GetAlias(Alias, sizeof(Alias)) ||
                    !*LogTab[TW ? TW->LogOrder[logslot] : logslot].GetLocID(LocID, sizeof(LocID)))
#else
            if (!*LTab(logslot).GetAlias(Alias, sizeof(Alias)) || !*LTab(logslot).GetLocID(LocID, sizeof(LocID)))
#endif
                {
                TWwDoCR(W);
                TWwPrintf(W, getnodemsg(5), NameOrAddrToFind);

                dump_node_ddata();
                return (FALSE);
                }

            (*newNode)->SetAlias(Alias);
            (*newNode)->SetLocID(LocID);

            label FileName;
            sprintf(FileName, getnodemsg(6), (*newNode)->GetAlias());
            (*newNode)->SetMailFileName(FileName);

            // Make sure NameToFind is a name, not address.
#ifdef WINCIT
            LogTab[TW ? TW->LogOrder[logslot] : logslot].GetName(NameToFind, sizeof(NameToFind));
#else
            LTab(logslot).GetName(NameToFind, sizeof(NameToFind));
#endif

            // Support for optional nodes.cit entries.
            (*newNode)->SetName(NameToFind);
            }
        }

    if (!*newNode)
        {
        cOutOfMemory(44);
        dump_node_ddata();
        return (FALSE);
        }

    compactMemory();

    sprintf(path, sbs, cfg.homepath, getnodemsg(8));

    if ((fBuf = fopen(path, FO_R)) == NULL) // ASCII mode
        {
        TWdoccr();
        TWcPrintf(getmsg(15), getnodemsg(8));
        TWdoccr();

        dump_node_ddata();
        return (option);
        }

    char line[256];
    Bool FoundOurEntry = FALSE;
    long pos = ftell(fBuf);
    while (fgets(line, 254, fBuf) != NULL)
        {
        lineno++;

        if (line[0] != '#')
            {
            pos = ftell(fBuf);
            continue;
            }

        // Don't read anything until we found our entry, except possible beginnings of our entry. (#NODE...)
        if (!FoundOurEntry && strnicmp(line + 1, nodekeywords[NOK_NODE], strlen(nodekeywords[NOK_NODE])) != SAMESTRING)
            {
            pos = ftell(fBuf);
            continue;
            }

        // Save a copy of the line in case this is the #LOGIN macro: parse_it
        // changes what is passed to it.
        char ltmp[256];
        CopyStringToBuffer(ltmp, line);

        count = parse_it(words, line);

        // Look up our first word in table of keywords.
        for (i = 0; i < NOK_NUM; i++)
            {
            if (SameString(words[0] + 1, nodekeywords[i]))
                {                   //^ add one for '#'
                break;
                }
            }

        if (i < NOK_NUM && !words[1][0])    // valid keywords need a param
            {
            TWcPrintf(getnodemsg(9), getnodemsg(8), ltoac(lineno), nodekeywords[i], ns);
            TWdoccr();
            continue;
            }

        if (i == NOK_NODE)
            {
            // This is a #NODE line... if we have alread found our entry,
            // then this is the start of the next one, and we are done.
            if (FoundOurEntry)
                {
                fclose(fBuf);
                dump_node_ddata();
                return (TRUE);
                }

            // This is a #NODE line... if it is for us, then we have now
            // found our entry. If not, then we continue looking.
            if (SameString(NameToFind, words[1]))
                {
                FoundOurEntry = TRUE;
                }
            else
                {
                pos = ftell(fBuf);
                continue;
                }
            }

        switch (i)
            {
            case NOK_BAUD:
                {
                PortSpeedE PS = digitbaud(atol(words[1]));

                if (PS == PS_ERROR)
                    {
                    TWcPrintf(getnodemsg(9), getnodemsg(8), ltoac(lineno), nodekeywords[i], words[1]);
                    TWdoccr();
                    }
                else
                    {
                    (*newNode)->SetBaud(PS);
                    }

                break;
                }

            case NOK_DIALOUT:
            case NOK_PHONE:
                {
                (*newNode)->SetDialOut(words[1]);

                if (strlen(words[1]) > 49)
                    {
                    TWcPrintf(getnodemsg(1), getnodemsg(8), ltoac(lineno), nodekeywords[i], 50);
                    TWdoccr();
                    }

                break;
                }

            case NOK_PREDIAL:
                {
                (*newNode)->SetPreDial(words[1]);

                if (strlen(words[1]) > 63)
                    {
                    TWcPrintf(getnodemsg(1), getnodemsg(8), ltoac(lineno), nodekeywords[i], 64);
                    TWdoccr();
                    }

                break;
                }

            case NOK_FETCH_TIMEOUT:
                {
                (*newNode)->SetFetchTimeout(atoi(words[1]));
                break;
                }

            case NOK_ZIP:
                {
                if (!words[2][0])   // need second param
                    {
                    TWcPrintf(getnodemsg(9), getnodemsg(8), ltoac(lineno), nodekeywords[i], ns);
                    TWdoccr();
                    continue;
                    }
                else
                    {
                    (*newNode)->SetCreatePacket(words[1]);

                    if (strlen(words[1]) > 39)
                        {
                        TWcPrintf(getnodemsg(1), getnodemsg(8), ltoac(lineno), nodekeywords[i], 40);
                        TWdoccr();
                        }

                    (*newNode)->SetExtractPacket(words[2]);

                    if (strlen(words[2]) > 39)
                        {
                        TWcPrintf(getnodemsg(1), getnodemsg(8), ltoac(lineno), nodekeywords[i], 40);
                        TWdoccr();
                        }
                    }

                break;
                }

            case NOK_NETWORK:
                {
                (*newNode)->SetNetworkRevisionNumber(0);

                NETTYPES j;
                for (j = (NETTYPES) 0; j < NET_NUM; j = (NETTYPES) (j + 1))
                    {
                    if (SameString(words[1], nettypes[j]))
                        {
                        break;
                        }
                    }

                if (j == NET_DCIT11)
                    {
                    j = NET_DCIT10;
                    }

                if (j == NET_6_9a)
                    {
                    (*newNode)->SetNetworkRevisionNumber(1);
                    j = NET_6_9;
                    }

                if (j == NET_NUM)
                    {
                    TWcPrintf(getnodemsg(9), getnodemsg(8), ltoac(lineno), nodekeywords[i], words[1]);
                    TWdoccr();
                    }
                else
                    {
                    (*newNode)->SetNetworkType(j);
                    }

                break;
                }

            case NOK_PROTOCOL:
                {
                (*newNode)->SetProtocol(words[1][0]);
                break;
                }

            case NOK_AUTOHALL:
                {
                (*newNode)->SetAutoHall(hallexists(words[1]));

                if (strlen(words[1]) > LABELSIZE)
                    {
                    TWcPrintf(getnodemsg(1), getnodemsg(8), ltoac(lineno), nodekeywords[i], LABELSIZE + 1);
                    TWdoccr();
                    }

                break;
                }

            case NOK_AUTOGROUP:
                {
                (*newNode)->SetAutoGroup(FindGroupByName(words[1]));

                if (strlen(words[1]) > LABELSIZE)
                    {
                    TWcPrintf(getnodemsg(1), getnodemsg(8), ltoac(lineno), nodekeywords[i], LABELSIZE + 1);
                    TWdoccr();
                    }

                break;
                }

            case NOK_MAPUNKGROUP:
                {
                g_slot GroupSlot = FindGroupByName(words[1]);

                if (GroupSlot == CERROR)
                    {
                    GroupSlot = SPECIALSECURITY;
                    }

                (*newNode)->SetMapUnknownGroup(GroupSlot);

                if (strlen(words[1]) > LABELSIZE)
                    {
                    TWcPrintf(getnodemsg(1), getnodemsg(8), ltoac(lineno), nodekeywords[i], LABELSIZE + 1);
                    TWdoccr();
                    }

                break;
                }

            case NOK_LOGIN:
                {
                (*newNode)->SetLoginMacro(ltmp + strlen(nodekeywords[NOK_LOGIN]) + 1);
                break;
                }

            case NOK_NODE:
                {
                // A bit silly.
                (*newNode)->SetName(words[1]);

                if (strlen(words[1]) > LABELSIZE)
                    {
                    TWcPrintf(getnodemsg(1), getnodemsg(8), ltoac(lineno), nodekeywords[i], LABELSIZE + 1);
                    TWdoccr();
                    }

                if (count > 2)
                    {
                    (*newNode)->SetOldRegion(words[2]);

                    if (strlen(words[2]) > LABELSIZE)
                        {
                        TWcPrintf(getnodemsg(1), getnodemsg(8), ltoac(lineno), nodekeywords[i], LABELSIZE + 1);
                        TWdoccr();
                        }
                    }
                else
                    {
                    (*newNode)->SetOldRegion(ns);
                    }

                (*newNode)->FreeMappedGroups();
                (*newNode)->SetRoomOffset(0);

                break;
                }

            case NOK_DIAL_TIMEOUT:
                {
                (*newNode)->SetDialTimeout(atoi(words[1]));
                break;
                }

            case NOK_REQUEST:
                {
                (*newNode)->SetRequest(atoi(words[1]));
                break;
                }

            case NOK_WAIT_TIMEOUT:
                {
                (*newNode)->SetWaitTimeout(atoi(words[1]));
                break;
                }

            case NOK_AUTOROOM:
                {
                (*newNode)->SetAutoRoom(atoi(words[1]));
                break;
                }

            case NOK_VERBOSE:
                {
                (*newNode)->SetDefaultVerbose();

                const char **verbosekeywords = (const char **) nddd->next->next->next->aux;

                for (int j = 1; j < count; j++)
                    {
                    if (SameString(words[j], getnodemsg(39)))
                        {
                        (*newNode)->SetDefaultVerbose();
                        }
                    else if (SameString(words[j], getnodemsg(40)))
                        {
                        (*newNode)->SetDefaultVerbose();
                        (*newNode)->SetVerbose(NCV_FILE69INFULL, TRUE);
                        (*newNode)->SetVerbose(NCV_NOACCESS, TRUE);
                        }
                    else if (SameString(words[j], getnodemsg(41)))
                        {
                        (*newNode)->SetDefaultVerbose();
                        (*newNode)->SetVerbose(NCV_FILE69INFULL, TRUE);
                        (*newNode)->SetVerbose(NCV_NOACCESS, TRUE);
                        (*newNode)->SetVerbose(NCV_ROOMCREATED, TRUE);
                        (*newNode)->SetVerbose(NCV_ROOMNOTCREATED, TRUE);
                        (*newNode)->SetVerbose(NCV_NETIDNOTFOUND, TRUE);
                        (*newNode)->SetVerbose(NCV_NONETIDONSYSTEM, TRUE);
                        }
                    else
                        {
                        const char *Keyword;
                        Bool NewSetting;

                        if (words[j][0] == '!')
                            {
                            Keyword = words[j] + 1;
                            NewSetting = FALSE;
                            }
                        else
                            {
                            Keyword = words[j];
                            NewSetting = TRUE;
                            }

                        NCV_Type TestType;

                        for (TestType = (NCV_Type) 0; TestType < NCV_MAX; TestType = (NCV_Type) (TestType + 1))
                            {
                            if (SameString(Keyword, verbosekeywords[TestType]))
                                {
                                (*newNode)->SetVerbose(TestType, NewSetting);
                                break;
                                }
                            }

                        if (TestType == NCV_MAX)
                            {
                            if (SameString(Keyword, getnodemsg(13)))
                                {
                                // ALL
                                for (TestType = (NCV_Type) 0; TestType < NCV_MAX; TestType = (NCV_Type) (TestType + 1))
                                    {
                                    (*newNode)->SetVerbose(TestType, NewSetting);
                                    }
                                }
                            else
                                {
                                TWcPrintf(getnodemsg(12), getnodemsg(8), ltoac(lineno), words[0], Keyword);
                                TWdoccr();
                                }
                            }
                        }
                    }

                break;
                }

            case NOK_CHAT:
                {
                (*newNode)->SetDefaultChat();

                const char **chatkeywords = (const char **) nddd->next->next->next->next->aux;

                for (int j = 1; j < count; j++)
                    {
                    const char *Keyword;
                    Bool NewSetting;

                    if (words[j][0] == '!')
                        {
                        Keyword = words[j] + 1;
                        NewSetting = FALSE;
                        }
                    else
                        {
                        Keyword = words[j];
                        NewSetting = TRUE;
                        }

                    NCC_Type TestType;

                    for (TestType = (NCC_Type) 0; TestType < NCC_MAX; TestType = (NCC_Type) (TestType + 1))
                        {
                        if (SameString(Keyword, chatkeywords[TestType]))
                            {
                            (*newNode)->SetChat(TestType, NewSetting);
                            break;
                            }
                        }

                    if (TestType == NCV_MAX)
                        {
                        if (SameString(Keyword, getnodemsg(13)))
                            {
                            // ALL
                            for (TestType = (NCC_Type) 0; TestType < NCC_MAX; TestType = (NCC_Type) (TestType + 1))
                                {
                                (*newNode)->SetChat(TestType, NewSetting);
                                }
                            }
                        else
                            {
                            TWcPrintf(getnodemsg(12), getnodemsg(8), ltoac(lineno), words[0], Keyword);
                            TWdoccr();
                            }
                        }
                    }

                break;
                }

            case NOK_REDIAL:
                {
                (*newNode)->SetRedial(atoi(words[1]));
                break;
                }

            case NOK_ROOM:
                {
                (*newNode)->SetRoomOffset(pos);
                fclose(fBuf);
                dump_node_ddata();
                return (TRUE);
                }

            case NOK_GROUP:
                {
                if (!(*newNode)->AddMappedGroups(words[1], words[2]))
                    {
                    TWcPrintf(getnodemsg(10), words[1]);
                    TWdoccr();
                    }

                if (strlen(words[1]) > LABELSIZE)
                    {
                    TWcPrintf(getnodemsg(1), getnodemsg(8), ltoac(lineno), nodekeywords[i], LABELSIZE + 1);
                    TWdoccr();
                    }

                if (strlen(words[2]) > LABELSIZE)
                    {
                    TWcPrintf(getnodemsg(1), getnodemsg(8), ltoac(lineno), nodekeywords[i], LABELSIZE + 1);
                    TWdoccr();
                    }

                break;
                }

            case NOK_GATEWAY:
                {
                (*newNode)->SetGateway(atoi(words[1]));
                break;
                }

            case NOK_FETCH:
                {
                (*newNode)->SetFetch(atoi(words[1]));
                break;
                }

            case NOK_NETFAIL:
                {
                (*newNode)->SetNetFail(atoi(words[1]));
                break;
                }

            case NOK_OUTPUTPACE:
                {
                (*newNode)->SetOutputPace(atoi(words[1]));
                break;
                }

            case NOK_IPADDRESS:
                {
#ifdef WINCIT
                (*newNode)->SetIpAddress(words[1]);

                if (strlen(words[1]) > 255)
                    {
                    TWcPrintf(getnodemsg(1), getnodemsg(8), ltoac(lineno), nodekeywords[i], 256);
                    TWdoccr();
                    }
#endif
                break;
                }

            case NOK_IPPORT:
                {
#ifdef WINCIT
                (*newNode)->SetIpPort(atoi(words[1]));
#endif
                break;
                }

            default:
                {
                TWcPrintf(getnodemsg(11), getnodemsg(8), ltoac(lineno), words[0]);
                TWdoccr();

                break;
                }
            }

        pos = ftell(fBuf);
        }

    fclose(fBuf);

    if (!FoundOurEntry && !option && debug)
        {
        TWwDoCR(W);
        TWwPrintf(W, getmsg(206), NameOrAddrToFind);
        TWwDoCR(W);
        }

    dump_node_ddata();

    if (option)
        {
        return (TRUE);
        }
    else
        {
        return (FoundOurEntry);
        }
    }
Ejemplo n.º 8
0
/* -------------------------------------------------------------------- */
void ReadExternalCit(void)
	{
	FILE *fBuf;
	char line[257];
	char *words[256];
	int count;

	if ((fBuf = fopen(externalCit, "r")) == NULL)       /* ASCII mode */
		{
		printf("Cannot find %s!", externalCit);
		exit(69);
		}
	else
		{
		int i, lineNo = 0;

		while (fgets(line, 256, fBuf) != NULL)
			{
			lineNo++;

			if (line[0] != '#')
				{
				continue;
				}

			count = parse_it(words, line);

			if (SameString(words[0], "#PROTOCOL"))
				{
				protocols *theProt;

				theProt = (protocols *) addLL((void **) &protList,
							sizeof(*theProt));

				if (theProt)
					{
					CopyStringToBuffer(theProt->name, words[1], LABELSIZE);
					theProt->batch = !!atoi(words[2]);
					theProt->block = atoi(words[3]);
					CopyStringToBuffer(theProt->rcv, words[4], 127);
					CopyStringToBuffer(theProt->snd, words[5], 127);

					if (count <= 6 || words[6][0] == '\0')
						{
						theProt->autoDown[0] = '\0';
						}
					else
						{
						CopyStringToBuffer(theProt->autoDown, words[6], LABELSIZE);
						}

					if (count > 7)
						{
						CopyStringToBuffer(theProt->respDown, words[7], 127);
						}
					}
				else
					{
					printf("Not enough memory for #PROTOCOL \"%s\"",
							words[1]);
					printf("\n");
					}
				}
			}

		fclose(fBuf);
		}
	}
Ejemplo n.º 9
0
void TERMWINDOWMEMBER GiveRoomPrompt(Bool JustDisplayedEvent)
	{
	static int roomCounter;
	label rn, gn, np, ex, hn;
	char rd[81];
	char tm[128], dt[128];
	int i;

	CommPort->FlushInput();

	OC.User.Reset();

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

	OC.ansiattr = cfg.attr;

	doEvent(EVT_ROOMPROMPT);

	if (CurrentUser->IsYouAreHere())
		{
		youAreHere();
		}

#ifdef WINCIT
	// if (!PendingSystemEvents)
    	// {
    	OC.SetOutFlag(PendingSystemEvents ? NOSTOP : IMPERVIOUS);
	// }

//	if (IdlePrompt)
//		{
//		return;
//		}

	if (!(CurrentUser->IsErasePrompt() && JustDisplayedEvent))
    	{
	    doCR();
		}

	if (JustDisplayedEvent)
		{
		numLines = 0;
		}
#endif

	OC.Formatting = FALSE;

	roomCounter++;

	RoomTab[thisRoom].GetName(rn, sizeof(rn));

	*gn = 0;
	if (RoomTab[thisRoom].IsGroupOnly())
		{
		if (RoomTab[thisRoom].IsBooleanGroup())
			{
			CopyStringToBuffer(gn, getmsg(471));
			}
		else
			{
			GroupData[RoomTab[thisRoom].GetGroupNumber()].GetName(gn, sizeof(gn));
			}
		}

	*np = 0;
	if (RoomTab[thisRoom].IsShared())
		{
		label Buffer;
		CopyStringToBuffer(np, loggedIn ? CurrentUser->GetNetPrefix(Buffer, sizeof(Buffer)) : cfg.netPrefix);
		}


	*ex = 0;
	i = 0;
	if (RoomTab[thisRoom].IsMsDOSdir())
		{
		if (CurrentUser->IsIBMRoom() && TermCap->IsIBMExtended())
			{
			ex[i++] = roomCounter == 6969 ? '\xcc' : '\xb9';
			}
		else
			{
			ex[i++] = roomCounter == 6969 ? '[' : ']';
			}
		}

	if (RoomTab[thisRoom].IsGroupOnly())
		{
		if (CurrentUser->IsIBMRoom() && TermCap->IsIBMExtended())
			{
			ex[i++] = roomCounter == 6969 ? '\xba' : '\xb3';
			}
		else
			{
			ex[i++] = roomCounter == 6969 ? ';' : ':';
			}
		}

	if (RoomTab[thisRoom].IsHidden())
		{
		ex[i++] = roomCounter == 6969 ? '(' : ')';
		}
	if (RoomTab[thisRoom].IsBIO())
		{
		ex[i++] = roomCounter == 6969 ? '{' : '}';
		}
	else if (!RoomTab[thisRoom].IsGroupOnly() && !RoomTab[thisRoom].IsMsDOSdir() && !RoomTab[thisRoom].IsHidden())
		{
		if (!(iswindow(thisRoom) && CurrentUser->IsIBMRoom() && TermCap->IsIBMExtended()))
			{
			ex[i++] = roomCounter == 6969 ? '<' : '>';
			}
		}

	if (iswindow(thisRoom))
		{
		if (CurrentUser->IsIBMRoom() && TermCap->IsIBMExtended())
			{
			ex[i++] = roomCounter == 6969 ? '\xae' : '\xaf';
			}
		else
			{
			ex[i++] = roomCounter == 6969 ? '<' : '>';
			}
		}
	ex[i] = 0;

	HallData[thisHall].GetName(hn, sizeof(hn));
	CurrentRoom->GetInfoLine(rd, sizeof(rd));

	char Buffer[64];
	strftime(tm, 127, (loggedIn) ? special_deansi(CurrentUser->GetDateStamp(Buffer, sizeof(Buffer)),
			TERM_TIME) : special_deansi(cfg.datestamp, TERM_TIME), 0l);

	strftime(dt, 127, (loggedIn) ? special_deansi(CurrentUser->GetVerboseDateStamp(Buffer,
			sizeof(Buffer)), TERM_DATE) : special_deansi(cfg.vdatestamp, TERM_DATE), 0l);

	Andy(loggedIn ? CurrentUser->GetPromptFormat(Buffer, sizeof(Buffer)) :
			cfg.prompt, getmsg(638), rn, gn, np, ex, hn, rd, tm, dt);

	OC.Formatting = TRUE;
	ansi(14);
	OC.MCI_goto = FALSE;

	termCap(TERM_NORMAL);
	mPrintf(spc);
    CursorIsAtPrompt = TRUE;

	OC.SetOutFlag(OUTOK);

	if (roomCounter == 6969)
		{
		roomCounter = 0;
		}
	}
Ejemplo n.º 10
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();
    }
Ejemplo n.º 11
0
/* ----------------------------------------------------------------------
   TtaSetAttributeText

   Changes the value of an attribute of type text.
   Parameters:
   attribute: the attribute to be modified.
   buffer: character string representing the new value of the attribute.
   element: the element with which the attribute is associated,
   NULL if the attribute is not yet associated with an element.
   document: the document to which the element belongs.
   Must be 0 if element is NULL.
   ---------------------------------------------------------------------- */
void TtaSetAttributeText (Attribute attribute, const char* buffer,
                          Element element, Document document)
{
  int                 lg;
  PtrAttribute        pAttr;
#ifndef NODISPLAY
  PtrAttribute        pPrevAttr, pA;
#endif /* NODISPLAY */
  Language	      lang;

  UserErrorCode = 0;
  pAttr = (PtrAttribute) attribute;
  if (pAttr == NULL)
    TtaError (ERR_invalid_parameter);
  else if (pAttr->AeAttrType != AtTextAttr)
    TtaError (ERR_invalid_attribute_type);
  else if (AttrOfElement (attribute, element))
    {
#ifndef NODISPLAY
      if (element != NULL)
        {
          /* detach temporarily attribute from element */
          pPrevAttr = NULL;
          pA = ((PtrElement) element)->ElFirstAttr;
          while (pA && pA != pAttr)
            {
              pPrevAttr = pA;
              pA = pA->AeNext;
            }
          if (pA)
            {
              if (pPrevAttr)
                pPrevAttr->AeNext = pA->AeNext;
              else
                ((PtrElement) element)->ElFirstAttr = pA->AeNext;
            }
          /* de-apply all presentation rules related to the attribute */
          UndisplayInheritedAttributes ((PtrElement) element, pAttr, document,
                                        TRUE);
          /* reattach attribute to element */
          if (pA)
            {
              if (pPrevAttr)
                pPrevAttr->AeNext = pAttr;
              else
                ((PtrElement) element)->ElFirstAttr = pAttr;
            }
        }
#endif
      if (pAttr->AeAttrText == NULL)
        GetTextBuffer (&pAttr->AeAttrText);
      else
        ClearText (pAttr->AeAttrText);
      /* Sets the new value */
      CopyStringToBuffer ((unsigned char *)buffer, pAttr->AeAttrText, &lg);
      if (pAttr->AeAttrNum == 1)
        /* language attribute */
        {
          lang = TtaGetLanguageIdFromName (buffer);
#ifdef NODISPLAY
          ChangeLanguageLeaves((PtrElement) element, lang);
#else
          ChangeLanguage (LoadedDocument[document - 1],
                          (PtrElement) element, lang, FALSE);
#endif
        }
#ifndef NODISPLAY
      if (element != NULL)
        DisplayAttribute ((PtrElement) element, pAttr, document);
#endif
    }
}
Ejemplo n.º 12
0
/*----------------------------------------------------------------------
  AttachMandatoryAttrSRule verifie que l'element pEl possede les  
  attributs requis indique's dans la regle pSRule du schema de    
  structure pSS et, si certains attributs requis manquent, force  
  l'utilisateur a leur donner une valeur et met ces attributs sur 
  l'element pEl.                                                  
  ----------------------------------------------------------------------*/
static void AttachMandatoryAttrSRule (PtrElement pEl, PtrDocument
                                      pDoc, SRule *pSRule,
                                      PtrSSchema pSS)
{
#ifndef NODISPLAY
  int                 len;
#endif /* NODISPLAY */
  PtrAttribute        pAttr, pA;
  PtrReference        pRef;
  ThotBool            found;
  ThotBool            MandatoryAttrOK = FALSE;
  NotifyAttribute     notifyAttr;
  int                 i, att;

  /* parcourt tous les attributs locaux definis dans la regle */
  for (i = 0; (pDoc->DocSSchema != NULL) && (i < pSRule->SrNLocalAttrs); i++)
    if (pSRule->SrRequiredAttr->Bln[i])
      /* cet attribut local est obligatoire */
      if (pDoc->DocSSchema != NULL)
        /* le document n'a pas ete ferme' entre-temps */
        {
          att = pSRule->SrLocalAttr->Num[i];
          /* cherche si l'element possede cet attribut */
          pAttr = pEl->ElFirstAttr;
          found = FALSE;
          while (pAttr != NULL && !found)
            if (pAttr->AeAttrNum == att &&
                (att == 1 ||
                 !strcmp (pAttr->AeAttrSSchema->SsName, pSS->SsName)))
              /* att = 1: Langue, quel que soit le schema de structure */
              found = TRUE;
            else
              pAttr = pAttr->AeNext;
          if (!found)
            /* l'element ne possede pas cet attribut requis */
            {
              /* envoie l'evenement AttrCreate.Pre */
              notifyAttr.event = TteAttrCreate;
              notifyAttr.document = (Document) IdentDocument (pDoc);
              notifyAttr.element = (Element) pEl;
              notifyAttr.info = 0; /* not sent by undo */
              notifyAttr.attribute = NULL;
              notifyAttr.attributeType.AttrSSchema = (SSchema) pSS;
              notifyAttr.attributeType.AttrTypeNum = att;
              CallEventAttribute (&notifyAttr, TRUE);
              /* cree un nouvel attribut pour l'element */
              GetAttribute (&pAttr);
              pAttr->AeAttrSSchema = pSS;
              pAttr->AeAttrNum = att;
              pAttr->AeDefAttr = FALSE;
              pAttr->AeAttrType = pSS->SsAttribute->TtAttr[att - 1]->AttrType;
              switch (pAttr->AeAttrType)
                {
                case AtNumAttr:
                case AtEnumAttr:
                  pAttr->AeAttrValue = 0;
                  break;
                case AtReferenceAttr:
                  /* attache un bloc reference a l'attribut */
                  GetReference (&pRef);
                  pAttr->AeAttrReference = pRef;
                  pRef->RdElement = pEl;
                  pRef->RdAttribute = pAttr;
                  break;
                case AtTextAttr:
                  pAttr->AeAttrText = NULL;
                  break;
                default:
                  break;
                }
              /* attache l'attribut a l'element */
              if (pEl->ElFirstAttr == NULL)
                /* c'est le 1er attribut de l'element */
                pEl->ElFirstAttr = pAttr;
              else
                {
                  pA = pEl->ElFirstAttr;	/* 1er attribut de l'element */
                  while (pA->AeNext != NULL)
                    /* cherche le dernier attribut de l'element */
                    pA = pA->AeNext;
                  /* chaine le nouvel attribut */
                  pA->AeNext = pAttr;
                }
              /* c'est le dernier attribut de l'element */
              pAttr->AeNext = NULL;
              /* envoie l'evenement AttrModify.Pre */
              notifyAttr.event = TteAttrModify;
              notifyAttr.document = (Document) IdentDocument (pDoc);
              notifyAttr.element = (Element) pEl;
              notifyAttr.info = 0; /* not sent by undo */
              notifyAttr.attribute = (Attribute) pAttr;
              notifyAttr.attributeType.AttrSSchema = (SSchema) pSS;
              notifyAttr.attributeType.AttrTypeNum = att;
              if (!CallEventAttribute (&notifyAttr, TRUE))
                /* l'application laisse l'editeur saisir la valeur de */
                /* l'attribut requis */
                {
#ifndef NODISPLAY
                  MandatoryAttrOK = FALSE;
                  do
                    {
                      /* demande a l'utilisateur d'entrer une valeur */
                      /* pour l'attribut */
                      if (pAttr->AeAttrType == AtReferenceAttr)
                        /* demande a l'utilisateur l'element reference' */
                        MandatoryAttrOK = LinkReference (pEl, pAttr, pDoc);
                      else
                        {
                          if (ThotLocalActions[T_attrreq] != NULL)
                            (*(Proc3)ThotLocalActions[T_attrreq]) (
                                                                   (void *)pAttr,
                                                                   (void *)pDoc,
                                                                   (void *)pEl);
                          else
                            switch (pAttr->AeAttrType)
                              {
                              case AtNumAttr:
                                /* attribut a valeur numerique */
                                pAttr->AeAttrValue = 0;
                                break;
				
                              case AtTextAttr:
                                /* attribut a valeur textuelle */
                                CopyStringToBuffer ((unsigned char *)" ", pAttr->AeAttrText, &len);
                                break;
				
                              case AtEnumAttr:
                                /* attribut a valeurs enumerees */
                                pAttr->AeAttrValue = 1;
                                break;
				
                              default:
                                break;
                              }
                          MandatoryAttrOK = TRUE;
                        }
                    }
                  while (!MandatoryAttrOK && pDoc->DocSSchema != NULL);
#endif /* NODISPLAY */
                  if (MandatoryAttrOK && pDoc->DocSSchema != NULL)
                    {
                      /* envoie l'evenement AttrModify.Post */
                      notifyAttr.event = TteAttrModify;
                      notifyAttr.document = (Document) IdentDocument (pDoc);
                      notifyAttr.element = (Element) pEl;
                      notifyAttr.info = 0; /* not sent by undo */
                      notifyAttr.attribute = (Attribute) pAttr;
                      notifyAttr.attributeType.AttrSSchema = (SSchema) pSS;
                      notifyAttr.attributeType.AttrTypeNum = att;
                      CallEventAttribute (&notifyAttr, FALSE);
                    }
                }
              if (pDoc->DocSSchema)
                {
                  /* envoie l'evenement AttrCreate.Post */
                  notifyAttr.event = TteAttrCreate;
                  notifyAttr.document = (Document) IdentDocument (pDoc);
                  notifyAttr.element = (Element) pEl;
                  notifyAttr.info = 0; /* not sent by undo */
                  notifyAttr.attribute = (Attribute) pAttr;
                  notifyAttr.attributeType.AttrSSchema = (SSchema) pSS;
                  notifyAttr.attributeType.AttrTypeNum = att;
                  CallEventAttribute (&notifyAttr, FALSE);
                }
            }
        }
}
Ejemplo n.º 13
0
void resizelogfile(void)
	{
#ifdef WINCIT
	LogEntry    *CurrentUser = new LogEntry(cfg.maxrooms, cfg.maxgroups, cfg.maxjumpback);
	l_slot      *LogOrder = new l_slot[cfg.MAXLOGTAB];

	if (!LogOrder || !CurrentUser)
		{
		illegal("no memory");
		}

	for (l_slot slot = 0; slot < cfg.MAXLOGTAB; slot++)
		{
		LogOrder[slot] = slot;
		}

	LogTab.Sort(&LogOrder);
#endif

	chdir(cfg.homepath);

	// get rid of any log?.tmp files
	unlink(getcfgmsg(156));
	unlink(getcfgmsg(157));
	unlink(getcfgmsg(158));
	unlink(getcfgmsg(159));
	unlink(getcfgmsg(160));
	unlink(getcfgmsg(161));

	// and the LE*.TMP files
	changedir(cfg.logextdir);
	ambigUnlink(getcfgmsg(215));
	changedir(cfg.homepath);

	// create new log?.tmp files with new size
	l_slot i = cfg.MAXLOGTAB;
	cfg.MAXLOGTAB = newmaxlogtab;
	zapLogFile(TRUE, TRUE);
	cfg.MAXLOGTAB = i;

	for (i = 0; (i < cfg.MAXLOGTAB) && (i < newmaxlogtab); i++)
		{
		msgDisp(getcfgmsg(183), ltoac(LTab(i).GetLogIndex()));
#ifndef WINCIT
		cPrintf(getcfgmsg(282), br);
#endif

		// Load from old files (the .DAT ones)
		CurrentUser->LogEntry1::ResetFileName();
		CurrentUser->LogEntry2::ResetFileName();
		CurrentUser->LogEntry3::ResetFileName();
		CurrentUser->LogEntry4::ResetFileName();
		CurrentUser->LogEntry5::ResetFileName();
		CurrentUser->LogEntry6::ResetFileName();
		CurrentUser->LogExtensions::ResetFileExtension();

		if (!CurrentUser->Load(LTab(i).GetLogIndex()))
			{
			crashout(getcfgmsg(281), getcfgmsg(155));
			}

		// And save to the new files (the .TMP ones)
		CurrentUser->LogEntry1::SetFileName(getcfgmsg(156));
		CurrentUser->LogEntry2::SetFileName(getcfgmsg(157));
		CurrentUser->LogEntry3::SetFileName(getcfgmsg(158));
		CurrentUser->LogEntry4::SetFileName(getcfgmsg(159));
		CurrentUser->LogEntry5::SetFileName(getcfgmsg(160));
		CurrentUser->LogEntry6::SetFileName(getcfgmsg(161));
		CurrentUser->LogExtensions::SetFileExtension(getcfgmsg(230));

		if (!CurrentUser->Save(i, CurrentUser->GetMessageRoom()))
			{
			crashout(getcfgmsg(283), getcfgmsg(155));
			}
		}

	doccr();
	doccr();

	// Back to using the .DAT files
	CurrentUser->LogEntry1::ResetFileName();
	CurrentUser->LogEntry2::ResetFileName();
	CurrentUser->LogEntry3::ResetFileName();
	CurrentUser->LogEntry4::ResetFileName();
	CurrentUser->LogEntry5::ResetFileName();
	CurrentUser->LogEntry6::ResetFileName();
	CurrentUser->LogExtensions::ResetFileExtension();

	// clear RAM buffer out
	CurrentUser->Clear();

	// Then clean up - .TMP to .DAT
	unlink(logDat);
	unlink(log2Dat);
	unlink(log3Dat);
	unlink(log4Dat);
	unlink(log5Dat);
	unlink(log6Dat);

	rename(getcfgmsg(156), logDat);
	rename(getcfgmsg(157), log2Dat);
	rename(getcfgmsg(158), log3Dat);
	rename(getcfgmsg(159), log4Dat);
	rename(getcfgmsg(160), log5Dat);
	rename(getcfgmsg(161), log6Dat);

	changedir(cfg.logextdir);
	ambigUnlink(getcfgmsg(211));

	FindFileC FF;
	if (FF.FindFirst(getcfgmsg(215)))
		{
		do
			{
			if (FF.IsNormalFile())
				{
				label newname;

				CopyStringToBuffer(newname, FF.GetShortName());
				strcpy(strchr(newname, '.'), getcfgmsg(285));
				rename(FF.GetShortName(), newname);
				}
			} while (FF.FindNext());
		}

	changedir(cfg.homepath);

#ifdef WINCIT
	msgDisp(NULL);
	//	msgCaption(ns);
	delete CurrentUser;
	delete [] LogOrder;
#endif
}
Ejemplo n.º 14
0
void cyclesignature(void)
	{
	FILE *fBuf;
	char line[256];
	char *words[256];
	Bool found = FALSE;
	char path[80];

	// there is only one signature line, so get out and use it
	if (cfg.sig_current_pos == LONG_MAX)
		{
		return;
		}

	sprintf(path, sbs, cfg.homepath, citfiles[C_CONFIG_CIT]);

	if ((fBuf = fopen(path, FO_R)) == NULL) // ASCII mode
		{
		return;
		}

	fseek(fBuf, cfg.sig_current_pos, SEEK_SET);

	Bool HaveStartedOver = FALSE;

	for (; !found;)
		{
		// if end of file cycle back up
		if (fgets(line, 254, fBuf) == NULL)
			{
			if (!HaveStartedOver)
				{
				fseek(fBuf, cfg.sig_first_pos, SEEK_SET);
				HaveStartedOver = TRUE;
				}
			else 
				{
				found = TRUE;	// not found, but this breaks us out of the loop
				}

			continue;
			}

		cfg.sig_current_pos = ftell(fBuf);

		if (line[0] != '#')
			{
			continue;
			}

		if (strnicmp(line, getmsg(137), strlen(getmsg(137))) != SAMESTRING)
			{
			// okay we've gone past the last signature, cycle back up
			if (!HaveStartedOver)
				{
				fseek(fBuf, cfg.sig_first_pos, SEEK_SET);
				HaveStartedOver = TRUE;
				}
			else 
				{
				found = TRUE;	// not found, but this breaks us out of the loop
				}

			continue;
			}
		else
			{
			found = TRUE;
			}

		parse_it(words, line);

		CopyStringToBuffer(cfg.nodeSignature, words[1]);

		cfg.sig_current_pos = ftell(fBuf);
		}

	fclose(fBuf);
	}
Ejemplo n.º 15
0
directoryinfo *TERMWINDOWMEMBER filldirectory(const char *temp, SortE Sort,
        OldNewPick which, Bool rev)
    {
    // to avoid possible memory corruption later
#ifdef WINCIT
    char filename[MAX_PATH];
#else
    char filename[_MAX_PATH];
#endif
    CopyStringToBuffer(filename, temp);
    if (!strpos('.', filename) && (strlen(filename) < sizeof(filename) - 1))
        {
        strcat(filename, getmsg(433));
        }

    stripdoubleasterisk(filename);

    directoryinfo *files = new directoryinfo[cfg.maxfiles];

    if (files == NULL)
        {
        mPrintfCR(getmsg(447));
        return (NULL);
        }

    const Bool HiddenOK = CurrentUser->IsAide();

    // keep going till it errors, which is end of directory
    int i = 0;
    FindFileC FF;
    if (FF.FindFirst(starstar))
        {
        do
            {
            if (FF.IsNormalFile(HiddenOK))
                {
                if (which == NewOnly || which == OldOnly)
                    {
                    time_t funix = FF.GetDateTime();

                    if (which == NewOnly)
                        {
                        if (funix < MRO.CheckDate)
                            {
                            //i--;
                            continue;
                            }
                        }
                    else
                        {
                        if (funix > MRO.CheckDate)
                            {
                            //i--;
                            continue;
                            }
                        }
                    }

                label Name;
                CopyStringToBuffer(Name, FF.GetShortName());

#ifdef WINCIT
                char FullName[MAX_PATH];
                CopyStringToBuffer(FullName, FF.GetFullName());
#endif

                Bool strip;

                if (!strpos('.', Name))
                    {
                    strcat(Name, getmsg(433));
#ifdef WINCIT
                    strcat(FullName, getmsg(433));
#endif
                    strip = TRUE;
                    }
                else
                    {
                    strip = FALSE;
                    }

                if (u_match(Name, filename)
#ifdef WINCIT
                        || u_match(FullName, filename)
#endif
                        )
                    {
                    if (strip)
                        {
                        Name[strlen(Name) - 1] = 0;
#ifdef WINCIT
                        FullName[strlen(FullName) - 1] = 0;
#endif
                        }

                    files[i].Attr = FF.GetAttr();
                    files[i].DateTime = FF.GetDateTime();
                    files[i].Length = FF.GetSize();
                    CopyStringToBuffer(files[i].Name, Name);
                    strlwr(files[i].Name);

#ifdef WINCIT
                    CopyStringToBuffer(files[i].FullName, FullName);
#endif

                    i++;
                    }
                }
            } while ((i + 1 < cfg.maxfiles) && FF.FindNext());
        }

    *files[i].Name = 0;
#ifdef WINCIT
    *files[i].FullName = 0;
#endif

    // alphabetical order
    if (Sort == SORT_ALPHA)
        {
        qsort(files, i, sizeof(directoryinfo),
                (rev) ? (QSORT_CMP_FNP) revstrcmp :
                (QSORT_CMP_FNP) fwdstrcmp);
        }

    // by date
    else if (Sort == SORT_DATE)
        {
        qsort(files, i, sizeof(directoryinfo),
                (rev) ? (QSORT_CMP_FNP) new_to_old_cmp :
                (QSORT_CMP_FNP) old_to_new_cmp);
        }

    return (files);
    }
Ejemplo n.º 16
0
long TERMWINDOWMEMBER getNumber(const char *prompt, long bottom, long top, long dfaultnum, Bool QuestIsSpecial,
		Bool *QuestionEntered)
    {
    if (QuestionEntered)
        {
        *QuestionEntered = FALSE;
        }

    long UserInput;
    char dfault[80], numstring[80];

    if (dfaultnum == -1l)
        {
        *dfault = 0;
        }
    else
        {
        CopyStringToBuffer(dfault, ltoac(dfaultnum));
        }

    do
        {
        getString(prompt, numstring, sizeof(numstring) - 1, QuestIsSpecial, dfault);

        normalizeString(numstring);

        if (QuestIsSpecial && (*numstring == '?'))
            {
            if (QuestionEntered)
                {
                *QuestionEntered = TRUE;
                }

            return (CERROR);
            }

        if (*numstring)
            {
            if (isdigit(*numstring) || *numstring == '-')
                {
                UserInput = strtol(numstring, NULL, (strncmpi(numstring, getmsg(51),
						strlen(getmsg(51))) == SAMESTRING) ? 16 : 10);
                }
            else
                {
                UserInput = RomanInput(numstring);
                }

            if (UserInput < bottom)
                {
                CRmPrintfCR(getmsg(499), ltoac(bottom));
                }

            if (UserInput > top)
                {
                CRmPrintfCR(getmsg(494), ltoac(top));
                }
            }
        else
            {
            UserInput = dfaultnum;
            }

        if (UserInput == 69)
            {
            CRmPrintfCR(getmsg(69));
            }
        } while ((UserInput < bottom || UserInput > top) && HaveConnectionToUser() && *numstring);

    return (UserInput);
    }
Ejemplo n.º 17
0
Bool TERMWINDOWMEMBER killuser(const char *name)
	{
	label who;
	l_slot logno;
	char line[80];

	if (!name)
		{
		SetDoWhat(SYSKUSER);
		}

	if (name)
		{
		CopyStringToBuffer(who, name);
		}
	else
		{
		getNormStr(cfg.Luser_nym, who, LABELSIZE);
		}

	if (!*who)
		{
		return (FALSE);
		}

	logno = FindPersonByPartialName(who);

	if (logno == CERROR)
		{
		if (!name)
			{
			mPrintfCR(getmsg(595), who);
			}

		return (FALSE);
		}

	LTab(logno).GetName(who, sizeof(who));

	if (loggedIn && CurrentUser->IsSameName(who))
		{
		if (!name)
			{
			mPrintfCR(getsysmsg(83));
			}

		return (FALSE);
		}

	sprintf(line, getsysmsg(84), cfg.Luser_nym, who);

	if (!name && !getYesNo(line, 0))
		{
		return (FALSE);
		}
	else
		{
		LogEntry1 Log1;

		if (!name)
			{
			CRmPrintfCR(getsysmsg(85), who);
			}

		Log1.Clear();
		if (Log1.Save(LTab(logno).GetLogIndex()))
			{
            if(!(read_tr_messages()))
                {
                errorDisp(getmsg(172));
                return(FALSE);
                }

#ifdef WINCIT
            trap(T_SYSOP, WindowCaption, gettrmsg(16), who);
#else
            trap(T_SYSOP, gettrmsg(16), who);
#endif
            dump_tr_messages();
			}

		return (TRUE);
		}
	}
Ejemplo n.º 18
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;
	}
Ejemplo n.º 19
0
int8_t ModbusProcess_FC43()
{
    uint8_t devIdCode = _au8Buffer[ 3 ];
    /*
     * The parameter " Read Device ID code " allows to define four access types :
        01: request to get the basic device identification (stream access)
        02: request to get the regular device identification (stream access)
        03: request to get the extended device identification (stream access)
        04: request to get one specific identification object (individual access)
     */
    uint8_t objId = _au8Buffer[ 4 ];
    /*
     Identification conformity level of the device and type of supported access
        0x01: basic identification (stream access only)
        0x02: regular identification (stream access only)
        0x03: extended identification (stream access only)
        0x81: basic identification (stream access and individual access)
        0x82: regular identification (stream access and individual access)
        0x83: extended identification(stream access and individual
        access)
     */
    _au8Buffer[ 5 ] = 0x00; // More Follows
    _au8Buffer[ 6 ] = 0x00; //Next Object Id
    
    _u8BufferSize = 8;
    switch(devIdCode)
    {
        case 0x01: // request to get the basic device identification (stream access)
            _au8Buffer[ 4 ] = 0x81; // Conformity level
            _au8Buffer[ 7 ] = 3; //Number of objects
            CopyStringToBuffer(0x00, VENDOR_NAME, sizeof(VENDOR_NAME));
            CopyStringToBuffer(0x01, PRODUCT_CODE, sizeof(PRODUCT_CODE));
            CopyStringToBuffer(0x02, MAJOR_MINOR_REVISION, sizeof(MAJOR_MINOR_REVISION));
            break;
        case 0x02: // request to get the regular device identification (stream access)
            _au8Buffer[ 4 ] = 0x82; // Conformity level
            _au8Buffer[ 7 ] = 4; //Number of objects
            CopyStringToBuffer(0x03, VENDOR_URL, sizeof(VENDOR_URL));
            CopyStringToBuffer(0x04, PRODUCT_NAME, sizeof(PRODUCT_NAME));
            CopyStringToBuffer(0x05, MODEL_NAME, sizeof(MODEL_NAME));
            CopyStringToBuffer(0x06, USER_APPLICATION_NAME, sizeof(USER_APPLICATION_NAME));
            break;
        case 0x04:  //request to get one specific identification object (individual access)
            _au8Buffer[ 7 ] = 1;
            switch(objId)
            {
                case 0x00:
                    _au8Buffer[ 4 ] = 0x81; // Conformity level
                    CopyStringToBuffer(objId, VENDOR_NAME, sizeof(VENDOR_NAME));
                    break;
                case 0x01:    
                    _au8Buffer[ 4 ] = 0x81; // Conformity level
                    CopyStringToBuffer(objId, PRODUCT_CODE, sizeof(PRODUCT_CODE));
                    break;
                case 0x02:    
                    _au8Buffer[ 4 ] = 0x81; // Conformity level
                    CopyStringToBuffer(objId, MAJOR_MINOR_REVISION, sizeof(MAJOR_MINOR_REVISION));
                    break;
                case 0x03:    
                    _au8Buffer[ 4 ] = 0x82; // Conformity level
                    CopyStringToBuffer(objId, VENDOR_URL, sizeof(VENDOR_URL));
                    break;
                case 0x04:    
                    _au8Buffer[ 4 ] = 0x82; // Conformity level
                    CopyStringToBuffer(objId, PRODUCT_NAME, sizeof(PRODUCT_NAME));
                    break;
                case 0x05:    
                    _au8Buffer[ 4 ] = 0x82; // Conformity level
                    CopyStringToBuffer(objId, MODEL_NAME, sizeof(MODEL_NAME));
                    break;
                case 0x06:    
                    _au8Buffer[ 4 ] = 0x82; // Conformity level
                    CopyStringToBuffer(objId, USER_APPLICATION_NAME, sizeof(USER_APPLICATION_NAME));
                    break;
            }
            break;
    }
    uint8_t u8CopyBufferSize = _u8BufferSize;
    ModbusSendTxBuffer();

    return u8CopyBufferSize;    
}
Ejemplo n.º 20
0
void LogEntry1Data::ResumeSyncSend(void)
	{
	if (!SyncSendPaused)
		{
		return;
		}

	SyncSendPaused = FALSE;

	if (SyncNumber == CERROR)
		{
		return;
		}

	// We just unpaused and we're assigned a record number... tell everybody
	// else all about ourselves.
	GAINEXCLUSIVEACCESS();
	char Buffer[256];
	
	CopyStringToBuffer(Buffer, Name);
	SetName(Buffer);

	CopyStringToBuffer(Buffer, Initials);
	SetInitials(Buffer);

	CopyStringToBuffer(Buffer, Password);
	SetPassword(Buffer);

	CopyStringToBuffer(Buffer, Surname);
	SetSurname(Buffer);

	CopyStringToBuffer(Buffer, Title);
	SetTitle(Buffer);

	CopyStringToBuffer(Buffer, RealName);
	SetRealName(Buffer);

	CopyStringToBuffer(Buffer, PhoneNumber);
	SetPhoneNumber(Buffer);

	CopyStringToBuffer(Buffer, ForwardAddr);
	SetForwardAddr(Buffer);

	CopyStringToBuffer(Buffer, ForwardAddrNode);
	SetForwardAddrNode(Buffer);

	CopyStringToBuffer(Buffer, ForwardAddrRegion);
	SetForwardAddrRegion(Buffer);

	CopyStringToBuffer(Buffer, PromptFormat);
	SetPromptFormat(Buffer);

	CopyStringToBuffer(Buffer, DateStamp);
	SetDateStamp(Buffer);

	CopyStringToBuffer(Buffer, VerboseDateStamp);
	SetVerboseDateStamp(Buffer);

	CopyStringToBuffer(Buffer, Signature);
	SetSignature(Buffer);

	CopyStringToBuffer(Buffer, NetPrefix);
	SetNetPrefix(Buffer);

	CopyStringToBuffer(Buffer, MailAddr1);
	SetMailAddr1(Buffer);

	CopyStringToBuffer(Buffer, MailAddr2);
	SetMailAddr2(Buffer);

	CopyStringToBuffer(Buffer, MailAddr3);
	SetMailAddr3(Buffer);

	CopyStringToBuffer(Buffer, Alias);
	SetAlias(Buffer);

	CopyStringToBuffer(Buffer, LocID);
	SetLocID(Buffer);

	CopyStringToBuffer(Buffer, MorePrompt);
	SetMorePrompt(Buffer);

	CopyStringToBuffer(Buffer, Occupation);
	SetOccupation(Buffer);

	CopyStringToBuffer(Buffer, WhereHear);
	SetWhereHear(Buffer);

	CopyStringToBuffer(Buffer, LastRoom);
	SetLastRoom(Buffer);

	CopyStringToBuffer(Buffer, LastHall);
	SetLastHall(Buffer);

	CopyStringToBuffer(Buffer, DefaultRoom);
	SetDefaultRoom(Buffer);

	CopyStringToBuffer(Buffer, DefaultHall);
	SetDefaultHall(Buffer);

	CopyStringToBuffer(Buffer, TermType);
	SetTermType(Buffer);
	RELEASEEXCLUSIVEACCESS();

	SetBirthDate(BirthDate);
	SetFirstOn(FirstOn);
	SetSex(Sex);
	SetNulls(Nulls);
	SetWidth(Width);
	SetLinesPerScreen(LinesPerScreen);
	SetAttribute(ATTR_NORMAL, attributes[ATTR_NORMAL]);
	SetAttribute(ATTR_BLINK, attributes[ATTR_BLINK]);
	SetAttribute(ATTR_REVERSE, attributes[ATTR_REVERSE]);
	SetAttribute(ATTR_BOLD, attributes[ATTR_BOLD]);
	SetAttribute(ATTR_UNDERLINE, attributes[ATTR_UNDERLINE]);
	SetNumUserShow(NumUserShow);
	SetDefaultProtocol(DefaultProtocol);
	SetCallTime(CallTime);
	SetCallNumber(CallNumber);
	SetTotalTime(TotalTime);
	SetCredits(Credits);
	SetLogins(Logins);
	SetPosted(Posted);
	SetRead(Read);
	SetPasswordChangeTime(PasswordChangeTime);
	SetCallsToday(CallsToday);
	SetCallLimit(CallLimit);
	SetLastMessage(LastMessage);
	SetDL_Bytes(DL_Bytes);
	SetUL_Bytes(UL_Bytes);
	SetDL_Num(DL_Num);
	SetUL_Num(UL_Num);
	SetPoopcount(Poopcount);

	SetDungeoned(IsDungeoned());
	SetForwardToNode(IsForwardToNode());
	SetAutoNextHall(IsAutoNextHall());
	SetEnterBorders(IsEnterBorders());
	SetVerified(IsVerified());
	SetSurnameLocked(IsSurnameLocked());
	SetDefaultHallLocked(IsDefaultHallLocked());
	SetPsycho(IsPsycho());
	SetViewTitleSurname(IsViewTitleSurname());
	SetViewSubjects(IsViewSubjects());
	SetViewSignatures(IsViewSignatures());
	SetOldIBMGraph(IsOldIBMGraph());
	SetOldIBMANSI(IsOldIBMANSI());
	SetOldIBMColor(IsOldIBMColor());
	SetTwirly(IsTwirly());
	SetAutoVerbose(IsAutoVerbose());
	SetPauseBetweenMessages(IsPauseBetweenMessages());
	SetMinibin(IsMinibin());
	SetClearScreenBetweenMessages(IsClearScreenBetweenMessages());
	SetViewRoomInfoLines(IsViewRoomInfoLines());
	SetViewHallDescription(IsViewHallDescription());
	SetVerboseContinue(IsVerboseContinue());
	SetViewCensoredMessages(IsViewCensoredMessages());
	SetViewBorders(IsViewBorders());
	SetOut300(IsOut300());
	SetUserSignatureLocked(IsUserSignatureLocked());
	SetHideMessageExclusions(IsHideMessageExclusions());
	SetDownload(IsDownload());
	SetUpload(IsUpload());
	SetChat(IsChat());
	SetPrintFile(IsPrintFile());
	SetSpellCheckMode(GetSpellCheckMode());
	SetMakeRoom(IsMakeRoom());
	SetVerboseLogOut(IsVerboseLogOut());
	SetConfirmSave(IsConfirmSave());
	SetConfirmAbort(IsConfirmAbort());
	SetConfirmNoEO(IsConfirmNoEO());
	SetUsePersonalHall(IsUsePersonalHall());
	SetYouAreHere(IsYouAreHere());
	SetIBMRoom(IsIBMRoom());
	SetWideRoom(IsWideRoom());
	SetMusic(IsMusic());
	SetCheckApostropheS(IsCheckApostropheS());
	SetCheckAllCaps(IsCheckAllCaps());
	SetCheckDigits(IsCheckDigits());
	SetExcludeEncryptedMessages(IsExcludeEncryptedMessages());
	SetViewCommas(IsViewCommas());
	SetPUnPauses(IsPUnPauses());
	SetRoman(IsRoman());
	SetSuperSysop(IsSuperSysop());

	SetInuse(IsInuse());
	SetUpperOnly(IsUpperOnly());
	SetLinefeeds(IsLinefeeds());
	SetExpert(IsExpert());
	SetAide(IsAide());
	SetTabs(IsTabs());
	SetOldToo(IsOldToo());
	SetProblem(IsProblem());
	SetUnlisted(IsUnlisted());
	SetPermanent(IsPermanent());
	SetSysop(IsSysop());
	SetNode(IsNode());
	SetNetUser(IsNetUser());
	SetAccounting(IsAccounting());
	SetMail(IsMail());
	SetViewRoomDesc(IsViewRoomDesc());
	}