menu channel,menubar,status {
.IRCManager { dialog $iif($dialog(ircmanager),-ev,-md) ircmanager ircmanager }
.-
}
dialog -l ircmanager {
title "Loading..."
size -1 -1 500 380
option pixels
text "" 1, 20 20 300 20
button "" 3, 340 40 80 20
button "" 4, 340 60 80 20
button "" 5, 340 80 80 20
button "/\" 6, 20 40 20 20
button "\/" 7, 20 70 20 20
text "" 17, 20 100 500 20
text "Server settings:" 10, 20 120 120 20
text "Server:" 11, 20 140 80 20
text "Port:" 12, 20 160 80 20
text "Channels:" 13, 20 180 80 20
text "Personal settings:" 14, 20 220 120 20
text "Nickname:" 15, 20 240 80 20
text "Password:" 16, 20 260 80 20
box "" 20, 100 140 200 20
box "" 21, 100 160 200 20
box "" 22, 100 180 200 20
box "" 23, 100 240 200 20
box "" 24, 100 260 200 20, pass
edit "" 30, 100 140 200 20
edit "" 31, 100 160 200 20, limit 5
edit "" 32, 100 180 200 20, autohs
edit "" 33, 100 240 200 20
edit "" 34, 100 260 200 20, pass
text "" 50, 310 140 200 20
text "" 51, 310 160 200 20
text "" 52, 310 180 200 20
text "" 53, 310 240 200 20
text "" 54, 310 260 200 20
check "Enable IRCManager" 40, 20 300 200 20
check "Start IRCManager on connect" 41, 20 320 200 20
button "Ok" 100, 20 340 80 20, ok
text "" 101, 110 342 350 20
}
on *:dialog:ircmanager:*:*: {
if ($devent == init) {
echo -a 3Loading IRCManager..
set %ircmanager.version 1.33
dialog -t ircmanager IRCManager %ircmanager.version [By Superior (c) 2007-2008]
set %ircmanager.status server.list
if (%ircmanager.setting.access == $NULL) {
set %ircmanager.setting.access on
}
elseif (%ircmanager.setting.access == on) {
did -ec ircmanager 40
}
elseif (%ircmanager.setting.access == off) {
did -eu ircmanager 40
}
if (%ircmanager.setting.startup == $NULL) {
set %ircmanager.setting.startup on
$iif(%ircmanager.setting.access == on,did -ec ircmanager 41,did -bc ircmanager 41)
}
elseif (%ircmanager.setting.startup == on) {
$iif(%ircmanager.setting.access == on,did -ec ircmanager 41,did -bc ircmanager 41)
}
elseif (%ircmanager.setting.startup == off) {
$iif(%ircmanager.setting.access == on,did -eu ircmanager 41,did -bu ircmanager 41)
}
did -ar ircmanager 1 IRCManager: Your Servers!
var %i 1
while ($gettok(%ircmanager.serverlist,%i,124) != $NULL) {
did -a ircmanager 2 $gettok(%ircmanager.serverlist,%i,124)
inc %i
}
did -ar ircmanager 3 Add Server
did -ar ircmanager 4 Edit Server
did -ar ircmanager 5 Del Server
did -h ircmanager 30-34
did -ar ircmanager 101 IRCManager %ircmanager.version copyright by Superior
}
if ($devent == sclick) {
if ($did == 2) {
did -ar ircmanager 20 %ircmanager.server. $+ $did(2).seltext
did -ar ircmanager 21 %ircmanager.port. [ $+ [ $did(2).seltext ] ]
did -ar ircmanager 22 %ircmanager.chan. [ $+ [ $did(2).seltext ] ]
did -ar ircmanager 23 %ircmanager.nickname. [ $+ [ $did(2).seltext ] ]
did -ar ircmanager 24 $str(*,$len(%ircmanager.nickpass. [ $+ [ $did(2).seltext ] ]))
}
if ($did == 3) {
;ADD Server
if (%ircmanager.status == server.list) {
set %ircmanager.status server.add
did -ar ircmanager 1 IRCManager: Add a server!
did -b ircmanager 2
did -ar ircmanager 3 Add Server
did -ar ircmanager 4 Reset
did -ar ircmanager 5 Cancel
did -h ircmanager 20-24
did -rv ircmanager 30-34
did -var ircmanager 51 Use a '+' infront of SSL ports!
did -var ircmanager 52 Use a ',' between the channels!
did -var ircmanager 54 Do not enter on public PC!
did -ar ircmanager 17 Click 'Add Server' to add the server to the list after you entered the details!
}
elseif (%ircmanager.status == server.add) {
if ($did(30).text == $NULL) {
did -ar ircmanager 101 Please add a server!
did -ar ircmanager 17 Please add a server!
}
else {
set %ircmanager.status server.list
set %ircmanager.serverlist %ircmanager.serverlist $+ $did(30).text $+ |
set %ircmanager.port. [ $+ [ $did(30).text ] ] $did(31).text
set %ircmanager.chan. [ $+ [ $did(30).text ] ] $did(32).text
set %ircmanager.nickname. [ $+ [ $did(30).text ] ] $did(33).text
set %ircmanager.nickpass. [ $+ [ $did(30).text ] ] $did(34).text
did -ae ircmanager 2 $did(30).text
did -are ircmanager 3 Add Server
did -are ircmanager 4 Edit Server
did -are ircmanager 5 Del Server
did -ar ircmanager 17
did -v ircmanager 20-24
did -h ircmanager 30-34
did -h ircmanager 50-54
}
}
elseif (%ircmanager.status == server.edit) {
set %ircmanager.status server.list
set %ircmanager.port. [ $+ [ $did(20).text ] ] $did(31).text
set %ircmanager.chan. [ $+ [ $did(20).text ] ] $did(32).text
set %ircmanager.nickname. [ $+ [ $did(20).text ] ] $did(33).text
set %ircmanager.nickpass. [ $+ [ $did(20).text ] ] $did(34).text
did -e ircmanager 2
did -are ircmanager 3 Add Server
did -are ircmanager 4 Edit Server
did -are ircmanager 5 Del Server
did -ar ircmanager 17
did -v ircmanager 20
did -arv ircmanager 21 %ircmanager.port. [ $+ [ $did(30).text ] ]
did -arv ircmanager 22 %ircmanager.chan. [ $+ [ $did(30).text ] ]
did -arv ircmanager 23 %ircmanager.nickname. [ $+ [ $did(30).text ] ]
did -arv ircmanager 24 $str(*,$len(%ircmanager.nickpass. [ $+ [ $did(2).seltext ] ]))
did -h ircmanager 30-34
}
elseif (%ircmanager.status == server.del) {
set %ircmanager.status server.list
set %ircmanager.server.temp $did(2).seltext
unset %ircmanager.*. $+ $did(2).seltext
did -ar ircmanager 1 IRCManager: Your Servers!
did -er ircmanager 2
var %i 1
while (%i <= $numtok(%ircmanager.serverlist,124)) {
if (%ircmanager.server.temp != $gettok(%ircmanager.serverlist,%i,124)) {
set %ircmanager.serverlist.temp %ircmanager.serverlist.temp $+ $gettok(%ircmanager.serverlist,%i,124) $+ |
did -a ircmanager 2 $gettok(%ircmanager.serverlist,%i,124)
}
inc %i
}
set %ircmanager.serverlist %ircmanager.serverlist.temp
unset %ircmanager.serverlist.temp
unset %ircmanager.server.temp
did -are ircmanager 3 Add Server
did -are ircmanager 4 Edit Server
did -are ircmanager 5 Del Server
did -ar ircmanager 17
did -av ircmanager 20-24
did -h ircmanager 30-34
}
}
if ($did == 4) {
;Edit Server
if (%ircmanager.status == server.list) {
if ($did(2).seltext == $NULL) {
did -ar ircmanager 101 Select a server!
did -ar ircmanager 17 Please add a server!
}
if ($did(2).seltext != $NULL) {
set %ircmanager.status server.edit
did -ar ircmanager 1 IRCManager: Edit a server!
did -b ircmanager 2
did -ar ircmanager 3 Edit Server
did -ar ircmanager 4 Reset
did -ar ircmanager 5 Cancel
did -ar ircmanager 17 Click 'Edit Server' to save the new server settings!
did -h ircmanager 20-24
did -arbv ircmanager 30 $did(2).seltext
did -arv ircmanager 31 %ircmanager.port. [ $+ [ $did(2).seltext ] ]
did -arv ircmanager 32 %ircmanager.chan. [ $+ [ $did(2).seltext ] ]
did -arv ircmanager 33 %ircmanager.nickname. [ $+ [ $did(2).seltext ] ]
did -arv ircmanager 34 %ircmanager.nickpass. [ $+ [ $did(2).seltext ] ]
}
}
elseif (%ircmanager.status == server.add) {
did -ar ircmanager 30-34
}
elseif (%ircmanager.status == server.edit) {
did -ar ircmanager 31 %ircmanager.port. [ $+ [ $did(2).seltext ] ]
did -ar ircmanager 32 %ircmanager.chan. [ $+ [ $did(2).seltext ] ]
did -ar ircmanager 33 %ircmanager.nickname. [ $+ [ $did(2).seltext ] ]
did -ar ircmanager 34 %ircmanager.nickpass. [ $+ [ $did(2).seltext ] ]
}
}
if ($did == 5) {
;DEL Server
if (%ircmanager.status == server.list) {
if ($did(2).seltext == $NULL) {
did -ar ircmanager 101 Select a server!
did -ar ircmanager 17 Please add a server!
}
if ($did(2).seltext != $NULL) {
set %ircmanager.status server.del
did -ar ircmanager 1 IRCManager: Delete a server!
did -b ircmanager 2
did -ar ircmanager 3 Del Server
did -arb ircmanager 4 Edit Server
did -ar ircmanager 5 Cancel
did -ar ircmanager 17 Click 'Del Server' to delete the selected server!
}
}
else {
set %ircmanager.status server.list
did -ar ircmanager 1 IRCManager: Your Servers!
did -e ircmanager 2
did -are ircmanager 3 Add Server
did -are ircmanager 4 Edit Server
did -are ircmanager 5 Del Server
did -ar ircmanager 17
did -v ircmanager 20-24
did -h ircmanager 30-34
did -h ircmanager 50-54
}
}
if ($did == 6) {
;Server UP
if ($did(2).seltext == $NULL) {
did -ar ircmanager 101 Select a server!
did -ar ircmanager 17 Please add a server!
}
else {
if ($findtok(%ircmanager.serverlist,$did(2).seltext,1,124) > 1) {
set %ircmanager.serverlist.temp $gettok(%ircmanager.serverlist,$calc($findtok(%ircmanager.serverlist,$did(2).seltext,1,124)-1),124)
set %ircmanager.serverlist $reptok(%ircmanager.serverlist,$gettok(%ircmanager.serverlist,$calc($findtok(%ircmanager.serverlist,$did(2).seltext,1,124)-1),124),$did(2).seltext,1,124)
set %ircmanager.serverlist $reptok(%ircmanager.serverlist,$did(2).seltext,%ircmanager.serverlist.temp,2,124) $+ |
did -o ircmanager 2 $calc($did(2).sel - 1) $did(2).seltext
did -o ircmanager 2 $did(2).sel %ircmanager.serverlist.temp
unset %ircmanager.serverlist.temp
}
}
}
if ($did == 7) {
;Server DOWN
if ($did(2).seltext == $NULL) {
did -ar ircmanager 101 Select a server!
did -ar ircmanager 17 Please add a server!
}
else {
if ($findtok(%ircmanager.serverlist,$did(2).seltext,1,124) < $numtok(%ircmanager.serverlist,124)) {
set %ircmanager.serverlist.temp $gettok(%ircmanager.serverlist,$calc($findtok(%ircmanager.serverlist,$did(2).seltext,1,124)+1),124)
set %ircmanager.serverlist $reptok(%ircmanager.serverlist,$gettok(%ircmanager.serverlist,$calc($findtok(%ircmanager.serverlist,$did(2).seltext,1,124)+1),124),$did(2).seltext,1,124)
set %ircmanager.serverlist $reptok(%ircmanager.serverlist,$did(2).seltext,%ircmanager.serverlist.temp,1,124) $+ |
did -o ircmanager 2 $calc($did(2).sel + 1) $did(2).seltext
did -o ircmanager 2 $did(2).sel %ircmanager.serverlist.temp
unset %ircmanager.serverlist.temp
}
}
}
if ($did == 40) {
if ($did(40).state == 1) {
set %ircmanager.setting.access on
did -e ircmanager 41
}
if ($did(40).state == 0) {
set %ircmanager.setting.access off
did -b ircmanager 41
}
}
if ($did == 41) {
if ($did(40).state == 1) {
set %ircmanager.setting.startup on
}
if ($did(40).state == 0) {
set %ircmanager.setting.startup off
}
}
if ($did == 100) {
if (%ircmanager.status != server.list) {
did -ar ircmanager 17 Please return to main menu first!
did -ar ircmanager 101 Are you sure you want to close without saving? Return to main menu!
/halt
}
}
if ($did(101).text != $NULL) {
.timerIRCMMessage 1 04 { did -ar ircmanager 101 }
}
}
if ($devent == close) {
if ($timer(0) != 0) {
.timerIRCM* off
}
}
}
on *:start: {
if ((%ircmanager.setting.access == on) && (%ircmanager.setting.startup == on)) {
echo -a 3Loading IRCManager settings...
set %ircmanager.connections $numtok(%ircmanager.serverlist,124)
var %x 1
while (%x <= $numtok(%ircmanager.serverlist,124)) {
echo -s 4----
echo -s 4Connecting to $gettok(%ircmanager.serverlist,%x,124) at port %ircmanager.port. [ $+ [ $gettok(%ircmanager.serverlist,%x,124) ] ]
echo -s 4You are now known as %ircmanager.nickname. [ $+ [ $gettok(%ircmanager.serverlist,%x,124) ] ]
echo -s 4Configuration compleet! Have a nice day and enjoy chatting!
echo -s 4IRCManager %ircmanager.version by Superior
echo -s 4----
inc %x
}
var %i 1
if (%x == 0) {
echo -s 4----
echo -s 4No servers added to IRCManager
echo -s 4IRCManager %ircmanager.version by Superior
echo -s 4----
}
var %i 1
while (%i < %x) {
if (%i == 1) {
.timer $+ %i 1 3 /server $gettok(%ircmanager.serverlist,%i,124) + $+ %ircmanager.port. [ $+ [ $gettok(%ircmanager.serverlist,%i,124) ] ]
}
elseif (%i != 1) {
.timer $+ %i 1 $calc(%i * 3) /server -m $gettok(%ircmanager.serverlist,%i,124) + $+ %ircmanager.port. [ $+ [ $gettok(%ircmanager.serverlist,%i,124) ] ]
}
inc %i
}
}
}
on *:connect: {
if (%ircmanager.setting.access == on) {
var %i 1
while (%i <= $numtok(%ircmanager.serverlist, 124)) {
if ($gettok($server,$calc($numtok($server, 46) - 1) -,46) == $gettok($gettok(%ircmanager.serverlist,%i,124),2-,46)) {
nick %ircmanager.nickname. [ $+ [ $gettok(%ircmanager.serverlist,%i,124) ] ]
if (%ircmanager.nickpass. [ $+ [ $gettok(%ircmanager.serverlist,%i,124) ] ] != $NULL) {
identify %ircmanager.nickpass. [ $+ [ $gettok(%ircmanager.serverlist,%i,124) ] ]
}
var %x 1
while (%x <= $numtok(%ircmanager.chan. [ $+ [ $gettok(%ircmanager.serverlist,%i,124) ] ],44)) {
join $gettok(%ircmanager.chan. [ $+ [ $gettok(%ircmanager.serverlist,%i,124) ] ],%x,44)
inc %x
}
dec %ircmanager.connections
}
inc %i
}
}
}
on *:NOTICE:*nickname is registered*:*: {
if ((%ircmanager.setting.access == on) && ($nick == NickServ) && (%ircmanager.connections == 0)) {
var %i 1
while (%i <= $numtok(%ircmanager.serverlist, 124)) {
if (($gettok($gettok(%ircmanager.serverlist,%i,124),2-,46) == $gettok($server,$calc($numtok($server, 46) - 1) -,46)) && ($me == %ircmanager.nickname. [ $+ [ $server ] ])) {
msg nickserv identify %ircmanager.nickpass. [ $+ [ $server ] ]
echo -s 4----
echo -s 4IRCManager has identified you at $server ( $+ $gettok(%ircmanager.serverlist,%i,124) $+ ) $+ ! [Identification requested by $nick $+ ]
echo -s 4----
}
inc %i
}
}
}