Author Topic: Request: Auto-Unban Script  (Read 6774 times)

peterq

  • Guest
Request: Auto-Unban Script
« on: May 18, 2010, 01:30:24 PM »
I've searched the forum and could find nothing that helped me.

I frequent a server where bans on aops are usually just jokes.  I'd like to have a script for IceChat 7 that will unban me immediately (or ASAP) via ChanServ when someone sets mode +b on my nick, ident, or vhost.

Also, I have a quick unrelated question: for text highlighting, I use $me.  How do I use wildcards so punctuation around my nick will also be highlighted?

Thanks.

peterq

  • Guest
Re: Request: Auto-Unban Script
« Reply #1 on: May 18, 2010, 03:59:43 PM »
I'd like to add something on:
Is it also possible to ban and then kick the person who banned me immediately after I am banned?  Through ChanServ would work.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Request: Auto-Unban Script
« Reply #2 on: May 18, 2010, 10:22:01 PM »
Use *$me* for matching any characters around your nick name.

As for then un-banning, see if this IceChat 7 style script works.
You can replace the /mode command with a chanserv command.
$fullhost can be replaced with $me or whatever you need to unban.

Code: [Select]
on *:ban:#test:{
if ($me == $bnick) {
/mode #test -b $fullhost
}
}
The IceChat God

peterq

  • Guest
Re: Request: Auto-Unban Script
« Reply #3 on: May 18, 2010, 11:15:10 PM »
Hi, Snerf.  Thanks for your reply.  I don't think I'm able to get this script to work. 

What I did while testing was:
- I replaced #test with a channel I was testing on
- Replaced the /mode #channel -b $fullhost with /cs unban #channel $me (I also tried it with /mode. I tried $fullhost, too)
- I saved it as an .ics file
- And banned myself in the testing channel.

Sorry to bother, but did I do anything wrong or is there something wrong with the script?

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Request: Auto-Unban Script
« Reply #4 on: May 19, 2010, 08:47:03 AM »
Could be that your nick isnt' matching the banned host. This usually happens when a host is banned, and not a nick name.

Instead of checking if $me == $nick , try seeing if you can match your host instead.

For instance:

if (my.host.com isin $banmask)
{

}

Just change my.host.com to whatever your host is, or part of it.
The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Request: Auto-Unban Script
« Reply #5 on: May 19, 2010, 08:52:19 AM »
if you use vbscript you can use regular expressions.

Code: [Select]
Sub ONBAN(Nickname,Host,ModeSetter,ModeSetterHost,Channel,ServerNumber)
MyNick = GetIdentifier("$me",ServerNumber)
MyHost = MyNick & "!" & GetIdentifier("$nick(" & Channel & "," & MyNick & ").host",ServerNumber)

if MaskMatch(MyHost,Nickname & "!" & Host) then
SendCommand "/mode " & channel & " -b " & Nickname & "!" & Host,ServerNumber
Else
MyHost = MyNick & "!~" & GetIdentifier("$nick(" & Channel & "," & MyNick & ").host",ServerNumber)
if MaskMatch(MyHost,Nickname & "!" & Host) then SendCommand "/mode " & channel & " -b " & Nickname & "!" & Host,ServerNumber
End If
End Sub

Function MaskMatch(mask,match)
  Set MaskRegex = new RegExp
  MaskRegex.IgnoreCase = True
  MaskRegex.pattern = replace(replace(match,"?","."),"*",".*")
  MaskMatch = MaskRegex.Test(mask)
End Function
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

peterq

  • Guest
Re: Request: Auto-Unban Script
« Reply #6 on: May 19, 2010, 11:48:28 AM »
Hi, Morio.  I was able to get your script to work, but how do I use /cs instead of /mode to unban myself?

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Request: Auto-Unban Script
« Reply #7 on: May 19, 2010, 01:55:56 PM »
just change the sendcommand parts, like this:

Code: [Select]
SendCommand "/cs #channel unban " & MyNick,ServerNumber

"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

peterq

  • Guest
Re: Request: Auto-Unban Script
« Reply #8 on: May 19, 2010, 02:05:39 PM »
Morio, I believe your syntax is incorrect, it should be:
Code: [Select]
SendCommand "/cs unban #channel " & MyNick,ServerNumberI was able to get that to work, too.

I have one last question: is there a way to make "#channel" a "wildcard" so I don't have to make a new script file for every channel that I'm on?  Thanks.

e: Never mind, I think I figured it out through trial and error:
Code: [Select]
SendCommand "/cs unban " & channel & " " & MyNick,ServerNumber
Thanks for the help.
« Last Edit: May 19, 2010, 02:19:17 PM by peterq »