home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / msj / v10n10 / vb40.exe / WCIMR.EXE / WCREAD.BAS < prev    next >
BASIC Source File  |  1995-10-01  |  5KB  |  173 lines

  1. Attribute VB_Name = "WCIMRead"
  2. '================================================
  3. ' GetCommonHeader
  4. ' Gets the Common Header record out of any file
  5.  
  6. Function GetCommonHeader(FNum As Integer, CH As CommonHeader, CP As CommonPStrings) As Integer
  7.     Get #FNum, 1, CH
  8.     
  9.     If (CH.ID <> "VIS") Then
  10.         GetCommonHeader = False
  11.         Exit Function
  12.     End If
  13.  
  14.     RC = GetPString(FNum, CP.Subject)
  15.     RC = GetPString(FNum, CP.Creator)
  16.     RC = GetPString(FNum, CP.CreAddr)
  17.     RC = GetPString(FNum, CP.Service)
  18.   
  19.     GetCommonHeader = True
  20. End Function
  21.  
  22. Function GetThreadHeader(Thrd As Thread)
  23. '================================================
  24. ' GetThreadHeader
  25. ' Fills the Thread Header info into a Thread
  26.  
  27.     Dim FNum As Integer
  28.     GetThreadHeader = 0
  29.  
  30.     Posn = Thrd.ComHdr.StrucSize + 10 ' Offset from beginning
  31.     
  32.     FNum = FreeFile
  33.     Open Thrd.FName For Binary Access Read Lock Read As #FNum
  34.     
  35.     Get #FNum, Posn, Thrd.Header.size
  36.     Get #FNum, , Thrd.Header.sectionid
  37.     RC = GetPString(FNum, Thrd.Header.Service)
  38.     Get #FNum, , Thrd.Header.threadid
  39.     RC = GetPString(FNum, Thrd.Header.sectionname)
  40.     RC = GetPString(FNum, Thrd.Header.forumname)
  41.     Get #FNum, , Thrd.Header.count
  42.     RC = GetPString(FNum, Thrd.Header.Subject)
  43.     Get #FNum, , Thrd.Header.HiWatermark
  44.     
  45.     GetThreadHeader = Seek(FNum)
  46.     Close #FNum
  47.  
  48. End Function
  49.  
  50. Function GetNextThreadMsg(FNum As Integer, T As ForumThdMsg)
  51. '================================================
  52. ' GetNextThreadMsg
  53. ' Reads the next thread msg from a thread file
  54.  
  55.     Get #FNum, , T.size
  56.     Get #FNum, , T.MessageID
  57.     Get #FNum, , T.ParentID
  58.     Get #FNum, , T.FirstChildID
  59.     Get #FNum, , T.NextChildID
  60.     Get #FNum, , T.numreplies
  61.     Get #FNum, , T.Created
  62.     Get #FNum, , T.Received
  63.     RC = GetPString(FNum, T.AuthorName)
  64.     RC = GetPString(FNum, T.AuthorAddr)
  65.     RC = GetPString(FNum, T.RecipName)
  66.     RC = GetPString(FNum, T.RecipAddr)
  67.     
  68.     Get #FNum, , T.flags
  69.     Get #FNum, , T.msgsize
  70.     
  71.     T.MsgText = String(T.msgsize, " ")
  72.     
  73.     Get #FNum, , T.MsgText
  74. End Function
  75.  
  76. Function GetForumMsgHeader(FNum As Integer, F As ForumMsgHeader) As Integer
  77. On Error Resume Next
  78.  
  79.     Get #FNum, , F.size
  80.     Get #FNum, , F.msgid
  81.     Get #FNum, , F.parent
  82.     Get #FNum, , F.nextsib
  83.     Get #FNum, , F.firstchild
  84.     Get #FNum, , F.numreplies
  85.     Get #FNum, , F.sectionid
  86.         
  87.     RC = GetPString(FNum, F.sectionname)
  88.     RC = GetPString(FNum, F.servicename)
  89.  
  90.     Get #FNum, , F.flags
  91.     Get #FNum, , F.threadid
  92.     Get #FNum, , F.msgsize
  93.     
  94.     Err.Clear
  95.     
  96.     RC = GetPString(FNum, F.forumname)
  97.     
  98.     If (F.msgsize <= 0) Then Exit Function
  99.     
  100.     F.body = String(F.msgsize, " ")
  101.     
  102.     If Err.Number <> 0 Then
  103.         F.body = "(error reading message)"
  104.     Else
  105.         Get #FNum, , F.body
  106.     End If
  107. End Function
  108. Function GetEMailHeader(FNum As Integer, E As EMailHeader) As Integer
  109.     Dim garbage$
  110.     
  111.     Get #FNum, , E.HdrSize
  112.     garbage$ = String(E.HdrSize, " ")
  113.     Get #FNum, , garbage$
  114.  
  115. End Function
  116. Function GetMessageHeader(FNum As Integer, M As MessageHeader) As Integer
  117.     Get #FNum, , M.size
  118.     Get #FNum, , M.Created
  119.     Get #FNum, , M.Received
  120.     
  121.     RC = GetPString(FNum, M.Subject)
  122.     RC = GetPString(FNum, M.AuthName)
  123.     RC = GetPString(FNum, M.AuthAddr)
  124.     
  125.     Get #FNum, , M.NumRecips
  126.     
  127.     count = 0
  128.         
  129.     While count < M.NumRecips
  130.         RC = GetRecipient(FNum, M.PrimaryRecips)
  131.         count = count + 1
  132.     Wend
  133.     
  134.     'rc = GetPString(FNum, M.Name)
  135.     'rc = GetPString(FNum, M.Addr)
  136. End Function
  137.  
  138. Function GetRecipient(FNum As Integer, Rec As Recipient) As Integer
  139.     RC = GetPString(FNum, Rec.Name)
  140.     RC = GetPString(FNum, Rec.Addr)
  141.     
  142.     Get #FNum, , Rec.Options
  143.     
  144.     GetRecipient = 0
  145. End Function
  146.  
  147. Function msgtype(ThdNum As Integer) As Byte
  148. ' MsgType - determines the message type from a thread number
  149.     msgtype = gThreadList(ThdNum).ComHdr.RecType
  150. End Function
  151.  
  152. Function GetNews(FNum As Integer, N As ENSStory) As Integer
  153.     Get #FNum, , N.HSize
  154.     Get #FNum, , N.StoryNum
  155.     Get #FNum, , N.CreDate
  156.  
  157. '    N.WireID.SLen = 6
  158.  '   N.WireID.SData = String(6, " ")
  159.   '  Get #FNum, , N.WireID.SData
  160.     
  161.     RC = GetPString(FNum, N.WireID)
  162.     RC = GetPString(FNum, N.Title)
  163.  
  164.     Get #FNum, , N.SSize
  165.     Get #FNum, , N.ContSize
  166.     'Get #FNum, , N.ContSize ' It's there for the header, and again for the message!
  167.     
  168.     N.Story = String(N.ContSize, " ")
  169.  
  170.     Get #FNum, , N.Story
  171. End Function
  172.  
  173.