Dies ist eine alte Version des Dokuments!


XDCC-Suchscript

Erlaubt die suche nach XDCC-Downloads über www ircdig com.

#NewScriptBegin XdccSearch
 
Dim MyConn
Dim SearchFr
Dim SearchTex
Dim IrcPath
Dim PacketNr
Dim CurrLine
Dim sUser
Dim FileName
Dim FileSize
 
Sub Load()
  SearchFr = 0
  CurrLine = 100
  MakeShortcut "", "xdccsearch", "/call XdccSearch.StartSearch $>0", 2
End Sub
 
Sub Unload()
  if SearchFr <> 0 Then CloseFrame SearchFr
End Sub
 
Sub StartSearch(Text)
  SearchTex = Text
  if SearchFr = 0 Then
    SearchFr = NewFrame("XDCC Search")
    SetFrontFrame SearchFr
  else
    SetFrontFrame SearchFr
    Send "/cls", SearchFr
  end if
  Print "~ Connect to Server...", SearchFr, valcClientMsg
  MyConn = DccConnect("www.ircdig.com",80,"","",0,1)
End sub
 
Sub FrameClosed(FrameID)
  if SearchFr = FrameID then SearchFr = 0
End Sub
 
Sub Serv_Connected(ConnID)
  if ConnID = MyConn Then
    RequStr = "phrase=" + Replace(SearchTex, " ", "+")+"&submit=Search&sort=1&sub=01&botfilter=1&nav=01"
 
    SendData "POST /bin/index.pl HTTP/1.1", ConnID
    'SendData "User-Agent: Mozilla/4.0 (compatible; Nettalk " + Version + "; XDCC Search Script)", ConnID
    SendData "Host: www.ircdig.com", ConnID
    SendData "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.0.9) Gecko/2009040821 Firefox/3.0.9", ConnID
    SendData "Accept: text/html", ConnID
    SendData "Accept-Encoding: deflate", ConnID
    SendData "Content-Type: application/x-www-form-urlencoded", ConnID
    SendData "Content-Length: " & (Len(RequStr)), ConnID
    SendData "Connection: Close"+chr(13)+chr(10), ConnID
    SendData RequStr, ConnID
    isOut=0
  End if
End Sub
 
Sub RecvDCCMsg(Text, Nick, FrameID, ConnID)
  if MyConn = ConnID Then
    i = instr(1, Text, "-- Channel: <a href=")
    if i > 0 then
      i2 = instr(i + 22, Text, chr(34))
      'echo i, i2
      IrcPath = Mid(Text, i+21, i2-i-21)
      i2 = instr(i+22, Text, "&nbsp;&nbsp;")
      i3 = instr(i2+1, Text, "<")
      'echo i2, i3, Text
      sUser = Mid(Text, i2+12, i3-i2-12)
      CurrLine = 0
    end if
    if CurrLine = 2 Then
      i = instr(1, Text, ")"+chr(34)+">")
      i2 = instr(i, Text, "<")
      'echo i,i2, Text
      PacketNr = Mid(Text, i+3, i2-i-3)
    end if
    if CurrLine = 3 Then
      i = instr(1, Text, "</td><td>")
      i2 = instr(i+9, Text, "<")
      FileSize = Mid(Text, i+9, i2-i-9)
      i = instr(1, Text, "<td><b>")
      i2 = instr(i, Text, "</b>")
      FileName = RemHtml(Mid(Text, i+7, i2-i-7))
 
      Print " ", SearchFr, valcClientMsg
 
      Print "- ", SearchFr, valcNotice
      Print FileName, SearchFr, valcLink, 1, IrcPath & " " & sUser & " " & PacketNr
      Print "  (" & FileSize & ")", SearchFr, valcNotice, 1
 
      Print "  " & IrcPath & " Bot: " & sUser & " Packet Nr. #" & PacketNr, SearchFr, valcClientMsg
    end if
    if instr(1, Text, "</html>") > 0 Then
      Print "~ End of list", SearchFr, valcClientMsg
    end if
    CurrLine = CurrLine + 1
  end if
End Sub
 
Sub ScriptLinkClicked(Text, Trigger, Button)
  send "/xdcc " & Split(Trigger, 1) & " /msg " & Split(Trigger, 2) & " xdcc send #" & Split(Trigger, 3), 1
End Sub
 
Function RemHtml(Text)
  i = 1
  dep = 0
  OutText = ""
  do until i > Len(Text)
    if Mid(Text, i, 1) = "<" Then
      dep = dep + 1
    else
      if Mid(Text, i, 1) = ">" Then
        dep = dep - 1
      else
        if dep = 0 then OutText = OutText + Mid(Text, i, 1)
      end if
    end if
    i=i+1
  loop
  RemHtml = OutText
End Function
 
Sub RecvDDECmd(Data, Topic)
  if Split(Data, 1) = "SecNettalkApp" Then
    if InStr(1, Split(Data, 3), "irc://") > 0 Then
      if InStr(1,ClipboardText," xdcc send #") > 0 and Left(ClipboardText, 1) = "/" Then
        'Nicht sofort zu der Liste hinzufügen:
        'Send "/xdcc dontadd," + Split(Data, 3) + " " + ClipboardText, 1
        'Sofort hinzufügen:
        Send "/xdcc " + Split(Data, 3) + " " + ClipboardText, 1
      End if
    End if
  End if
End Sub

Eigene Werkzeuge