Commit Graph

598 Commits

Author SHA1 Message Date
Andrew Chen f24d4c9155 Merge pull request #72 from andrewgaul/remove-literal
Remove unused literal methods
2011-10-27 23:32:28 -07:00
cketti e3f6561008 Don't crash when trying to connect to an non-SSL service using SSL
Fixes issue 3798
2011-10-28 04:59:08 +02:00
cketti 91ee21bb2d Use "String.length() == 0" instead of String.isEmpty() [API 9+] 2011-10-27 19:11:44 +02:00
cketti b69d6cb64c Use Locale.US with toUpperCase() and toLowerCase() where appropriate 2011-10-27 17:17:43 +02:00
cketti 9327c86fe7 Use Locale.US when calling toUpperCase() on the generated MIME boundary
Fixes issue 3733
2011-10-27 16:52:27 +02:00
Andrew Chen b6cdec43e9 Merge pull request #73 from andrewgaul/address-parse-npe
Fix NPE in Address.Parse
2011-10-26 18:15:40 -07:00
Andrew Gaul ad5676ed28 Fix NPE in Address.Parse
Found by FindBugs.  Also avoid an allocation in the uncommon case.
2011-10-25 21:24:38 -07:00
Andrew Gaul e394924ce4 Prefer Random.nextInt over Math.random
Addresses a FindBugs complaint.
2011-10-25 21:21:23 -07:00
Andrew Gaul a2d0f9ccb7 Remove unused literal methods 2011-10-25 13:56:07 -07:00
Jesse Vincent ae3f098b4a Merge pull request #64 from andrewgaul/typesafe-set
Avoid type-unsafe Set
2011-10-20 05:34:48 -07:00
Andrew Gaul 5b9f542bd7 Avoid type-unsafe Set 2011-10-19 23:05:34 -07:00
Andrew Gaul ce4b42f66b Remove duplicated combine flags code 2011-10-19 22:04:57 -07:00
Andrew Gaul 80d9246130 Prefer unsynchronized Collection types 2011-10-19 21:56:20 -07:00
cketti dd8cd33c5a Fixed decoding of store URIs with empty passwords 2011-10-18 05:05:40 +02:00
cketti 6b5b4e474e Fixed store URI encoding/decoding in Pop3Store 2011-10-17 05:59:36 +02:00
cketti d87e25dde1 Added new authentication methods to SmtpTransport.createUri() 2011-10-17 04:57:01 +02:00
cketti 52a92d93a1 Add dialog to ask for server passwords after import 2011-10-17 04:34:26 +02:00
cketti fc8d2e9979 Merge branch 'master' into issue549
Conflicts:
	res/menu/accounts_context.xml
	res/menu/accounts_option.xml
	res/values/strings.xml
	src/com/fsck/k9/Account.java
	src/com/fsck/k9/activity/Accounts.java
	src/com/fsck/k9/activity/AsyncUIProcessor.java
	src/com/fsck/k9/activity/FolderList.java
	src/com/fsck/k9/activity/ImportListener.java
	src/com/fsck/k9/activity/K9Activity.java
	src/com/fsck/k9/activity/K9ListActivity.java
	src/com/fsck/k9/activity/MessageView.java
	src/com/fsck/k9/mail/store/ImapStore.java
	src/com/fsck/k9/mail/store/Pop3Store.java
	src/com/fsck/k9/mail/store/WebDavStore.java
	src/com/fsck/k9/mail/transport/SmtpTransport.java
