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.16 by tdb, Mon Mar 5 23:12:43 2001 UTC vs.
Revision 1.18 by tdb, Thu Mar 8 13:43:54 2001 UTC

# Line 77 | Line 77 | public class IRC__Alerter implements PluginAlerter {
77              if(((alert.getLevel() == 0) && (alert.getLastLevel() >= level)) || (alert.getLevel() >= level)) {
78                  String alertType = Alert.alertLevels[alert.getLevel()];
79                  String thresholdType = Alert.thresholdLevels[alert.getThreshold()];
80 +                String timeFirstSince = DateUtils.formatTime(System.currentTimeMillis() - alert.getInitialAlertTime(), "%DAYS% days, %HOURS% hours, %MINS% mins, and %SECS% secs");
81 +                String timeFirstOccured = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.UK).format(new Date(alert.getInitialAlertTime()));
82                  // sort out the message              
83                  String message;
84                  try {
# Line 93 | Line 95 | public class IRC__Alerter implements PluginAlerter {
95                  message = StringUtils.replaceText(message, "%thresholdValue%", alert.getThresholdValue());
96                  message = StringUtils.replaceText(message, "%attributeName%", alert.getAttributeName());
97                  message = StringUtils.replaceText(message, "%timeTillNextAlert%",  getTimeString(Long.parseLong(alert.getTimeTillNextAlert())));
98 +                message = StringUtils.replaceText(message, "%timeSinceFirstAlert%", timeFirstSince);
99 +                message = StringUtils.replaceText(message, "%timeOfFirstAlert%", timeFirstOccured);
100                  
101                  // send the message
102                  _logger.write(toString(), Logger.DEBUG, "Sending " + _name + " at "+ alertType + " level");
# Line 102 | Line 106 | public class IRC__Alerter implements PluginAlerter {
106                  _alertCount ++;
107              }
108          }
109 +        else {
110 +            _ignoredCount ++;
111 +        }
112      }
113  
114      /**
# Line 168 | Line 175 | public class IRC__Alerter implements PluginAlerter {
175      /**
176       * Number of alerts sent
177       */
178 <    private long _alertCount = 0;
178 >    private int _alertCount = 0;
179      
180      /**
181 +     * Number of alerts ignored when in "stopped" mode
182 +     */
183 +    private int _ignoredCount = 0;
184 +    
185 +    /**
186       * Time of IRCBot startup
187       */
188      private long _startTime;
# Line 551 | Line 563 | public class IRC__Alerter implements PluginAlerter {
563                      sendPrivMsg(getMsgSender(line), helpCommand);
564                  }
565                  else if(message.indexOf(statCommand)!=-1) {
566 <                    sendMsg(getMsgSender(line)+", I have sent a total of "+_alertCount+" alerts!");
566 >                    sendMsg(getMsgSender(line)+", I have sent a total of "+_alertCount+" alerts, and ignored a total of "+_ignoredCount+"!");
567                  }
568                  else if(message.indexOf(uptimeCommand)!=-1) {
569                      long uptime = (System.currentTimeMillis() - _startTime) / 1000;
570                      String uptimeText = DateUtils.formatTime(uptime, "%DAYS% days, %HOURS% hours, %MINS% mins, and %SECS% secs");
571                      sendMsg(getMsgSender(line)+", I have been running for "+uptimeText);
572 +                }
573 +                else if(message.indexOf("ping")!=-1) {
574 +                    sendMsg("pong");
575                  }
576                  else if(message.indexOf("do a jibble dance")!=-1) {
577                      // little joke :)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines