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.17 by ajm, Tue Mar 6 02:33:55 2001 UTC vs.
Revision 1.21 by tdb, Thu Mar 15 04:06:57 2001 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 < package uk.ac.ukc.iscream.client.alerters;
2 > package uk.org.iscream.client.alerters;
3  
4   //---IMPORTS---
5 < import uk.ac.ukc.iscream.client.*;
6 < import uk.ac.ukc.iscream.core.*;
7 < import uk.ac.ukc.iscream.util.*;
8 < import uk.ac.ukc.iscream.componentmanager.*;
5 > import uk.org.iscream.client.*;
6 > import uk.org.iscream.core.*;
7 > import uk.org.iscream.util.*;
8 > import uk.org.iscream.componentmanager.*;
9  
10   import java.io.*;
11   import java.net.*;
# Line 52 | Line 52 | public class IRC__Alerter implements PluginAlerter {
52                          
53          // connect to the IRC server
54          _ircbot = new IRCBot();
55 +        // set it's name and start it
56 +        _ircbot.setName("client.IRC__Alerter$IRCBot");
57          _ircbot.start();
58          _startTime = System.currentTimeMillis();
59          
# Line 106 | Line 108 | public class IRC__Alerter implements PluginAlerter {
108                  _alertCount ++;
109              }
110          }
111 +        else {
112 +            _ignoredCount ++;
113 +        }
114      }
115  
116      /**
117       * Overrides the {@link java.lang.Object#toString() Object.toString()}
118       * method to provide clean logging (every class should have this).
119       *
120 <     * This uses the uk.ac.ukc.iscream.util.NameFormat class
120 >     * This uses the uk.org.iscream.util.NameFormat class
121       * to format the toString()
122       *
123       * @return the name of this class and its CVS revision
# Line 172 | Line 177 | public class IRC__Alerter implements PluginAlerter {
177      /**
178       * Number of alerts sent
179       */
180 <    private long _alertCount = 0;
180 >    private int _alertCount = 0;
181      
182      /**
183 +     * Number of alerts ignored when in "stopped" mode
184 +     */
185 +    private int _ignoredCount = 0;
186 +    
187 +    /**
188       * Time of IRCBot startup
189       */
190      private long _startTime;
# Line 434 | Line 444 | public class IRC__Alerter implements PluginAlerter {
444           * Overrides the {@link java.lang.Object#toString() Object.toString()}
445           * method to provide clean logging (every class should have this).
446           *
447 <         * This uses the uk.ac.ukc.iscream.util.NameFormat class
447 >         * This uses the uk.org.iscream.util.NameFormat class
448           * to format the toString()
449           *
450           * @return the name of this class and its CVS revision
# Line 521 | Line 531 | public class IRC__Alerter implements PluginAlerter {
531                          endOfChan = newChan.length();
532                      }
533                      newChan = newChan.substring(0, endOfChan);
534 <                    sendMsg(getMsgSender(line)+", okay, I'm off to "+newChan);
535 <                    _socketOut.println("PART "+_channel);
536 <                    _socketOut.println("JOIN "+newChan);
537 <                    _channel = newChan;
534 >                    if(newChan.equals(_channel)) {
535 >                        sendMsg(getMsgSender(line)+", I'm already on "+newChan+"!");
536 >                    } else {
537 >                        sendMsg(getMsgSender(line)+", okay, I'm off to "+newChan);
538 >                        _socketOut.println("PART "+_channel);
539 >                        _socketOut.println("JOIN "+newChan);
540 >                        _channel = newChan;
541 >                    }
542                  }
543                  else if(message.indexOf(nickChangeCommand)!=-1) {
544                      String nickChangeCmd = nickChangeCommand;
# Line 555 | Line 569 | public class IRC__Alerter implements PluginAlerter {
569                      sendPrivMsg(getMsgSender(line), helpCommand);
570                  }
571                  else if(message.indexOf(statCommand)!=-1) {
572 <                    sendMsg(getMsgSender(line)+", I have sent a total of "+_alertCount+" alerts!");
572 >                    sendMsg(getMsgSender(line)+", I have sent a total of "+_alertCount+" alerts, and ignored a total of "+_ignoredCount+"!");
573                  }
574                  else if(message.indexOf(uptimeCommand)!=-1) {
575                      long uptime = (System.currentTimeMillis() - _startTime) / 1000;
576                      String uptimeText = DateUtils.formatTime(uptime, "%DAYS% days, %HOURS% hours, %MINS% mins, and %SECS% secs");
577                      sendMsg(getMsgSender(line)+", I have been running for "+uptimeText);
578 +                }
579 +                else if(message.indexOf("ping")!=-1) {
580 +                    sendMsg("pong");
581                  }
582                  else if(message.indexOf("do a jibble dance")!=-1) {
583                      // little joke :)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines