[F] Fix VTODO files in Folder
[+] Add Globals.kt
This commit is contained in:
parent
5e3442810b
commit
a36670d585
4 changed files with 56 additions and 48 deletions
|
@ -5,6 +5,7 @@
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="gradleHome" value="/usr/share/java/gradle" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
|
|
@ -1,3 +1 @@
|
||||||
|
|
||||||
rootProject.name = "mail-calendar-reminder-kotlin"
|
rootProject.name = "mail-calendar-reminder-kotlin"
|
||||||
|
|
||||||
|
|
1
src/main/kotlin/Globals.kt
Normal file
1
src/main/kotlin/Globals.kt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
public const val VERSION = 1.0;
|
|
@ -55,6 +55,7 @@ fun main(args: Array<String>) {
|
||||||
val path = Paths.get("")
|
val path = Paths.get("")
|
||||||
val directoryName = path.toAbsolutePath().toString()
|
val directoryName = path.toAbsolutePath().toString()
|
||||||
logger.debug("Current Working Directory is = $directoryName")
|
logger.debug("Current Working Directory is = $directoryName")
|
||||||
|
|
||||||
if (args.size <= 4) {
|
if (args.size <= 4) {
|
||||||
logger.error("Es fehlen noch einige Parameter!!!")
|
logger.error("Es fehlen noch einige Parameter!!!")
|
||||||
logger.error("ics-dir, from, to, password, host")
|
logger.error("ics-dir, from, to, password, host")
|
||||||
|
@ -88,13 +89,19 @@ fun getNotifications(file: String) {
|
||||||
FileInputStream(file).use { fin ->
|
FileInputStream(file).use { fin ->
|
||||||
val builder = CalendarBuilder()
|
val builder = CalendarBuilder()
|
||||||
val calendar: net.fortuna.ical4j.model.Calendar = builder.build(fin)
|
val calendar: net.fortuna.ical4j.model.Calendar = builder.build(fin)
|
||||||
|
var isValidVEVENT = false
|
||||||
|
|
||||||
for (o: Component in calendar.components) {
|
for (o: Component in calendar.components) {
|
||||||
logger.debug("Component: " + o.name)
|
logger.debug("Component: " + o.name)
|
||||||
for (o1: Property in o.properties) {
|
for (o1: Property in o.properties) {
|
||||||
logger.debug(o1.name + ": " + o1.value)
|
logger.debug(o1.name + ": " + o1.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (o.name.equals("VEVENT"))
|
||||||
|
isValidVEVENT = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isValidVEVENT) {
|
||||||
// http://www.cheerfulprogramming.com/blog/2021/03/09/intro-to-ical4j
|
// http://www.cheerfulprogramming.com/blog/2021/03/09/intro-to-ical4j
|
||||||
val event: VEvent = calendar.getComponent(Component.VEVENT)
|
val event: VEvent = calendar.getComponent(Component.VEVENT)
|
||||||
|
|
||||||
|
@ -140,11 +147,12 @@ fun getNotifications(file: String) {
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
messageText += "\n\n Folgende Notiz existiert in diesen Eintrag: \n" + description.value
|
messageText += "\n\n Folgende Notiz existiert in diesen Eintrag: \n" + description.value
|
||||||
}
|
}
|
||||||
messageText += "\n\n This email is a service from mail-calendar-reminder Version 0.1. \n Delivered by Simon Rieger"
|
messageText += "\n\n This email is a service from mail-calendar-reminder Version $VERSION. \n Delivered by Simon Rieger"
|
||||||
logger.info(messageText)
|
logger.info(messageText)
|
||||||
sendMail(messageSubject, messageText)
|
sendMail(messageSubject, messageText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
} catch (e: ParserException) {
|
} catch (e: ParserException) {
|
||||||
|
|
Loading…
Reference in a new issue