Changeset 274
- Timestamp:
- 08/19/08 07:51:07 PM (5 months ago)
- Location:
- branches/LogicMail-1.0/LogicMail/src/org/logicprobe/LogicMail
- Files:
-
- 3 modified
-
mail/imap/ImapParser.java (modified) (1 diff)
-
ui/CompositionScreen.java (modified) (1 diff)
-
util/StringParser.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/LogicMail-1.0/LogicMail/src/org/logicprobe/LogicMail/mail/imap/ImapParser.java
r198 r274 213 213 hostName = (String)entry.elementAt(3); 214 214 } 215 216 String addrStr = 217 (mbName.equals(strNIL) ? "" : mbName) + 218 (hostName.equals(strNIL) ? "" : ('@' + hostName)); 215 219 // Now assemble these into a single address entry 216 220 // (possibly eventually storing them separately) 217 221 if(realName.length() > 0 && !realName.equals(strNIL)) { 218 addrList[index] = realName + " <" + mbName + "@" + hostName+ ">";222 addrList[index] = realName + " <" + addrStr + ">"; 219 223 } 220 224 else { 221 addrList[index] = mbName + "@" + hostName;225 addrList[index] = addrStr; 222 226 } 223 227 index++; -
branches/LogicMail-1.0/LogicMail/src/org/logicprobe/LogicMail/ui/CompositionScreen.java
r200 r274 128 128 if(env.to != null) { 129 129 for(i=0; i<env.to.length; i++) { 130 insertRecipientField(EmailAddressBookEditField.ADDRESS_TO).setAddress(env.to[i]); 130 if(env.to[i].indexOf('@') != -1) { 131 insertRecipientField(EmailAddressBookEditField.ADDRESS_TO).setAddress(env.to[i]); 132 } 131 133 } 132 134 } 133 135 if(env.cc != null) { 134 136 for(i=0; i<env.cc.length; i++) { 135 insertRecipientField(EmailAddressBookEditField.ADDRESS_CC).setAddress(env.cc[i]); 137 if(env.cc[i].indexOf('@') != -1) { 138 insertRecipientField(EmailAddressBookEditField.ADDRESS_CC).setAddress(env.cc[i]); 139 } 136 140 } 137 141 } 138 142 if(env.bcc != null) { 139 143 for(i=0; i<env.bcc.length; i++) { 140 insertRecipientField(EmailAddressBookEditField.ADDRESS_BCC).setAddress(env.bcc[i]); 144 if(env.bcc[i].indexOf('@') != -1) { 145 insertRecipientField(EmailAddressBookEditField.ADDRESS_BCC).setAddress(env.bcc[i]); 146 } 141 147 } 142 148 } -
branches/LogicMail-1.0/LogicMail/src/org/logicprobe/LogicMail/util/StringParser.java
r254 r274 334 334 return buf.toString(); 335 335 } 336 336 337 337 /** 338 338 * Recursively parse a nested paren string. … … 359 359 boolean inQuote = false; 360 360 while(q < rawText.length()) { 361 if( rawText.charAt(q) == '\"') {361 if(isQuoteChar(rawText, q, p)) { 362 362 if(!inQuote) { 363 363 inQuote = true; … … 422 422 } 423 423 } 424 if(rawText.charAt(i) == '\"' && !subInQuote) { 424 425 if(isQuoteChar(rawText, i, q+1) && !subInQuote) { 425 426 subInQuote = true; 426 427 } 427 else if( rawText.charAt(i) == '\"'&& subInQuote) {428 else if(isQuoteChar(rawText, i, q+1) && subInQuote) { 428 429 subInQuote = false; 429 430 } … … 454 455 } 455 456 return parsedText; 457 } 458 459 /** 460 * Helper method to determine if a character is a quote. 461 */ 462 private static boolean isQuoteChar(String rawText, int index, int startIndex) 463 { 464 if(index == startIndex) { 465 return rawText.charAt(index) == '\"'; 466 } 467 else if(rawText.charAt(index) == '\"') { 468 if(rawText.charAt(index - 1) == '\\') { 469 if(index - 2 < startIndex || rawText.charAt(index - 2) == '\\') { 470 return true; 471 } 472 else { 473 return false; 474 } 475 } 476 else { 477 return true; 478 } 479 } 480 else { 481 return false; 482 } 456 483 } 457 484