2011-10-14 20:33:25 +02:00
cketti b05750c245 Better input validation in *Store.createUri() 2011-10-13 02:35:08 +02:00
cketti 1ab7dbae54 Added input validation for folder settings 2011-10-08 21:30:45 +02:00
Andrew Gaul 57be9e3ee3 Make sets immutable
Use final and unmodifiable and avoid anonymous inner classes.
2011-10-06 20:22:18 -07:00
cketti 2e2428b093 Merge pull request #55 from andrewgaul/stringbuilder
Prefer StringBuilder over StringBuffer
2011-10-06 09:04:43 -07:00
cketti 31af4526ab Merge pull request #58 from andrewgaul/spelling
Spelling corrections
2011-10-06 09:01:37 -07:00
Andrew Gaul 220e55603d Spelling corrections 2011-10-05 22:04:39 -07:00
Andrew Gaul dad0332667 Make an inner class static 2011-10-05 22:01:53 -07:00
Andrew Gaul 47eb0fa2e1 Prefer StringBuilder over StringBuffer
The former is unsynchronized and slightly faster.
2011-10-05 21:50:31 -07:00
cketti 0619eaf79c Catch NumberFormatException when parsing disposition size parameter
Fixes issue 3712
2011-10-01 21:17:00 +02:00
Jesse Vincent fd61b4f20b Merge pull request #52 from andrewgaul/peekable-bad-offset
Fix bad offset in PeekableInputStream
2011-09-28 21:10:41 -07:00
Andrew Gaul 7cf1bfcc98 Fix bad offset in PeekableInputStream 2011-09-20 21:21:50 -07:00
Jesse Vincent 1b7481f854 optimize cketti's pop3 space-splitting code to not make lots of extra
copies of responses.
2011-09-04 15:53:12 -04:00
Jesse Vincent 1ac652dc5f Small bug introduced during a refactoring "Extracted POP3 commands and capabilities to constants" introduced a typo that broke interactions wit some POP3 servers. 2011-08-28 18:28:12 -04:00
Apoorv Khatreja 47bedec410 Fixed an issue which caused space characters to throw exceptions when being parsed. Some cosmetic changes, and context sensitivity for EXISTS, RECENT and EXPUNGE responses which have empty token lists. 2011-08-04 23:30:27 +05:30
Apoorv Khatreja 9335dacd46 Added a separate handler for status responses to parse the resp-text tokens contained in these responses. 2011-08-02 02:19:12 +05:30
Adam be1be56e3a Fixed bug where uid in response was truncated
The SAX parser returns chunks of text to the
WebDavHandler. Other tags were correctly appending
values while the special cased <uid> tag was
simply assigned the value it was given, which would
result in the last chunk assigned to it and not
the whole string of text.
2011-07-28 15:08:00 -04:00
Jesse Vincent 3679b31b12 Workaround for market-reported error:
java.lang.Error: org.apache.james.mime4j.io.MaxHeaderLimitException: Maximum header limit exceeded
at com.kaitenmail.mail.internet.MimeMessage.parse(MimeMessage.java:85)
at com.kaitenmail.mail.store.Pop3Store$Pop3Message.parse(Pop3Store.java:932)
at com.kaitenmail.mail.store.Pop3Store$Pop3Folder.fetchBody(Pop3Store.java:714)
at com.kaitenmail.mail.store.Pop3Store$Pop3Folder.fetch(Pop3Store.java:579)
at com.kaitenmail.controller.MessagingController.downloadSmallMessages(MessagingController.java:1562)
at com.kaitenmail.controller.MessagingController.downloadMessages(MessagingController.java:1288)
at com.kaitenmail.controller.MessagingController.synchronizeMailboxSynchronous(MessagingController.java:1031)
at com.kaitenmail.controller.MessagingController.access$400(MessagingController.java:81)
at com.kaitenmail.controller.MessagingController$8.run(MessagingController.java:823)
at com.kaitenmail.controller.MessagingController.run(MessagingController.java:276)
at java.lang.Thread.run(Thread.java:1096)
Caused by: org.apache.james.mime4j.io.MaxHeaderLimitException: Maximum header limit exceeded
at org.apache.james.mime4j.stream.AbstractEntity.parseField(AbstractEntity.java:153)
at org.apache.james.mime4j.stream.MimeEntity.advance(MimeEntity.java:120)
at org.apache.james.mime4j.stream.MimeTokenStream.next(MimeTokenStream.java:351)
at org.apache.james.mime4j.parser.MimeStreamParser.parse(MimeStreamParser.java:179)
at com.kaitenmail.mail.internet.MimeMessage.parse(MimeMessage.java:83)
... 10 more
2011-07-25 01:49:42 -04:00
Jesse Vincent 0543183b11 Work around a weird NPE in WebDAV sync reported by Jon Blow 2011-07-19 22:43:32 -04:00
cketti 2acd55a9ef Implemented work-around to handle malformed UIDL responses (POP3).
Fixes issue 3546
2011-07-17 14:37:21 +02:00
cketti 9f581cb6f3 Extracted POP3 commands and capabilities to constants 2011-07-17 14:13:04 +02:00
Apoorv Khatreja adc7d65d09 Newline :/ 2011-07-17 01:42:12 +05:30
Apoorv Khatreja c6a2cb48b1 Added method to check for status response. 2011-07-17 01:41:14 +05:30
Apoorv Khatreja 021d5641e5 ant astyle 2011-07-17 01:40:20 +05:30
Jesse Vincent b85c9b7b0e Work around the fact that when we can't get read status for a message,
we'd end up with an NPE as we then queried the hashmap
2011-07-11 11:08:20 -04:00
Jesse Vincent 98ae8cf2be refactoring to use the object we extracted from the array 2011-07-11 11:08:20 -04:00
Jesse Vincent d7dfba15cf It appears that Exchange is returning responses
without a visiblecount element for empty folders
Which resulted in this code returning -1 (as that was
the previous default.)
-1 is an error condition. Now the default is empty
2011-07-09 17:00:35 -04:00
Jesse Vincent 220be75473 Add a bit of logging to find out what webdav servers tell us about how
many messages they have in debug mode
2011-07-09 16:24:18 -04:00
Jesse Vincent 8cffc5b682 Bullet proofing for user-reported exceptions in WebDAV sync:
E/k9      ( 5735): java.lang.NullPointerException
E/k9      ( 5735):      at
com.kaitenmail.mail.store.WebDavStore$WebDavMessage.setNewHeaders(WebDavStore.java:1903)
E/k9      ( 5735):      at
com.kaitenmail.mail.store.WebDavStore$WebDavFolder.fetchEnvelope(WebDavStore.java:1655)
E/k9      ( 5735):      at
com.kaitenmail.mail.store.WebDavStore$WebDavFolder.fetchEnvelope(WebDavStore.java:1627)
E/k9      ( 5735):      at
com.kaitenmail.mail.store.WebDavStore$WebDavFolder.fetchEnvelope(WebDavStore.java:1627)
E/k9      ( 5735):      at
com.kaitenmail.mail.store.WebDavStore$WebDavFolder.fetchEnvelope(WebDavStore.java:1627)
E/k9      ( 5735):      at
com.kaitenmail.mail.store.WebDavStore$WebDavFolder.fetchEnvelope(WebDavStore.java:1627)
E/k9      ( 5735):      at
com.kaitenmail.mail.store.WebDavStore$WebDavFolder.fetch(WebDavStore.java:1404)
E/k9      ( 5735):      at
com.kaitenmail.controller.MessagingController.fetchUnsyncedMessages(MessagingController.java:1418)
E/k9      ( 5735):      at
com.kaitenmail.controller.MessagingController.downloadMessages(MessagingController.java:1253)
E/k9      ( 5735):      at
com.kaitenmail.controller.MessagingController.synchronizeMailboxSynchronous(MessagingController.java:1031)
E/k9      ( 5735):      at
com.kaitenmail.controller.MessagingController.access$400(MessagingController.java:81)
E/k9      ( 5735):      at
com.kaitenmail.controller.MessagingController$30.run(MessagingController.java:3768)
E/k9      ( 5735):      at
com.kaitenmail.controller.MessagingController.run(MessagingController.java:276)
E/k9      ( 5735):      at java.lang.Thread.run(Thread.java:1096)
2011-07-09 15:26:30 -04:00
cketti d310167b99 Rewrite mime type image/pjpeg to image/jpeg
Fixes issue 1712
2011-07-07 03:05:12 +02:00
Jesse Vincent b02b895aaf Add 2MB, 5MB and "All" message download options 2011-07-02 15:29:49 -04:00
Jesse Vincent 2a698f1ab9 ant astyle 2011-07-02 15:18:43 -04:00
cketti 1bdf7095a7 Delete the old localized outbox. Fixes the "two outboxes" problem.
Rename the "new" hardcoded outbox to "K9MAIL_INTERNAL_OUTBOX". This
is done to avoid collisions with folders named "OUTBOX" in a remote
store. See
https://groups.google.com/group/k-9-mail/browse_thread/thread/cbb1c77abba84695

