Lasso Soft Inc. > Home

[SHp_prowl]

LinkSHp_prowl
AuthorLieven Gekiere
CategoryCustom Tag
Version8.5.x
LicensePublic Domain
Posted08 Aug 2009
Updated10 Aug 2009
More by this author...

Description

Wrapper for the Prowl iPhone notification API. Allows you to send messages from Lasso to your iPhone 3G/3GS via Push notifications. Requires the iPhone Prowl app to receive the notifications. (see http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=320876271 ) More info on Prowl: http://prowl.weks.net

Sample Usage

[include:'SHp_prowl.inc']

[var:'p'=prowl(-apikey='xxxxxxxxxxxxxx', -application='Lasso')]
[$p->update('This notification is powered by Lasso.')]

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

[//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;

]

Related Tags

Comments

09 Aug 2009, Samuel Cohen

Requirements?

This is awesome! One note: requires [string_truncate]
http://tagswap.net/String_Truncate

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft