aIRC — File Browser

aIRCv0.8.69 / aIRCv0.8.69 / script / eggdrop1.mrc

eggdrop1.mrc — 15.87 KB — Download this file

;/**********************************************************************
; *
; * aIRC
; * Eggdrop userfile download (and eggy popups)
; *
; **********************************************************************/

; /getegguf [egg IP] [port] [yourlogin] [yourpass] [file]
alias getegguf {
  var %i,%s
  while (1) {
    inc %i
    %s = getegguf. $+ %i
    if ($sock(%s) == $null) && ($dialog(%s) == $null) { break }
  }
  if ($_not($_ishost($1))) { tokenize 32 $null $1- }
  if ($_not($_isint($2))) { tokenize 32 $1 3333 $2- }
  if (\ !isin $5-) { tokenize 32 $1 $2 $iif($3 != $null,$3,$null) $iif($4 != $null,$4,$null) $getdir $+ $5- }
  if ($_fixfilename($5-,f) == $null) { tokenize 32 $1 $2 $3 $4 }
  _getegguf.parms $1-
  if ($result == 0) {
    _dialog -m %s getegguf
    if ($1 != $null) { did -o %s 111 1 $1 }
    if ($2 != $null) { did -o %s 121 1 $2 }
    if ($3 != $null) { did -o %s 161 1 $3 }
    if ($4 != $null) { did -o %s 171 1 $4 }
    if ($5- != $null) { did -o %s 211 1 $_fixfilename($5-,m) }
    _getegguf.chd %s
  }
  else { _getegguf.init %s $1- }
}
alias _getegguf.init {
  var %s = $1
  tokenize 32 $2-
  if ($isfile($5-)) && ($_filexists(0,Get eggdrop userfile [/getegguf],$5-)) { _remove $5- }
  info.a Attemping connection with eggdrop bot: $1 ( $+ $2 $+ )
  sockopen %s $1 $2
  sockmark %s $3 $+ $chr(9) $+ $4 $+ $chr(9) $+ 0 $+ $chr(9) $+ $5- $+ $chr(9) $+ 0 $+ $chr(9) $+ 0
}
alias _getegguf.chd {
  if ($dialog($1)) { did $iif($_getegguf.parms($did($1,111),$did($1,121),$did($1,161),$did($1,171),$did($1,211)),-e,-b) $1 400 }
}
alias _getegguf.parms {
  if ($_ishost($1)) && ($_isint($2)) && ($3 != $null) && ($4 != $null) && ($_fixfilename($5-) != $null) { return 1 }
  return 0
}
dialog getegguf {
  title "Download eggdrop userfile"
  size -1 -1 130 198
  option dbu

  box "Bot",100,5 5 120 60
  text "&Host:",110,10 15 50 10
  edit "",111,15 25 100 10,autohs
  text "P&ort:",120,10 35 50 10
  edit "",121,15 45 100 10,autohs

  box "Login",150,5 70 120 60
  text "H&andle:",160,10 80 50 10
  edit "",161,15 90 100 10,autohs
  text "&Password:",170,10 100 50 10
  edit "",171,15 110 100 10,autohs pass

  box "File",200,5 135 120 38
  text "Save userlist in &file:",210,10 145 100 10
  edit "",211,15 155 90 10,autohs
  button "...",212,110 157 10 8

  button "&Ok",400,30 180 30 15,ok
  button "&Cancel",401,70 180 30 15,cancel
}
ON *:DIALOG:getegguf.*:*:*:{
  if ($devent == init) {
    _mdx.init $_icofile(importuf.ico)
    _dummy $_lang.loaddialog($dname,_getegguf,00086969,main.lang,$scriptdir)
  }
  elseif ($devent == sclick) {
    if ($did == 212) { .timer -o 1 0 _getegguf.dfile $dname }
    if ($did == 400) { .timer -o 1 0 _getegguf.init $dname $did(111) $did(121) $did(161) $did(171) $did(211) }
  }
  _getegguf.chd $dname
}
alias _getegguf.dfile {
  var %dir
  if ($nofile($_fixfilename($did($1,211))) != $null) { %dir = $ifmatch }
  if ($isdir(%dir) == $false) { %dir = $getdir }
  if ($dialog($1) == $null) { return }
  var %t = $$dir="Save eggdrop userile in:" %dir
  if ($dialog($1) == $null) { return }
  if (%t != $null) { did -o $1 211 1 $_fixfilename(%t,m) }
  dialog -v $1
  _getegguf.chd $1
}
ON *:SOCKOPEN:getegguf.*:{
  if ($sockerr) { error.a Download eggdrop userfile $remove($sockname,getegguf.) $+ : $_sockerr }
  .timer $+ $sockname -o 1 15 _getegguf.chtimerlogin $sockname
}
ON *:SOCKCLOSE:getegguf.*:{ error.a Download eggdrop userfile, disconnected from bot. }
ON *:SOCKWRITE:getegguf.*:{
  if ($sockerr) { error.a Download eggdrop userfile $remove($sockname,getegguf.) $+ : $_sockerr }
}
ON *:SOCKREAD:getegguf.*:{
  if ($sockerr) {
    error.a Download eggdrop userfile $remove($sockname,getegguf.) $+ : $_sockerr
    return
  }
  var %sr
  sockread %sr
  while ($sockbr) {
    if (%sr != $null) {
      tokenize 32 %sr
      if ($_not($_sockmark(3))) {
        if ($1- == Please enter your nickname.) { _swcrlf $_sockmark(1) }
        elseif (Enter your password* iswm $1-) {
          error.a Download eggdrop userfile, $_sockmark(1) isn't a bot in $sock($sockname).ip
          sockclose $sockname
        }
        elseif (You don't have access.* iswm $1-) {
          error.a Download eggdrop userfile, $_sockmark(1) has no access in $sock($sockname).ip
          sockclose $sockname
        }
        elseif ($1 == passreq) { _swcrlf $_sockmark(2) }
        elseif ($1 == badpass) {
          error.a Download eggdrop userfile, bad password
          sockclose $sockname
        }
        elseif ($1 == version) && ($_isint($2)) {
          _swcrlf $1-
          sockmark $sockname $puttok($puttok($sock($sockname).mark,1,3,9),$2,6,9)
          .timer $+ $sockname -o 1 15 _getegguf.chtimer $sockname
        }
      }
      elseif ($1 == pi) || ($1 == ping)  { _swcrlf $replace($1,i,o) }
      elseif ($1 == el) {  }
      elseif ($1- == s u?) {
        sockmark $sockname $puttok($sock($sockname).mark,1,5,9)
        _swcrlf s uy
      }
      elseif ($1- == userfile?) {
        sockmark $sockname $puttok($sock($sockname).mark,1,5,9)
        _swcrlf uf-yes
      }
      elseif ($1-2 == s un) { _swcrlf ping }
      elseif ($1-2 == s us) {
        _getegguf.dl $sockname $3-
        if ($result) { error.a Download eggdrop userfile: Invalid Send request }
      }
      elseif ($1 == ufsend) {
        _getegguf.dl $sockname $2-
        if ($result) { error.a Download eggdrop userfile: Invalid Send request }
      }
      elseif ($1 == bye) {
        error.a Download eggdrop userfile, disconnected from bot.
        sockclose $sockname
      }
    }
    if ($sockname == $null) { break }
    sockread %sr
  }
}
alias _getegguf.chtimer {
  if ($sock($1)) && ($_not($_sockmark($1,5))) {
    sockwrite $1 bye $+ $crlf
    error.a Download eggdrop userfile, timeout. Probably share-users is off, or $^'($_sockmark($1,1)) doesn't have the botattr '+s' in the bot.
    sockclose $1
    sockclose $replace($1,getegguf,geteggufdl)
  }
}
alias _getegguf.chtimerlogin {
  if ($sock($1)) && ($_not($_sockmark($1,5))) {
    error.a Download eggdrop userfile, unable to log in.
    sockclose $1
    sockclose $replace($1,getegguf,geteggufdl)
  }
}

