Squish/*.msg

Area:    Quik_Bas
  Msg:    #309
 Date:    02-06-93 13:54 (Public) 
 From:    Coridon Henshaw          
 To:      Graham Tippett           
 Subject: Squish/*.msg             
Hello Graham!

Wednesday February 03 1993, Graham Tippett writes to All:

 GT> Can someone give me some help on using either *.MSG or 
 GT> Squish format areas
 GT> in my programs (Working on a little something now but I can't figure out
 GT> *.MSG or Squish format..) Thanks for any help!

Ok, here's the MSG format:
===Chop===
TYPE MSGHeaderType
        FromUser AS STRING * 36    'from, null terminated
        ToUser AS STRING * 36      'to, null terminated
        Subject AS STRING * 72     'subject, null terminated
        datetime AS STRING * 20    'datetime, full (all 20 chars)
        timesread AS INTEGER       'number of times read
        DestNode AS INTEGER        'destination node
        OrigNode AS INTEGER        'origin node
        cost AS INTEGER            'cost of message
        OrigNet AS INTEGER         'origin network
        DestNet AS INTEGER         'destination network
        DestZone AS INTEGER        'destination zone (not required)
        OrigZone AS INTEGER        'origin zone      (Not req)
        DestPoint AS INTEGER       'destination zone (not req)
        OrigPoint AS INTEGER       'origin zone (some 
implemenations use these)
        ReplyTo AS INTEGER         'previous reaply (in same area)
        attribute AS INTEGER       'attributes, see below
        nextreply AS INTEGER       'next reply
END TYPE
===Chop===

And the Squish format:

===Chop===
TYPE SQIDX      ' .SQI file: one of these per message (12 bytes)
  Offst  AS LONG
  UMSGID AS LONG
  Hash   AS LONG
END TYPE

TYPE SQBASE     ' .SQD database header (256 bytes): 1 per .SQD file
  SLEN    AS INTEGER ' A signed INTEGER with a min or -
32767 and a max of 32767
  RSVD1   AS INTEGER
  NUMMSG  AS LONG       ' No of msgs in area
  HiMsg   AS LONG       ' Highest msg number (same as NUMMSG)
  SKIPMSG AS LONG       ' # of msgs to protect from autoKill
  HiWater AS LONG       ' Highwatermark
  UID     AS LONG       ' # of next UMSGID to use
  BaseId  AS STRING * 80' Name (incl path) of this message base
  FBEGIN  AS LONG       ' Offset to 1st frame
  FLAST   AS LONG       ' Offset to last frame
  FFBEGIN AS LONG       ' Offset to 1st free frame
  FFLAST  AS LONG       ' Offset to last free frame
  FEND    AS LONG       ' Offset to end of file
  MAXMSGS AS LONG       ' # of msgs to keep
  MAXDAYS AS INTEGER    ' # of days to keep msgs for
  SZSQHDR AS INTEGER    ' Size of SQHDR (32 bytes)
END TYPE

TYPE SQHDR
        ID     AS LONG
        Nextf  AS LONG
        Prevf  AS LONG
        FLEN   AS LONG
        MsgLen AS LONG
        CLEN   AS LONG
        FTYP   AS INTEGER
        RSVD   AS INTEGER
END TYPE

TYPE SQMESSAGE    ' The message Header, as it appears in a Squish area
     ATTRIB     AS LONG
     Junk       AS STRING * 1
     From       AS STRING * 36
     Dest       AS STRING * 36
     Subj       AS STRING * 72
     OrigZone   AS INTEGER
     OrigNet    AS INTEGER
     OrigNode   AS INTEGER
     OrigPoint  AS INTEGER
     DestZone   AS INTEGER
     DestNet    AS INTEGER
     DestNode   AS INTEGER
     DestPoint  AS INTEGER
     BINDATES   AS STRING * 8
     UTCOFST    AS INTEGER
     ReplyTo    AS LONG
     Replies    AS STRING * 40
     DateMsg    AS STRING * 20
END TYPE
'Ok, now for the explanations: the two main files are 
<name>.SQD and_ <name>.SQI.
' The first structure is for the .SQI file (you can open 
that one as RANDOM_ with
'a length of 12); the others are for the .SQD file (which you open as BINARY).
'
'There is a one-to-one correspondence between records in .SQI and the (non-
'deleted) messages.  You want message #25: just read the 25th record from the
'.SQI file into the SQIDX-dimensioned variable.  Then, use 
the offset SQI.OFFST
'+ 1 to read the SQHDR-dimensioned variable (the SQI offsets start at 0 but QB
'treats the first byte in a BINARY file as byte 1).  This SQHDR is 28-bytes
'long, and it is immediately followed by the 230 bytes of the SQMSG-defined
'variable (the message header), and SQD.MSGLEN bytes of message text.
===Chop===

And the Hudson/QBBS format, as I've been able to decode:

===Chop===
TYPE MsgHdrType
        MsgNum          AS INTEGER
        PrevReply       AS INTEGER
        NextReply       AS INTEGER
        TimesRead       AS INTEGER
        StartBlock      AS INTEGER
        NumBlock        AS INTEGER
        DestNet         AS INTEGER
        DestNode        AS INTEGER
        OrigNet         AS INTEGER
        OrigNode        AS INTEGER
        DestZone        AS STRING * 1
        FromZone        AS STRING * 1
        Cost            AS INTEGER
        MsgAttr         AS STRING * 1
        NetAttr         AS STRING * 1
        BoardNumber     AS STRING * 1
        PostTime        AS STRING * 4
        PostDate        AS STRING * 8
        WhoToLength     AS STRING * 1
        WhoTo           AS STRING * 34
        WhoFromLength   AS STRING * 1
        WhoFrom         AS STRING * 34
        SubjectLength   AS STRING * 1
        Subject         AS STRING * 76
END TYPE

TYPE MsgIdxType
        AddrOffset      AS INTEGER 'Message index pointer (ABS)
        Board           AS STRING * 1
END TYPE

TYPE LastReadType
        Msgbase         AS INTEGER 'Lastread pointer (ABS)
END TYPE
===Chop===

That's all folks!

 GT>  ! Origin:  Rich Wood For ZC -  (1:351/1116)

                 ^^^^^^^^^^^^^^^^ Seconded!
Coridon Henshaw \ Sirrus Software

--- GEcho 1.00
 * Origin: TCS Concordia - Mail Only - Toronto, Ontario (1:250/820)


Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET