All pastes #480253 Raw Edit

Blinkenlights TCPSocket1 DataAvailable

public text v1 · immutable
·published 2007-05-10 05:31 UTC
rendered paste body
  // Let's see if this works.
  // Our regexes
  // Whispers: ^\(\<font color\=\'whisper\'\>\[ \<name shortname\=\'(.*?)\' src\=\'whisper\-from\'\>(.*?)\<\/name\> whispers\, \"(.*?)\" to you\. \]\<\/font\>$
  // Follow requests: ^\(\<font color\=\'query\'\>\<name shortname\=\'(.*?)\'\>(.*?)\<\/name\> requests permission to follow you\. To accept the request\, \<a href\=\'command\:\/\/lead\'\>click here\<\/a\> or type \`lead and press \&lt\;enter\&gt\;\.\<\/font\>$
  // Lead requests: ^\(\<font color\=\'query\'\>\<name shortname\=\'(.*?)\'\>(.*?)\<\/name\> requests permission to lead you\. To accept the request\, \<a href\=\'command\:\/\/follow\'\>click here\<\/a\> or type \`follow and press \&lt\;enter\&gt\;\.\<\/font\>$
  
  Dim furctempdata, whisper As String
  Dim furcwhischk as Integer
  
  furctempdata = me.ReadAll
  
  // Check if we've recieved a whisper (well, duh, we have) and see who it's from
  // Also see if anyone wants to lead/follow us.
  If InStr( furctempdata, "<font color='whisper'>" ) <> 0 then
    Dim ResultString, ResultString2 As String
    Dim FurcWhisRegex As RegEx
    Dim myMatch As RegExMatch
    FurcWhisRegex = New RegEx
    FurcWhisRegex.Options.CaseSensitive = True
    FurcWhisRegex.Options.TreatTargetAsOneLine = True
    FurcWhisRegex.SearchPattern = "^\(\<font color\=\'whisper\'\>\[ \<name shortname\=\'(.*?)\' src\=\'whisper\-from\'\>(.*?)\<\/name\> whispers\, \""(.*?)\"" to you\. \]\<\/font\>$"
    myMatch = FurcWhisRegex.Search(furctempdata)
    If myMatch <> Nil Then
      ResultString = myMatch.SubExpressionString(2)
      ResultString2 = myMatch.SubExpressionString(3)
      me.Write "wh Kawinma " + ResultString + " " + ResultString2 + chr(13) + chr(10)
      me.Poll
    End If
    // If someone wants to follow us..
  ElseIf InStr( furctempdata, "<font color='query'>" ) <> 0 And InStr( furctempdata, "type `lead" ) <> 0 Then
    Dim ResultString As String
    Dim FurcWhisRegex As RegEx
    Dim myMatch As RegExMatch
    FurcWhisRegex = New RegEx
    FurcWhisRegex.Options.CaseSensitive = True
    FurcWhisRegex.Options.TreatTargetAsOneLine = True
    FurcWhisRegex.SearchPattern = "^\(\<font color\=\'query\'\>\<name shortname\=\'(.*?)\'\>(.*?)\<\/name\> requests permission to follow you\. To accept the request\, \<a href\=\'command\:\/\/lead\'\>click here\<\/a\> or type \`lead and press \&lt\;enter\&gt\;\.\<\/font\>$"
    myMatch = FurcWhisRegex.Search(furctempdata)
    If myMatch <> Nil Then
      ResultString = myMatch.SubExpressionString(2)
      me.Write "wh Kawinma " + " " + ResultString + chr(13) + chr(10)
      me.Poll
    End If
    // If someone wants to lead us..
  ElseIf  InStr( furctempdata, "<font color='query'>" ) <> 0 And InStr( furctempdata, "type `follow" ) <> 0 Then
    Dim ResultString As String
    Dim FurcWhisRegex As RegEx
    Dim myMatch As RegExMatch
    FurcWhisRegex = New RegEx
    FurcWhisRegex.Options.CaseSensitive = True
    FurcWhisRegex.Options.TreatTargetAsOneLine = True
    FurcWhisRegex.SearchPattern = "^\(\<font color\=\'query\'\>\<name shortname\=\'(.*?)\'\>(.*?)\<\/name\> requests permission to lead you\. To accept the request\, \<a href\=\'command\:\/\/follow\'\>click here\<\/a\> or type \`follow and press \&lt\;enter\&gt\;\.\<\/font\>$"
    myMatch = FurcWhisRegex.Search(furctempdata)
    If myMatch <> Nil Then
      ResultString = myMatch.SubExpressionString(2)
      me.Write "wh Kawinma " + " " + ResultString + chr(13) + chr(10)
      me.Poll
    End If
  End If