Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/hotmail
In directory sc8-pr-cvs1:/tmp/cvs-serv21049
Modified Files:
HotmailMailSession.java
Log Message:
Updated for new hotmail interface
Index: HotmailMailSession.java
===================================================================
RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/hotmail/HotmailMailSession.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** HotmailMailSession.java 6 Oct 2003 14:30:11 -0000 1.29
--- HotmailMailSession.java 2 Dec 2003 11:01:04 -0000 1.30
***************
*** 42,46 ****
/*
! Hotmail module (v0.7) for MyPostman.
Supports retrieval of unread Inbox messages complete with attachements.
--- 42,46 ----
/*
! Hotmail module (v0.8) for MyPostman.
Supports retrieval of unread Inbox messages complete with attachements.
***************
*** 122,125 ****
--- 122,129 ----
local.put("JA", new String[] {"\u53d7\u4fe1\u30c8\u30ec\u30a4", "(\\d+)\\s<b>\\((\\d+)\\)"});
local.put("NL", new String[] {"Postvak IN", "(\\d+)\\s<b>\\((\\d+)\\)"});
+
+ // New as of 2 Dec 03
+ local.put("EN", new String[] {"Mail", "New mail from my contacts:"});
+ // **TODO** add other languages here!
}
***************
*** 451,458 ****
try {
String[] arr = (String[]) local.get(lang);
! inboxUrlPattern = Pattern.compile("<a href=\"(\\S+)\"><font class=\".*\">" + arr[0]
! + "\\s*:\\s" + arr[1] + "</b>");
logger.fine(" Using inboxUrlPattern :" + inboxUrlPattern.pattern());
//messageCountPattern = Pattern.compile("<td.*><font.*>" + arr[1] + "</font></td>");
//logger.fine(" Using inboxUrlPattern :" + messageCountPattern.pattern());
} catch (Exception e) {
--- 455,466 ----
try {
String[] arr = (String[]) local.get(lang);
! // CH - New login structure 2/12/03
! //inboxUrlPattern = Pattern.compile("<a href=\"(\\S+)\"><font class=\".*\">" + arr[0]
! // + "\\s*:\\s" + arr[1] + "</b>");
! inboxUrlPattern = Pattern.compile("<a href=\"(\\S+)\" tabindex=121 class=\"E\">" + arr[0] + "</a>");
logger.fine(" Using inboxUrlPattern :" + inboxUrlPattern.pattern());
//messageCountPattern = Pattern.compile("<td.*><font.*>" + arr[1] + "</font></td>");
+ messageCountPattern = Pattern.compile("<td.*><font.*>" + arr[1] + "</font><td.*><font.*> (\\d+)</font></td>");
+ logger.fine("Using message count pattern: " + messageCountPattern);
//logger.fine(" Using inboxUrlPattern :" + messageCountPattern.pattern());
} catch (Exception e) {
***************
*** 466,475 ****
if (inboxMatcher.find()) {
inboxUrlStr = inboxMatcher.group(1);
// new structure has this on the same line:
! numMessages = Integer.parseInt(inboxMatcher.group(2));
! numNewMessages = Integer.parseInt(inboxMatcher.group(3));
! logger.info("Number of messages in inbox: " + numMessages);
! logger.info("Number new: " + numNewMessages);
!
/* //changed as of 7 May 03
//The msg count should be on the next line...
--- 474,487 ----
if (inboxMatcher.find()) {
inboxUrlStr = inboxMatcher.group(1);
+ logger.info("Found Inbox url: " + inboxUrlStr);
+ //changed again - 2/12/03 - CH
// new structure has this on the same line:
! //numMessages = Integer.parseInt(inboxMatcher.group(2));
! //numNewMessages = Integer.parseInt(inboxMatcher.group(3));
! //logger.info("Number of messages in inbox: " + numMessages);
! //logger.info("Number new: " + numNewMessages);
! }
! //changed again - 2/12/03 - CH
! msgCountMatcher = messageCountPattern.matcher(line);
/* //changed as of 7 May 03
//The msg count should be on the next line...
***************
*** 477,492 ****
logger.finest("html: " + line);
msgCountMatcher = messageCountPattern.matcher(line);
-
- if (msgCountMatcher.find()) {
- logger.info("Line containing the number of messages found!");
- numMessages = Integer.parseInt(msgCountMatcher.group(1));
- numNewMessages = Integer.parseInt(msgCountMatcher.group(2));
- logger.info("Number of messages in inbox: " + numMessages);
- logger.info("Number new: " + numNewMessages);
- }
- }
*/
!
! }
}
--- 489,502 ----
logger.finest("html: " + line);
msgCountMatcher = messageCountPattern.matcher(line);
*/
! if (msgCountMatcher.find()) {
! logger.info("Line containing the number of new messages found!");
! //numMessages = Integer.parseInt(msgCountMatcher.group(1));
! numNewMessages = Integer.parseInt(msgCountMatcher.group(1));
! //logger.info("Number of messages in inbox: " + numMessages);
! logger.info("Number new: " + numNewMessages);
!
! }
!
}
***************
*** 509,516 ****
//verify we were able to determine the correct number of messages...
! if (numMessages > -1) {
authenticated = true;
return WebMailSession.WMS_LOGIN_OK;
! }
}
--- 519,526 ----
//verify we were able to determine the correct number of messages...
! //if (numMessages > -1) {
authenticated = true;
return WebMailSession.WMS_LOGIN_OK;
! //}
}
***************
*** 587,591 ****
// Fixed bug: the .\d* part is optional for MSN system messages
! Pattern messagePattern = Pattern.compile("<a href=\"(\\S+)msg=MSG(\\d+(\\.\\d*)?)[\\&|\"]");
Pattern sizePattern = Pattern.compile("\\&start=\\d+\\&len=(\\d+)");
--- 597,601 ----
// Fixed bug: the .\d* part is optional for MSN system messages
! Pattern messagePattern = Pattern.compile("<a href=\"javascript:G\\('(\\S+)msg=MSG(\\d+(\\.\\d*)?)[\\&|\"]");
Pattern sizePattern = Pattern.compile("\\&start=\\d+\\&len=(\\d+)");
***************
*** 598,601 ****
--- 608,612 ----
if (matcher.find()) {
msgReadBaseUrl = matcher.group(1);
+ logger.finest("msgReadBaseUrl: " + msgReadBaseUrl);
MailIdentifier mi = new MailIdentifier();
mi.MailID = matcher.group(2);
***************
*** 694,697 ****
--- 705,712 ----
}
+ logger.finest("retrieveMessage " + num +" , " + numLines);
+ logger.finest("messageIDS.size() = " + messageIDS.size());
+ logger.finest(baseUrl);
+ logger.finest(msgReadBaseUrl);
try {
URL url = new URL(baseUrl + msgReadBaseUrl + "msg=MSG"
|