home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Troubleshooting Netware Systems
/
CSTRIAL0196.BIN
/
attach
/
msj
/
v10n10
/
vb40.exe
/
WCIMR.EXE
/
WCREAD.BAS
< prev
next >
Wrap
BASIC Source File
|
1995-10-01
|
5KB
|
173 lines
Attribute VB_Name = "WCIMRead"
'================================================
' GetCommonHeader
' Gets the Common Header record out of any file
Function GetCommonHeader(FNum As Integer, CH As CommonHeader, CP As CommonPStrings) As Integer
Get #FNum, 1, CH
If (CH.ID <> "VIS") Then
GetCommonHeader = False
Exit Function
End If
RC = GetPString(FNum, CP.Subject)
RC = GetPString(FNum, CP.Creator)
RC = GetPString(FNum, CP.CreAddr)
RC = GetPString(FNum, CP.Service)
GetCommonHeader = True
End Function
Function GetThreadHeader(Thrd As Thread)
'================================================
' GetThreadHeader
' Fills the Thread Header info into a Thread
Dim FNum As Integer
GetThreadHeader = 0
Posn = Thrd.ComHdr.StrucSize + 10 ' Offset from beginning
FNum = FreeFile
Open Thrd.FName For Binary Access Read Lock Read As #FNum
Get #FNum, Posn, Thrd.Header.size
Get #FNum, , Thrd.Header.sectionid
RC = GetPString(FNum, Thrd.Header.Service)
Get #FNum, , Thrd.Header.threadid
RC = GetPString(FNum, Thrd.Header.sectionname)
RC = GetPString(FNum, Thrd.Header.forumname)
Get #FNum, , Thrd.Header.count
RC = GetPString(FNum, Thrd.Header.Subject)
Get #FNum, , Thrd.Header.HiWatermark
GetThreadHeader = Seek(FNum)
Close #FNum
End Function
Function GetNextThreadMsg(FNum As Integer, T As ForumThdMsg)
'================================================
' GetNextThreadMsg
' Reads the next thread msg from a thread file
Get #FNum, , T.size
Get #FNum, , T.MessageID
Get #FNum, , T.ParentID
Get #FNum, , T.FirstChildID
Get #FNum, , T.NextChildID
Get #FNum, , T.numreplies
Get #FNum, , T.Created
Get #FNum, , T.Received
RC = GetPString(FNum, T.AuthorName)
RC = GetPString(FNum, T.AuthorAddr)
RC = GetPString(FNum, T.RecipName)
RC = GetPString(FNum, T.RecipAddr)
Get #FNum, , T.flags
Get #FNum, , T.msgsize
T.MsgText = String(T.msgsize, " ")
Get #FNum, , T.MsgText
End Function
Function GetForumMsgHeader(FNum As Integer, F As ForumMsgHeader) As Integer
On Error Resume Next
Get #FNum, , F.size
Get #FNum, , F.msgid
Get #FNum, , F.parent
Get #FNum, , F.nextsib
Get #FNum, , F.firstchild
Get #FNum, , F.numreplies
Get #FNum, , F.sectionid
RC = GetPString(FNum, F.sectionname)
RC = GetPString(FNum, F.servicename)
Get #FNum, , F.flags
Get #FNum, , F.threadid
Get #FNum, , F.msgsize
Err.Clear
RC = GetPString(FNum, F.forumname)
If (F.msgsize <= 0) Then Exit Function
F.body = String(F.msgsize, " ")
If Err.Number <> 0 Then
F.body = "(error reading message)"
Else
Get #FNum, , F.body
End If
End Function
Function GetEMailHeader(FNum As Integer, E As EMailHeader) As Integer
Dim garbage$
Get #FNum, , E.HdrSize
garbage$ = String(E.HdrSize, " ")
Get #FNum, , garbage$
End Function
Function GetMessageHeader(FNum As Integer, M As MessageHeader) As Integer
Get #FNum, , M.size
Get #FNum, , M.Created
Get #FNum, , M.Received
RC = GetPString(FNum, M.Subject)
RC = GetPString(FNum, M.AuthName)
RC = GetPString(FNum, M.AuthAddr)
Get #FNum, , M.NumRecips
count = 0
While count < M.NumRecips
RC = GetRecipient(FNum, M.PrimaryRecips)
count = count + 1
Wend
'rc = GetPString(FNum, M.Name)
'rc = GetPString(FNum, M.Addr)
End Function
Function GetRecipient(FNum As Integer, Rec As Recipient) As Integer
RC = GetPString(FNum, Rec.Name)
RC = GetPString(FNum, Rec.Addr)
Get #FNum, , Rec.Options
GetRecipient = 0
End Function
Function msgtype(ThdNum As Integer) As Byte
' MsgType - determines the message type from a thread number
msgtype = gThreadList(ThdNum).ComHdr.RecType
End Function
Function GetNews(FNum As Integer, N As ENSStory) As Integer
Get #FNum, , N.HSize
Get #FNum, , N.StoryNum
Get #FNum, , N.CreDate
' N.WireID.SLen = 6
' N.WireID.SData = String(6, " ")
' Get #FNum, , N.WireID.SData
RC = GetPString(FNum, N.WireID)
RC = GetPString(FNum, N.Title)
Get #FNum, , N.SSize
Get #FNum, , N.ContSize
'Get #FNum, , N.ContSize ' It's there for the header, and again for the message!
N.Story = String(N.ContSize, " ")
Get #FNum, , N.Story
End Function