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.SpecialCharacters;
25  
26  /***
27   *@author     Christoph Walcher
28   */
29  public class PersonalInformationMessage extends SingleLineMessage {
30    private String phoneNumber;
31    private String type;
32  
33    /***
34     *  Description of the Field
35     */
36    public final static String WORK = "PHW";
37  
38    /***
39     *  Description of the Field
40     */
41    public final static String HOME = "PHH";
42  
43    /***
44     *  Description of the Field
45     */
46    public final static String MOBILE = "PHM";
47  
48    public final static String SCREEN_NAME = "MFN";
49    
50    /***
51     *  Creates a new instance of BuddyPhoneMessage
52     */
53    public PersonalInformationMessage() {
54    }
55  
56    /***
57     *  Gets the messageCommand attribute of the PersonalInformationMessage object
58     *
59     *@return    The messageCommand value
60     */
61    public String getMessageCommand() {
62      return MsnMessageFactory.CMD_PERSONAL_PHONE_NUMBER;
63    }
64  
65    /***
66     *  Getter for property type.
67     *
68     *@return    Value of property type.
69     */
70    public String getType() {
71      return type;
72    }
73  
74    /***
75     *  Getter for property phoneNumber.
76     *
77     *@return    Value of property phoneNumber.
78     */
79    public String getPhoneNumber() {
80      return phoneNumber;
81    }
82  
83    /***
84     *  Adds a feature to the Line attribute of the PersonalInformationMessage object
85     *
86     *@param  line  The feature to be added to the Line attribute
87     *@return       Description of the Return Value
88     */
89    public MsnMessage addLine(String line) {
90      // Message Prototype:
91      // PRP 54 PHH 555%20555-0690
92      StringTokenizer st = new StringTokenizer(line);
93  
94      st.nextToken();
95  
96      //skip CMD_PERSONAL_PHONE_NUMBER
97      st.nextToken();
98  
99      // skip Transaction ID
100     st.nextToken();
101 
102     // Possibly not set
103     if (st.hasMoreTokens()) {
104       phoneNumber =
105         SpecialCharacters.getInstance().decode(
106           st.nextToken(),
107           true);
108     }
109 
110     return this;
111   }
112 
113   /* (non-Javadoc)
114    * @see net.sf.dexterim.msn.message.MsnMessage#process(net.sf.dexterim.msn.MsnConnection)
115    */
116   public void process(MsnConnection connection) {
117     // TODO Auto-generated method stub
118     
119   }
120 }