ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/client/alerters/IRC__Alerter.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/client/alerters/IRC__Alerter.java (file contents):
Revision 1.26 by tdb, Sat Mar 24 03:47:50 2001 UTC vs.
Revision 1.30 by tdb, Thu Jan 17 17:58:12 2002 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 < package uk.org.iscream.client.alerters;
2 > package uk.org.iscream.cms.server.client.alerters;
3  
4   //---IMPORTS---
5 < import uk.org.iscream.client.*;
6 < import uk.org.iscream.core.*;
7 < import uk.org.iscream.util.*;
8 < import uk.org.iscream.componentmanager.*;
5 > import uk.org.iscream.cms.server.client.*;
6 > import uk.org.iscream.cms.server.core.*;
7 > import uk.org.iscream.cms.server.util.*;
8 > import uk.org.iscream.cms.server.componentmanager.*;
9   import java.io.*;
10   import java.net.*;
11   import java.util.*;
# Line 64 | Line 64 | public class IRC__Alerter extends AlerterSkeleton {
64       * @param alert the alert to send
65       */
66      public void sendAlert(Alert alert) {
67 +        // sort out the message      
68 +        String alertType = Alert.alertLevels[alert.getLevel()];        
69 +        String message;
70 +        try {
71 +            message = _cp.getProperty(_name, "Alerter.IRC.message");
72 +        } catch (PropertyNotFoundException e) {
73 +            message = NOT_CONFIGURED;
74 +            _logger.write(toString(), Logger.WARNING, "Alerter.IRC.message value unavailable using default of " + message);
75 +        }
76 +        message = processAlertMessage(message, alert);        
77          // only send alerts if we're active
78 <        if(_active) {
69 <            // sort out the message      
70 <            String alertType = Alert.alertLevels[alert.getLevel()];        
71 <            String message;
72 <            try {
73 <                message = _cp.getProperty(_name, "Alerter.IRC.message");
74 <            } catch (PropertyNotFoundException e) {
75 <                message = NOT_CONFIGURED;
76 <                _logger.write(toString(), Logger.WARNING, "Alerter.IRC.message value unavailable using default of " + message);
77 <            }
78 <            message = processAlertMessage(message, alert);                
79 <            
78 >        if(_active) {          
79              // send the message
80              _logger.write(toString(), Logger.DEBUG, "Sending " + _name + " at "+ alertType + " level");
81              _ircbot.sendMsg(message);
# Line 96 | Line 95 | public class IRC__Alerter extends AlerterSkeleton {
95       * Overrides the {@link java.lang.Object#toString() Object.toString()}
96       * method to provide clean logging (every class should have this).
97       *
98 <     * This uses the uk.org.iscream.util.NameFormat class
98 >     * This uses the uk.org.iscream.cms.server.util.NameFormat class
99       * to format the toString()
100       *
101       * @return the name of this class and its CVS revision
# Line 121 | Line 120 | public class IRC__Alerter extends AlerterSkeleton {
120  
121   //---ACCESSOR/MUTATOR METHODS---
122  
123 +    /**
124 +     * Returns the "friendly" name of this class. This
125 +     * is simply an accessor for _name, required due to
126 +     * inheritance issues with extending AlerterSkeleton.
127 +     *
128 +     * @return the friendly name
129 +     */
130 +    protected String getFName() {
131 +        return _name;
132 +    }
133 +
134   //---ATTRIBUTES---
135      
136      /**
# Line 407 | Line 417 | public class IRC__Alerter extends AlerterSkeleton {
417           * Overrides the {@link java.lang.Object#toString() Object.toString()}
418           * method to provide clean logging (every class should have this).
419           *
420 <         * This uses the uk.org.iscream.util.NameFormat class
420 >         * This uses the uk.org.iscream.cms.server.util.NameFormat class
421           * to format the toString()
422           *
423           * @return the name of this class and its CVS revision
# Line 432 | Line 442 | public class IRC__Alerter extends AlerterSkeleton {
442                  _socketOut.println("PONG" + line.substring(4));
443              }
444              // see if it's for us
445 <            else if(getMsg(line).startsWith(_nickname+",") || getMsg(line).startsWith(_nickname+":") || getMsg(line).startsWith(_nickname+" ")) {
445 >            else if(getMsg(line).toLowerCase().startsWith(_nickname.toLowerCase()+",") ||
446 >                    getMsg(line).toLowerCase().startsWith(_nickname.toLowerCase()+":") ||
447 >                    getMsg(line).toLowerCase().startsWith(_nickname.toLowerCase()+" ")) {
448                  // setup some String's
449                  String stopCommand, startCommand, timeSinceLastAlertCommand, lastAlertCommand, joinCommand;
450                  String nickChangeCommand, versionCommand, helpCommand, statCommand, uptimeCommand;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines