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 HotmailNotificationMessage extends MimeMessage {
27    private int inboxUnread;
28    private int foldersUnread;
29    private String inboxURL;
30    private String foldersURL;
31    private String postURL;
32  
33    /***
34     *  Description of the Method
35     *
36     *@param  account
37     *      Description of the Parameter
38     *@param  nick
39     *      Description of the Parameter
40     *@param  lineList
41     *      Description of the Parameter
42     *@exception  net.sf.dexterim.msn.engine.MessageFormatException
43     *      Description of the Exception
44     */
45    public void processMessage(
46      String account,
47      String nick,
48      java.util.List lineList)
49      throws net.sf.dexterim.msn.message.MessageFormatException {
50      java.util.Iterator lineIter = lineList.iterator();
51  
52      while (lineIter.hasNext()) {
53        TokenizedLine tokenLine = new TokenizedLine((String)lineIter.next());
54  
55        if (tokenLine.getTokenCount() > 1) {
56          if ("Inbox-Unread:".equals(tokenLine.getToken(0))) {
57            try {
58              inboxUnread = Integer.parseInt(tokenLine.getToken(1));
59            }
60            catch (NumberFormatException nex) {
61              throw new net.sf.dexterim.msn.message.MessageFormatException(nex);
62            }
63          }
64          else if ("Folders-Unread:".equals(tokenLine.getToken(0))) {
65            try {
66              foldersUnread = Integer.parseInt(tokenLine.getToken(1));
67            }
68            catch (NumberFormatException nex) {
69              throw new net.sf.dexterim.msn.message.MessageFormatException(nex);
70            }
71          }
72          else if ("Inbox-URL:".equals(tokenLine.getToken(0))) {
73            inboxURL = tokenLine.getToken(1);
74          }
75          else if ("Folders-URL:".equals(tokenLine.getToken(0))) {
76            foldersURL = tokenLine.getToken(1);
77          }
78          else if ("Post-URL:".equals(tokenLine.getToken(0))) {
79            postURL = tokenLine.getToken(1);
80          }
81        }
82      }
83    }
84  
85    /***
86     *  Getter for property inboxUnread.
87     *
88     *@return    Value of property inboxUnread.
89     */
90    public int getInboxUnread() {
91      return inboxUnread;
92    }
93  
94    /***
95     *  Getter for property foldersUnread.
96     *
97     *@return    Value of property foldersUnread.
98     */
99    public int getFoldersUnread() {
100     return foldersUnread;
101   }
102 
103   /* (non-Javadoc)
104    * @see net.sf.dexterim.msn.message.MsnMessage#process(net.sf.dexterim.msn.MsnConnection)
105    */
106   public void process(MsnConnection connection) {
107     // TODO Auto-generated method stub
108     
109   }
110 }