aIRC — File Browser
aIRCv0.8.69 / aIRCv0.8.69 / script / userlist.mrc
userlist.mrc — 30.3 KB — Download this file
;/**********************************************************************
; *
; * aIRC
; * Userlist
; *
; **********************************************************************/
;;
;
; -( USERLIST )-
;
;;
alias _userlist { _dialog -m userlist _simplelist }
ON *:DIALOG:userlist:init:0:{
_mdx.init $_icofile(userlist.ico)
did -v $dname 1,103,104,105,106
did -h $dname 2,201
did -o $dname 101 1 Add
did -o $dname 102 1 Remove
did -o $dname 103 1 Edit
did -o $dname 104 1 Match
did -o $dname 105 1 Refresh
did -o $dname 106 1 All users
did -o $dname 202 1 Close
_dummy $_lang.loaddialog($dname,_userlist,00086969,main.lang,$scriptdir)
_userlist.match *
}
ON *:DIALOG:userlist:sclick:101:{ _userlist.devent.add }
ON *:DIALOG:userlist:sclick:102:{ _userlist.devent.remove }
ON *:DIALOG:userlist:sclick:103:{
if ($did(userlist,1,$did(userlist,1).sel) != $null) { .timer -o 1 0 user $ifmatch }
}
ON *:DIALOG:userlist:dclick:1:{
if ($did(userlist,1,$did(userlist,1).sel) != $null) { .timer -o 1 0 user $ifmatch }
}
ON *:DIALOG:userlist:sclick:104:{ _userlist.devent.match }
ON *:DIALOG:userlist:sclick:105:{ _userlist.match $did(userlist,221,1) }
ON *:DIALOG:userlist:sclick:201,202:{ _userlistmrcunload }
alias _userlist.match {
if ($dialog(userlist) == $null) { return }
if ($1 == $null) { tokenize 32 * }
var %t = $1-
if ($1- == *) { %t = all users }
did -o userlist 221 1 $1-
set -u %c.partyline.match.handleonly 1
set -u %c.partyline.match.nolog 1
_cmd.match $null $1- 1 $_countusers
dialog -t userlist Userlist - Matching %t ( $+ $line(@__match,0) $+ / $+ $_countusers $+ )
var %i = $line(@__match,0)
did -r userlist 1
while (%i) {
did -a userlist 1 $line(@__match,%i)
dec %i
}
close -@ @__match @__matchr
dialog -v userlist
}
alias _userlist.devent.match {
if ($dialog(userlist) == $null) { return }
tokenize 32 $_parameter($null,0,Match users:,normal,$did(userlist,221,1),<attr> [channel]<CRLF><wildcard-string><CRLF>Blank for all)
tokenize 32 $1 $iif($2 !isnum,$2)
if ($2 == $null) { tokenize 32 $1 }
_userlist.match $1-
dialog -v userlist
}
alias _userlist.devent.add {
if ($dialog(userlist) == $null) { return }
tokenize 32 $_parameter($null,1,Add user,1,$null,Add user:)
if ($dialog(userlist) == $null) { return }
+user $1
_userlist.match $did(userlist,221,1)
dialog -v userlist
if ($_isuser($1)) { user $1 }
}
alias _userlist.devent.remove {
var %handle,%delete,%sel,%n,%question
if ($dialog(userlist) == $null) { return }
%n = $did(userlist,1,0).sel
if (%n == 0) { return }
if (%n > 1) { %question = Remove %n selected users? }
else {
%handle = $did(userlist,1,$did(userlist,1,1).sel)
%question = Remove user %handle ?
}
%delete = $_yesno(1,Remove users,0,%question)
if ($dialog(userlist) == $null) || ($_not(%delete)) { return }
%sel = $did(userlist,1).sel
while (%n) {
if ($did(userlist,1,$did(userlist,1,%n).sel) != $null) { -user $ifmatch }
dec %n
}
_userlist.match $did(userlist,221,1)
did -c userlist 1 %sel
if ($did(userlist,1).sel == $null) { did -c userlist 1 $did(userlist,1).lines }
dialog -v userlist
}
;;
;
; -( USER )-
;
;;
alias _user {
%c.user.handle = $1
_dialog -m _user _user
unset %c.user.handle
}
dialog _user {
size -1 -1 290 205
option dbu
title "User"
tab "Flags",10,5 5 280 170
tab "Info",11
; TAB 10 - Flags
list 30,10 30 80 130,tab 10
button "Add",31,10 160 35 15,tab 10
button "Remove",32,55 160 35 15, tab 10
check "[a] &Autoop",33,100 30 60 10,tab 10
check "[d] &Deop",34,100 40 60 10,tab 10
check "[f] &Friend",35,100 50 60 10,tab 10
check "[&g] Autovoice",56,100 60 50 10,tab 10
check "[k] Auto&kick",36,100 70 60 10,tab 10
check "[m] &Master",37,100 80 60 10,tab 10
check "[n] Ow&ner",38,100 90 60 10,tab 10
check "[o] &Op",39,100 100 60 10,tab 10
check "[q] &Quiet",40,100 110 60 10,tab 10
; check "[s] &Shitlisted",41,100 120 60 10,tab 10
check "[v] &Voice",42,100 120 60 10,tab 10
check "[w] &Wasop test",57,100 130 60 10,tab 10
check "[B] Bot access",54,100 140 50 10,tab 10
edit "",55,150 140 50 10,tab 10
; adfgkmnoqsvw
check "[b] &Bot",43,200 30 60 10,tab 10
check "[c] &Common",44,200 40 60 10,tab 10
check "[h] &Highlight",45,200 50 60 10,tab 10
check "[j] &Janitor",46,200 60 60 10,tab 10
check "[p] &Partyline",47,200 70 60 10,tab 10
check "[t] Bo&tnet master",48,200 80 60 10,tab 10
check "[u] &Unshared",49,200 90 60 10,tab 10
check "[x] &Xfer",50,200 100 60 10,tab 10
; bchjptux
check "[C] DCC Chat",51,200 110 60 10,tab 10
check "[S] DCC Send",52,200 120 60 10,tab 10
check "[N] NO DCCs",53,200 130 60 10,tab 10
text "Infoline:",68,100 160 25 10,tab 10
edit "",69,120 158 150 12,autohs tab 10
; TAB 11 - Info
box "Hosts",73,10 30 90 140,tab 11
list 70,15 40 80 110,tab 11
button "New",71,15 150 35 15,tab 11
button "Remove",72,60 150 35 15, tab 11
text "Password:",80,108 37 35 10,tab 11 right
edit "",81,145 35 120 10,tab 11 pass autohs
text "Comment:",82,108 49 35 10,tab 11 right
edit "",83,145 47 120 10,tab 11 autohs
text "Email:",84,108 61 35 10,tab 11 right
edit "",85,145 59 120 10,tab 11 autohs
text "URL:",86,108 73 35 10,tab 11 right
edit "",87,145 71 120 10,tab 11 autohs
text "Boyfriend:",88,108 85 35 10,tab 11 right
edit "",89,145 83 120 10,tab 11 autohs
text "Girlfriend:",90,108 97 35 10,tab 11 right
edit "",91,145 95 120 10,tab 11 autohs
text "Real life name:",92,108 109 35 10,tab 11 right
edit "",93,145 107 120 10,tab 11 autohs
text "Date of birth:",94,108 121 35 10,tab 11 right
edit "",95,145 119 120 10,tab 11 autohs
text "Bot Profile:",96,108 133 35 10,tab 11 right
combo 97,145 131 120 100,tab 11 drop
text "Bot Password:",98,108 147 35 10,tab 11 right
edit "",99,145 145 120 10,tab 11 pass autohs
text "User:",1,6 187 20 7
edit "",2,25 185 60 12 autohs
button "OK",241,200 185 36 17,ok
button "Cancel",242,250 185 36 17,cancel
edit "",498,999 999 1 1,hide autohs
list 499,999 999 1 1,hide
edit "",500,999 999 1 1,hide autohs
}
ON *:DIALOG:_user:init:0:{
_mdx.init $_icofile(userlist.ico)
_dummy $_lang.loaddialog($dname,$dname,00086969,main.lang,$scriptdir)
_duser.init
}
ON *:DIALOG:_user:edit:55,69:{ did -co $dname 499 $did(499).sel $gettok($did(499,$did(499).sel),1-2,32) $iif($gettok($did(55),1,32) != $null,$gettok($did(55),1,32),$null) $did(69) }
ON *:DIALOG:_user:sclick:30:{ _duser.refreshflags }
ON *:DIALOG:_user:sclick:31:{ .timer -o 1 0 _duser.newchannel }
ON *:DIALOG:_user:sclick:32:{
tokenize 32 $did($dname,30,1).sel
if ($1 != 1) {
did -d $dname 30,499 $1
if ($did(30,$1) != $null) { did -c $dname 30,499 $1 }
else { did -c $dname 30,499 $calc($1 - 1) }
}
_duser.refreshflags
}
; ON *:DIALOG:_user:sclick:60:{
; did -o $dname 499 $did($dname,30,1).sel $did($dname,30,$did($dname,30,1).sel)
; _duser.refreshflags
; }
ON *:DIALOG:_user:sclick:71:{ .timer -o 1 0 _duser.newhost }
ON *:DIALOG:_user:sclick:72:{
tokenize 32 $did($dname,70,1).sel
did -d $dname 70 $1
if ($did(70,$1) != $null) { did -c $dname 70 $1 }
else { did -c $dname 70 $calc($1 - 1) }
}
ON *:DIALOG:_user:sclick:241:{
.timer -o 1 0 _duser.save 1
halt
}
ON *:DIALOG:_user:sclick:241:{
_userlistmrcunload
halt
}
ON *:DIALOG:_user:sclick:*:{
if ($did >= 33) && ($did <= 57) { _duser.saveflagsbuf }
}
alias _duser.init {
var %handle = %c.user.handle,%profile
unset %c.user.handle
did -o $dname 500 1 0
if ($_isuser(%handle)) {
did -mo _user 2 1 %handle
did -o $dname 500 1 1
}
elseif (%handle != $null) { did -o _user 2 1 %handle }
_duser.loadflags %handle
_duser.loadhosts %handle
did -o $dname 81 1 $_userpass(%handle)
did -o $dname 83 1 $_getuserfield(%handle,comment)
did -o $dname 85 1 $_getuserfieldp(%handle,email)
did -o $dname 87 1 $_getuserfieldp(%handle,url)
did -o $dname 89 1 $_getuserfieldp(%handle,bf)
did -o $dname 91 1 $_getuserfieldp(%handle,gf)
did -o $dname 93 1 $_getuserfieldp(%handle,irl)
did -o $dname 95 1 $_getuserfieldp(%handle,dob)
did -o $dname 99 1 $_decrypt($_getuserfield(%handle,botpass))
.timer -o 1 0 did -f $dname 2
_duser.init.loadbotprofiles $_getuserfield(%handle,botprofile)
}
alias _duser.init.loadbotprofiles {
var %file = $_botprofilesfile,%d = _user,%win = @__loadbotprofiles,%l
did -r %d 97
_botprofiles2win
while ($line(%win,0)) {
if ($line(%win,1) == $1-) { did -ac %d 97 $line(%win,1) }
else { did -a %d 97 $line(%win,1) }
dline %win 1
}
close -@ %win
if ($did(%d,97).sel == $null) && ($did(%d,97).lines) { did -ac %d 97 none }
else { did -a %d 97 none }
}
alias _duser.loadflags {
if ($dialog(_user) == $null) { return }
did -r _user 30,499
did -a _user 30 ----Global----
did -a _user 499 ----Global---- $iif($_ruini($1,global) != $null,$_ruini($1,global),$null) $iif($_getuserfield($1,botaccess) != $null,$_getuserfield($1,botaccess),$null) $_getuserfield($1,infoline.default)
if ($_isuser($1)) {
var %i = 1,%c = $_ruini($1,channels),%t = $numtok(%c,32)
while (%i <= %t) {
did -a _user 30 $gettok(%c,%i,32)
did -a _user 499 $gettok(%c,%i,32) $iif($_ruini($1,$gettok(%c,%i,32)) != $null,$_ruini($1,$gettok(%c,%i,32)),$null) $iif($_getuserfield($1,$_nospaces(botaccess.,$gettok(%c,%i,32))),$_getuserfield($1,$_nospaces(botaccess.,$gettok(%c,%i,32))),$null) $_getuserfield($1,$_nospaces(infoline.,$gettok(%c,%i,32)))
inc %i
}
}
did -c _user 30,499 1
_duser.refreshflags
}
alias _duser.loadhosts {
if ($dialog(_user) == $null) || ($_not($_isuser($1))) { return }
var %i = 1,%h = $_ruini($1,hosts),%t = $numtok(%h,32)
while (%i <= %t) {
did -a _user 70 $gettok(%h,%i,32)
inc %i
}
}
alias _duser.newhost {
var %i = 1,%t,%x,%r
while ($did(_user,70,%i) != $null) {
%t = $addtok(%t,$ifmatch,44)
inc %i
}
if ($did(_user,2)) {
%x = Add host to user $did(_user,2) .<CRLF>[nick!*@* to add a nick]
if ($_address($did(_user,2),%_maskuser) != $null) && ($istok(%t,$_address($did(_user,2),%_maskuser),44) == $false) { %r = $_address($did(_user,2),%_maskuser) }
}
else { %x = Add host to user.<CRLF>[nick!*@* to add a nick] }
tokenize 32 $_parameter($null,1,Users [/user],ismask,%r,%x) $iif(%t,%t,$null) $iif(%r,%r,$null)
if ($dialog(_user)) && ($istok($2,$1,44) == $false) { did -ac _user 70 $1 }
}
alias _duser.newchannel {
var %i = 1,%t,%base = $gettok($did(_user,499,$did(_user,499,1).sel),2,32)
while ($did(_user,30,%i) != $null) {
if ($ifmatch != ----Global----) { %t = $addtok(%t,$ifmatch,44) }
inc %i
}
var %i = 1,%r
while ($chan(%i) != $null) {
if ($istok(%t,$ifmatch,44) == $false) { %r = $addtok(%r,$chan(%i),44) }
inc %i
}
tokenize 32 $_parameter($null,1,Users [/user],ischan,$gettok(%r,1,44),Channel:) $iif(%t,%t,$null) $iif(%r,%r,$null)
if ($_ischan($1)) && ($dialog(_user)) && ($istok($2,$1,44) == $false) {
did -ac _user 30 $1
did -ac _user 499 $1 %base
_duser.refreshflags
}
}
alias _duser.refreshbotflags {
var %d = _user,%globalflags = $gettok($did(%d,499,1),2,32)
if (%globalflags != $null) && (b isincs %globalflags) {
did -e %d 54,96,97,98,99
did $iif($did(%d,54).state,-e,-b) %d 55
}
else {
did -bu %d 54
did -b %d 55,96,97,98,99
}
}
alias _duser.refreshflags {
if ($dialog(_user) == $null) { return }
var %l = $did(_user,30,1).sel
var %c = $did(_user,30,%l),%f = $gettok($did(_user,499,%l),2,32),%botaccess = $gettok($did(_user,499,%l),3,32),%infoline = $gettok($did(_user,499,%l),4-,32)
if (%f == $null) { %f = 0 }
_duser.checkflag %f a 33
_duser.checkflag %f d 34
_duser.checkflag %f f 35
_duser.checkflag %f k 36
_duser.checkflag %f m 37
_duser.checkflag %f n 38
_duser.checkflag %f o 39
_duser.checkflag %f q 40
; _duser.checkflag %f s 41
_duser.checkflag %f v 42
_duser.checkflag %f b 43
_duser.checkflag %f c 44
_duser.checkflag %f h 45
_duser.checkflag %f j 46
_duser.checkflag %f p 47
_duser.checkflag %f t 48
_duser.checkflag %f u 49
_duser.checkflag %f x 50
_duser.checkflag %f C 51
_duser.checkflag %f S 52
_duser.checkflag %f N 53
_duser.checkflag %f B 54
_duser.checkflag %f g 56
_duser.checkflag %f w 57
_duser.refreshbotflags
did $iif(%l == 1,-e,-bu) _user 43,44,45,46,47,48,49,50,51,52,53
did $iif($did(_user,30,1).sel == 1,-b,-e) _user 32
did -o _user 55 1 %botaccess
did -o _user 69 1 %infoline
did -c _user 499 %l
did $iif($did(_user,54).state,-e,-b) _user 55
}
alias _duser.checkflag {
if ($2 isincs $1) { did -c _user $3 }
else { did -u _user $3 }
}
alias _duser.saveflagsbuf {
if ($dialog(_user) == $null) { return }
if ($devent == sclick) && ($did >= 33) && ($did <= 54) { %c.duser.e = $did }
var %botstate = $did(43).state
_duser.sflag a 33
_duser.sflag d 34
_duser.sflag f 35
_duser.sflag k 36
_duser.sflag m 37
_duser.sflag n 38
_duser.sflag o 39
_duser.sflag q 40
; _duser.sflag s 41
_duser.sflag v 42
_duser.sflag b 43
_duser.sflag c 44
_duser.sflag h 45
_duser.sflag j 46
_duser.sflag p 47
_duser.sflag t 48
_duser.sflag u 49
_duser.sflag x 50
_duser.sflag C 51
_duser.sflag S 52
_duser.sflag N 53
_duser.sflag B 54
_duser.sflag g 56
_duser.sflag w 57
%c.duser.sfb = $_fixflags(%c.duser.sfb,%c.duser.r,$iif($did(_user,30,1).sel > 1,1,0))
if ($did(_user,30,1).sel == 1) && (%botstate == 0) { %c.duser.sfb = $removecs(%c.duser.sfb,b,B) }
did -o _user 499 $did(_user,30,1).sel $did(_user,30,$did(_user,30,1).sel) $iif(%c.duser.sfb != $null,%c.duser.sfb,$null) $iif($gettok($did(_user,55),1,32) != $null,$gettok($did(_user,55),1,32),$null) $did(_user,69)
unset %c.duser.*
_duser.refreshflags
}
alias _duser.sflag {
if ($did(_user,$2).state) { %c.duser.sfb = %c.duser.sfb $+ $1 }
if (%c.duser.e == $2) {
if ($did($dname,$did).state == 0) { %c.duser.r = - $+ $1 }
else { %c.duser.r = + $+ $1 }
}
}
alias _duser.save {
if ($dialog(_user) == $null) || ($did(_user,2) == $null) { return }
var %h = $did(_user,2),%c,%i,%f,%t,%n,%dchans,%chattr,%infoline,%oldhosts,%newhosts,%pass,%botaccess,%botpass
if ($_isuser(%h)) && ($_not($did(_user,500,1))) && ($_yesno(1,$null,0,There is already a user [ %h ] <CRLF>Overwrite old settings?)) { -user %h }
if ($_not($_isuser(%h))) { +user %h }
%i = $did(_user,30).lines
while (%i) {
if ($did(_user,30,%i) != ----Global----) { %dchans = $addtok(%dchans,$ifmatch,32) }
dec %i
}
var %c = $_ruini(%h,channels),%i = $numtok(%c,32)
while (%i) {
if ($_not($istok(%dchans,$gettok(%c,%i,32),32))) { -chrec %h $gettok(%c,%i,32) }
dec %i
}
if ($_reqchangemodes($_ruini(%h,global),$gettok($did(_user,499,1),2,32)) != $null) { %chattr = $ifmatch }
%botaccess = $gettok($did(_user,499,1),3,32)
%infoline = $gettok($did(_user,499,1),4-,32)
if (%botaccess isnum) {
if ($ifmatch != $_getuserfield(%h,botaccess)) && (%botaccess > 0) { .timer -o 1 0 botaccess %h $round(%botaccess,0) }
}
elseif ($_reqchangemodes($_getuserfield(%h,botaccess),%botaccess) != $null) { .timer -o 1 0 botaccess %h $ifmatch }
if (%infoline !== $_getuserfield(%h,infoline.default)) {
if (%infoline != $null) { chinfo %h $ifmatch }
else { chinfo %h none }
}
%i = $did(_user,30).lines
while (%i > 1) {
%c = $gettok($did(_user,499,%i),1,32)
%f = $gettok($did(_user,499,%i),2,32)
%botaccess = $gettok($did(_user,499,%i),3,32)
%infoline = $gettok($did(_user,499,%i),4-,32)
if ($_reqchangemodes($_ruini(%h,%c),$gettok($did(_user,499,%i),2,32)) != $null) {
%t = $ifmatch %c
%chattr = $addtok(%chattr,%t,124)
}
if (%botaccess isnum) {
if ($ifmatch != $_getuserfield(%h,$_nospaces(botaccess.,%c))) && (%botaccess > 0) { .timer -o 1 0 botaccess %h $round(%botaccess,0) %c }
}
elseif ($_reqchangemodes($_getuserfield(%h,$_nospaces(botaccess.,%c)),%botaccess) != $null) { .timer -o 1 0 botaccess %h $ifmatch %c }
if (%infoline !== $_getuserfield(%h,$_nospaces(infoline.,%c))) {
if (%infoline != $null) { chinfo %h %c $ifmatch }
else { chinfo %h %c none }
}
dec %i
}
if (%chattr != $null) { chattr %h %chattr }
%oldhosts = $_ruini(%h,hosts)
%i = $did(_user,70).lines
while (%i) {
%newhosts = $addtok(%newhosts,$did(_user,70,%i),32)
dec %i
}
%i = $numtok(%oldhosts,32)
while (%i) {
if ($istok(%newhosts,$gettok(%oldhosts,%i,32),32) == $false) { -host %h $gettok(%oldhosts,%i,32) }
dec %i
}
%i = $numtok(%newhosts,32)
while (%i) {
if ($istok(%oldhosts,$gettok(%newhosts,%i,32),32) == $false) { +host %h $gettok(%newhosts,%i,32) }
dec %i
}
%pass = $gettok($did(_user,81),1,32)
if (%pass !== $_userpass(%h)) {
if (%pass != $null) { chpass %h $ifmatch }
else { chpass %h }
}
if ($did(_user,83) !== $_getuserfield(%h,comment)) {
if ($did(_user,83) != $null) { comment %h $ifmatch }
else { comment %h }
}
%i = 1
while ($gettok(email url bf gf irl dob,%i,32) != $null) {
%t = $ifmatch
%n = $calc(83 + (%i * 2))
if ($did(_user,%n) !== $_getuserfieldp(%h,%t)) {
if ($did(_user,%n) != $null) { ch $+ %t %h $ifmatch }
else { ch $+ %t %h none }
}
inc %i
}
if (b isincs $_nickflags(%h)) {
if ($did(_user,97,$did(_user,97).sel) == none) && ($_getuserfield(%h,botprofile) == $null) { }
elseif ($did(_user,97,$did(_user,97).sel) !== $_getuserfield(%h,botprofile)) {
if ($ifmatch != $null) { botprofile %h $ifmatch }
else { botprofile %h none }
}
%botpass = $gettok($did(_user,99),1,32)
if (%botpass !== $_decrypt($_getuserfield(%h,botpass))) {
if (%botpass != $null) { chbotpass %h $ifmatch }
else { chbotpass %h }
}
}
else {
_setuserfield %h botprofile
_setuserfield %h botpass
}
if ($1) {
dialog -x _user
_userlistmrcunload
}
flushini " $+ $_userinifile $+ "
}
;;
;
; -( IMPORT USERLIST )-
;
;;
;
;;
;
; /importuf [-a|-n|-r|-u] <file to import>
; method:
; -a - If user exists, add info
; -n - Add new users only
; -r - If user exists, replace it
; -u - Replace all userlist
;
alias _importuf {
var %d = importuf,%i = 1,%n,%m,%f = _,%header,%file,%ftmp = $_tmpfile(ini)
if ($dialog(%d)) {
dialog -v %d
return
}
if ($istok(-a -n -r -u,$1,32)) {
%m = $1
tokenize 32 $2-
}
if ($1- == $null) { tokenize 32 $$dir="Import (eggdrop/aIRC/ircN) userfile from:" $mircdir }
tokenize 32 $_fixfilename($1-)
if ($_not($isfile($1-))) {
error.a File not found: $^'($1-)
return
}
%header = $read -nl1 $1-
if (#?v: * iswm %header) {
if ($mid(%header,2,1) isin 1234) {
if (#4v: * iswm %header) { %file = $_importuf.egg4($1-) }
elseif (#3v: * iswm %header) { %file = $_importuf.egg3($1-) }
else {
error.a This is an eggdrop userfile (# $+ $mid(%header,2,1) $+ v) . I can't import this userfile.
return
}
if ($isfile(%file)) { tokenize 32 %file }
else {
error.a Eggdrop userfile is empty/invalid
return
}
}
elseif ($mid(%header,2,1) === A) {
.copy -o " $+ $1- $+ " " $+ %ftmp $+ "
tokenize 32 %ftmp
}
else {
error.a Invalid userfile: $^'($1-)
return
}
}
elseif ($ini($1-,users)) && ($findfile($nofile($1-),ircn.*,0,1)) {
%header = No header (ircN 7.xx userfile)
%file = $_importuf.ircn7xx($1-)
if ($isfile(%file)) { tokenize 32 %file }
else {
error.a ircN userfile is empty/invalid
return
}
}
else {
error.a Invalid userfile: $^'($1-)
return
}
%n = $ini($1-,0)
if (%m) {
close -@ @__importufdoku
window -h @__importufdoku
while (%i <= %n) {
aline @__importufdoku $_readini($1-,$ini($1-,%i),handle)
inc %i
}
if (%m == -a) { %f = %f $+ a }
if (%m == -r) { %f = %f $+ r }
if (%m == -u) { %f = %f $+ ur }
_importuf.dok %f $1-
}
else {
_dialog -m %d %d
did -o %d 1 1 $1-
did -o %d 11 1 %header
did -c %d 23
did -f %d 400
did -r %d 31
while (%i <= %n) {
did -ack %d 31 $_readini($1-,$ini($1-,%i),handle)
inc %i
}
}
}
dialog importuf {
title "Import Userfile"
size -1 -1 130 198
option dbu
edit "",1,1000 1000 100 100,read hide autohs autovs multihs return
box "Userfile header",10,5 5 120 35
text "",11,10 15 110 30
box "Import Method",20,5 45 120 55
radio "Add &new users only",21,10 55 110 10
radio "If user exists, &add info",22,10 65 110 10
radio "If user exists, &replace it",23,10 75 110 10
radio "Replace all &userlist",24,10 85 110 10
box "Users to import:",30,5 105 120 70
list 31,10 115 110 60,extsel sort
button "&Import",400,30 180 30 15,ok
button "&Cancel",401,70 180 30 15,cancel
}
ON *:DIALOG:importuf:init:0:{
_mdx.init $_icofile(importuf.ico)
_dummy $_lang.loaddialog($dname,_importuf,00086969,main.lang,$scriptdir)
did -h $dname 1
}
ON *:DIALOG:importuf:sclick:400:{
close -@ @__importufdoku
window -h @__importufdoku
var %i = 1,%f = _
while (%i <= $did($dname,31,0).sel) {
aline @__importufdoku $did($dname,31,$did($dname,31,%i).sel)
inc %i
}
if ($did(22).state) { %f = %f $+ a }
if ($did(23).state) { %f = %f $+ r }
if ($did(24).state) { %f = %f $+ ur }
.timer -o 1 0 _importuf.dok %f $did($dname,1,1)
_userlistmrcunload
halt
}
ON *:DIALOG:importuf:sclick:401:{
_remove $did($dname,1,1)
_userlistmrcunload
}
alias _importuf.dok {
var %win = @__importufdok,%wu = @__importufdoku,%i = 1,%n = $line(%wu,0),%f1 = $2-,%f2 = $_userinifile,%handle,%loadflags = $1,%last
if ($window(%wu == $null)) { return }
if ($sock(partyline*.*,0)) {
if ($_yesno(0,Import Userfile [/importuf],1,To import a userfile, you must close all partyline sessions. Proceed?)) { sockclose partyline*.* }
else {
close -@ %wu
return
}
}
_progress.init Importing Userfile...
_progress2 0 $calc(%n + 1)
if (u isincs %loadflags) || ($_not($isfile(%f2))) { write -c " $+ %f2 $+ " }
close -@ %win
window -h %win
while (%i <= %n) {
clear %win
%handle = $line(%wu,%i)
_progress2 %i $calc(%n + 1)
loadbuf -t $+ %handle %win " $+ %f1 $+ "
if (r isincs %loadflags) || ($_not($_isuser(%handle))) {
if ($_isuser(%handle)) { remini " $+ %f2 $+ " %handle }
writeini " $+ %f2 $+ " %handle !!dummy!! !!dummy!!
flushini " $+ %f2 $+ "
savebuf -a %win " $+ %f2 $+ "
remini " $+ %f2 $+ " %handle !!dummy!!
flushini " $+ %f2 $+ "
}
elseif (a isincs %loadflags) && ($_isuser(%handle)) {
var %h,%c,%r
while ($line(%win,0)) {
%h = $gettok($line(%win,1),1,61)
%c = $gettok($line(%win,1),2,61)
%r = $readini -n " $+ %f2 $+ " %handle %h
if (%h == hosts) || (%h == channels) {
var %x = 1
while ($gettok(%c,%x,32) != $null) {
if ($_not($istok(%r,$ifmatch,32))) { %r = $addtok(%r,$gettok(%c,%x,32),32) }
inc %x
}
if (%r != $null) { writeini " $+ %f2 $+ " %handle %h %r }
}
elseif (%r == $null) && (%c != $null) { writeini " $+ %f2 $+ " %handle %h %c }
dline %win 1
}
}
inc %i
}
_progress 99 Reloading userfile...
flushini " $+ %f2 $+ "
_userinifile.setheader $_userinifile
_start.users
close -@ %win %wu
if ($dialog(importuf)) {
dialog -x importuf
_userlistmrcunload
}
_progress 100 Done!
_remove %f1
}
;/*
; * tagged lines in the user file:
; * * OLD:
; * # (comment)
; * ; (comment)
; * - hostmask(s)
; * + email
; * * dcc directory
; * = comment
; * : info line
; * . xtra (Tcl)
; * ! channel-specific
; * !! global laston
; * :: channel-specific bans
; * NEW:
; * *ban global bans
; * *ignore global ignores
; * ::#chan channel bans
; * - entries in each
; * <handle> begin user entry
; * --KEY INFO - info on each
; * NEWER:
; * % exemptmask(s)
; * @ Invitemask(s)
; * *exempt global exempts
; * *Invite global Invites
; * && channel-specific exempts
; * &&#chan channel exempts
; * $$ channel-specific Invites
; * $$#chan channel Invites
; */
alias _importuf.egg3 {
var %win = @__importuf.eggl,%file = $_tmpfile(ini),%i = 1,%n,%users = 1,%line,%h,%handle,%chan,%wini = _dummy,%2-,%globalflags,%botflags,%channels
_openwins %win
loadbuf %win " $+ $1- $+ "
%n = $line(%win,0)
write -c $"(%file) $chr(35) $+ $1-
write $"(%file) $line(%win,1)
_progress.init Loading eggdrop userfile...
_progress2 1 %n
while (%i <= %n) {
%line = $line(%win,%i)
if (3 // %i) { _progress2 %i %n }
%h = $gettok(%line,1,32)
%2- = $gettok(%line,2-,32)
if (#* !iswm %line) && ($len(%line)) {
if ($left(%h,1) == *) || (::* iswm %h) { break }
elseif (%h == !) {
%chan = $gettok(%line,2,32))
%channels = $addtok(%channels,%chan,32)
%wini channels %channels
%wini %chan $_sanitycheck($gettok(%line,4,32),%chan)
if ($gettok(%line,3,32)) { %wini __laston. $+ %chan $ifmatch }
%wini __infoline. $+ %chan $gettok(%line,5-,32)
}
elseif (%h == :) {
if (b isincs %globalflags) { %wini botaddr %2- }
else { %wini __infoline.default %2- }
}
elseif (%h == =) { %wini __comment %2- }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; DCCDIR
elseif (%h == *) { }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
elseif (%h == -) { %wini hosts $remove(%2-,$chr(44)) }
elseif (%h == !!) { %wini __laston %2- }
elseif (%h == +) { %wini ++EMAIL %2- }
elseif (%h == .) {
if ($left(%2-,1) == $chr(123)) { %2- = $right(%2-,-1) }
if ($right(%2-,1) == $chr(125)) { %2- = $left(%2-,-1) }
%wini ++ $+ $gettok(%2-,1,32) $gettok(%2-,2-,32)
}
else {
%handle = %h
%wini = _importuf.egg.wtmpini $shortfn(%file) %handle
%wini handle %handle
%globalflags = $gettok(%line,3,32)
var %botflags
if (s isincs %globalflags) { %botflags = %botflags $+ $ifmatch }
if (h isincs %globalflags) { %botflags = %botflags $+ $ifmatch }
if (a isincs %globalflags) { %botflags = %botflags $+ $ifmatch }
if (l isincs %globalflags) { %botflags = %botflags $+ $ifmatch }
if (r isincs %globalflags) { %botflags = %botflags $+ $ifmatch }
%globalflags = $removecs(%globalflags,s,h,a,l,r)
%wini global $_sanitycheck(%globalflags)
%wini botfl %botflags
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; pass = $gettok(%line,2,32)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
}
}
inc %i
}
_progress2 %n %n
close -@ %win
return %file
}
alias _importuf.egg4 {
var %win = @__importuf.eggl,%file = $_tmpfile(ini),%i = 1,%n,%users = 1,%line,%h,%hosts,%handle,%chan,%wini = _dummy,%2-,%channels
_openwins %win
loadbuf %win " $+ $1- $+ "
%n = $line(%win,0)
write -c $"(%file) $chr(35) $+ $1-
write $"(%file) $line(%win,1)
_progress.init Loading eggdrop userfile...
_progress2 1 %n
while (%i <= %n) {
%line = $line(%win,%i)
if (3 // %i) { _progress2 %i %n }
%h = $gettok(%line,1,32)
%2- = $gettok(%line,2-,32)
if (#* !iswm %line) && ($len(%line)) {
if ($left(%h,1) == *) || (::* iswm %h) || (%h == -) || (&* iswm %h) || (@* iswm %h) || ($left(%h,1) == $chr(36)) { }
elseif (%h == !) {
%chan = $gettok(%line,2,32))
%channels = $addtok(%channels,%chan,32)
%wini channels %channels
%wini %chan $_sanitycheck($gettok(%line,4,32),%chan)
%wini __laston. $+ %chan $gettok(%line,3,32)
%wini __infoline. $+ %chan $gettok(%line,5-,32)
}
elseif (%h == --BOTADDR) { %wini botaddr %2- }
elseif (%h == --BOTFL) { %wini botfl %2- }
elseif (%h == --COMMENT) { %wini __comment %2- }
elseif (%h == --CONSOLE) {
%wini console-chan $gettok(%line,2,32)
if ($gettok(%line,3,32) != -) { %wini console-flags $ifmatch }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; DCCDIR
elseif (%h == --DCCDIR) { }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
elseif (%h == --HOSTS) {
%hosts = %hosts %2-
%wini hosts %hosts
}
elseif (%h == --INFO) { %wini __infoline.default %2- }
elseif (%h == --LASTON) { %wini __laston %2- }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; PASS
elseif (%h == --PASS) { }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
elseif (%h == --XTRA) { %wini ++ $+ %2- }
else {
%handle = %h
%wini = _importuf.egg.wtmpini $shortfn(%file) %handle
%wini handle %handle
%wini global $_sanitycheck($gettok(%line,3,32))
var %hosts
}
}
inc %i
}
_progress2 %n %n
close -@ %win
return %file
}
alias _importuf.egg.wtmpini {
if ($1 != $null) && ($2 != $null) && ($3 != $null) && ($4- != $null) { writeini $1- }
}
alias _importuf.ircn7xx {
var %file = $_tmpfile(ini),%i = 1,%n,%users = 1,%line,%h,%hosts,%handle,%chan,%wini = _dummy,%2-,%channels
%n = $ini($1-,0)
write -c $"(%file)
_progress.init Loading ircN 7.xx userfile...
_progress2 1 %n
while (%i <= %n) {
_progress2 %i %n
if ($ini($1-,%i) != users) {
%handle = $ifmatch
%wini = _importuf.egg.wtmpini $shortfn(%file) %handle
%wini handle %handle
%wini hosts $_readini($1-,%handle,hostmask)
%wini global $_sanitycheck($_readini($1-,%handle,flags))
%wini __infoline.default $_readini($1-,%handle,infoline)
%channels = $replace($_readini($1-,%handle,channels),$chr(44),$chr(32))
%wini channels %channels
while (%channels != $null) {
%chan = $gettok(%channels,1,32)
%channels = $deltok(%channels,1,32)
%wini %chan $_sanitycheck($_readini($1-,%handle,%chan),%chan)
%wini __infoline. $+ %chan $_readini($1-,%handle,$_nospaces(infoline.,%chan))
}
}
inc %i
}
_progress2 %n %n
return %file
}
;;;
;;;
alias -l _userlistmrcunload { _quickunload userlist,_user,importuf $script }