Advertisement
westor

Pacman online for mIRC

Jun 14th, 2018
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 6.67 KB | None | 0 0
  1. alias -l pac_cinstall {
  2.   ;if (!$sslready) return $input(You do not have SSL capabilities. SSL is required to download Pacman $+ $crlf See http://www.mirc.com/ssl.html for more information,wo,Pacman install)
  3.   if ($input($+(Do you want to install to the default folder?,$crlf,Default folder: $scriptdirPacman\),yq,Pacman - Install)) set %pac_dir_install $scriptdirPacman\
  4.   elseif ($sdir($scriptdir,Where do you want to install Pacman to?) != $null) && (!$istok(cancel error,$sfstate,32)) set %pac_dir_install $v1
  5.   else return $input($+(The installation has been cancelled or an error occured,$crlf,Execute this installer again if you want to install),ow,Pacman - Install)
  6.   if (!$isdir(%pac_dir_install)) mkdir $qt(%pac_dir_install $+ maps\)
  7.   sockclose pac_ckinst
  8.   sockopen pac_ckinst ouims.hopto.org 80
  9.   sockmark pac_ckinst $false
  10.   write -c $qt(%pac_dir_install $+ update.pac)
  11. }
  12.  
  13. on *:sockopen:pac_ckinst:{
  14.   if (!$sockerr) {
  15.     sockwrite -n $sockname GET /pacman/update.pac HTTP/1.1
  16.     sockwrite -n $sockname Host: $sock($sockname).addr
  17.     sockwrite -n $sockname Connection: close
  18.     sockwrite -n $sockname
  19.   }
  20.   else {
  21.     .timer -ho 1 0 noop $!input(Cannot connect to the server $+ $chr(44) aborting the installation..,oh,Pacman - Install)
  22.     unset %pac_dir_install
  23.   }
  24. }
  25.  
  26. on *:sockread:pac_ckinst:{
  27.   if (!$sockerr) {
  28.     if ($sock($sockname).mark) {
  29.       sockread -f &a
  30.       bwrite $qt(%pac_dir_install $+ \update.pac) -1 -1 &a
  31.     }
  32.     else {
  33.       var %a
  34.       sockread %a
  35.       if (%a == $null) sockmark $sockname 1
  36.       elseif ($sock($sockname).mark == $false) {
  37.         if (*200 OK* !iswm %a) {
  38.           .timer -ho 1 0 noop $!input(Cannot find the list of files $!+ $!chr(44) the installation has been aborted.,ho,Pacman - Install)
  39.           sockclose $sockname
  40.           .remove $qt(%pac_dir_install $+ update.pac)
  41.           unset %pac_dir_install
  42.         }
  43.         sockmark $sockname 0
  44.       }
  45.     }
  46.   }
  47.   else {
  48.     .timer -ho 1 0 noop $!input(An error occured while downloading the list of files $!+ $!chr(44) the installation has been aborted.,ho,Pacman - Install)
  49.     .remove $qt(%pac_dir_install $+ update.pac)
  50.     unset %pac_dir_install
  51.   }
  52. }
  53. on *:sockclose:pac_ckinst:pac_install
  54.  
  55. alias -l pac_install {
  56.   var %a 2
  57.   set %pacprogress $int($calc(200 / ($lines(%pac_dir_install $+ update.pac) - 1)))
  58.   window -kpdfC +l $+(@Installing,$chr(160),Pacman...) -1 -1 200 40
  59.   while ($read(%pac_dir_install $+ update.pac,tn,%a)) {
  60.     pac_dl_install %a $v1
  61.     inc %a
  62.   }
  63.   set %pacinstall %a - 2
  64. }
  65.  
  66. alias -l pac_dl_install {
  67.   sockclose pac_install $+ $1
  68.   sockopen pac_install $+ $1 ouims.hopto.org 80
  69.   sockmark pac_install $+ $1 $2-
  70. }
  71. on *:sockopen:pac_install?*:{
  72.   if (!$sockerr) {
  73.     .fopen -no $sockname $qt(%pac_dir_install $+ $sock($sockname).mark)
  74.     sockwrite -n $sockname GET /pacman/ $+ $sock($sockname).mark HTTP/1.1
  75.     sockwrite -n $sockname Host: $sock($sockname).addr
  76.     sockwrite -n $sockname Connection: close
  77.     sockwrite -n $sockname
  78.     sockmark $sockname $false
  79.   }
  80.   else {
  81.     .timer -ho 1 0 noop $!input(Cannot connect to the server to download the file $nopath($sock($sockname).mark) $!+ $!chr(44) the installation has been aborted.,oh,Pacman - Install)
  82.     pac_abortinstall
  83.   }
  84. }
  85.  
  86. on *:sockread:pac_install?*:{
  87.   if (!$sockerr) {
  88.     if ($sock($sockname).mark) {
  89.       sockread -f &a
  90.       .fwrite -b $sockname &a
  91.     }
  92.     else {
  93.       var %a
  94.       sockread %a
  95.       if (%a == $null) sockmark $sockname 1
  96.       elseif ($sock($sockname).mark == $false) {
  97.         if (*200 OK* !iswm %a) {
  98.           .timer -ho 1 0 noop $!input(Cannot find the file $nopath($fopen($sockname).fname) on the server $!+ $!chr(44) the installation has been aborted.,ho,Pacman - Install)
  99.           pac_abortinstall
  100.         }
  101.         sockmark $sockname 0
  102.       }
  103.     }
  104.   }
  105.   else {
  106.     .timer -ho 1 0 noop $!input(An error occured while downloading the file $nopath($fopen($sockname).fname) $!+ $!chr(44) the installation has been aborted.,ho,Pacman - Install)
  107.     pac_abortinstall
  108.   }
  109. }
  110.  
  111. alias -l pac_abortinstall {
  112.   sockclose pac_install?*
  113.   .fclose pac_install?*
  114.   var %a 2
  115.   while ($read(%pac_dir_install $+ update.pac,tn,%a) != $null)  {
  116.     var %v $v1
  117.     if ($isfile(%pac_dir_install $+ %v)) {  
  118.       if (*.mrc iswm %v) .unload -rs $qt(%pac_dir_install $+ %v)
  119.       .remove $qt(%pac_dir_install $+ %v)
  120.     }
  121.     inc %a
  122.   }
  123.   .remove $qt(%pac_dir_install $+ update.pac)
  124.   unset %pac_dir_install %pacinstall %pacprogress
  125.   window -c $+(@Installing,$chr(160),Pacman...)
  126. }
  127.  
  128. on *:sockclose:pac_install?*:{
  129.   var %f $fopen($sockname).fname
  130.   dec %pacinstall
  131.   .fclose $sockname
  132.   drawrect -fr $+(@Installing,$chr(160),Pacman...) 64512 0 0 0 $calc(200 - %pacinstall * %pacprogress) 40
  133.   if ($right(%f,4) == .mrc) .load -rs $qt(%f)
  134.   if (!%pacinstall) { unset %pacinstall %pacprogress %pac_dir_install | window -c $+(@Installing,$chr(160),Pacman...) | .timer -h 1 0 pac_finstall }
  135. }
  136. alias -l pac_finstall {
  137.   noop $input(Pacman installed sucessfully!,to,Pacman - Install)
  138.   if ($input($+(Do you want to delete the file used for the installer (that file will be unloaded as well)?,$crlf,File : $script),wqy,Pacman - Install)) {
  139.     !.remove $qt($script)
  140.     var %u 1
  141.   }
  142.   if (!$v1) && ($input(Do you want to unload that file anyway?,wyq,Pacman - Install)) var %u 1
  143.   var %m1 menubar,%m2 menubar,status,%m3 menubar,channel, %m4 menubar,query,%m5 menubar,status,channel,%m6 menubar,status,query,%m7 menubar,status,channel,query,%m8 No menu, please
  144.   var %menu $input(Please select some popups locations for Pacman,mi,Pacman - Install,%m1,%m1,%m2,%m3,%m4,%m5,%m6,%m7,%m8)
  145.   var %read $read($script(pacman.mrc),wnt,menu & $({,0))
  146.   if (%menu != No menu, please) && (%menu) write -l $+ $readn $qt($script(pacman.mrc)) menu %menu $({,0)
  147.   else write -l $+ $readn $qt($script(pacman.mrc)) nomenu $({,0)
  148.   ;left up right down nicklobby nickgame autodupdate dialtop wintop blink upnp
  149.   write -il1 $qt($script(pacman.mrc)) ;37 38 39 40 - - 0 0 0 1 0 0
  150.   .reload -rs $qt($script(pacman.mrc))
  151.   pacman
  152.   if (%u) .unload -rs $qt($script)
  153. }
  154.  
  155.  
  156. menu menubar,channel,query,status {
  157.   Pacman Install: pacman_install
  158. }
  159. alias Pacman_install {
  160.   if ($script(pacman.mrc)) || ($script(pac_server.mrc)) || ($script(pac_client.mrc)) || ($script(pac_lobby.mrc)) || ($script(pac_editor.mrc)) return $input($+(The following Pacman file is loaded:,$crlf,$v1,$crlf,Please unload it before reinstalling Pacman),oi,Pacman - Install)
  161.   if ($version >= 7.22) || ($input($+(Pacman Online requires a version of mIRC greater or equal to 7.22,$crlf,You are using mIRC v,$version,$chr(44) $chr(32),Do you want to install nonetheless?),yw,Pacman - Install)) pac_cinstall
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement