vHost request system

By TimRoden on Mar 28, 2011

This is a mIRC snippet for a vHost system. The bot on which this is run must have the correct IRCop privilege to set vHosts, and it must be in your request and accept channels

You MUST set two variable for this to work:
%request.chan
%review.chan
The rest will take care of itself.

Planned updates:
[ ] Save all accepted vHosts to a .txt file
[ ] Add a queue to the system
[ ] Clean up the code a bit

Updates:
Changed %var =
To unset %var

If you have suggestions for any other updates, such as how to make this system less "exploitable" Please comment below.

And remember, this is my second public snippet, so please be nice.

on 1:TEXT:!request *:%request.chan: { 
  %pending = true
  %request.host = $2
  %request.nick = $nick
  msg %request.chan %request.nick, You have requested vHost: %request.host Please wait for an IRCOp to approve it. 
  msg %review.chan Attn All online Opers: %request.nick Requests vHost: %request.host
  msg %review.chan Type !accept or !deny to Accept/deny %Vhost 
}
on 1:TEXT:!accept:%review.chan: { 
  if %pending = true {
    msg hostserv set %request.nick %request.host
    msg %review.chan vHost request: %request.host for %request.nick accepted.
    msg %request.chan %request.nick Your request for %request.host has been accepted. To activate it, please type /msg hostserv on 
    %lasthost.accept = %request.host
    unset %request.host 
    unset %request.nick  
    unset %pending
  }
  else {
    msg %review.chan there are no vHost requests pending!
  }
}
on 1:TEXT:!deny:%review.chan: { 
  if %pending = true {
    msg %review.chan vHost request: %request.host for %request.nick denied.
    msg %request.chan %request.nick Your request for %request.host has been denied. Please /part %request.chan 
    unset %request.host 
    unset %request.nick 
    unset %pending 
  }
  else {
    msg %review.chan there are no vHost requests pending!
  }
}
on 1:TEXT:!last:%review.chan: {
  msg %review.chan Last accepted host was %lasthost.accept
}

Comments

Sign in to comment.
dma174   -  Jan 23, 2019

how do i request a vhost?

 Respond  
[85]   -  Apr 28, 2011

like this...

 Respond  
Vegitha   -  Apr 01, 2011

awesome code Tim

 Respond  
jaytea   -  Mar 28, 2011

Also whats that all on its own?
I guess it unsets them (nether really tried that method) but yeah unset %var should work.

'%var =' (followed by a space or end of line) gets mapped directly onto 'set %var' early on by mIRC's interpreter. thus '%var = value' as a command is exactly equivalent to 'set %var value' - remember that /set modifies local variables and only creates a global variable if a local one of that name doesn't exist.

the procedure that does this mapping is a bit greedy: it also plays a role in the evaluation of the arguments to an identifier (which is a slightly different evaluation routine in a number of ways). this really is silly, but at least it allows me to produce proof of the above claim :P

//echo -a $+(a, %var =, b) and $replace(a, a, %var =)
 Respond  
Jethro   -  Mar 28, 2011

Tim, you may check up on the use of $addtok() and then use $istok() or $findtok() to reference to the variable. By using $addtok(), you can have many tokens within a variable.

 Respond  
TimRoden   -  Mar 28, 2011

napa182: I'll be adding a queue at some point.
[Plornt]: Updating to reflect your suggestions

 Respond  
[Plornt]   -  Mar 28, 2011

%request.host =
%request.nick =
%pending =

Also whats that all on its own?
I guess it unsets them (nether really tried that method) but yeah unset %var should work.

Also since when could you set normal variables like that :s I always thought only local variables worked like that. Heh.

 Respond  
napa182   -  Mar 28, 2011

what happens when you get like 4 people requesting a Vhost in a row? Seems like the vars will rewrite to the last person that requested it.

 Respond  
TimRoden   -  Mar 28, 2011

Thanks, Jethro_. That's the kind of stuff that's nice to hear.

 Respond  
Jethro   -  Mar 28, 2011

Good work. It's clean and straight to the point. I'm not gonna sweat about multiple text events anymore. :p

 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.