Beispiel #1
0
 // Transfer Address.
 bool SPIFlash::_transferAddress(void) {
   if (address4ByteEnabled) {
     _nextByte(WRITE, Highest(_currentAddress));
   }
   _nextByte(WRITE, Higher(_currentAddress));
   _nextByte(WRITE, Hi(_currentAddress));
   _nextByte(WRITE, Lo(_currentAddress));
   return true;
 }
 ActivationFactory::ActivationFactory() : ConstructionFactory<Activation*>("Activation") {
     registerConstructor("", fl::null);
     registerConstructor(First().className(), &(First::constructor));
     registerConstructor(General().className(), &(General::constructor));
     registerConstructor(Highest().className(), &(Highest::constructor));
     registerConstructor(Last().className(), &(Last::constructor));
     registerConstructor(Lowest().className(), &(Lowest::constructor));
     registerConstructor(Proportional().className(), &(Proportional::constructor));
     registerConstructor(Threshold().className(), &(Threshold::constructor));
 }
Beispiel #3
0
USHORT FIDOSDM::Add (class TCollection &MsgText)
{
   USHORT RetVal = FALSE;
   PSZ pszText, pszAddress;
   CHAR Temp[128];
   MSGINDEX msgIndex;

   if ((msgIndex.Number = Highest () + 1L) == 1L) {
      if ((pszText = (PSZ)MsgText.First ()) != NULL)
         do {
            if (!strncmp (pszText, "\001PATH", 5) || !strncmp (pszText, "SEEN-BY:", 8)) {
               msgIndex.Number++;
               break;
            }
         } while ((pszText = (PSZ)MsgText.Next ()) != NULL);
   }
   sprintf (msgIndex.FileName, "%lu.msg", msgIndex.Number);

   memset (&msgHdr, 0, sizeof (msgHdr));

   pszAddress = FromAddress;
   if (strchr (pszAddress, ':') != NULL)
      pszAddress = strchr (pszAddress, ':') + 1;
   if (strchr (pszAddress, '/') != NULL) {
      msgHdr.OrigNet = (USHORT)atoi (pszAddress);
      pszAddress = strchr (pszAddress, '/') + 1;
   }
   msgHdr.OrigNode = (USHORT)atoi (pszAddress);

   pszAddress = ToAddress;
   if (strchr (pszAddress, ':') != NULL)
      pszAddress = strchr (pszAddress, ':') + 1;
   if (strchr (pszAddress, '/') != NULL) {
      msgHdr.DestNet = (USHORT)atoi (pszAddress);
      pszAddress = strchr (pszAddress, '/') + 1;
   }
   msgHdr.DestNode = (USHORT)atoi (pszAddress);

   if (Crash == TRUE)
      msgHdr.Attrib |= MSGCRASH;
   if (FileAttach == TRUE)
      msgHdr.Attrib |= MSGFILE;
   if (FileRequest == TRUE)
      msgHdr.Attrib |= MSGFRQ;
   if (Hold == TRUE)
      msgHdr.Attrib |= MSGHOLD;
   if (KillSent == TRUE)
      msgHdr.Attrib |= MSGKILL;
   if (Local == TRUE)
      msgHdr.Attrib |= MSGLOCAL;
   if (Private == TRUE)
      msgHdr.Attrib |= MSGPRIVATE;
   if (ReceiptRequest == TRUE)
      msgHdr.Attrib |= MSGRRQ;
   if (Received == TRUE)
      msgHdr.Attrib |= MSGREAD;
   if (Sent == TRUE)
      msgHdr.Attrib |= MSGSENT;

   msgHdr.Reply = (USHORT)Original;
   msgHdr.Up = (USHORT)Reply;

   strcpy (msgHdr.From, From);
   strcpy (msgHdr.To, To);
   strcpy (msgHdr.Subject, Subject);
   sprintf (msgHdr.Date, "%2d %3.3s %02d  %02d:%02d:%02d", Written.Day, fidoMonths[Written.Month - 1], Written.Year % 100, Written.Hour, Written.Minute, Written.Second);

   sprintf (Temp, "%s%s", BasePath, msgIndex.FileName);
   if ((fp = _fsopen (Temp, "wb", SH_DENYNO)) != NULL) {
      fwrite (&msgHdr, sizeof (msgHdr), 1, fp);

      if ((pszText = (PSZ)MsgText.First ()) != NULL)
         do {
            fwrite (pszText, strlen (pszText), 1, fp);
            fwrite ("\r", 1, 1, fp);
         } while ((pszText = (PSZ)MsgText.Next ()) != NULL);

      fwrite ("\000", 1, 1, fp);
      fclose (fp);

      Index.Add (&msgIndex, sizeof (MSGINDEX));
      TotalMsgs++;

      RetVal = TRUE;
   }

   return (RetVal);
}