Fixes issue 3411
2011-06-17 06:17:01 +02:00
cketti 222cd43c80 Some code cleanup. No functional changes. 2011-06-17 04:13:32 +02:00
Jesse Vincent 379a8dfa9e It turns out that 79a96952f2 has caused a
lot of messages to be unreadable in K-9 3.8.  (see mailing list
threads)
2011-06-09 21:54:22 -04:00
cketti ded489daab Add support for incoming-server and outgoing-server elements on import 2011-06-09 05:50:43 +02:00
cketti 4a807e33d9 Decode transport URIs into ServerSettings objects 2011-06-07 16:39:41 +02:00
cketti bccf0b5546 Renamed class StoreSettings to ServerSettings 2011-06-07 16:09:15 +02:00
cketti f4bcb4d923 Extracted inner class Store.StoreSettings 2011-06-07 15:59:23 +02:00
cketti f6de6f8e42 Save name of the store type in StoreSettings 2011-06-07 04:07:50 +02:00
cketti 25c1a565e7 WebDavStore cleanup
Store port number so we can throw away the store URI once decoded
2011-06-07 03:01:02 +02:00
cketti 29738993d9 Added function to decode store URIs into a container object
This will later be used by the export code to make exporting the
password optional (and the XML output "pretty").
It's also the first step to get away from store URIs towards something
more easily extensible, like Store.StoreSettings.
2011-06-07 00:08:43 +02:00
cketti 0e2afc38ef Cosmetic changes
- Grouped static fields and functions
- Renamed static fields to match code standard
2011-06-06 21:10:14 +02:00
Jesse Vincent 31adcd2ed8 Revert "http://code.google.com/p/k9mail/issues/detail?id=3408&sort=-id&colspec=ID%20Product%20Type%20Status%20Priority%20Milestone%20Owner%20Summary"
This reverts commit 0c2e06133c.

