View Javadoc

1   /* Copyright 2006 The JA-SIG Collaborative.  All rights reserved.
2   *  See license distributed with this file and
3   *  available online at http://www.uportal.org/license.html
4   */
5   
6   package org.jasig.irclog.events;
7   
8   import java.util.ArrayList;
9   import java.util.Arrays;
10  import java.util.Collections;
11  import java.util.List;
12  
13  import org.jibble.pircbot.PircBot;
14  
15  /***
16   * @see PircBot#onNickChange(String, String, String, String)
17   * 
18   * @author Eric Dalquist <a href="mailto:eric.dalquist@doit.wisc.edu">eric.dalquist@doit.wisc.edu</a>
19   * @version $Revision$
20   */
21  public class NickChangeEvent extends IrcEvent {
22      private static final List<String> PROPERTIES = Collections.unmodifiableList(Arrays.asList(new String[] { "oldNick", "login", "hostname", "newNick" }));
23      
24      protected final String oldNick;
25      protected final String login;
26      protected final String hostname;
27      protected final String newNick;
28      
29      public NickChangeEvent(final PircBot source, final String oldNick, final String login, final String hostname, final String newNick) {
30          super(source);
31          this.oldNick = oldNick;
32          this.login = login;
33          this.hostname = hostname;
34          this.newNick = newNick;
35      }
36  
37      /***
38       * @see org.jasig.irclog.events.IrcEvent#getArgumentProperties()
39       */
40      @Override
41      protected List<String> getArgumentProperties() {
42          final List<String> parentProps = super.getArgumentProperties();
43          final List<String> props = new ArrayList<String>(PROPERTIES.size() + parentProps.size());
44          
45          props.addAll(parentProps);
46          props.addAll(PROPERTIES);
47          
48          return props;
49      }
50  
51      /***
52       * @return the hostname
53       */
54      public String getHostname() {
55          return this.hostname;
56      }
57  
58      /***
59       * @return the login
60       */
61      public String getLogin() {
62          return this.login;
63      }
64  
65      /***
66       * @return the newNick
67       */
68      public String getNewNick() {
69          return this.newNick;
70      }
71  
72      /***
73       * @return the oldNick
74       */
75      public String getOldNick() {
76          return this.oldNick;
77      }
78  }