mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
57_Calendar: process continuation lines, get/set syntax checks
git-svn-id: https://svn.fhem.de/fhem/trunk@6742 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
92b341b261
commit
77037e7df8
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- change: 57_Calendar: process continuation lines, get/set syntax checks
|
||||||
- bugfix: SYSMON: fix availability of cpu/kernel_max
|
- bugfix: SYSMON: fix availability of cpu/kernel_max
|
||||||
- bugfix: SYSMON: numeric check
|
- bugfix: SYSMON: numeric check
|
||||||
- change: 59_Weather: change icons for conditions 31, 34, 36
|
- change: 59_Weather: change icons for conditions 31, 34, 36
|
||||||
|
@ -39,8 +39,6 @@ package main;
|
|||||||
# http://forum.fhem.de/index.php?topic=18707.new
|
# http://forum.fhem.de/index.php?topic=18707.new
|
||||||
# http://forum.fhem.de/index.php?topic=15827.new
|
# http://forum.fhem.de/index.php?topic=15827.new
|
||||||
#
|
#
|
||||||
# Continuation lines are only partially honored, e.g. not for descriptions
|
|
||||||
#
|
|
||||||
# Potential future extensions: add support for EXDATE
|
# Potential future extensions: add support for EXDATE
|
||||||
# http://forum.fhem.de/index.php?topic=24485.new#new
|
# http://forum.fhem.de/index.php?topic=24485.new#new
|
||||||
#
|
#
|
||||||
@ -81,7 +79,10 @@ sub addproperty {
|
|||||||
$key= $1;
|
$key= $1;
|
||||||
$parts= defined($3) ? $3 : "";
|
$parts= defined($3) ? $3 : "";
|
||||||
$parameter= defined($4) ? $4 : "";
|
$parameter= defined($4) ? $4 : "";
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
return unless($key);
|
||||||
#main::Debug "-> key=\'$key\' parts=\'$parts\' parameter=\'$parameter\'";
|
#main::Debug "-> key=\'$key\' parts=\'$parts\' parameter=\'$parameter\'";
|
||||||
if($key eq "EXDATE") {
|
if($key eq "EXDATE") {
|
||||||
push @{$self->{properties}{exdates}}, $parameter;
|
push @{$self->{properties}{exdates}}, $parameter;
|
||||||
@ -115,19 +116,19 @@ sub parseSub {
|
|||||||
while($ln<$#ical) {
|
while($ln<$#ical) {
|
||||||
my $line= $ical[$ln];
|
my $line= $ical[$ln];
|
||||||
chomp $line;
|
chomp $line;
|
||||||
$line =~ s/[\x0D]//; # chomp will not remove the CR
|
$line =~ s/[\x0D]$//; # chomp will not remove the CR
|
||||||
#main::Debug "$ln: $line";
|
|
||||||
$ln++;
|
$ln++;
|
||||||
next if($line eq ""); # remove empty line
|
# check for and handle continuation lines (4.1 on page 12)
|
||||||
#### corrects line-wraps: if next line is starting with at least 2 spaces, join them
|
while($ln<$#ical) {
|
||||||
if ($ln<$#ical){
|
my $line1= $ical[$ln];
|
||||||
my $line1= $ical[$ln];
|
last unless($line1 =~ /^\s(.*)/);
|
||||||
if ($line1 =~ s/^\s\s*//) {
|
$line.= $1;
|
||||||
$line.=$line1;
|
chomp $line;
|
||||||
$ln++;
|
$line =~ s/[\x0D]$//; # chomp will not remove the CR
|
||||||
};
|
$ln++;
|
||||||
};
|
};
|
||||||
####
|
#main::Debug "$ln: $line";
|
||||||
|
next if($line eq ""); # ignore empty line
|
||||||
last if($line =~ m/^END:.*$/);
|
last if($line =~ m/^END:.*$/);
|
||||||
if($line =~ m/^BEGIN:(.*)$/) {
|
if($line =~ m/^BEGIN:(.*)$/) {
|
||||||
my $entry= ICal::Entry->new($1);
|
my $entry= ICal::Entry->new($1);
|
||||||
@ -978,6 +979,7 @@ sub Calendar_Set($@) {
|
|||||||
my ($hash, @a) = @_;
|
my ($hash, @a) = @_;
|
||||||
|
|
||||||
my $cmd= $a[1];
|
my $cmd= $a[1];
|
||||||
|
$cmd= "?" unless($cmd);
|
||||||
|
|
||||||
# usage check
|
# usage check
|
||||||
if((@a == 2) && ($a[1] eq "update")) {
|
if((@a == 2) && ($a[1] eq "update")) {
|
||||||
@ -998,12 +1000,14 @@ sub Calendar_Get($@) {
|
|||||||
|
|
||||||
my ($hash, @a) = @_;
|
my ($hash, @a) = @_;
|
||||||
|
|
||||||
|
|
||||||
my $eventsObj= $hash->{fhem}{events};
|
my $eventsObj= $hash->{fhem}{events};
|
||||||
my @events;
|
my @events;
|
||||||
|
|
||||||
my $cmd= $a[1];
|
my $cmd= $a[1];
|
||||||
if(grep(/^$cmd$/, ("text","full","summary","location","alarm","start","end"))) {
|
$cmd= "?" unless($cmd);
|
||||||
|
|
||||||
|
my @cmds2= qw/text full summary location alarm start end/;
|
||||||
|
if($cmd ~~ @cmds2) {
|
||||||
|
|
||||||
return "argument is missing" if($#a < 2);
|
return "argument is missing" if($#a < 2);
|
||||||
my $reading= $a[2];
|
my $reading= $a[2];
|
||||||
@ -1049,7 +1053,7 @@ sub Calendar_Get($@) {
|
|||||||
return join(";", @uids);
|
return join(";", @uids);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return "Unknown argument $cmd, choose one of text summary full find";
|
return "Unknown argument $cmd, choose one of find text full summary location alarm start end";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user