Merge pull request 'change version, add Meta Data' (#3) from patch-changeMetaVersion into dev
Reviewed-on: #3
This commit is contained in:
commit
bffdf597c2
@ -23,7 +23,7 @@
|
||||
# Usage:
|
||||
#
|
||||
##########################################################################
|
||||
# $Id: 98_Matrix.pm 14063 2022-11-12 12:52:00Z Man-fred $
|
||||
# $Id$
|
||||
|
||||
package FHEM::Matrix;
|
||||
use strict;
|
||||
@ -63,6 +63,8 @@ sub Initialize {
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
=item summary Provides a Matrix-Chatbot.
|
||||
=item summary_DE Stellt einen Matrix-Chatbot bereit.
|
||||
@ -359,4 +361,48 @@ sub Initialize {
|
||||
</ul>
|
||||
|
||||
=end html_DE
|
||||
|
||||
=for :application/json;q=META.json 70_Matrix.pm.pm
|
||||
{
|
||||
"abstract": "Provides a Matrix-Chatbot",
|
||||
"x_lang": {
|
||||
"de": {
|
||||
"abstract": "Stellt einen Matrix-Chatbot bereit"
|
||||
}
|
||||
},
|
||||
"version": "v0.15.3",
|
||||
"author": [
|
||||
"Manfred Bielemeier"
|
||||
],
|
||||
"x_fhem_maintainer": [
|
||||
"<a href=https://forum.fhem.de/index.php?action=profile;u=41965>mBielemeier </a>"
|
||||
],
|
||||
"x_fhem_maintainer_github": [
|
||||
"Man-fred"
|
||||
],
|
||||
"prereqs": {
|
||||
"runtime": {
|
||||
"requires": {
|
||||
"FHEM::Meta": 0,
|
||||
"HttpUtils": 0,
|
||||
"strict": 0,
|
||||
"warnings": 0,
|
||||
"experimental": 0,
|
||||
"carp": 0,
|
||||
"POSIX": 0,
|
||||
"JSON::PP": 0,
|
||||
"encode": 0,
|
||||
},
|
||||
"recommends": {
|
||||
"JSON": 0
|
||||
},
|
||||
"suggests": {
|
||||
"JSON::XS": 0,
|
||||
"Cpanel::JSON::XS": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
=end :application/json;q=META.json
|
||||
|
||||
=cut
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Usage:
|
||||
#
|
||||
##########################################################################
|
||||
# $Id: Matrix.pm 22821 2022-11-12 12:52:00Z Man-fred $
|
||||
# $Id$
|
||||
#
|
||||
# from the developerpages:
|
||||
# Verwendung von lowerCamelCaps für a) die Bezeichnungen der Behälter für Readings, Fhem und Helper und der Untereintraege,
|
||||
@ -108,8 +108,6 @@ BEGIN {
|
||||
);
|
||||
}
|
||||
|
||||
my $VERSION = '0.0.15';
|
||||
|
||||
sub Attr_List {
|
||||
return
|
||||
"matrixLogin:password matrixRoom matrixPoll:0,1 matrixSender matrixMessage matrixQuestion_ matrixQuestion_[0-9]+ matrixAnswer_ matrixAnswer_[0-9]+ $readingFnAttributes";
|
||||
@ -121,6 +119,12 @@ sub Define {
|
||||
my $hash = shift;
|
||||
my $aArg = shift;
|
||||
|
||||
my $version;
|
||||
|
||||
return $@ unless ( FHEM::Meta::SetInternals($hash) );
|
||||
$version = FHEM::Meta::Get( $hash, 'version' );
|
||||
use version 0.77; our $VERSION = $version;
|
||||
|
||||
return 'too few parameters: define <name> Matrix <server> <user>'
|
||||
if ( scalar( @{$aArg} ) != 4 );
|
||||
|
||||
@ -1584,14 +1588,7 @@ sub _PerformHttpRequestOrInternalTimerFAIL {
|
||||
Log3( $name, 4, "$name : Matrix::ParseHttpResponse $hash" );
|
||||
if ( AttrVal( $name, 'matrixPoll', 0 ) == 1 ) {
|
||||
if ( $nextRequest ne '' && $hash->{helper}->{softfail} < 3 ) {
|
||||
if ( $nextRequest eq 'sync' && $hash->{helper}->{repeat} ) {
|
||||
$def = $hash->{helper}->{repeat}->{def};
|
||||
$value = $hash->{helper}->{repeat}->{value};
|
||||
$hash->{helper}->{repeat} = undef;
|
||||
|
||||
_PerformHttpRequest( $hash, $def, $value );
|
||||
}
|
||||
else {
|
||||
if ( !_SyncNextRequest( $hash, $nextRequest ) ) {
|
||||
_PerformHttpRequest( $hash, $nextRequest, '' );
|
||||
}
|
||||
}
|
||||
@ -1620,13 +1617,27 @@ sub _PerformHttpRequestOrInternalTimerFAIL {
|
||||
if ( $nextRequest eq 'login' ) {
|
||||
_PerformHttpRequest( $hash, $nextRequest, '' );
|
||||
}
|
||||
elsif ( $nextRequest eq 'sync' && $hash->{helper}->{repeat} ) {
|
||||
$def = $hash->{helper}->{repeat}->{def};
|
||||
$value = $hash->{helper}->{repeat}->{value};
|
||||
$hash->{helper}->{repeat} = undef;
|
||||
|
||||
_PerformHttpRequest( $hash, $def, $value );
|
||||
}
|
||||
_SyncNextRequest( $hash, $nextRequest );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sub _SyncNextRequest {
|
||||
return 0
|
||||
unless ( __PACKAGE__ eq caller(0) )
|
||||
; # nur das eigene Package darf private Funktionen aufrufen (CoolTux)
|
||||
|
||||
my $hash = shift;
|
||||
my $nextRequest = shift;
|
||||
|
||||
if ( $nextRequest eq 'sync' && $hash->{helper}->{repeat} ) {
|
||||
$def = $hash->{helper}->{repeat}->{def};
|
||||
$value = $hash->{helper}->{repeat}->{value};
|
||||
$hash->{helper}->{repeat} = undef;
|
||||
|
||||
return _PerformHttpRequest( $hash, $def, $value );
|
||||
}
|
||||
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user