[F] Fix VTODO files in Folder

[+] Add Globals.kt
This commit is contained in:
Simon Rieger 2023-06-12 19:43:30 +02:00
parent 5e3442810b
commit a36670d585
4 changed files with 56 additions and 48 deletions

View file

@ -5,6 +5,7 @@
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="/usr/share/java/gradle" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />

View file

@ -1,3 +1 @@
rootProject.name = "mail-calendar-reminder-kotlin"

View file

@ -0,0 +1 @@
public const val VERSION = 1.0;

View file

@ -55,6 +55,7 @@ fun main(args: Array<String>) {
val path = Paths.get("")
val directoryName = path.toAbsolutePath().toString()
logger.debug("Current Working Directory is = $directoryName")
if (args.size <= 4) {
logger.error("Es fehlen noch einige Parameter!!!")
logger.error("ics-dir, from, to, password, host")
@ -88,13 +89,19 @@ fun getNotifications(file: String) {
FileInputStream(file).use { fin ->
val builder = CalendarBuilder()
val calendar: net.fortuna.ical4j.model.Calendar = builder.build(fin)
var isValidVEVENT = false
for (o: Component in calendar.components) {
logger.debug("Component: " + o.name)
for (o1: Property in o.properties) {
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
val event: VEvent = calendar.getComponent(Component.VEVENT)
@ -140,11 +147,12 @@ fun getNotifications(file: String) {
if (description != null) {
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)
sendMail(messageSubject, messageText)
}
}
}
} catch (e: IOException) {
logger.error(e)
} catch (e: ParserException) {