Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Const USERNAME_ME_BRACKETS = &H3299CC
  2. Public Const USERNAME_ME_USERNAME = &HFFFF
  3. Public Const USERNAME_TEXT = &HFFFFFF
  4.  
  5. Public Const USERNAME_EMOTE = &HFFE600
  6. Public Const USERNAME_WHISPER_TO_AND_FROM = &HAA5303
  7.  
  8. Public Const VNET_SERVER_ERROR = &HCC1100
  9. Public Const VNET_SERVER_INFO = &H3299CC
  10. Public Const VNET_SERVER_ACCOUNT = &H5DFC0A
  11.  
  12. Public Const VNET_USERNAME = &HCDBE70
  13. Public Const VNET_CLIENT = &HA3A3A3
  14. Public Const VNET_TEXT = &H66CCCC
  15. Public Const VNET_INFO = &HAC92B
  16.  
  17. Public arrEvents() As Variant
  18.  
  19. Public Sub setArray()
  20.   arrEvents = Array("%1username%/1 %2(message)%/2 %3has joined VectorNet.%/3", _
  21.                     "%1username%/1 %2(message)%/2 %3has left VectorNet.%/3", _
  22.                     "%1<username>%/1 %2message%/2", _
  23.                     "%1<%/1%2username%/2 %1message>%/1", _
  24.                     "%1message%/1", _
  25.                     "%1username%/1 %2[pingms]%/2 %3has joined the channel.%/3", _
  26.                     "%1username%/1 %2[pingms]%/2 %3has left the channel.%/3", _
  27.                     " %1<To %/1%2username%/2%1>%/1 %2message%/2", _
  28.                     " %1<From %/1%2username%/2%1>%/1 %2message%/2", _
  29.                     "%1<%/1%2username%/2%1>%/1 %3message%/3")
  30. End Sub
  31.  
  32. Public Sub buildHTMLBody()
  33.   Dim htmlFile As String, fsoHTMLLog
  34.   htmlFile = App.Path & "\logs\" & Year(Date) & "-" & Month(Date) & "-" & Day(Date) & ".html"
  35.  
  36.   If Not fso.FileExists(htmlFile) Then
  37.     fso.CreateTextFile htmlFile
  38.  
  39.     Set fsoHTMLLog = fso.GetFile(htmlFile).OpenAsTextStream(2)
  40.  
  41.     With fsoHTMLLog
  42.       .writeline "  <body bgcolor=""black""><font face=""Tahoma"" color=""white""><h3><center>VectorNet logs dated " & Date & " for the username " & Config.username & ".</center></h3>"
  43.     End With
  44.     fsoHTMLLog.Close
  45.   End If
  46. End Sub
  47.  
  48. Public Sub handleHTMLEvent(ByVal arrIndex As Integer, ByVal username As String, ByVal message As String, ParamArray saColors() As Variant)
  49.   On Error Resume Next
  50.  
  51.   Dim htmlFile As String, htmlLine As String, fsoHTMLLog As Object
  52.   Dim timeString As String
  53.  
  54.   timeString = "<font color=""#F0FFF0"">[" & Time() & "] </font>"
  55.   htmlFile = App.Path & "\logs\" & Format(Date, "yyyy-mm-dd") & ".html"
  56.   htmlLine = arrEvents(arrIndex)
  57.  
  58.   For i = 0 To UBound(saColors)
  59.     htmlLine = Replace(htmlLine, "%" & i + 1, "<font color=""#" & Hex(saColors(i)) & """>")
  60.     htmlLine = Replace(htmlLine, "%/" & i + 1, "</font>")
  61.   Next i
  62.  
  63.   If arrIndex = 5 Or arrIndex = 6 Then
  64.       htmlLine = Replace(htmlLine, "ping", User(findUserIndex(username)).ping)
  65.   End If
  66.  
  67.   htmlLine = Replace(htmlLine, "username", username)
  68.   htmlLine = Replace(htmlLine, "message", message)
  69.   htmlLine = htmlLine & "<br />"
  70.  
  71.   If Not fso.FileExists(htmlFile) Then
  72.     fso.CreateTextFile htmlFile
  73.   End If
  74.  
  75.   Set fsoHTMLLog = fso.GetFile(htmlFile).OpenAsTextStream(8)
  76.   fsoHTMLLog.writeline timeString & htmlLine
  77.   fsoHTMLLog.Close
  78. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement