IceChat Forums

IceChat 7 => IceChat 7 Scripts => Topic started by: krolsekater on May 24, 2008, 10:28:59 PM

Title: Adapting mIRC script to Icechat 7?
Post by: krolsekater on May 24, 2008, 10:28:59 PM
Hi,

There's a specific IRC server (irc.voila.fr) that requires an "IRC key". This key is obtained by going through 4 steps: choosing nickname, accepting terms and conditions, copying a code from a picture (like when I registered) and finally receiving this key.

Now, there's an add-on for this for mIRC 6.2 (i don't know if it's compatible with other versions).

In the scripting session it says that some spacing and { } might need to be adjusted, but it doesn't explain how.

Anyway, when I tried to use it (via scripts) i got the following error message:
[21:54]  ->> ERROR:clsScriptAlias:860:Function:Execute Error Number:9 : Subscript out of range

Here's the entire script:

;###########ADDON CREE PAR VESTAX######################
;###POUR FACILITER LA CONNEXION SUR LES SERVEURS ORANGE VOILA#####
;################################################


alias cond { dialog -m cond cond }
dialog cond {
  title "Comportement général des utilisateurs"
  size -1 -1 182 127
  option dbu
  box "Veuillez lire attentivement ce qui suit", 1, 2 3 178 111
  edit "", 2, 4 12 174 100, read return autovs multi vsbar
  check "J'ai lu et j'accepte les conditions générales", 3, 2 115 116 10
  button "Connexion", 4, 143 115 37 10
}
on *:dialog:cond:init:*:{
  did -b cond 4
  var %i = 1
  while (%i <= $lines(cle-irc/conditions.txt)) {
    did -a cond 2 $replace($read(cle-irc/conditions.txt,%i),.,$crlf $+ $crlf)
    inc %i
  }
}
on *:dialog:cond:sclick:3:{ if ($did(3).state = 1) { did -e cond 4 } | else { did -b cond 4 } }
on *:dialog:cond:sclick:4:{ server irc.voila.fr:6667 $did(irccle,5) }
alias irccle { dialog -m irccle irccle }
dialog irccle {
  title "Clé IRC Wanadoo"
  size -1 -1 146 69
  option dbu
  box "Etape 1", 1, 2 3 143 31
  text "Entrez votre pseudo:", 2, 5 12 56 8
  edit "", 3, 64 11 79 10, autohs
  text "Votre clef: en attente", 4, 5 22 57 8
  edit "", 5, 64 21 79 10, read autohs
  box "Etape 2", 6, 2 34 91 22
  icon 7, 94 36 49 18
  text "Entrez le code:", 8, 5 44 38 8
  edit "", 9, 45 43 44 10, autohs
  button "Connexion", 10, 2 57 37 10
  button "Confirmer", 11, 41 57 37 10
  button "Fermer", 12, 107 57 37 10, ok
}
on *:dialog:irccle:init:*:{
did -b irccle 11
did -a irccle 3 %nick.clé
did -a irccle 5 %clé.irc
}
on *:dialog:irccle:sclick:10:{ clé }
alias clé {
  .remove wanadoo.txt
  .remove wanadoo2.txt
  .remove image.jpg
  .remove trtr.htm
  did -ra irccle 4 Votre clef: patientez...
  did -r irccle 5
  did -b irccle 11
  sockclose clé
  sockopen clé tchat.orange.fr 80
}
on *:sockopen:clé:{
  var %id = $+(nick= $+ $did(irccle,3))
  sockwrite -n clé POST /v4authClientLourd2.php HTTP/1.1
  sockwrite -n clé HOST: tchat.orange.fr
  sockwrite -n clé Content-Type: application/x-www-form-urlencoded
  sockwrite -n clé Connection: close
  sockwrite -n clé Content-Length: $len(%id)
  sockwrite -n clé $crlf
  sockwrite -n clé %id
}
on *:sockread:clé:{
  sockread %clé
  if (<input type="hidden" isin %clé) { write wanadoo.txt $remove(%clé,<input type="hidden" name=",$chr(9),value=",",/>,") }
}
on *:sockclose:clé:{
  sockclose clé2
  sockopen clé2 tchat.orange.fr 80
}
on *:sockopen:clé2:{
  var %id = $+(cgu=1,&,nick= $+ $gettok($read(wanadoo.txt,1),2,32) $+ ,&,clef= $+ $gettok($read(wanadoo.txt,2),2,32) $+ ,&,form_destination=v4authClientLourd2.php,&,1=1)
  sockwrite -n clé2 POST /v4authClientLourd2.php HTTP/1.1
  sockwrite -n clé2 HOST: tchat.orange.fr
  sockwrite -n clé2 Content-Type: application/x-www-form-urlencoded
  sockwrite -n clé2 Connection: close
  sockwrite -n clé2 Content-Length: $len(%id)
  sockwrite -n clé2 $crlf
  sockwrite -n clé2 %id
}
on *:sockread:clé2:{
  sockread %a
  if (<img src="/Code/image.php?img= isin %a) { set %url.img $remove(%a,<img src="/Code/image.php?img=,$chr(9),alt="code de contrôle",width="93" height="43">) }
  if (<input type="hidden" name=" isin %a) { write wanadoo2.txt $remove(%a,<input type="hidden" name=",$chr(9),value=",/>,") }
}
on *:sockclose:clé2:{
  sockclose clé3
  sockopen clé3 tchat.orange.fr 80
}
on *:sockopen:clé3:{ sockwrite -n clé3 GET http://tchat.orange.fr/Code/image.php?img= $+ %url.img }
on *:sockread:clé3:{
  sockread &image
  bwrite image.jpg -1 -1 &image
  did -g irccle 7 image.jpg
  did -ra irccle 4 Votre clef:
}
on *:dialog:irccle:sclick:11:{ sockclose clé4 | sockopen clé4 tchat.orange.fr 80 }
on *:sockopen:clé4:{
  var %id = $+(clef= $+ $gettok($read(wanadoo2.txt,1),2,32) $+ ,&,nick= $+ $gettok($read(wanadoo2.txt,2),2,32) $+ ,&,code1= $+ $gettok($read(wanadoo2.txt,3),2,32) $+ ,&,code2= $+ $gettok($read(wanadoo2.txt,4),2,32) $+ ,&,cgu=1,&,code= $+ $did(irccle,9))
  sockwrite -n clé4 POST /v4authClientLourd3.php HTTP/1.1
  sockwrite -n clé4 HOST: tchat.orange.fr
  sockwrite -n clé4 Content-Type: application/x-www-form-urlencoded
  sockwrite -n clé4 Connection: close
  sockwrite -n clé4 Content-Length: $len(%id)
  sockwrite -n clé4 $crlf
  sockwrite -n clé4 %id
}
on *:sockread:clé4:{
  sockread %e
  write trtr.htm %e
}
on *:sockclose:clé4:{
  did -ra irccle 5 $gettok($read(wanadoo2.txt,1),2,32)
  .remove wanadoo.txt
  .remove wanadoo2.txt
  .remove image.jpg
  .remove trtr.htm
  set %clé.irc $did(irccle,5)
  if (!$did(irccle,5)) { did -a irccle 5 Pseudo deja utilisé }
  if ($did(irccle,5) = Pseudo deja utilisé) { halt } | else { set %nick.clé $did(irccle,3) | nick $did(irccle,3) | cond }
}
on *:dialog:irccle:edit:9:{ if ($len($did(9)) = 6) { did -e irccle 11 } | else { did -b irccle 11 } }
menu menubar,channel,status,query {
  -
  Clé IRC:/dialog -m irccle irccle
}
on *:load:{
  echo -a 12Addon clé IRC bien chargée
  echo -a 12Pour le lancer taper:4 /irccle12 ou clic droit et4 Clé IRC
  echo -a 12Par VestaX www.universal-djs.com
}







Title: Re: Adapting mIRC script to Icechat 7?
Post by: Snerf on May 24, 2008, 10:33:09 PM
Sorry, can not be converted to IceChat 7 script, because there is no support for sockets.

Also, scripts that are that complicated simply will not work. IceChat really only works with simpler mirc style scripts, you need to use the VB Script Engine to make very complicated scripts.
Title: Re: Adapting mIRC script to Icechat 7?
Post by: krolsekater on May 24, 2008, 11:03:32 PM
So I'd need to convert this then to icechat 5 scripting style using VB ? :-s
Title: Re: Adapting mIRC script to Icechat 7?
Post by: Snerf on May 25, 2008, 10:53:49 AM
Yes, and that would require a complete re-write and very good knowledge of using sockets/http object in VB Script. The !google script in Script Downloads uses the HTTP Object, if you want a peek what your in for.