Vorrei creare un client IRC che accetti il DCC

« Older   Newer »
  Share  
zeck93
CAT_IMG Posted on 4/1/2013, 22:03     +1   -1




E' da qualche giorno che ci penso...
L'idea sarebbe quella di poter ricevere file [non coperti da copyright ovviamente :)] mediante client IRC in autoit.

Però non riesco a capire come poterlo fare..
Qualche idea?

UPDATE: ho fatto questo
[CODE]
#include <irc.au3>

Global $server = "blabla"
Global $port = 6667
Global $nick = "blabla"
Global $channel = "#blabla"
Global $ip

TCPStartup ()
Global $sock = _IRCConnect($server, $port, $nick); Connects to IRC and Identifies its Nickname

While 1
$recv = TCPRecv($sock, 8192); Recieve things from server
If @error Then Exit MsgBox(1, "IRC Example", "Server has errored or disconnected"); If you can't recieve then the server must have died.
Local $sData = StringSplit($recv, @CRLF); Splits the messages, sometimes the server groups them
For $i = 1 To $sData[0] Step 1; Does each message seperately
Local $sTemp = StringSplit($sData[$i], " "); Splits the message by spaces
If $sTemp[1] = "" Then
ContinueLoop
Else
;~ ConsoleWrite($sTemp[1])
;~ ConsoleWrite($sTemp[2])
;~ ConsoleWrite($sTemp[3])
ConsoleWrite($sData[$i] & @CRLF)
EndIf
If $sTemp[0] >= "7" Then
If $sTemp[2] = "NOTICE" Then
If $sTemp[3] = $nick Then
If StringRight($sTemp[4], 3) = "DCC" Then
If $sTemp[5] = "Send" Then
$ip = $sTemp[7]
$ip = StringReplace($ip, "(", "")
$ip = StringReplace($ip, ")", "")
ConsoleWrite($sData[$i] & @CRLF)
EndIf
EndIf
EndIf
EndIf
EndIf
If $sTemp[0] >= "8" Then
If $sTemp[2] = "PRIVMSG" Then
If $sTemp[3] = $nick Then
If StringRight($sTemp[4], 3) = "DCC" Then
If $sTemp[5] = "SEND" Then
$filename = $sTemp[6]
;~ $socket = $sTemp[7]
$fport = $sTemp[8]
$privmsg = $sData[$i]
$privmsg = StringReplace($privmsg, "!", " ")
$privmsg = StringReplace($privmsg, ":", "")
$pmsplit = StringSplit($privmsg, " ")
$name = StringReplace($pmsplit[1], " ", "")
TCPSend($sock, 'PRIVMSG ' & $name & ' :DCC RESUME "' & $filename & '" ' & $fport & ' 0')
ConsoleWrite($sData[$i])
$socket = TCPConnect($ip, $fport)
If $socket = -1 Then Exit MsgBox(1, "Error", "Server " & $ip & " is not responding.")
While 1
$recv = TCPRecv($socket, 1024)
If $recv <> "" Then
MsgBox(0, "", $recv)
Else
Sleep(10)
EndIf
WEnd


EndIf
EndIf

EndIf
EndIf
EndIf
If $sTemp[1] = "PING" Then _IRCPing($sock, $sTemp[2]); Checks for PING replys (There smaller then usual messages so its special!
If $sTemp[0] <= 2 Then ContinueLoop; Useless messages for the most part
Switch $sTemp[2]; Splits the command msg
Case "266"; It's what I use as an indictator to show when its done sending you info.
;~ _IRCJoinChannel ($sock, $channel)
;~ _IRCSendMessage($sock, "Hello!", $channel)
;~ _IRCChangeMode ($sock, "+i", $nick)
EndSwitch
Next
WEnd


Il fatto è che quando un utente invia il file, si viene a creare un socket... e mi servirebbe sapere qual'è per poter "far rimanere in ascolto" il mio client...
Ce la sto quasi facendo :D

Edited by zeck93 - 5/1/2013, 01:00
 
Top
CAT_IMG Posted on 5/1/2013, 03:45     +1   -1

So implementare gli object

Group:
Admin
Posts:
1,215
Reputazione:
+150

Status:


Hai esperienze precedenti nella programmazione di rete?
 
Top
zeck93
CAT_IMG Posted on 5/1/2013, 09:51     +1   -1




CITAZIONE (‡ (dd) @ 5/1/2013, 03:45) 
Hai esperienze precedenti nella programmazione di rete?

Dipende a cosa ti riferisci di preciso, comunque generalmente: no. :)

- - -

Sono riuscito a farlo solo che trasferisce file di max 11kb -.-''

Edited by zeck93 - 5/1/2013, 10:49
 
Top
Hpmezzo
CAT_IMG Posted on 8/1/2013, 17:48     +1   -1




www.autoitscript.com/forum/topic/43515-irc-udf/
Vedi se c'è quello che ti interessa!
 
Top
zeck93
CAT_IMG Posted on 8/1/2013, 19:45     +1   -1




CITAZIONE (Hpmezzo @ 8/1/2013, 17:48) 
Vedi se c'è quello che ti interessa!

Sì, la "base" l'ho copiata da lì... Ma è troppo un casino, ci ho rinunciato...
Adesso che sono finite le vacanze non ho più tanto tempo come prima.
 
Top
4 replies since 4/1/2013, 22:03   114 views
  Share