The patch would cause an extra SMTP connection on _any_ meesage with
attachments. Marcus is headed away on holiday and asked me to revert it
for him (after I asked him to revert it) - With luck, we'll talk through
a design to work around this issue on the list

Conflicts:

	src/com/fsck/k9/mail/transport/SmtpTransport.java
2011-06-02 09:35:03 -04:00
Jesse Vincent 3d583da450 ant astyle 2011-06-01 16:03:56 -04:00
Marcus Wolschon 0c2e06133c http://code.google.com/p/k9mail/issues/detail?id=3408&sort=-id&colspec=ID%20Product%20Type%20Status%20Priority%20Milestone%20Owner%20Summary
Issue 3408: 	SMTP timeouts while calculating message size
2011-06-01 09:13:16 +02:00
Marcus Wolschon 0b6f0a09bb http://code.google.com/p/k9mail/issues/detail?id=3407&sort=-id&colspec=ID%20Product%20Type%20Status%20Priority%20Milestone%20Owner%20Summary
Issue 3407: 	Handling of SMTP 5xx error codes unclean

fix part one: 5xx error codes are detected in SMTP-code and reported as permanent failures.
2011-06-01 09:07:05 +02:00
cketti 30d31c7074 Explicitly use Locale.US when dealing with dates in message headers 2011-05-26 04:32:26 +02:00
Jesse Vincent 92239739b0 microoptimize peekableInputStream's peek method to not do an extra
method dispatch and boolean check on every peek.
2011-05-24 21:35:18 -04:00
Jesse Vincent 29117ae7a6 Switch a StringBuffer to StringBuilder, which replaced it 2011-05-24 21:21:03 -04:00
Koji Arai b4f3712246 Should retrieve just visibleLimit messages when the local folder is cleared. 2011-05-25 00:37:51 +09:00
Koji Arai cb46f170cd Should reset visibleLimit on clear messages. 2011-05-25 00:37:49 +09:00
Koji Arai a4f7288d37 Avoid NullPointerException.
The name parameter in Content-Type may be not set.
2011-05-25 00:37:46 +09:00
cketti 2d7fad1fa9 Use InetAddress.getCanonicalHostName() instead of getHostName()
This should always return a FQDN.
2011-05-19 00:55:34 +02:00
cketti 8fc714ac4a Don't show "null" for partially downloaded messages with empty text body 2011-05-16 00:36:46 +02:00
cketti 41b039b691 Fix bug introduced with commit b7a6dbd973
Fixes issue 3297
2011-05-15 16:23:53 +02:00
cketti 95288b37d7 Removed unnecessary method implementation
Make Pop3Folder.setFlags(Flag[],boolean) throw an
UnsupportedOperationException instead of calling a method that does
just that.
2011-05-14 23:46:26 +02:00
cketti dc96bf3186 Only mark all messages as read on the server if that's supported
This change prevents K-9 Mail from establishing a connection to the
server when all messages are marked as read on a POP3 account.
2011-05-14 23:30:47 +02:00
cketti ba9bc2f8e9 Added method Folder.isFlagSupported(Flag) 2011-05-14 23:19:24 +02:00
cketti 86fca9c1f2 POP3: Check for support of the TOP command (if CAPA isn't supported)
This will allow to download partial messages if the server doesn't
support the CAPA command but supports the TOP command (e.g. Hotmail).

Fixes issue 2042
2011-05-14 21:40:21 +02:00
cketti 8e1c4acef9 Get rid of constant K9.OUTBOX
Use Account.getOutboxFolderName() instead (still hardcoded, though)
2011-05-08 02:22:38 +02:00
cketti 92ea452163 Restore hardcoded Outbox 2011-05-07 23:57:47 +02:00
cketti 33c0bf9e31 Avoid NullPointerException for messages with html_content = NULL in DB
Fixes issue 3302
2011-05-06 20:02:55 +02:00
Jesse Vincent 8a907f9be7 remove a pointless extra assignment 2011-05-05 12:47:57 -04:00
Jesse Vincent 196a9c167d comment some preview regexes 2011-05-05 12:47:39 -04:00
Andrew Chen 3fcca67ae5 Preserve legacy SMTP authentication behavior for PLAIN by trying LOGIN if supported. 2011-05-04 23:34:02 -07:00
Bernhard Redl f2283aa91e Catch IllegalCharsetNameException causing force-close on unsupported japanese charsets (issue 3272) 2011-05-01 04:32:10 +02:00
cketti b7a6dbd973 Skip IMAP folders with names that are not correctly encoded.
Configure the CharsetDecoder to throw an exception if malformed input
is encountered. Not doing this can cause an endless loop that
allocates memory until the application dies with an OutOfMemory error.
Until we have support for both a folder display name and a raw folder
name we simply ignore folders with names that aren't correctly encoded
with the modified UTF-7 variant.

Fixes issue 3268

Credits: Bernhard Redl (aatdark) analysed the problem and wrote the
initial version of the fix.
2011-04-28 04:46:01 +02:00
cketti 037b0ff64d Fix automatic authentication method selection for SMTP
Only use automatic authentication method selection if none was
explicitly selected in outgoing server settings.
2011-04-26 18:23:41 +02:00
cketti e8a1a9a466 Restored semantics of auth*Supported in SMTP authentication code
Also, display a debug message if a certain authentication method was
selected by the user but the server didn't advertise support for it in
the EHLO response.
2011-04-26 17:49:40 +02:00
Jonas Hurrelmann da38149091 Support for SMTP authentication methods that are not announced by the server.
- Added AUTOMATIC as a new authentication method that will automatically choose the best authentication method (basically old behavior with CRAM_MD5). All other options will now enforce the selected authentication method.
- Added LOGIN as selectable option.
- Cleaned up code so strings to the different authentication methods are only defined once.
2011-04-25 22:32:48 +02:00
cketti 4b2fe6efab Removed unused imports 2011-04-21 00:00:16 +02:00
cketti 49308922d9 Refactored code to calculate number of unread messages some more 2011-04-20 23:58:10 +02:00
Bernhard Redl 92f7c3a19f Refactored the code to calculate the number of unread messages in an account 2011-04-20 23:35:02 +10:00
Bernhard Redl 415c11d712 "When calculating the number of unread messages shown in the account list, INBOX now is always counted, even if a "special" folder has been set to INBOX (issue 3074) 2011-04-20 23:09:02 +10:00
Jesse Vincent d3848d352d astyle 2011-04-12 22:17:22 +10:00
bitblaster d2c56edbd2 Restored original imports, added comments, changed method createFolder 2011-04-12 22:17:11 +10:00
bitblaster 0a5d7ba953 In getPersonalNameSpaces now we ask the server for the real folder names corresponding to the special folders ids (for which we have constants), so we can map the account folders using the real names. 2011-04-12 22:17:11 +10:00
bitblaster c46372b58c Replaced references to K9.INBOX with account.getInboxFolderName() 2011-04-12 22:17:11 +10:00
bitblaster 59b1d57658 Replaced references to K9.INBOX with account.getInboxFolderName() 2011-04-12 22:17:11 +10:00
bitblaster 20a9043a13 Replaced references to K9.INBOX with account.getInboxFolderName() 2011-04-12 22:17:11 +10:00
Jesse Vincent 0174988d27 astyle 2011-04-12 22:16:22 +10:00
Sander Bogaert c283449d04 Added another badDateTimeFormat to ImapResponseParser.
Some IMAP servers generate timestamps without timezones. :/

Fixes gcode issue 3179
2011-04-12 21:34:22 +10:00