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