-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from notKamui/dev
IMAP engine rework and folder listeners
- Loading branch information
Showing
11 changed files
with
380 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.notkamui.kourrier.core | ||
|
||
import com.notkamui.kourrier.imap.KourrierFolder | ||
import com.notkamui.kourrier.imap.KourrierFolderType | ||
import com.notkamui.kourrier.imap.KourrierIMAPSession | ||
import com.notkamui.kourrier.search.KourrierSortTerm | ||
|
||
/** | ||
* Is thrown when an inconsistency in the [KourrierIMAPSession] status happens. | ||
*/ | ||
class KourrierIMAPSessionStateException | ||
internal constructor(message: String) : IllegalStateException(message) | ||
|
||
/** | ||
* Is thrown when an inconsistent in the [KourrierFolder] status happens. | ||
*/ | ||
class KourrierIMAPFolderStateException | ||
internal constructor(message: String) : IllegalStateException(message) | ||
|
||
/** | ||
* Is thrown when a [KourrierFolderType] is unknown or invalid. | ||
*/ | ||
class UnknownFolderTypeException | ||
internal constructor() : IllegalArgumentException() | ||
|
||
/** | ||
* Is thrown when a [KourrierSortTerm] is unknown or invalid. | ||
*/ | ||
class UnknownSortTermException | ||
internal constructor() : IllegalArgumentException() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/kotlin/com/notkamui/kourrier/imap/folder_listener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.notkamui.kourrier.imap | ||
|
||
import java.util.EventListener | ||
|
||
/** | ||
* [EventListener] interface of [KourrierFolder] to listen to [KourrierIMAPMessage]s. | ||
*/ | ||
interface KourrierFolderListener : EventListener { | ||
/** | ||
* Is launched when a [message] is received. | ||
*/ | ||
fun onMessageReceived(message: KourrierIMAPMessage) | ||
|
||
/** | ||
* Is launched when a [message] is **expunged** (this doesn't always mean "deleted"). | ||
*/ | ||
fun onMessageRemoved(message: KourrierIMAPMessage) | ||
|
||
/** | ||
* Is launched when a [message]'s flags changed. | ||
*/ | ||
fun onMessageFlagsChanged(message: KourrierIMAPMessage) | ||
|
||
/** | ||
* Is launched when a [message]'s envelope changed. | ||
*/ | ||
fun onMessageEnvelopeChanged(message: KourrierIMAPMessage) | ||
} | ||
|
||
/** | ||
* Generic adapter for [KourrierFolderListener]. | ||
*/ | ||
open class KourrierFolderAdapter : KourrierFolderListener { | ||
override fun onMessageReceived(message: KourrierIMAPMessage) { | ||
/* Default */ | ||
} | ||
|
||
override fun onMessageRemoved(message: KourrierIMAPMessage) { | ||
/* Default */ | ||
} | ||
|
||
override fun onMessageFlagsChanged(message: KourrierIMAPMessage) { | ||
/* Default */ | ||
} | ||
|
||
override fun onMessageEnvelopeChanged(message: KourrierIMAPMessage) { | ||
/* Default */ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.