From f95f6b46e614b528eb25882a517b83b3837eb9d4 Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Mon, 15 Feb 2016 07:46:25 +0000 Subject: [PATCH] 32_mailcheck.pm: added set active/inactive commands git-svn-id: https://svn.fhem.de/fhem/trunk@10850 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/32_mailcheck.pm | 29 +++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 741dff80e..1e24c2c4e 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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. + - feature: 32_mailcheck: added set active/inactive commands - feature: 02_RSS: new attribute urlOverride - feature: 71_YAMAHA_NP: Added auto reading update for tuner and player - feature 49_SSCAM: The port in DEF-String is optional now, diff --git a/fhem/FHEM/32_mailcheck.pm b/fhem/FHEM/32_mailcheck.pm index 9a285f790..425ef8c3e 100755 --- a/fhem/FHEM/32_mailcheck.pm +++ b/fhem/FHEM/32_mailcheck.pm @@ -34,7 +34,7 @@ mailcheck_Initialize($) $hash->{DefFn} = "mailcheck_Define"; $hash->{NotifyFn} = "mailcheck_Notify"; $hash->{UndefFn} = "mailcheck_Undefine"; - #$hash->{SetFn} = "mailcheck_Set"; + $hash->{SetFn} = "mailcheck_Set"; $hash->{GetFn} = "mailcheck_Get"; $hash->{AttrFn} = "mailcheck_Attr"; $hash->{AttrList} = "debug:1 ". @@ -240,7 +240,23 @@ mailcheck_Set($$@) { my ($hash, $name, $cmd) = @_; - my $list = ""; + my $list = "active:noArgs inactive:noArgs"; + + if( $cmd eq 'active' ) { + mailcheck_Disconnect($hash); + $hash->{STATE} = "Initialized"; + mailcheck_Connect($hash); + + return undef; + + } elsif( $cmd eq 'inactive' ) { + mailcheck_Disconnect($hash); + $hash->{STATE} = 'inactive'; + + return undef; + + } + return "Unknown argument $cmd, choose one of $list"; } @@ -515,6 +531,15 @@ mailcheck_Read($) the mail address of the last sender
+ + Set +
+ Get