1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
[//lasso
// Prowl Notification API for Lasso
// (c)2009 Lieven Gekiere/SHpartners Belgium
define_type(
'prowl',
-description='Implements the Prowl Notification API in Lasso.'
);
local(
'apikey' = string,
'application' = string
);
define_tag(
'oncreate',
-opt='apikey', -type='string',
-opt='application', -type='string'
);
local_defined('apikey') ? self->apikey = #apikey;
local_defined('application') ? self->application = #application;
/define_tag;
define_tag('apicheck');
return(self->apikey != '');
/define_tag;
define_tag(
'retrieve',
-req='path', -type='string',
-opt='post', -type='string',
-encodenone
);
fail_if(!self->apicheck, -1, 'api key not set.');
protect;
local('getparams') = array(
'apikey'=self->apikey,
'application' =self->application,
'event' = #post
);
local('response') = include_url(
'https://prowl.weks.net' + #path,
-getparams=#getparams
);
handle_error;
local('response') = 'There was a problem communicating with Prowl.';
/handle_error;
/protect;
return(#response);
/define_tag;
define_tag(
'update',
-req='event', -type='string',
-encodenone
);
local('path') = '/publicapi/add';
return(self->retrieve(#path, string_truncate(#event, 1024)));
/define_tag;
/define_type;
]
|
Requirements?
This is awesome! One note: requires [string_truncate] http://tagswap.net/String_Truncate