Username:
Password:
  Home About Us Articles Rules Script Library FAQ Help
Not logged in (register
Server Notice Handler 2 for mIRC v6
By: arcane

Last Modified: Apr 11 2:17pm (r26)

This script sorts the various server notices that IRCOps get into several different Custom Windows. The script is fairly strange to look at, but should be extremely easy to modify for other servers (or add new SNotices as the IRCd is upgraded).

SNotices.dat
The snotices.dat file that I reference consists of two things. Wildcard patterns for SNotices, then the name of an alias that should be run if the SNotice matches the aforementioned wildcard pattern.

The file is in the format of:

WildCard Pattern
snAlias
[etc]


Example
This is the snotices.dat file that I'm using on UtoNet right now.

??? Notice -- Received KILL message for *
snKill
Q:lined nick *
snIgnore
Forbidding Q-lined nick *
snQline
??? Flood -- *!*@* (*) exceeds *
snFlood
??? ?:Line added for *
snBan
??? Permanent ?:Line added for *
snBan
??? Expiring ?:Line *
snBan
* removed *:Line *
snBan
???*Global Z:Line added for *
snBan
??? Permanent Global Z:Line added for *
snBan
??? Expiring Global Z:Line *
snBan
??? Permanent Global Q:line added for *
snQline
* removed Global Q:line *
snQline
* invited * into the channel.
snOther
* (*@*)* is now a*
snOpers
Stats '?' requested by *
snOpers
??? OperOverride -- *
snOpers
??? Global -- from Nickserv: * used SET * as *
snOpers
??? Global -- from OperServ: *
snOpers
??? Global -- from ????Serv: *
snFlood
??? Notice -- * used SAPART to make *
snOpers
??? Notice -- * used SAJOIN to make *
snOpers
??? * did a /whois on you.
snOther
??? ChatOps -- from *
snChatOps
??? Notice -- Failed OPER attempt by *
snOpers
??? Notice -- names abuser *[*] *
snFloods
Ex * ttl * host *
snOther
??? LocOps -- Received SQUIT *
snEmergency
??? LocOps -- from *
snChatOps
??? Notice -- TS Control - U:line set time to be *
snIgnore
??? HelpOp -- from *
snIgnore
??? Notice -- No response from *, closing link
snEmergency
'?' requested by *
snOpers
* = *.in-addr.arpa (??)
snOther
??? Notice -- * used suspicious DCC command *
snBan
??? Global -- from *: *
snChatOps
??? Notice -- Maximum connections: *
snOther
[SpamFilter] * matches filter *
snBan
??? Spamfilter added: *
snBan
*!*@* removed SpamFilter *
snBan
Temporary shun added on user *
snBan
Removed temporary shun on user *
snBan
??? Shun added for *
snBan
??? Expiring Shun *
snBan
??? Permanent Shun added for *
snBan
??? Notice -- * did a DNS cache list
snOpers
[?vhost?] *
snOpers
??? [?vhost?] Login for * failed - password incorrect
snOther
??? [?vhost?] *
snOpers
*!*@* removed Shun *
snBan
??? Notice -- * is rehashing server config file
snOpers
??? Notice -- Loading IRCd configuration ..
snOpers
??? Notice -- Configuration loaded without any problems ..
snOpers
??? Notice -- Got signal SIGHUP, reloading unrealircd.conf file
snOpers
??? Notice -- error: *
snEmergency
??? You are connected to evek.us.utonet.org with *
snOther
??? If you are having problems connecting due to ping timeouts, please type /quote pong * or /raw pong * now.
snOther
Setting/removing of usermode(s) '*' has been disabled.
snOther
* changed the virtual hostname of *
snOpers
* changed the virtual ident of *
snOpers
* changed the GECOS of *
snOpers
OpenSSL *
snOther
Your nick!user@host-mask is now (*) *
snOther
??? Authentication phrase (method=*, para=*) is: *
snOther
??? Syntax: /mkpasswd <authmethod> :parameter
snOther
??? NetAdmin.Chat -- from *
snChatOps
??? AdminChat -- from *
snChatOps
- evek.us.utonet.org Bot Message of the Day -
snOther
- Bandwidth restrictions engaged, thanks for marking yourself as a bot.
snOther
End of /BOTMOTD command.
snOther
??? Notice -- (?link?) Link *
snOpers
??? Notice -- Link * -> * is now synced *
snOpers
??? Global -- from *: Link with Network ?Complete!?
snOpers
Lag reply -- *
snOther
??? Notice -- * added a *dccdeny for *
snOpers
??? Notice -- * already has a dccdeny
snOpers
??? Notice -- * removed a *dccdeny for *
snOpers
??? Listener on *
snOther
??? Notice -- * closed * unknown connections
snOpers
??? Notice -- Entering high-traffic mode*
snEmergency
??? Notice -- Still high-traffic mode*
snEmergency
??? Notice -- Resetting HTM and raising limit to:*
snEmergency
??? Notice -- Resuming standard operation*
snEmergency
Ca * Cd * Ce * Cl * Ch * Cu *
snOther
Re * Rl * Rp * Rq *
snOther
Ru * Rsh * Rs * Rt *
snOther
??? Notice -- Failed to delete command* when unloading *
snEmergency
??? Notice -- ??? TROUBLE: *
snEmergency
??? Notice -- Time running backwards!*
snEmergency
??? Notice -- Aieeeee!!!Restarting server...*
snEmergency
All connections in use.
snEmergency
??? Notice -- Rehashing all MOTDs and RULES on request of *
snOpers
??? Notice -- Rehashing OperMOTD on request of *
snOpers
??? Notice -- Rehashing BotMOTD on request of *
snOpers
??? Notice -- Doing garbage collection ..
snOpers
??? Notice -- Server Terminating by request of *
snEmergency
??? Notice -- Server is Restarting by request of *
snEmergency
??? * (*) can only be set *
snOther
??? A Channel Limit (+l <max>) is required for +L to be set.
snOther
??? No Knocks mode (+K) can only be set when the channel is invite only (+i)
snOther
??? You cannot * in *, it is a network service
snOther
??? You cannot * in *, (s)he is *
snOther
??? Only one channel may be specified for linking.
snOther
error: channelmode +f: time range should be 1-999
snOther
channelmode +f: floodtype '*', value should be 1-999
snOther
Setting/removing of channelmode(s) '*' has been disabled.
snOther
??? Couldn't join * ! - Link setting was too bouncy
snOther
??? * cannot be linked to itself.
snOther
??? Channel Linking (+L) can only be set by the channel owner.
snOther
??? Can not join *: *
snOther
??? Redirecting you to *
snOther
??? NOTICE -- * forced High traffic mode to *
snOpers
??? NOTICE -- * changed the High traffic mode max rate to *
snOpers
??? NOTICE -- * set High traffic mode to *
snOpers
??? NOTICE -- *High traffic mode is now *
snOpers
??? * did a /stats L on you! IP may have been shown
snOpers
OperOverride -- *
snOpers
??? You were forced to *
snOpers
Flood from unknown connection * detected
snFlood
??? ?: * tried to kick you from channel *
snOther
??? Cannot kick * from channel * (usermode +?)
snOther
*
snUnknown


Extensibility
Adding a new SNotice to the script is easy. Just insert a new wildcard match in the snotices.dat file and associate it with the proper alias.

In order to add additional functionality, for example if you want a new Custom Window for certain types of SNotices or if you wanted to color certain types of bans differently, you can create your own aliases. If you wanted to add an alias specifically for GLines for example, you could add in the SNotices.dat file:

??? G:Line added for *
snGlines

Then in your remotes you would have to add a new alias called snGlines. You won't have to modify any of the exising code.

If you want general SNotices to go to an @SNotices instead of the status window, change the snOther alias, commenting out snStatus $$1- and uncommenting snSNotice $$1-.

Installation
Installation should be very, very simple. First take the contents of my snotices.dat and create your own snotices.dat in mIRC's working directory. Then copy the script itself into its own file. Run the following commands to initliaze the script (or start mIRC), and then you're done.

/snInitHash
/snInitWindows

Feel free to post questions, comments, or additional SNotice formats here. I'll continually update this script as I make changes to my own snotices.dat so subscribing may not be a bad idea.

Revision History
R1 - snReload alias, many new SNotices, snEmergency action, ignore wallops from other networks
R2 - changed .dat file to show global Z:Lines being removed by services
R3 - updated .dat file
R4 - updated .dat file
R5 - vital updates to .dat file. Please upgrade.
R6 - updated .dat file
R7 - updated .dat file
R8 - updated .dat file
R9 - updated .dat file
R10 - updated .dat file
R11 - updated .dat file
R12 - updated .dat file
R13 - updated .dat file
R14 - updated .dat file, rewrote large portions of the script, added on LOAD and on START triggers for easier installation, built in support to echo to @SNotices instead of your status window.
R15 - Fixed snReload recursion bug (ooops)
R16 - updated .dat file
R17 - updated .dat file
R18 - updated .dat file
R19 - updated .dat file
R20 - updated .dat file
R21 - updated .dat file, SNotice windows now bind to a connection so that stuff doesn't go awry when entering commands in their editbox
R22 - Fixed snReload recursion bug again. Grr.
R23 - I suck. Fixed typos.
R24 - Fixed problems using the script with multiple connections
R25 - Fixed snReload recursion bug again. Why do I keep overwriting this change!?
R26 - Fixed a revision number error (damn you Bergee!)
on *:LOAD: {
  snInitHash

  snInitWindows
}
on *:START:{
  snInitHash
}
on *:CONNECT:{
  if ( $network == UtoNet ) {
    snInitWindows
  }
}

alias snOther {
  ; Change this alias if you want general SNotices in
  ; an @SNotice window instead of your status window.

  snStatus $$1-
  ; snSNotice $$1-
}

alias snEcho {
  if (!$window($$1)) { window -ek0n $$1 }
  echo $color(NOTICE) -tgm $$1 $$2-
  echo $color(INFO) -g $$1 -
}

alias snBan { snEcho @Bans $$1- }
alias snKill { snEcho @Kills $$1- }
alias snQLine { snEcho @QLines $$1- }
alias snFlood { snEcho @Floods $$1- }
alias snOpers { snEcho @Opers $$1- }
alias snSNotice { snEcho @SNotices $$1- }
alias snIgnore { }

alias snStatus {
  echo $color(NOTICE) -ts $$1-
  echo $color(INFO) -gs -
}

alias snChatOps {
  echo $color(WALLOPS) -agt $+(-,$nick,-,$chr(32),$$1-)
  echo $color(INFO) -tmn @Opers $+(-,$nick,-,$chr(32),$$1-)   
  echo $color(INFO) -g @Opers -
}

alias snEmergency {
  echo $color(NOTICE) -tsl $+(-,$nick,-,$chr(32),$$1-)
  echo $color(NOTICE) -tal $+(-,$nick,-,$chr(32),$$1-)
  beep 6 90
  if ($window(@Emergency) == $null) {
    window -ek0n @Emergency
  }
  echo $color(NOTICE) -tlm @Emergency $$1-
  echo $color(INFO) -g @Emergency -
}

alias snUnknown {
  if ($window(@Unknown) == $null) {
    window -ek0n @Unknown
  }
  echo $color(NOTICE) -tm @Unknown $$1-
  echo $color(INFO) -g @Unknown -
  snStatus $1-
}

alias snRehash {
  hfree sn
  snInitHash
  snInitWindows
}
alias snReload {
  ; since not everyone is used to Unix terms
  snRehash
}

alias snInitHash {
  .hmake -s sn 200
  var %line = 1
  while ( %line < $lines( snotices.dat ) ) {
    hadd sn $calc( ( %line + 1 ) / 2 ) $+ wc $read( snotices.dat, %line )
    hadd sn $calc( ( %line + 1 ) / 2 ) $+ fn $read( snotices.dat, $calc( %line + 1 ) )
    inc %line 2
  }
}

alias snInitWindows {
  if (!$window( @Kills  )) { window -ek0n @Kills  }
  if (!$window( @Bans   )) { window -ek0n @Bans   }
  if (!$window( @Floods )) { window -ek0n @Floods }
  if (!$window( @QLines )) { window -ek0n @QLines } 
  if (!$window( @Opers  )) { window -ek0n @Opers  }
}

on ^*:SNOTICE:*:{
  if ($target == AUTH) {
    ; Don't do anything anymore
  }
  elseif ($network == UtoNet) {
    ;    .fopen snlog logs/@snotices.UtoNet.log
    ;    if ( $ferr ) .fopen -n snlog logs/@snotices.UtoNet.log
    ;    .fwrite -n snlog $asctime([hh:nn:ss]) $+(-,$nick,-) $$1-
    ;    .fclose snlog

    var %found = 0
    var %line = 1
    while ( %found == 0 ) {
      if ( $hget( sn, %line $+ wc ) iswm $1- ) {
        echo $eval( $+($,$hget( sn, %line $+ fn ),( $+($,1-) )), 2)
        var %found = 1
      } 
      inc %line
    }
    haltdef
  }
}
on ^*:WALLOPS:*:{
  if ( $network == UtoNet ) {
    echo $color(WALLOPS) -agt $+(!,$nick,!,$chr(32),$$1-)
    if ($window(@Opers) == $null) {
      snInitWindows
    }
    echo $color(INFO) -tn @Opers $+(!,$nick,!,$chr(32),$$1-) 
    echo 1 -g @Opers -
    haltdef
  }
}

Comments
arcane
Jun 18 11:28am
This script is really too bulky for non-opers. If you still want an SNotice/Wallop handler, I'd recommend taking a look at Bergee's original version of this script.
Bergee
Jun 18 1:38pm
Which incidentally, I won't be updating any longer because now I'll be using this.
Elly
Jun 24 7:23pm
/cecho from my core libs (and $wmatch, now that I think about it heh) would be useful here.

Also, why not just have a Window name to which the event's output is echoed (since they seem to all use the same format anyway)? Then you could cut the whole thing down to a cecho statement heh =)
arcane
Jun 24 8:42pm
They don't all use the same format at all. Refer to snIgnore, snEmergency, and snChatOps ... plus I might opt to add in additional functionality later.
FoF
Dec 29 5:51pm
Some of the masks over run each other. Removed Q:lines go the snban instead of snqline. Can probablly just switch them.
* removed *:Line *
snBan

* removed Global Q:line *
snQline
Konc
Dec 30 10:15am
In one place, for example (I just picked one of the lines), you previously had
window -eik0nz @Unknown

But now it's been changed to
window -eiz0n @Unknown

Now the '0' there was part of the 'k', to hide the @ prefix, wasn't it? Isn't it kinda redundant to still have it then?
arcane
Jan 22 5:00pm
yeah .. not sure why on earth I did that..
arcane
Apr 02 12:53pm
Anyway, I've fixed the /window parameters so that it will actually do what you would expect it to do.
 
All content Copyright © 2004 - 2008 UtoNet IRC Network
UtoNet is sponsored and hosted by Datinix Systems