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