C'est bon j'ai tout effacé ici, j'ai compris comment ça marche.
Euh... Comment on réserve sont propre channel c'est bien cela :
Mais sa me retourne rien...
Code : Tout sélectionner
#Region
;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\Utilitaires\AutoIt3\Icons\au3.ico
#AutoIt3Wrapper_Res_Description=Un logiciel pour parler entre membre TCF organisé ainsi des réunions et savoir qui est en ligne.
#AutoIt3Wrapper_Res_Fileversion=0.0.0.0
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=TCF
#AutoIt3Wrapper_Res_Language=1036
#EndRegion
;**** Directives created by AutoIt3Wrapper_GUI ****
; ----------------------------------------------------------------
; ---------------------- INFORMATION -----------------------------
; ----------------------------------------------------------------
; Version AutoIt : 3.3.8.1
; Langue : Français
; Plateforme : Win7
; Auteur : Mica2727 (Mica2727 at orange dot fr)
;
; Fonction du script :
; Un logiciel pour parler entre membre TCF organisé ainsi des réunions et savoir qui est en ligne.
;
#comments-start
Version 0.0b : 17/10/2013
- Création de la page de configuration sur un fichier de config.ini
- Mise à jour sur le pseudo qui s'affiche dans le chat.
- Recherche comment ouvrir un port ou une passerelle.
Version 0.0a : 14/10/2013
- Création de l'interface.
#comments-end
; ----------------------------------------------------------------
; --------------------- INFORMATION EXE --------------------------
; ----------------------------------------------------------------
;
;
;
; ----------------------------------------------------------------
; ------------------------ VARIABLES -----------------------------
; ----------------------------------------------------------------
; Include
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <ListboxConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Dim $ver = "[ V0.0a ] "
Dim $connect = "0", $cfg = ".\config\cfg.ini", $connectedRead, $connected, $send, $newUser, $msg
Dim $channel = "#TCFDrago", $datasplit, $datasplit2, $element
Global $port = 6667
Local $hDLL = DllOpen("user32.dll")
; ----------------------------------------------------------------
; -------------------- Création de la GUI ------------------------
; ----------------------------------------------------------------
; Création GUI 1
#Region ### START Koda GUI section ### Form=d:\internet\scite\tcf messenger\tcfmessenger.kxf
$TCFMessenger = GUICreate("TCFMessenger", 701, 521, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE,"Echap")
$MenuItem1 = GUICtrlCreateMenu("&Options")
$MenuItem3 = GUICtrlCreateMenuItem("Mes informations", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenu("&A propos")
$Group1 = GUICtrlCreateGroup("Chat", 8, 72, 537, 385)
$chat = GUICtrlCreateList("", 16, 88, 521, 361,BitOR($LBS_NOTIFY,$LBS_SORT,$LBS_DISABLENOSCROLL,$LBS_NOSEL,$WS_VSCROLL))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$btn_connect = GUICtrlCreateButton("Connecté", 8, 8, 75, 25)
$btn_disconnect = GUICtrlCreateButton("Déconnecté", 88, 8, 75, 25)
$btn_away = GUICtrlCreateButton("Absent", 248, 8, 75, 25)
$btn_occupe = GUICtrlCreateButton("Occupé", 168, 8, 75, 25)
$Label1 = GUICtrlCreateLabel("Autre Status?", 8, 48, 103, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$status = GUICtrlCreateInput("status", 112, 48, 121, 21)
$sendMsg = GUICtrlCreateButton("OK", 656, 464, 35, 25)
$inputMsg = GUICtrlCreateInput("inputMsg", 8, 464, 641, 24)
GUICtrlSetOnEvent($inputMsg,"saveMsg")
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
$Group2 = GUICtrlCreateGroup("Membre", 552, 72, 145, 385)
$mbr = GUICtrlCreateList("", 560, 88, 133, 361,BitOR($LBS_NOTIFY,$LBS_SORT,$LBS_DISABLENOSCROLL,$LBS_NOSEL,$WS_VSCROLL))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$btn_game = GUICtrlCreateButton("En train de jouer", 328, 8, 91, 25)
$btn_status = GUICtrlCreateButton("Ok!", 240, 48, 35, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form=
$MyInfo = GUICreate("MyInfo", 269, 131, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE,"Echap")
$text_myinfo = GUICtrlCreateLabel("Mes informations :", 8, 8, 159, 27)
GUICtrlSetFont(-1, 14, 400, 0, "Tahoma")
$pseudo = GUICtrlCreateLabel("Mon pseudo :", 16, 48, 85, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$cfg_pseudo = GUICtrlCreateInput("", 104, 48, 121, 21)
$saveinfo = GUICtrlCreateButton("Sauvegarder", 8, 88, 75, 25)
GUICtrlSetOnEvent($saveinfo,"saveInfo")
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###
; ----------------------------------------------------------------
; ------------------- Programme en lui même ----------------------
; ----------------------------------------------------------------
GUICtrlSetData($cfg_pseudo,IniRead($cfg,"Config","cfg_pseudo","VotrePseudo"))
TCPStartup()
$connected = TCPConnect(TCPNameToIP("irc.freenode.net"),$port)
TCPSend($connected,"NICK Naruxc27"&@CRLF)
TCPSend($connected,"USER Naruxc27 France pratchett Michael"&@CRLF)
While 1
;~ $msg = GUIGetMsg()
;~ Switch $msg
;~ Case $GUI_EVENT_CLOSE
;~ Exit
;~ Case $sendMsg
;~ TCPSend($connected, "PRIVMSG " & $channel & " :" & GUICTrlRead($inputMsg) & @CRLF)
;~ MsgBox(64,"test", "<" & $pseudo & "> " & GUICTRLRead($inputMsg))
;~ GUiCtrlsEtData($inputMsg, "")
;~ EndSwitch
$row = TCPRecv($connected, 4000)
If @error Then Exit
If Not $row Then ContinueLoop
$datasplit = StringSplit($row,@CRLF,1)
For $i = 1 To $datasplit[0] Step 1
If $datasplit[$i] <> "" Then _GUICTrlListBox_AddString($chat,$datasplit[$i])
$datasplit2 = StringSplit($datasplit[$i], " ")
;~ _GUICTrlListBox_AddString($chat,$datasplit2[1]&$datasplit2[2]&$datasplit[3] & @CRLF)
If $datasplit2[1] = "PING" Then
TCPSend($connected, "PONG " & $datasplit2[2] & @CRLF)
EndIf
If $datasplit2[0] < 3 Then ContinueLoop
Switch $datasplit2[2] ;on fait un switch pour faire des différences si le deuxieme mot est :
Case "PRIVMSG" ; privmsg (donc on recoit du texte)
$qui = StringMid($datasplit2[1], 2, StringInStr($datasplit2[1], "!") - 2) ;recuperer le pseudo de celui qui a écrit
$quoi = StringMid($datasplit[$i], StringInStr($datasplit[$i], ":", 0, 2) + 1)
$ou = $datasplit2[3] ;et sur quel canal
_GUICtrlListBox_AddString($chat, "<" & $qui & "> " & $quoi)
Case "001" ; 001 (c'est à dire qu'on a fini de se connecter, on établie la connexion au channel
TCPSend($connected, "JOIN " & $channel & @CRLF) ;JOIN #channel
_GUICtrlListBox_AddString($chat, "Vous êtes connecté.")
_GUICtrlListBox_ResetContent($chat)
Case "353"
For $j = 6 To $datasplit2[0]
_GUICTrlListBox_AddString($mbr, $datasplit2[$j])
MsgBox(64,"data",$datasplit2[$j])
Next
EndSwitch
Next
if $row == -1 Then ExitLoop
Sleep(100)
WEnd
If $connected <> -1 Then TCPCloseSocket($connected)
TCPShutdown()
; ----------------------------------------------------------------
; ------------------------- FONCTIONS ----------------------------
; ----------------------------------------------------------------
Func Echap()
If @GUI_WinHandle == $TCFMessenger Then
DllClose($hDLL)
Exit
ElseIf @GUI_WinHandle == $MyInfo Then
GUISetState(@SW_HIDE,$MyInfo)
EndIf
EndFunc
; Préchargement des données.
Func preLoad()
; En cours...
EndFunc
; Envoie le message écrit.
Func saveMsg()
$MyPseudo = IniRead($cfg,"Config","cfg_pseudo","VotrePseudo")
$Text = GUICtrlRead($inputMsg)
$MyText = StringSplit(GUICtrlRead($inputMsg)," ")
$MyTextSplit = StringSplit(GUICtrlRead($inputMsg)," ")
; Si il/elle presse entrée
; On vérifie que le message n'est pas vide
Switch $MyTextSplit[1]
Case "NICK"
_sendCMD($MyText)
_sendChat("Pseudo changer correctement en "&$MyTextSplit[2])
Case "MSG"
_sendCMD($MyText)
_sendChat("Commande bien envoyer")
Case Default
If StringLen($Text) > 2 Then
_sendCMD("PRIVMSG" &" "& "#TCFDrago" & " :" & $Text)
_sendChat("["&@HOUR&":"&@MIN&":"&@SEC&"] " & $MyPseudo & ": " & $Text)
_del($inputMsg)
EndIf
EndSwitch
GUICtrlSetData($inputMsg,"")
EndFunc
; GUI 2
Func openMyInfo()
GUISetState(@SW_SHOW,$MyInfo)
EndFunc
; Enregistre les données de la seconde fenêtre.
Func saveInfo()
IniWrite($cfg,"Config","cfg_pseudo",GUICtrlRead($cfg_pseudo))
GUISetState(@SW_HIDE,$MyInfo)
EndFunc
Func _del($set)
GUICtrlSetData($set,"")
EndFunc
Func _sendCMD($val)
TCPSend($connected,$val&@CRLF)
EndFunc
Func _sendChat($val)
_GUICTrlListBox_AddString($chat, $val)
EndFunc
Quand je le met dans la boucle infini le TCP MSG, ça me sort " UNKNOW COMMAND " et quand je le met dans ma fonction ça me sort rien du tout. En faite je n'est pa sde réponse du serveur, j'y comprends rien du tout oO