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.30.2.4 by tdb, Tue Feb 5 21:40:03 2002 UTC vs.
Revision 1.32 by tdb, Sat May 18 18:16:00 2002 UTC

# Line 1 | Line 1
1 + /*
2 + * i-scream central monitoring system
3 + * Copyright (C) 2000-2002 i-scream
4 + *
5 + * This program is free software; you can redistribute it and/or
6 + * modify it under the terms of the GNU General Public License
7 + * as published by the Free Software Foundation; either version 2
8 + * of the License, or (at your option) any later version.
9 + *
10 + * This program is distributed in the hope that it will be useful,
11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 + * GNU General Public License for more details.
14 + *
15 + * You should have received a copy of the GNU General Public License
16 + * along with this program; if not, write to the Free Software
17 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 + */
19 +
20   //---PACKAGE DECLARATION---
21   package uk.org.iscream.cms.server.client.alerters;
22  
# Line 267 | Line 286 | public class IRC__Alerter extends AlerterSkeleton {
286              
287              // put these details into the bot
288              this.setLogin(user);
289 <            this.setVersion(comment);
289 >            this.setVersion("[" + getRevision() + "] " + comment);
290              this.setFinger(finger);
291              
292              // attempt to connect, trying each nickname
# Line 410 | Line 429 | public class IRC__Alerter extends AlerterSkeleton {
429          public void onNickChange(String oldNick, String login, String hostname, String newNick) {
430              if(oldNick.equals(_nickname)) {
431                  _nickname = newNick;
432 +                // tell the underlying pircbot that our nick has changed too :)
433 +                setName(newNick);
434              }
435          }
436          
# Line 448 | Line 469 | public class IRC__Alerter extends AlerterSkeleton {
469           * This method handles input directed to us, and
470           * responds accordingly if required.
471           *
451         * nb. matching user input is quite bad right now,
452         *     and should be improved one day.
453         *
472           * @param message the message from someone
473           * @param source where the message came from, so we know where to send the response
474           */
# Line 479 | Line 497 | public class IRC__Alerter extends AlerterSkeleton {
497                  return;
498              }
499              
482            // see if the message matches (loosely!) any
483            // of our known commands
500              if(message.equalsIgnoreCase(stopCommand)) {
501                  _active = false;
502                  sendMessage(source, "alerts have been stopped");
# Line 511 | Line 527 | public class IRC__Alerter extends AlerterSkeleton {
527                  }
528                  
529              }
530 <            else if(message.equalsIgnoreCase(joinCommand)) {
530 >            else if(message.toLowerCase().startsWith(joinCommand.toLowerCase())) {
531                  String joinCmd = joinCommand;
532                  String newChan = message.substring(message.indexOf(joinCmd) + joinCmd.length() + 1);
533                  int endOfChan = newChan.indexOf(" ");
# Line 527 | Line 543 | public class IRC__Alerter extends AlerterSkeleton {
543                      _channel = newChan;
544                  }
545              }
546 <            else if(message.equalsIgnoreCase(nickChangeCommand)) {
546 >            else if(message.toLowerCase().startsWith(nickChangeCommand.toLowerCase())) {
547                  String nickChangeCmd = nickChangeCommand;
548                  String newNick = message.substring(message.indexOf(nickChangeCmd) + nickChangeCmd.length() + 1);
549                  int endOfNick = newNick.indexOf(" ");
# Line 538 | Line 554 | public class IRC__Alerter extends AlerterSkeleton {
554                  changeNick(newNick);
555              }
556              else if(message.equalsIgnoreCase(versionCommand)) {
557 <                sendMessage(source, "I am version "+REVISION.substring(11, REVISION.length()-2)+" of the i-scream alerting bot");
557 >                sendMessage(source, "I am version " + getRevision() + " of the i-scream alerting bot");
558              }
559              else if(message.equalsIgnoreCase(helpCommand)) {
560                  sendMessage(source, "Hello, I am the i-scream alerting bot version "+REVISION.substring(11, REVISION.length() -2));
# Line 627 | Line 643 | public class IRC__Alerter extends AlerterSkeleton {
643              try {
644                  Thread.sleep(delayTime * 1000);
645              } catch (InterruptedException e) {}
646 +        }
647 +        
648 +        /**
649 +         * Returns the revision of the bot.
650 +         *
651 +         * @return the revision of this bot
652 +         */
653 +        private String getRevision() {
654 +            return REVISION.substring(11, REVISION.length()-2);
655          }
656          
657          /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines