View Javadoc
1   //////////////////////////////////////////////////////////////////////////////
2   // dexterIM - Instant Messaging Framework
3   // Copyright (C) 2003  Christoph Walcher
4   //
5   // This program is free software; you can redistribute it and/or modify
6   // it under the terms of the GNU General Public License as published by
7   // the Free Software Foundation; either version 2 of the License, or
8   // (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  package net.sf.dexterim.msn.message;
20  
21  import java.util.StringTokenizer;
22  
23  import net.sf.dexterim.msn.MsnConnection;
24  import net.sf.dexterim.msn.util.MD5;
25  
26  /***
27   *  Description of the Class
28   *
29   *@author     christoph
30   */
31  public class ChallengeMessage extends SingleLineMessage {
32    private MD5 md5Hash;
33  
34    /***
35     *  Constructor for the CheckMessage object
36     */
37    public ChallengeMessage() {
38    }
39  
40    /***
41     *  Gets the messageCommand attribute of the CheckMessage object
42     *
43     *@return    The messageCommand value
44     */
45    public String getMessageCommand() {
46      return MsnMessageFactory.CMD_CHECK;
47    }
48  
49    /***
50     *  Getter for property md5Hash.
51     *
52     *@return    Value of property md5Hash.
53     */
54    public MD5 getMd5Hash() {
55      return md5Hash;
56    }
57  
58    /***
59     *  Adds a feature to the Line attribute of the CheckMessage object
60     *
61     *@param  line  The feature to be added to the Line attribute
62     *@return       Description of the Return Value
63     */
64    public MsnMessage addLine(String line) {
65      StringTokenizer st = new StringTokenizer(line);
66  
67      st.nextToken();
68  
69      st.nextToken();
70  
71      String s = st.nextToken() + MsnMessageFactory.MAGIC_STRING;
72  
73      md5Hash = new MD5(s);
74  
75      return this;
76    }
77  
78    /* (non-Javadoc)
79     * @see net.sf.dexterim.msn.message.MsnMessage#process(net.sf.dexterim.msn.MsnConnection)
80     */
81    public void process(MsnConnection connection) {
82      connection.challengeReceived(this);
83    }
84  }