alias _getegguf.dl {
  var %s = $replace($1,getegguf,geteggufdl)
  sockclose %s
  if ($_ishost($longip($2))) && ($_isint($3)) {
    sockopen %s $longip($2) $3
    sockmark %s $_sockmark($1,4)
    return 0
  }
  return 1
}
ON *:SOCKOPEN:geteggufdl.*:{
  if ($sockerr) {
    error.a Get eggdrop userfile $remove($sockname,geteggufdl.) $+ : $_sockerr
    return
  }
}
ON *:SOCKWRITE:geteggufdl.*:{
  if ($sockerr) { error.a Get eggdrop userfile $remove($sockname,getegguf.) $+ : $_sockerr }
}
ON *:SOCKREAD:geteggufdl.*:{
  if ($sockerr) {
    error.a Get eggdrop userfile $remove($sockname,getegguf.) $+ : $_sockerr
    return
  }
  var %file = $sock($sockname).mark
  .timer $+ $replace($sockname,getegguf,geteggufdl) -o 1 2 _getegguf.dlchtimer $sockname %file
  ;  sockread &bin | bwrite $"(%file) -1 -1 &bin | halt
  var %sr
  sockread %sr
  ;  write $"(%file) %sr | halt
  if (%sr != $null) && (%sr != $chr(4)) {
    %sr = $replace(%sr,$chr(32),$cr)
    bset -t &bin 1 %sr
    breplace &bin 13 32
    bset -t &bin $calc($bvar(&bin,0) + 1) $crlf
    bwrite $"(%file) -1 &bin
  }
}
ON *:SOCKCLOSE:geteggufdl.*:{ _getegguf.dlchtimer $sockname $sock($sockname).mark }
alias _getegguf.dlchtimer {
  var %s = $remove($1,dl)
  sockclose $1
  if ($sock(%s)) {
    sockwrite %s ue $+ $crlf
    sockwrite %s bye $+ $crlf
  }
  sockclose %s
  if ($isfile($2-)) {
    info.a Downloaded eggdrop userfile: $^'($_fixfilename($2-))
    .timer -o 1 0 importuf $2-
  }
  else { error.a Failed eggdrop userfile download }
}
;
alias `eggp.pre {
  unset %`eggp.*
  if ($_telnet.host) && ($_telnet.service == eggdrop) { set -u %`eggp.popup eggdrop }
  elseif (=* iswm $active) && ($chat($right($active,-1)).status == active) { set -u %`eggp.popup eggdrop }
}
alias _eggp.say {
  if (@telnet* iswm $active) { _telnet.sw $1- }
  else { say $1- }
}
menu @telnet,query {
  $`eggp.pre:{  }
  %`eggp.popup
  .you
  ..chat:{ _eggp.say .chat $_param(normal,$null,on|off<CRLF><channel # or name><CRLF><*channel# or name>) }
  ..strip:{ _eggp.say .strip $_param1(normal,$null,[modes]) }
  ..echo:{ _eggp.say .echo $_onoff($null,1,$null,on,echo) }
  ..-
  ..console:{ _eggp.say .console $_param1(normal,$null,[channel] [modes]) }
  ..store:{ _eggp.say .store }
  ..-
  ..info:{ _eggp.say .info $_param(normal,$null,[channel] [info-line]<CRLF>[channel] none) }
  ..nick:{ _eggp.say .nick $_param(normal,$null,<new-nick>) }
  ..newpass:{ _eggp.say .newpass $_param(normal,$null,<password>) }
  ..-
  ..su:{ _eggp.say .su $_param(normal,$null,<user>) }
  ..quit:{ _eggp.say .quit $_param1(normal,$null,[comment]) }
  ..-
  ..email:{ _eggp.say .email $_param1(normal,$null,[email address]<CRLF>none) }
  ..url:{ _eggp.say .url $_param1(normal,$null,[url site address]<CRLF>none) }
  ..bf:{ _eggp.say .bf $_param1(normal,$null,[boyfriend]<CRLF>none) }
  ..gf:{ _eggp.say .gf $_param1(normal,$null,[girlfriend]<CRLF>none) }
  ..irl:{ _eggp.say .irl $_param1(normal,$null,[irl]<CRLF>none) }
  ..dob:{ _eggp.say .dob $_param1(normal,$null,[date of birth]<CRLF>none) }
  .users
  ..+user:{ _eggp.say .+user $_param(normal,$null,<nickname> <hostmask>) }
  ..-user:{ _eggp.say .-user $_param(normal,$null,<nickname>) }
  ..adduser:{ _eggp.say .adduser $_param(normal,$null,<nickname> [handle]) }
  ..deluser:{ _eggp.say .deluser $_param(normal,$null,<nickname>) }
  ..-
  ..+chrec:{ _eggp.say .chrec $_param(normal,$null,<handle> [channel]) }
  ..-chrec:{ _eggp.say .-chrec $_param(normal,$null,<handle> [channel]) }
  ..+host:{ _eggp.say .+host $_param(normal,$null,<nickname> <hostmask>) }
  ..-host:{ _eggp.say .-host $_param(normal,$null,<hostmask><CRLF><nickname> <hostmask>) }
  ..-
  ..boot:{ _eggp.say .boot $_param(normal,$null,<nickname> [reason]<CRLF><nick@bot> [reason]) }
  ..chattr:{ _eggp.say .chattr $_param(normal,$null,<nickname> [attributes] [channel]) }
  ..chnick:{ _eggp.say .chnick $_param(normal,$null,<oldnick> <newnick>) }
  ..chhandle:{ _eggp.say .chhandle $_param(normal,$null,<oldnick> <newnick>) }
  ..chpass:{ _eggp.say .chpass $_param(normal,$null,<handle> [newpassword]) }
  ..comment:{ _eggp.say .comment $_param(normal,$null,<user> <comment...>) }
  ..console:{ _eggp.say .console $_param1(normal,$null,<user> [channel] [modes]) }
  ..info:{ _eggp.say .chinfo $_param(normal,$null,<user> [channel] [info-line]<CRLF><user> [channel] none) }
  ..match:{ _eggp.say .match $_param(normal,$null,<attr> [channel] [[start] limit]<CRLF><wildcard-string> [[start] limit]) }
  ..seen:{ _eggp.say .seen $_param(normal,$null,<handle>) }
  ..strip:{ _eggp.say .strip $_param1(normal,$null,<user> [modes]) }
  ..-
  ..chemail:{ _eggp.say .chemail $_param(normal,$null,<user> [email address]) }
  ..churl:{ _eggp.say .churl $_param(normal,$null,<user> [url address]) }
  ..chbf:{ _eggp.say .chbf $_param(normal,$null,<user> [boyfriend]) }
  ..chgf:{ _eggp.say .chgf $_param(normal,$null,<user> [girlfriend]) }
  ..chirl:{ _eggp.say .chirl $_param(normal,$null,<user> [real life name]) }
  ..chbf:{ _eggp.say .chbf $_param(normal,$null,<user> [boyfriend]) }
  .-
  .bot
  ..binds:{ _eggp.say .binds $_param1(normal,$null,[type]<CRLF>[type] all) }
  ..botinfo:{ _eggp.say .botinfo }
  ..dccstat:{ _eggp.say .dccstat }
  ..module:{ _eggp.say .module $_param1(normal,$null,[modulename]) }
  ..motd:{ _eggp.say .motd }
  ..servers:{ _eggp.say .servers }
  ..status:{ _eggp.say .status $_param1(normal,$null,[all]) }
  ..-
  ..addlog:{ _eggp.say .addlog $_param(normal,$null,<text>) }
  ..debug:{ _eggp.say .debug }
  ..die:{ _eggp.say .die $_param1(normal,$null,[reason]) }
  ..jump:{ _eggp.say .jump $_param1(normal,$null,[server [port]]) }
  ..loadmod:{ _eggp.say .loadmod $_param(normal,$null,<module>) }
  ..rehash:{ _eggp.say .rehash }
  ..rehelp:{ _eggp.say .rehelp }
  ..reload:{ _eggp.say .reload }
  ..restart:{ _eggp.say .restart }
  ..save:{ _eggp.say .save }
  ..unloadmod:{ _eggp.say .unloadmod $_param(normal,$null,<module>) }
  .bots
  ..+bot:{ _eggp.say .+bot $_param(normal,$null,<bot> <address:botport#[/userport#]> [hostmask]) }
  ..-bot:{ _eggp.say .-bot $_param(normal,$null,<bot>) }
  ..botattr:{ _eggp.say .botattr $_param(normal,$null,<nickname> [attributes] [channel]) }
  ..bots:{ _eggp.say .bots }
  ..bottree:{ _eggp.say .bottree }
  ..chaddr:{ _eggp.say .chaddr $_param(normal,$null,<bot> <address:botport#/userport#>) }
  ..flush:{ _eggp.say .flush $_param(normal,$null,<bot>) }
  ..link:{ _eggp.say .link $_param(normal,$null,[some-bot] <new-bot>) }
  ..modules:{ _eggp.say .modules $_param(normal,$null,<botname>) }
  ..trace:{ _eggp.say .trace $_param(normal,$null,<bot>) }
  ..unlink:{ _eggp.say .unlink $_param(normal,$null,<bot><CRLF>*) }
  ..vbottree:{ _eggp.say .vbottree }
  .partyline
  ..assoc:{ _eggp.say .assoc $_param1(normal,$null,[[*]channel #] [name]) }
  ..away:{ _eggp.say .away $_param1(normal,$null,[away-message]) }
  ..back:{ _eggp.say .back }
  ..banner:{ _eggp.say .banner $_param(normal,$null,<text>) }
  ..me:{ _eggp.say .me $_param(normal,$null,<text>) }
  ..relay:{ _eggp.say .relay $_param(normal,$null,<botname>) }
  ..simul:{ _eggp.say .simul $_param(normal,$null,<nickname> <text>) }
  .-
  .bans
  ..+ban:{ _eggp.say .+ban $_param(normal,$null,<hostmask> [channel] [%%bantime <XdXhXm>] [comment]) }
  ..-ban:{ _eggp.say .-ban $_param(normal,$null,<hostmask OR number>) }
  ..-
  ..bans:{ _eggp.say .bans $_param(normal,$null,[[channel] wildcard]<CRLF><all>) }
  ..resetbans:{ _eggp.say .resetbans }
  ..-
  ..stick:{ _eggp.say .stick $_param(normal,$null,<hostmask OR number>) }
  ..unstick:{ _eggp.say .unstick $_param(normal,$null,<hostmask OR number>) }
  .ignores
  ..+ignore:{ _eggp.say .+ignore $_param(normal,$null,<hostmask> [comment]) }
  ..-ignore:{ _eggp.say .-ignore $_param(normal,$null,<hostmask OR number>) }
  ..-
  ..ignores:{ _eggp.say .ignores $_param1(normal,$null,[wildcard]) }
  .channel
  ..channel:{ _eggp.say .channel $_param1(normal,$null,[channel-name]) }
  ..chaninfo:{ _eggp.say .chaninfo $_param1(normal,$null,[channel]) }
  ..chanload:{ _eggp.say .chanload }
  ..chanset:{ _eggp.say .chanset $_param(normal,$null,<channel> <settings>) }
  ..chansave:{ _eggp.say .chansave }
  ..reset:{ _eggp.say .reset $_param(normal,$null,[channel]) }
  .irc/control
  ..op:{ _eggp.say .op $_param(normal,$null,<nickname> [channel]) }
  ..deop:{ _eggp.say .deop $_param(normal,$null,<nickname> [channel]) }
  ..voice:{ _eggp.say .voice $_param(normal,$null,<nickname> [channel]) }
  ..devoice:{ _eggp.say .devoice $_param(normal,$null,<nickname> [channel]) }
  ..-
  ..kick:{ _eggp.say .kick $_param(normal,$null,[channel] <nickname> [reason]) }
  ..kickban:{ _eggp.say .kickban $_param(normal,$null,[channel] <nickname> [comment]) }
  ..-
  ..invite:{ _eggp.say .invite $_param(normal,$null,<nickname> [channel]) }
  ..topic:{ _eggp.say .topic $_param(normal,$null,<text>) }
  ..-
  ..act:{ _eggp.say .act $_param(normal,$null,[channel] <text>) }
  ..say:{ _eggp.say .say $_param(normal,$null,[channel] <text>) }
  ..msg:{ _eggp.say .msg $_param(normal,$null,<nickname> <text>) }
  ..-
  ..dump:{ _eggp.say .dump $_param(normal,$null,<text>) }
  .-
  .files
  ..files:{ _eggp.say .files }
  .notes
  ..note:{ _eggp.say .note $_param(normal,$null,<nickname[@bot]> <message>) }
  ..notes:{ _eggp.say .notes $_param(normal,$null,index<CRLF>read <# or ALL><CRLF>erase <# or ALL>) }
  ..fwd:{ _eggp.say .fwd $_param(normal,$null,<handle> [desto]) }
  .-
  .whom:{ _eggp.say .whom $_param1(normal,$null,[channel]) }
  .who:{ _eggp.say .who $_param1(normal,$null,[bot]) }
  .whois:{ _eggp.say .whois $_param(normal,$null,<nickname>) }
  .-
  .set:{ _eggp.say .set $_param(normal,$null,<variable> [value]) }
  .help:{ _eggp.say .help $_param1(normal,$null,Help on:<CRLF>[blank for general help]) }
}