redesign all condition and switches of

_PerformHttpRequest fn
This commit is contained in:
Marko Oldenburg 2023-01-02 13:58:03 +01:00
parent 87ae5607ae
commit 396d69c3f6

View File

@ -734,13 +734,13 @@ sub _createParamRefForFilter {
: '' : ''
) if ( $paramValue eq 'urlPath' ); ) if ( $paramValue eq 'urlPath' );
return return (
'{"event_fields": ["type","content","sender"],"event_format": "client", "presence": { "senders": [ "@xx:example.com"]}}' $paramValue eq 'data'
if ( $paramValue eq 'data' && exists( $createParamRefObj->{value} )
&& exists( $createParamRefObj->{value} ) && $createParamRefObj->{value}
&& $createParamRefObj->{value} ); ? '{"event_fields": ["type","content","sender"],"event_format": "client", "presence": { "senders": [ "@xx:example.com"]}}'
: ''
return; );
} }
sub _createParamRefForQuestion { sub _createParamRefForQuestion {
@ -766,8 +766,11 @@ sub _createParamRefForQuestion {
'v3/rooms/' 'v3/rooms/'
. AttrVal( $createParamRefObj->{hash}->{NAME}, 'matrixMessage', '!!' ) . AttrVal( $createParamRefObj->{hash}->{NAME}, 'matrixMessage', '!!' )
. '/send/m.poll.start?access_token=' . '/send/m.poll.start?access_token='
. $createParamRefObj->{hash}->{helper}->{access_token} . (
if ( $paramValue eq 'urlPath' ); $createParamRefObj->{hash}->{helper}->{access_token}
? $createParamRefObj->{hash}->{helper}->{access_token}
: ''
) if ( $paramValue eq 'urlPath' );
my $data = my $data =
'{"org.matrix.msc3381.poll.start": {"max_selections": 1,' '{"org.matrix.msc3381.poll.start": {"max_selections": 1,'
@ -790,8 +793,12 @@ qq(],"org.matrix.msc1767.text": "$value"}, "m.markup": [{"mimetype": "text/plain
if ( $paramValue eq 'data' ); if ( $paramValue eq 'data' );
} }
else { else {
Log3( $createParamRefObj->{hash}->{NAME}, Log3( $createParamRefObj->{hash}->{NAME}, 5,
5, 'question: ' . $value . $size . $question[0] ); 'question: '
. $value
. $size
. ( defined( $question[0] ) && $question[0] ? $question[0] : '' )
);
return; return;
} }
@ -822,9 +829,12 @@ sub _createParamRefForUrlSync {
$full_state = ''; $full_state = '';
} }
return return 'r0/sync?access_token='
'r0/sync?access_token=' . (
. $createParamRefObj->{hash}->{helper}->{access_token} $createParamRefObj->{hash}->{helper}->{access_token}
? $createParamRefObj->{hash}->{helper}->{access_token}
: ''
)
. $since . $since
. $full_state . $full_state
. '&timeout=50000&filter=' . '&timeout=50000&filter='
@ -881,28 +891,28 @@ sub _createParamRefForDef {
. $createParamRefObj->{value} . '"}', . $createParamRefObj->{value} . '"}',
}, },
# 'questionEnd' => { 'questionEnd' => {
# 'urlPath' => 'urlPath' =>
# _createParamRefForQuestionEnd( $createParamRefObj, 'urlPath' ), _createParamRefForQuestionEnd( $createParamRefObj, 'urlPath' ),
# 'data' => 'data' =>
# _createParamRefForQuestionEnd( $createParamRefObj, 'data' ), _createParamRefForQuestionEnd( $createParamRefObj, 'data' ),
# }, },
# 'filter' => { 'filter' => {
# 'urlPath' => 'urlPath' =>
# _createParamRefForFilter( $createParamRefObj, 'urlPath' ), _createParamRefForFilter( $createParamRefObj, 'urlPath' ),
# 'data' => _createParamRefForFilter( $createParamRefObj, 'data' ), 'data' => _createParamRefForFilter( $createParamRefObj, 'data' ),
# }, },
# 'question' => { 'question' => {
# 'urlPath' => 'urlPath' =>
# _createParamRefForQuestion( $createParamRefObj, 'urlPath' ), _createParamRefForQuestion( $createParamRefObj, 'urlPath' ),
# 'data' => _createParamRefForQuestion( $createParamRefObj, 'data' ), 'data' => _createParamRefForQuestion( $createParamRefObj, 'data' ),
# }, },
# 'sync' => { 'sync' => {
# 'urlPath' => _createParamRefForUrlSync($createParamRefObj), 'urlPath' => _createParamRefForUrlSync($createParamRefObj),
# }, },
}; };
::Log( 1, ::Log( 1,