|
Joined: Jul 2006
Posts: 248
Fjord artisan
|
OP
Fjord artisan
Joined: Jul 2006
Posts: 248 |
hello this script adds ops mask/ip/domain in the protect list in every channel I join I want these entries to work only when I am in this channel, so how do I make those entries expire when I close mirc? or any other way? on me:^&*:join:#: {
.timer 1 3 checkregs #
}
alias checkregs {
if (!$1) { return }
var %loop = 1, %regs = $nick($1,0,a,r)
while (%loop <= %regs) {
protect $nick($1,%loop,a,r) 2
inc %loop
}
} thanks !
|
|
|
|
Joined: Jan 2006
Posts: 111
Vogon poet
|
Vogon poet
Joined: Jan 2006
Posts: 111 |
Try this: ON *:DISCONNECT: { protect -r }
|
|
|
|
Joined: Jul 2006
Posts: 248
Fjord artisan
|
OP
Fjord artisan
Joined: Jul 2006
Posts: 248 |
there are more protect entries than the ones added with the above script and there are more added during mirc session
I want to remove the specific entries, not all
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
Not a beauty, this code... A hash table instead of the variables and a smarter remove routine would prettify it a lot  I tested only a bit, hope it's all working. menu channel {
Temp Protection
.$iif(($group(#autoprotection) == on),$style(1)) switch $qt(auto add/-remove) $iif(($group(#autoprotection) == on),off,on): $iif(($group(#autoprotection) == on),.disable,.enable) #autoprotection
.-
.temp-protect the nonreg users of $qt($active) now : add.protect $network $active
.clear temp-protects of $qt($active) : rem.protect $network $active
.clear temp-protects of $qt($network) : rem.protect $network net
.clear all temp-protects : rem.protect
}
; group of events (menu switch)
#autoprotection on
; add temp protections if joining a chan
on me:*:join:#: { add.protect $network $chan }
; remove temp protections on kick/part/quit/disconnect/exit
on *:kick:#: { if ($knick == $me) rem.protect $network $chan }
on me:*:part:#: { rem.protect $network $chan }
on me:*:quit: { rem.protect $network net }
on *:disconnect: { rem.protect $network net }
on *:exit: { rem.protect }
#autoprotection end
; alias: add the nonreg users of a chan to temp protection
alias add.protect {
if ($me ison $2) {
; ial for that chan is up to date:
if ($chan($2).ial) {
var %nr = 1
; loop all "regular" users
while ($nick($2,%nr,a,r)) {
!protect $v1 $2 2 $1
; set a variable for this protect entry/switch
set $+(%,tempprotect+,$1,+,$2,+,$address($v1,2))
inc %nr
}
}
; ial is not up to date: update ial, and try again
else {
.who $2
.timer 1 10 add.protect $network $2
}
}
}
; alias: remove the protection of users added before
alias rem.protect {
; loop all variables
var %nr = 1
; remove all temp entries of a chan
if ($2 != net) {
var %net = $1, %chan = $2
while $var($+(%,tempprotect+,%net,+,%chan,+*),%nr) {
tokenize 43 $v1
!protect -r $4 $3 $2
inc %nr
}
; unset the variables for that chan
unset $+(%,tempprotect+, [ %net ] ,+, [ %chan ] ,+*)
}
; remove all temp entries of a network
elseif ($2 == net) {
var %net = $1
while $var($+(%,tempprotect+,%net,+*),%nr) {
tokenize 43 $v1
!protect -r $4 $3 $2
inc %nr
}
; unset the variables for that net
unset $+(%,tempprotect+, [ %net ] ,+*)
}
; remove all temp entries
else {
while ($var(%tempprotect+*),%nr) {
tokenize 43 $v1
!protect -r $4 $3 $2
inc %nr
}
; unset all variables
unset %tempprotect+*
}
} 2 Notes: 1) The individual protect commands are not silenced yet (for you to check how it works). You can disable this output with ease: change the four occurrences of "!protect" to ".protect". 2) Atm, this will not add/remove protection on op/deop and the like, nor will it remove the protection entries of parting/quitting users.
Last edited by Horstl; 28/08/07 11:26 PM.
|
|
|
|
Joined: Jul 2006
Posts: 248
Fjord artisan
|
OP
Fjord artisan
Joined: Jul 2006
Posts: 248 |
thanks! 2) Atm, this will not add/remove protection on op/deop and the like, nor will it remove the protection entries of parting/quitting users.
but that would be essential.. you mean it wont add to protect a person that gets op after I join the channel? and it wont remove the protect when an op quits or leaves the channel? I wish it could do these...
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
but that would be essential.. I did not know exactly in what circumstances you wanted to protect  This code will add protection on +o/+h/+v, and remove that protection on part/quit of that user - if the "auto" switch was turned on in menu. In addition, now you can add/remove temp protection for single users via menu. ; ---------- menu ----------
menu channel,nicklist {
$iif((!$protect),$style(2)) Temp Protection $iif((!$protect),[disabled])
; toggle auto add/remove
.$iif(($group(#autoprotection) == on),$style(1)) switch $qt(auto add/-remove) $iif(($group(#autoprotection) == on),OFF,ON) : {
$iif(($group(#autoprotection) == on),.disable,.enable) #autoprotection
}
.-
; add/remove single users
.$iif(($check.protect($$1,$active,$network)),$style(1) REMOVE,ADD) protection for user $qt($$1) on $qt($active) : {
$iif(($check.protect($$1,$active,$network)),rem.single.protect,add.single.protect) $network $active $$1
}
.-
; add/remove all nonreg users of a chan
.ADD temp-protecs for nonreg users of $qt($active) : add.protect $network $active
.REMOVE temp-protects of $qt($active) : rem.protect $network $active
.-
; remove all network entries
.CLEAR temp-protects of network $qt($network) : rem.protect $network net
; remove all entries
.CLEAR ALL temp-protects : rem.protect
}
; ---------- events ----------
; group (switch): automated protection events
#autoprotection off
; add temp protections if you're joining a chan
on me:*:join:#: { add.protect $network $chan }
; add temp protection if v/h/o is granted
on *:op:#: { add.single.protect $network $chan $opnick }
on *:help:#: { add.single.protect $network $chan $hnick }
on *:voice:#: { add.single.protect $network $chan $vnick }
; remove temp protections on kick/part/quit/disconnect/exit (you)
on *:kick:#: { if ($knick == $me) rem.protect $network $chan }
on me:*:part:#: { rem.protect $network $chan }
on me:*:quit: { rem.protect $network net }
on *:disconnect: { rem.protect $network net }
on *:exit: { rem.protect }
;remove temp protections on part/quit (protected users)
on !*:part:#: { rem.single.protect $network $chan $nick }
on !*:quit: { rem.single.protect $network * $nick }
#autoprotection end
; ---------- aliases ----------
; return whether or not a user is protected on that chan and network
; note: checking protections, not vars for tempprotections!
alias -l check.protect {
var %nr = 1, %address = $address($1,2)
while ($protect(%nr)) {
if (($v1 == %address) && ($istok($protect(%nr).type,$2,44)) && ($protect(%nr).network == $3)) { return %nr }
inc %nr
}
}
; add a temp protection
alias -l add.single.protect {
!protect $3 $2 2 $1
set $+(%,tempprotect+,$1,+,$2,+,$address($3,2))
}
; add all nonreg users of a chan to temp protection
alias -l add.protect {
if ($me ison $2) {
; ial for that chan is up to date:
if ($chan($2).ial) {
var %nr = 1
; loop all "regular" users
while ($nick($2,%nr,a,r)) {
!protect $v1 $2 2 $1
; set a variable for this protect entry/switch
set $+(%,tempprotect+,$1,+,$2,+,$address($v1,2))
inc %nr
}
}
; ial is not up to date: update ial, and try again
else {
.who $2
.timer 1 10 add.protect $network $2
}
}
}
; remove a temp protection
alias -l rem.single.protect {
if ($var($+(%,tempprotect+,$1,+,$2,+,$address($3,2)),1)) {
tokenize 43 $v1
!protect -r $4 $3 $2
unset $v1
}
else { echo -c info $2 The protection for $3 on $2 $+([,$1,]) was not added temporarily - remove it manually. }
}
; remove protections of users added before
alias -l rem.protect {
; loop all variables
var %nr = 1
; remove all temp protections of a chan
if ($2 != net) {
var %net = $1, %chan = $2
while ($var($+(%,tempprotect+,%net,+,%chan,+*),%nr)) {
tokenize 43 $v1
!protect -r $4 $3 $2
inc %nr
}
; unset the variables for that chan
unset $+(%,tempprotect+, [ %net ] ,+, [ %chan ] ,+*)
}
; remove all temp protections of a network
elseif ($2 == net) {
var %net = $1
while ($var($+(%,tempprotect+,%net,+*),%nr)) {
tokenize 43 $v1
!protect -r $4 $3 $2
inc %nr
}
; unset the variables for that net
unset $+(%,tempprotect+, [ %net ] ,+*)
}
; remove all temp protections
else {
while ($var(%tempprotect+*),%nr) {
tokenize 43 $v1
!protect -r $4 $3 $2
inc %nr
}
; unset all variables
unset %tempprotect+*
}
}
; ---------- end ----------
|
|
|
|
Joined: Jul 2006
Posts: 248
Fjord artisan
|
OP
Fjord artisan
Joined: Jul 2006
Posts: 248 |
mm thanks
sorry, I dont want to remove the protect of an op when he leaves or quits
I want to remove them when I leave or quit
and I want to protect people that get +o/+h/+v and to remove them when I quit or leave
thanks
can you tell me please how the full script should be
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
If you don't want to un-protect the (host of) users who had been op/hop/voice if they part/quit, remove these lines: ;remove temp protections on part/quit (protected users)
on !*:part:#: { rem.single.protect $network $chan $nick }
on !*:quit: { rem.single.protect $network * $nick } ...keep the rest 
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
Fjord artisan
Joined: Feb 2006
Posts: 307 |
thanks
but, excuse me, do I just paste all the above code in my remote and I am done? its very big code!
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
Paste the "last" big code block to a new remote file, and remove the three lines mentioned later (these lines would remove temp protect of parting/quitting users). Then save this file, and you should be done. You can enable/disable the whole "auto temp protect" via popup menu (right-click in a channel window). There you'll see other options too - I added them as I thought they might be useful. The code is that big as some "loop routines" are required; I also added a couple of comments to the code; and I use comments like "; ---- aliases ----" to sort scripts optically if they reach a certrain length - this might have confused you. If you encounter other problems with this temp protect script, feel free to ask 
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
Fjord artisan
Joined: Feb 2006
Posts: 307 |
mm thanks but I wouldnt like a menu to add (on me join and on user op) and remove (on me leave or quit) protects of nonregs in channels, since I want to do it automaticaly, would that save some space?
something else, when I 'enable' it I get many of these in my status:
* The protection for XXX on * [DALNet] was not added temporarily - remove it manually.
but nothing is added! and ofcourse these are not ops when I join or get op when I am in the channel
last, I hope the protects are added at the bottom of the list...
thanks
Last edited by nataliad; 01/09/07 08:29 AM.
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
something else, when I 'enable' it I get many of these in my status: * The protection for XXX on * [DALNet] was not added temporarily - remove it manually. but nothing is added! and ofcourse these are not ops when I join or get op when I am in the channel
The only possible reason for this can be a mis-pasted code: this echo is produced by a single alias - which can only be called "once", via menu popups. However, if you really don't need a menu switch (imho it's always a good idea to have a switch vor automated things  ), use the code below. With the menu, it's functions, and all comments removed, you'll save a total of 2.6kb hard disc space. on me:*:join:#: { add.protect $network $chan }
on *:op:#: { add.single.protect $network $chan $opnick }
on *:help:#: { add.single.protect $network $chan $hnick }
on *:voice:#: { add.single.protect $network $chan $vnick }
on *:kick:#: { if ($knick == $me) rem.protect $network $chan }
on me:*:part:#: { rem.protect $network $chan }
on me:*:quit: { rem.protect $network net }
on *:disconnect: { rem.protect $network net }
on *:exit: { rem.protect }
alias -l add.single.protect {
!protect $3 $2 2 $1
set $+(%,tempprotect+,$1,+,$2,+,$address($3,2))
}
alias -l add.protect {
if ($me ison $2) {
if ($chan($2).ial) {
var %nr = 1
while ($nick($2,%nr,a,r)) {
!protect $v1 $2 2 $1
set $+(%,tempprotect+,$1,+,$2,+,$address($v1,2))
inc %nr
}
}
else {
.who $2
.timer 1 10 add.protect $network $2
}
}
}
alias -l rem.protect {
var %nr = 1
if (!$2) {
while ($var(%tempprotect+*,%nr)) {
echo -s tokenize 43 $v1
echo -s !protect -r $4 $3 $2
inc %nr
}
unset %tempprotect+*
}
elseif ($2 == net) {
var %net = $1
while ($var($+(%,tempprotect+,%net,+*),%nr)) {
tokenize 43 $v1
!protect -r $4 $3 $2
inc %nr
}
unset $+(%,tempprotect+, [ %net ] ,+*)
}
else {
var %net = $1, %chan = $2
while ($var($+(%,tempprotect+,%net,+,%chan,+*),%nr)) {
tokenize 43 $v1
!protect -r $4 $3 $2
inc %nr
}
unset $+(%,tempprotect+, [ %net ] ,+, [ %chan ] ,+*)
}
} last, I hope the protects are added at the bottom of the list... mIRC sorts the list automatically (think e.g. of adding/changing/removing only parameters of a protection). You cannot assign a list position manually.
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
I did an error in the code above: use the "big" code block and remove the three lines as mentioned. But replace the "alias -l rem.protect" with the one I posted in my reply to nataliad. Sorry for this lapse. You also can send me a PM if you have problems with doing so. Regards. (...being a bit uncertain if I'm responding to two users ore one  )
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
Fjord artisan
Joined: Feb 2006
Posts: 307 |
thanks very much for your script
can you tell me please the correct code?
as for the sorting of lists, mirc doesn't autosort the protect/ignore list, it adds new entries at the bottom and it sorts them only if you click the sort button
so this way, if I know the last entry I can check whether new entries have been added and if those have been removed succesfuly by the script
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
can you tell me please the correct code? ...try the one I pasted in response to your last reply. as for the sorting of lists, mirc doesn't autosort the protect/ignore list, it adds new entries at the bottom and it sorts them only if you click the sort button so this way, if I know the last entry I can check whether new entries have been added and if those have been removed succesfuly by the script ...not if you add "other" protections in the meantime, or change switches for existing protections (you might have run across e.g. the message "* Updated protect channels for xy" already). Thus, there's no guarantee for the temp protections of this scripts to be located at the bottom of the list.
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
Fjord artisan
Joined: Feb 2006
Posts: 307 |
1)you said to remove the three lines, are they removed now? you updated the code?
2) what you mean "other" protections?
3) ok, if the protection already exists, it wont be added in the bottom, it will stay where it is, but in this situation, I wont have an unwanted protect entry! (this is the main concern)
4) also can you make the script to work only for people in #channel1 and #channel2 in every server?
thank you very much!
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
1)you said to remove the three lines, are they removed now? you updated the code? That's why i pasted the code again in post #184782. 2) what you mean "other" protections? All protections that had not been added by this temp-script. 4) also can you make the script to work only for people in #channel1 and #channel2 in every server? Add the channel names to all event definitions that contain a # char: join, op, help, voice, kick, part. Change e.g.: to on *:op:#channel1,#channel2:
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
Fjord artisan
Joined: Feb 2006
Posts: 307 |
thanks can you tell me please when I part ANY of #channel1,#channel2 it will remove ALL temp protect entries (from the ops of ALL channels)? if this happens, then I would like to remove the temp entries only when I quit/disconnect/close mirc and not when I get kicked or I part a channel also I get this in my status: tokenize 43 %tempprotect+#channel1+op1+
!protect -r
Last edited by nataliad; 06/09/07 08:52 AM.
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
Fjord artisan
Joined: Feb 2006
Posts: 307 |
also I get these lines in the status:
#Hellas somenick H x@83.73.77.52 :0 x
does the script /who all the channel??? I dont think the first script I pasted does this, it only whoises the ops...
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
can you tell me please when I part ANY of #channel1,#channel2 it will remove ALL temp protect entries (from the ops of ALL channels)? change: on me:*:part:#chan1,#chan2: { rem.protect $network $chan } to on me:*:part:#chan1,#chan2: { rem.protect $network net } if this happens, then I would like to remove the temp entries only when I quit/disconnect/close mirc and not when I get kicked or I part a channel hum? This is i contradictory to the request above and, anyway, why keep protections for a channel you are not on? If you rejoin that channel, the temp protections will be added again. also I get this in my status: tokenize 43 %tempprotect+#channel1+op1+
!protect -r You might have mis-pasted the code, I see no other reason for this happening. also I get these lines in the status: #Hellas somenick H x@83.73.77.52 :0 x does the script /who all the channel??? I dont think the first script I pasted does this, it only whoises the ops... The script did always do a /who if not all the users of that chan are in your internal address list (which is most likely...  ). Why? - If you join a (specified) chan, you want to protect all nonreg users by host (mask type 2). - mIRC is able to look up the hosts of these users if needed (not a mask but a mask type is specified), e.g. /protect nick #chan 2 network Quoting "/help /protect": If you specify a type then the users address is looked up via the server. ...But the script request was about temp protection. As long as there is no "remove on exit" switch for the /protect command, a scripted sollution has to remember (store) which of the protections are temp protections - thus has to store distinct data about that. I used variables like %tempprotect+<network>+<channel>+<host> . The "host" part is the crucial point: it's looked up via internal address list. Thus, a /who #channel is mandatory in most cases - /who-ing a chan is faster than /whois-ing ops only; you cannot who ops only.
|
|
|
|
|