Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/wilko/jaim/NickTocResponse.java


1   /* 
2    *   (C) 2002 Paul Wilkinson  wilko@users.sourceforge.net
3    *
4    *   This program is free software; you can redistribute it and/or modify
5    *   it under the terms of the GNU General Public License as published by
6    *   the Free Software Foundation; either version 2 of the License, or
7    *   (at your option) any later version.
8    *
9    *   This program is distributed in the hope that it will be useful,
10   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   *   GNU General Public License for more details.
13   *
14   *   You should have received a copy of the GNU General Public License
15   *   along with this program; if not, write to the Free Software
16   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17   *
18   */
19  
20  /*
21   * NickTocResponse.java
22   *
23   * Created on 6 May 2002, 17:21
24   */
25  
26  package com.wilko.jaim;
27  
28  /**
29  * The NicTocResponse is used internally to manage the TOC signon process.  It is not delivered to clients of {@link JaimConnection}
30   * @author  paulw
31   * @version $Revision: 1.6 $
32   */
33  public class NickTocResponse extends TocResponse implements TocResponseHandler {
34  
35      private String nickName;
36      
37      public static final String RESPONSE_TYPE="NICK";
38      
39      
40      /** Creates new NickTocResponse */
41      public NickTocResponse() {
42          nickName="";
43      }
44  
45      
46      public TocResponse parseString(java.lang.String str) {
47          NickTocResponse tr=new NickTocResponse();
48          tr.doParse(str);
49          return(tr);
50      }
51      
52      private void doParse(String str)
53      {
54          int colonPos=str.indexOf(':');
55          
56              if (colonPos != -1)
57              {
58                  nickName=str.substring(colonPos+1);
59              }
60          
61          
62      }
63      
64      public String getNickName()
65      {
66          return(nickName);
67      }
68      
69      
70      public String getResponseType() {
71          return RESPONSE_TYPE;
72      }
73      
74      /** Returns true if this response handler can handle the specified response.
75       * @param Response - the response string from TOC.  This is the part of the response before the first ':'
76       * @return true if the response can be handled
77       */
78      public boolean canHandle(String Response) {
79          return(Response.equalsIgnoreCase(RESPONSE_TYPE));
80      }
81      
82  }