*** empty log message ***
authorMatthew Mondor <mmondor@pulsar-zone.net>
Mon, 27 Nov 2006 14:30:28 +0000 (14:30 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Mon, 27 Nov 2006 14:30:28 +0000 (14:30 +0000)
mmsoftware/js/js-sh/app/irclog/config.js
mmsoftware/js/js-sh/app/irclog/irclog.js

index 5920495..b2ff176 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: config.js,v 1.1 2006/11/27 13:57:27 mmondor Exp $ */
+/* $Id: config.js,v 1.2 2006/11/27 14:30:28 mmondor Exp $ */
 
 /* Configuration */
 var irc_channel = '#gurumeditation';
@@ -23,6 +23,14 @@ var irc_part_message = 'Farewell';
 var irc_quit_message = 'Farewell';
 var irc_auto_whois = true;
 var irc_log_pings = false;
+var irc_auto_voice = [];
+var irc_auto_op = [
+       "^mur![^@]*@smtp.uiah.fi$",
+       "^phadthai![^@]*@ginseng.pulsar-zone.net$",
+       "^cprior![^@]*@unaffiliated/cprior$",
+       "^Kool-Aid![^@]*@[^.]*.[^.]*.or.comcast.net$"
+];
+var irc_auto_ban = [];
 
 /* XXX Would be more complex, but ideal
 var networks = [
index 5131302..aa2d882 100644 (file)
@@ -1,6 +1,6 @@
-/* $Id: irclog.js,v 1.9 2006/11/27 14:03:01 mmondor Exp $ */
+/* $Id: irclog.js,v 1.10 2006/11/27 14:30:28 mmondor Exp $ */
 
-var irc_version = '$Id: irclog.js,v 1.9 2006/11/27 14:03:01 mmondor Exp $';
+var irc_version = '$Id: irclog.js,v 1.10 2006/11/27 14:30:28 mmondor Exp $';
 
 function file_read(name)
 {
@@ -201,7 +201,7 @@ File.prototype.state_nick = function()
 
 File.prototype.state_log = function()
 {
-       var line, s, from, to, chan, msg, w;
+       var line, s, from, to, chan, msg, w, i;
 
        stdout.write(log_timestamp() + ' -+- Entering state_log()' + "\n");
 
@@ -237,13 +237,46 @@ File.prototype.state_log = function()
                        msg = line.substr(s.length);
                        from = line.substr(1, line.indexOf('!') - 1);
                        if (from.toLowerCase() == irc_nickname.toLowerCase() &&
-                           msg.toLowerCase() == irc_channel.toLowerCase()) {
+                           msg.toLowerCase() == irc_channel.toLowerCase())
                                on_channel = true;
-                               continue;
-                       } else if (irc_auto_whois) {
-                               this.putline('WHOIS ' + from);
-                               continue;
+                       else {
+                               if (irc_auto_whois)
+                                       this.putline('WHOIS ' + from);
+                               /* Check for auto op/voice/ban */
+                               w = line.split(' ');
+                               s = w[0].substr(1);
+                               for (i in irc_auto_voice) {
+                                       if (s.match(irc_auto_voice[i])
+                                           != null) {
+                                               this.putline('MODE ' +
+                                                   irc_channel + ' +v ' +
+                                                   from);
+                                               break;
+                                       }
+                               }
+                               for (i in irc_auto_op) {
+                                       if (s.match(irc_auto_op[i])
+                                           != null) {
+                                               this.putline('MODE ' +
+                                                   irc_channel + ' +o ' +
+                                                   from);
+                                               break;
+                                       }
+                               }
+                               for (i in irc_auto_ban) {
+                                       if (s.match(irc_auto_ban[i].regex)
+                                           != null) {
+                                               this.putline('MODE ' +
+                                                   irc_channel + ' +b ' +
+                                                   irc_auto_ban[i].mask);
+                                               this.putline('KICK ' +
+                                                   irc_channel + ' ' +
+                                                   from + ' :automatic ban');
+                                               break;
+                                       }
+                               }
                        }
+                       continue;
                }
 
                /* :<nick>!<user>@<host> KICK <channel> <nick> :<message> */