All pastes #31774 Raw Edit

Miscellany

public text v1 · immutable
#31774 ·published 2005-11-30 04:45 UTC
rendered paste body
Private Sub sckIRC_DataArrival(ByVal bytesTotal As Long)
  sckIRC.GetData tmpdata                                              ' Get data from the socket
  colRawQueue.Add tmpdata
End Sub

Private Sub ParseTim_Timer()
  If colRawQueue.Count > 0 Then                                       ' If there are raw lines in queue
    CheckForLine colRawQueue(1)                                       ' Feed it though fuction
    colRawQueue.Remove 1                                              ' Remove it from queue
  End If
  If colParseQueue.Count > 0 Then                                     ' If there are any lines to parse in queue
    Parse colParseQueue(1)                                            ' Parse them
    colParseQueue.Remove 1                                            ' Remove from queue
  End If
End Sub

Public Sub CheckForLine(strLine As String)
    Dim intCounter As Integer                                          ' Dim Some Stuff
    Dim strOneLine As String
    Static strRestLine As String
    strLine = strRestLine & strLine
    For intCounter = 1 To Len(strLine)                                 ' Loop through for every character
        If Mid(strLine, intCounter, 1) = Chr(13) Or Mid(strLine, intCounter, 1) = Chr(10) Then    'If there is a cr or lf
            strOneLine = Mid(strLine, 1, intCounter - 1)
            strOneLine = Replace(strOneLine, Chr(10), "")
            strOneLine = Replace(strOneLine, Chr(13), "")
            If Trim(strOneLine) <> "" Then
                colParseQueue.Add strOneLine
            End If
            strLine = Mid$(strLine, intCounter + 1)
            intCounter = 0
        End If
    Next intCounter
    strRestLine = strLine
End Sub