AutoJoin

By sunslayer on May 02, 2009

copy/paste into remotes (alt+R)

once you copy and paste it reload the file to set the default settings

right click in the channel and click AutoJoin or type /aj to start

the rest is pretty self explanatory :/

Updates:
6-05-09 Added a Chanserv id option

alias aj {
  if (!$1) dialog $iif($dialog(aj.start),-v,-md) aj.start aj.start
  elseif ($1) {
    if ($regex($1,/^-a(dd)?/Si)) {
      echo -a $iif($iif($2,$2,#) !isin $hget(Autojoin,$network),$iif($2,$2,#) has been added to,$iif($2,$2,#) is already in) your AutoJoin List for: $network $+ !
      $iif($iif($2,$2,#) !isin $hget(Autojoin,$network),hadd -m AutoJoin $network $hget(autojoin,$network) $iif($2,$2-,#),noop) 
    }
    elseif ($regex($1,/^-d(el)?/Si)) { echo -a $iif($iif($2,$2,#) isin $hget(autojoin,$network),$iif($2,$2,#) has been deleted from,$iif($2,$2,#) is not in) your AutoJoin list for: $network $+ ! | $iif($iif($2,$2,#) isin $hget(Autojoin,$network),aj.del $iif($2,$2,#),noop) }
    elseif ($regex($1,/^-c(lear)?/Si)) { hdel autojoin $network | echo -a All Channels in AutoJoin have been deleted for: $network }
    elseif ($regex($1,/^-l(ist)?/Si)) echo -a Current Channels in autojoin for $network $+ :04 $hget(autojoin,$network)
    elseif ($regex($1,/^-n(et(work(s)))?/Si)) {
      if ($regex($2,/^-a(dd)?/Si)) {
        if (!$hget(autojoin,$network) && $network !isin $hget(autojoin,networks)) {
          if ($status == connected) { hadd autojoin networks $hget(autojoin,networks) $network | hadd -s autojoin $network $add.chan | add.network }
          elseif ($status != connected) { noop $input(You are not connected to a server!,o,Error) }
        }
        else noop $input(Network already exists!,o,Error)
      }
      elseif ($regex($2,/^-d(el)?/Si)) { hadd autojoin networks $remove($hget(autojoin,networks),$iif($3,$3,$network)) | hdel -ws autojoin $iif($3,$3,$network) $+ * }
      elseif ($regex($2,/^-l(ist)?/Si)) echo -a Current Networks in Autojoin: $hget(autojoin,networks)
      elseif ($hget(autojoin,$network)) noop $input(Network already exists!,o,Error)
    }
    elseif ($regex($1,/^-s(tat(istic(s)))?/Si)) { $iif($2,aj.chanlist #,aj.chanlist) | echo -a Total Channels on Autojoin List for:04 $network $+ 11( $+ $gettok($hget(autojoin,$network),0,32) $+ ) }
  }
}
menu channel,status {
  AutoJoin
  .Autojoin:aj
  .Power
  ..$style($iif($hget(autojoin,power) == on,1,0)) On:hadd autojoin power on
  ..$style($iif($hget(autojoin,power) == off,1,0)) Off:hadd autojoin power off
}
dialog aj.start {
  title "Auto Join"
  size -1 -1 120 50
  option dbu
  box "NetWorks",1,2 2 117 47
  combo 2,15 15 95 50,drop sort hsbar
  button "Add/Del NetWorks",3,34 30 50 13
}
on *:dialog:aj.start:*:*: {
  if ($devent == init)  didtok $dname 2 32 $hget(autojoin,networks)
  elseif ($devent == sclick) {
    if ($did == 2) { hadd autojoin active $did(2).seltext | dialog -x $dname $dname | dialog $iif($dialog(autojoin),-v,-md) autojoin autojoin }
    elseif ($did == 3) { dialog -x $dname | dialog $iif($dialog(aj.networks),-v,-md) aj.networks aj.networks }
  }
}

dialog autojoin {
  title "AutoJoin"
  size -1 -1 214 123
  option dbu
  box "Network", 1, 4 2 210 120
  box "list", 2, 8 9 100 110
  box "Options", 3, 110 9 100 110
  list 4, 11 17 93 99, sort
  text "Channel:", 5, 120 22 30 10
  edit "", 6, 145 22 50 10, autohs
  button "Add", 7, 115 34 25 12
  button "Del", 8, 180 34 25 12
  button "Clear", 16, 148 34 25 12
  box "Power", 9, 115 50 90 20
  button "On", 10, 134 56 25 11
  button "Off", 11, 165 56 25 11
  button "Settings", 12, 123 84 35 12
  button "Back", 13, 123 98 35 12
  button "Connect", 14, 160 84 35 12
  button "Close", 15, 160 98 35 12
  box "Other", 17, 115 75 90 41
}
on *:dialog:autojoin:*:*: {
  if ($devent == init) { didtok $dname 4 32 $hget(autojoin,$hget(autojoin,active)) | did -b $dname 7,8 | did -ra $dname 1 $hget(autojoin,active) | did -ra $dname 2 List  ( $+ $iif($gettok($hget(autojoin,$hget(autojoin,active)),0,32),$v1,0) $+ ) | did -b $dname $iif($hget(autojoin,power) == on,10,11) }
  elseif ($devent == sclick) {
    if ($did == 4) { did -ra $dname 6 $did(4).seltext | did -e $dname 8 }
    elseif ($did == 7) { hadd -m autojoin $hget(autojoin,active) $iif($hget(autojoin,$hget(autojoin,active)),$v1,$null) $did(6) | did -a $dname 4 $did(6) | did -r $dname 6 | did -ra $dname 2 List  ( $+ $gettok($hget(autojoin,$hget(autojoin,active)),0,32) $+ ) }
    elseif ($did == 8) { aj.del $did(6) | did -d $dname 4 $did(4).sel | did -r $dname 6 | did -b $dname 7 | did -ra $dname 2 List  ( $+ $gettok($hget(autojoin,$hget(autojoin,active)),0,32) $+ ) }
    elseif ($did == 10) { hadd autojoin power on | did -b $dname 10 | did -e $dname 11 }
    elseif ($did == 11) { hadd autojoin power off | did -b $dname 11 | did -e $dname 10 }
    elseif ($did == 12) { hadd autojoin edit $hget(autojoin,active) | dialog -x $dname | dialog $iif($dialog(aj.edit),-v,-md) aj.edit aj.edit }
    elseif ($did == 13) { dialog -x $dname | dialog $iif($dialog(aj.start),-v,-md) aj.start aj.start }
    elseif ($did == 14) server $iif($status == disconnect,$chr(32),-m) $hget(autojoin,$hget(autojoin,active) $+ .address) $+ : $+ $hget(autojoin,$hget(autojoin,active) $+ .port)
    elseif ($did == 15) { dialog -x $dname }
    elseif ($did == 16) { $iif($$?="Enter 'Yes' to erase all Channels for This network?" == yes,noop $aj.clear(Chan),noop) }
  }
  elseif ($devent == dclick) {
    if ($did == 4 && $me !ison $did(4).seltext && $mid($did(4).seltext,1,1)) == $chr(35)) join $did(4).seltext
  }
  elseif ($devent == edit) { did -e $dname 7 }
}

dialog aj.networks {
  title "AutoJoin"
  size -1 -1 140 90
  option dbu
  list 1,3 3 133 50,sort vsbar
  edit "",2,35 55 70 10
  button "Add",3,35 68 20 12
  button "Del",4,84 68 20 12
  button "Clear",5,60 68 20 12
  button "Back",6,110 75 20 12
  button "Edit",7,10 75 20 12
}
on *:dialog:aj.networks:*:*: {
  if ($devent == init) { didtok $dname 1 32 $hget(autojoin,networks) | did -b $dname 3,4,7 }
  elseif ($devent == sclick) {
    if ($did == 1) { did -ra $dname 2 $did(1).seltext | did -e $dname 4,7 }
    elseif ($did == 3) { hadd autojoin Networks $hget(autojoin,networks) $did(2) | did -a $dname 1 $did(2) | did -r $dname 2 }
    elseif ($did == 4) { hadd autojoin networks $remove($hget(autojoin,networks),$did(1).seltext) | did -d $dname 1 $did(1).sel | did -r $dname 2 }
    elseif ($did == 5) { $iif($$?="Enter 'Yes' To Erase all Networks and settings" == yes,aj.clear,noop) }
    elseif ($did == 6) { dialog -x $dname | dialog $iif($dialog(aj.start),-v,-md) aj.start aj.start }
    elseif ($did == 7) { hadd autojoin edit $did(1).seltext | hadd autojoin active $did(1).seltext | dialog -x $dname | dialog $iif($dialog(aj.edit),-v,-md) aj.edit aj.edit }
  }
  elseif ($devent == dclick) {
    if ($did == 1) { hadd autojoin active $did(1).seltext | dialog -x $dname | dialog $iif($dialog(autojoin),-v,-md) autojoin autojoin }
  }
  elseif ($devent == edit) did -e $dname 3
}
dialog aj.edit {
  title "AutoJoin"
  size -1 -1 154 86
  option dbu
  tab "NetWork Settings", 1, 1 -2 153 88
  tab "Nick Settings", 14
  tab "Channel Settings", 23
  text "NetWork/Server Name", 2, 5 14 55 10, tab 1
  edit "", 3, 70 14 76 10, tab 1 autohs
  text "Network/Server address", 4, 5 27 59 10, tab 1
  edit "", 5, 71 27 76 10, tab 1 autohs
  button "Done", 6, 5 70 30 12
  button "Back", 7, 117 70 30 12
  text "Port", 8, 5 39 11 8, tab 1
  edit "", 9, 70 39 40 10, tab 1
  button "Network", 10, 47 70 60 12
  text "Auto Connect?", 11, 5 54 35 8, tab 1
  radio "Yes", 12, 70 54 18 10, tab 1 group
  radio "No", 13, 90 54 15 10, tab 1
  text "Nickname", 15, 5 14 25 8, tab 14
  edit "", 16, 70 14 80 10, tab 14 autohs
  text "Password", 17, 4 27 25 8, tab 14
  edit "", 18, 70 27 80 10, tab 14 pass autohs
  text "Auto Identify?", 19, 4 49 36 7, tab 14 center
  radio "Yes", 20, 69 47 18 10, tab 14 group
  radio "no", 21, 91 48 15 10, tab 14
  button "Identify now", 22, 108 47 40 10, tab 14
  text "Channel:", 24, 10 15 21 8, tab 23
  combo 25, 57 15 68 35, tab 23 drop
  text "Password", 26, 10 30 23 8, tab 23
  edit "", 27, 57 30 68 10, tab 23
  text "Auto ID?", 28, 10 43 22 8, tab 23
  radio "Yes", 29, 57 44 20 8, tab 23 group
  radio "No", 30, 81 44 18 8, tab 23
  button "Identify Now", 31, 105 41 39 12, tab 23
  button "Add", 32, 29 56 29 11, tab 23
  button "Del", 33, 96 56 29 11, tab 23
}
on *:dialog:aj.edit:*:*: {
  if ($devent == init) {
    did -ra $dname 1 $hget(autojoin,edit) 
    did -ra $dname 3 $hget(autojoin,$hget(autojoin,edit) $+ .name)
    did -ra $dname 5 $hget(autojoin,$hget(autojoin,edit) $+ .address)
    did -ra $dname 9 $hget(autojoin,$hget(autojoin,edit) $+ .port)
    did -ra $dname 10 $hget(autojoin,edit)
    did -c $dname $iif($hget(autojoin,$hget(autojoin,edit) $+ .autoconnect) == yes,12,13)
    did -c $dname $iif($hget(autojoin,$hget(autojoin,edit) $+ .nick.autoconnect) == yes,20,21)
    $iif($hget(autojoin,nick) $+ .nick.name && $hget(autojoin,nick) $+ .nick.pass,noop,did -b $dname 19)
    did -ra $dname 16 $hget(autojoin,$hget(autojoin,edit) $+ .nick.name)
    did -ra $dname 18 $hget(autojoin,$hget(autojoin,edit) $+ .nick.pass)
    didtok $dname 25 32 $aj.chanlist(return)
    did -c $dname $iif($hget(autojoin,$hget(autojoin,edit) $+ .cp. $+ $did(25)),29,30)
    did -b $dname 32,33
  }
  elseif ($devent == sclick) {
    if ($regex($did,/^(6|7))) { aj.save.settings | dialog -x $dname | dialog $iif($dialog(aj.start),-v,-md) aj.start aj.start }
    elseif ($did == 10) { aj.save.settings | hadd autojoin active $hget(autojoin,edit) | dialog -x $dname | dialog $iif($dialog(autojoin),-v,-md) autojoin autojoin }
    elseif ($did == 12) { hadd autojoin $hget(autojoin,edit) $+ .autoconnect yes | did -u $dname 13 }
    elseif ($did == 13) { hadd autojoin $hget(autojoin,edit) $+ .autoconnect no | did -u $dname 12 }
    elseif ($did == 20) { hadd autojoin $hget(autojoin,edit) $+ .nick.autoconnect yes | did -u $dname 21 }
    elseif ($did == 21) { hadd autojoin $hget(autojoin,edit) $+ .nick.autoconnect no | did -u $dname 20 }
    elseif ($did == 22) { aj.save.settings | aj.id }
    elseif ($did == 25) { 
      did $iif($hget(autojoin,$hget(autojoin,edit) $+ .cp. $+ $did(25)),-ra $dname 27 $v1,-r $dname 27) 
      did -b $dname $iif($hget(autojoin,$hget(autojoin,edit) $+ .cp. $+ $did(25)),32,33)
      did -u $dname 29,30
      did -c $dname $iif($hget(autojoin,$hget(autojoin,edit) $+ .cp. $+ $did(25) $+ .autoid) == yes,29,30)
      did $iif($hget(autojoin,$hget(autojoin,edit) $+ .cp. $+ $did(25)),-e,-b) $dname 33
      did $iif($hget(autojoin,$hget(autojoin,edit) $+ .cp. $+ $did(25)),-e,-b) $dname 32
    }
    elseif ($regex($did,/(29|30))) { hadd autojoin $hget(autojoin,edit) $+ .cp. $+ $did(25) $+ .autoid $iif($regml(1) == 29,yes,no) }
    elseif ($did == 31) { 
      if ($hget(autojoin,$hget(autojoin,edit) $+ .cp. $+ $did(25))) { .msg Chanserv identify $did(25) $v1 } 
    }
    elseif ($did == 32) { hadd autojoin $hget(autojoin,edit) $+ .cp. $+ $did(25) $did(27) }
    elseif ($did == 33) { hdel autojoin $hget(autojoin,edit) $+ .cp. $+ $did(25) | did -r $dname 27 | did -u $dname 29 | did -c $dname 30 | hadd autojoin $hget(autojoin,edit) $+ .cp. $+ $did(25) $+ .autoid no }
  }
  elseif ($devent == edit) {
    if ($did == 27) did -e $dname 32
  }
}

alias -l aj.save.settings {
  hadd autojoin $hget(autojoin,edit) $+ .name $iif($did(3),$did(3),$hget(autojoin,edit))
  hadd autojoin $hget(autojoin,edit) $+ .address $iif($did(5),$did(5),irc. $+ $hget(autojoin,edit) $+ .net)
  hadd autojoin $hget(autojoin,edit) $+ .port $iif($did(9),$did(9),6667)
  hadd autojoin $hget(autojoin,edit) $+ .nick.name $iif($did(16),$v1,$me)
  $iif($did(18),hadd autojoin $hget(autojoin,edit) $+ .nick.pass $did(18),noop)
}
alias -l aj.clear { 
  if ($1 == Network || !$1) { hdel -w autojoin * | did -r $dname 1 | noop $input(All Networks have been erased.,o) }
  elseif ($1 == chan) { hdel autojoin $hget(autojoin,active) | did -r $dname 3,4 | noop $input(All Channels have been erased.,o) | did -ra $dname 2 List (0) }
}
alias -l aj.startup {
  .hmake autojoin 10
  $iif($isfile(autojoin.txt),goto load,goto make)
  :make
  hadd -m autojoin networks SwiftIRC | hadd autojoin SwiftIRC #SunSlayer | hadd autojoin startup yes | hadd autojoin swiftirc.address irc.swiftirc.net | hadd autojoin swiftirc.port 6667 | hadd autojoin swiftirc.name SwiftIRC | hadd autojoin swiftirc.autoconnect yes
  HALT
  :load
  if ($hget(autojoin)) { hload autojoin autojoin.txt | hadd autojoin power on | hadd autojoin start on | aj.connect }
}
alias -l add.chan {
  var %a 1 
  while (%a <= $chan(0)) {
    var %b %b $chan(%a) | inc %a
  }
  return %b
}
alias -l add.network {
  hadd autojoin $network $+ .address $server
  hadd autojoin $network $+ .port $port
  hadd autojoin $network $+ .name $network
}
alias -l aj.chanlist {
  if ($1 == return) { var %a 1 | while (%a <= $gettok($hget(autojoin,$hget(autojoin,edit)),0,32)) { var %b %b $gettok($hget(autojoin,$hget(autojoin,edit)),%a,32) | inc %a } | return %b }
  elseif (!$1) {
    var %a 1
    while (%a <= $gettok($hget(autojoin,$network),0,32)) {
      if ($me ison $gettok($hget(autojoin,$network),%a,32)) { echo -a Statistics for 05( $+ $chan($gettok($hget(autojoin,$network),%a,32)) $+ ) Users: 06( $+ $nick($chan($gettok($hget(autojoin,$network),%a,32)),0,a) $+ ) Ops: 04( $+ $nick($chan($gettok($hget(autojoin,$network),%a,32)),0,o) $+ ) Halfops: 08( $+ $nick($chan($gettok($hget(autojoin,$network),%a,32)),0,h) $+ ) Voices: 02( $+ $nick($chan($gettok($hget(autojoin,$network),%a,32)),0,v) $+ ) Regular: 10( $+ $nick($chan($gettok($hget(autojoin,$network),%a,32)),0,r) $+ ) }
      inc %a
    }
  }
  elseif ($me ison $1) { echo -a Statistics for 05( $+ $1 $+ ) Users: 06( $+ $nick(#,0,a) $+ ) Ops: 04( $+ $nick(#,0,o) $+ ) Halfops: 08( $+ $nick(#,0,h) $+ ) Voices: 02( $+ $nick(#,0,v) $+ ) Regular: 10( $+ $nick(#,0,r) $+ ) }
}
alias -l aj.connect {
  if ($hget(autojoin,power) == on) {
    var %a = 1 , %b = $gettok($hget(autojoin,networks),0,32)
    while (%a <= %b) {
      if ($gettok($hget(autojoin,$gettok($hget(autojoin,networks),%a,32) $+ .autoconnect),1,32) == yes) {
        server $iif(%a = 1,$chr(32),-m) $gettok($hget(autojoin,$gettok($hget(autojoin,networks),%a,32) $+ .address),1,32) $+ : $+ $gettok($hget(autojoin,$gettok($hget(autojoin,networks),%a,32) $+ .port),1,32)
      }
      inc %a
    }
  }
}
alias -l aj.id { 
  if ($dialog(aj.edit) && $did(aj.edit,16) && $did(aj.edit,18)) { $iif($did(aj.edit,16) != $me,nick $did(aj.edit,16),noop) | .msg NickServ identify $did(aj.edit,18) }
  elseif (!$dialog(aj.edit) && $hget(autojoin,$network $+ .nick.name) && $hget(autojoin,$network $+ .nick.pass)) {
    $iif($hget(autojoin,$network $+ .nick.name) != $me,nick $v1,noop)
    .msg nickserv identify $hget(autojoin,$network $+ .nick.pass) 
  } 
}
alias aj.del {
  var %a $hget(autojoin,$hget(autojoin,edit)) | var %b 1 
  while (%b <= $gettok(%a,0,32)) {
    if ($gettok(%a,%b,32) != $1) { var %c %c $gettok(%a,%b,32) }
    inc %b 
  } 
  hadd autojoin $hget(autojoin,active) %c
}
alias aj.chanid {
  if ($hget(autojoin,power) == on) {
    var %a 1
    while (%a <= $gettok($hget(autojoin,$network),0,32)) {
      if ($hget(autojoin,$network $+ .cp. $+ $gettok($hget(autojoin,$network),%a,32) $+ .autoid) == yes) { 
        .msg chanserv identify $gettok($hget(autojoin,$network),%a,32) $hget(autojoin,$hget(autojoin,edit) $+ .cp. $+ $gettok($hget(autojoin,$network),%a,32))
      }
      inc %a
    }
  }
}
on *:connect: { 
  if ($hget(autojoin,power) == on) {
    if ($hget(autojoin,$network $+ .nick.autoconnect) == yes) aj.id
    aj.chanid
    if ($hget(autojoin, $network $+ .autoconnect) == yes) .timer 1 1 join $replace($hget(autojoin,$network),$chr(32),$chr(44)) 
  }
}
on *:start:aj.startup
on *:load:if (!$hget(autojoin)) { aj.startup | aj.connect }
on *:exit: { hadd autojoin startup no | hsave autojoin autojoin.txt }
on *:unload: { hsave autojoin autojoin.txt }

Comments

Sign in to comment.
sunslayer   -  May 19, 2009

added an AutoID option :D

again if u find any bugs plz tell me

 Respond  
sunslayer   -  May 19, 2009

thnx :p

updated a few things

the auto id thing is a nice idea too, not quite sure where to put it tho. might have to redo the layout of the dialog

 Respond  
bigrat2   -  May 19, 2009

Nice!

Only thing I can suggest to change is, give the test fields the "autohs" option.
eg. edit "",6, 145 22 50 10, autohs

This is so you can put more text into them. I had a little trouble fitting some text into one of the text fields. :)

Other than that - awesome! :)

EDIT: Maybe add autoident functionality?

 Respond  
sunslayer   -  May 05, 2009

a few months now L

and im assuming ur Daemon?

 Respond  
chadbdurham   -  May 05, 2009

when the hell did you learn how to script sunslayer (daemon)

 Respond  
PuNkTuReD   -  May 04, 2009

very nice m8, gets a 10 from me now.

 Respond  
sunslayer   -  May 03, 2009

updated, uses hashtables now :D

if u find any bugs tell me i couldnt find any but...

 Respond  
PuNkTuReD   -  May 03, 2009

alt + r in mirc opens your script editor to the remotes section

click File - New

paste the code

 Respond  
Weasel   -  May 03, 2009

Uhm, how do i do remotes?

 Respond  
sunslayer   -  May 03, 2009

thnx :D ill start working on an update using hashes

 Respond  
PuNkTuReD   -  May 03, 2009

in a way, very similar to ini.

hadd -m Database Table Info

$hget(Database,Table,Info)

the -m, makes it so if the database does not exist, it gets created.

the /help file helps, but if ya need any tips, pm me.

 Respond  
sunslayer   -  May 03, 2009

ye i dont relly know anything bout hashes sadly :(

 Respond  
PuNkTuReD   -  May 03, 2009

very neatly coded script here,
gets a 8 from me.

only thing i could be picky about is that hash would be alot better for this type of script.

 Respond  
sunslayer   -  May 03, 2009

updated and thnx punktured :)

 Respond  
PuNkTuReD   -  May 03, 2009

im sure someone will say it soon enough, so i will.

if
elseif
else

very nice script btw

 Respond  
sunslayer   -  May 02, 2009

thanks :p

any suggestions or things to add?

 Respond  
Aucun50   -  May 02, 2009

Looks nice, the scripting is very good to i like the use of $regex and others.

 Respond  
TheNitelyfe   -  May 02, 2009

O NAISE

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.