Adobe COLDFUSION 9 Manual page 1272

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
(listgetat(message,1) IS "C") OR
(listgetat(message,1) IS "Celsius")>
<cfset scale=listgetat(message,1)>
<cfif isNumeric(listgetat(message,2))>
<cfset temperature=listgetat(message,2)>
<cfswitch expression="#scale#">
<cfcase value="F, Fahrenheit">
</cfcase>
<cfcase value="C, Celsius">
</cfcase>
</cfswitch>
<cfelse>
<cfset retmsg=errormsg>
</cfif>
<cfelse>
<cfset retmsg=errormsg>
</cfif>
<cfelse>
<cfset retmsg=errormsg>
</cfif>
<!--- Fill the return value as required for the event gateway type. --->
<cfif arguments.CFEVENT.GatewayType is "Socket">
<cfset retValue = structNew()>
<cfset retValue.MESSAGE = retmsg>
<cfset retValue.originatorID = orig>
<cfelseif (arguments.CFEVENT.GatewayType is "Sametime") OR
(arguments.CFEVENT.GatewayType is "XMPP")>
<cfset retValue = structNew()>
<cfset retValue.MESSAGE = retmsg>
<cfset retValue.BuddyID = arguments.CFEVENT.DATA.SENDER>
<cfset retValue.originatorID = orig>
<cfelseif arguments.CFEVENT.GatewayType is "SMS">
<cfset retValue = structNew()>
<cfset retValue.command = "submit">
<cfset retValue.sourceAddress = arguments.CFEVENT.gatewayid>
<cfset retValue.destAddress = arguments.CFEVENT.originatorid>
<cfset retValue.shortMessage = retmsg>
</cfif>
<!--- Send the return message back. --->
<cfreturn retValue>
</cffunction>
</cfcomponent>
Sending a message using the SendGatewayMessage function
The
function has the following format:
SendGatewayMessage
<cfset retmsg = temperature & " degrees Fahrenheit is "
& (temperature-32.0) * (5.0/9.0) & " degrees Celsius">
<cfset retmsg = temperature & " degrees Celsius is "
&(temperature * 9.0/5.0) + 32 & " degrees Fahrenheit">
Last updated 8/5/2010
1267

Advertisement

Table of Contents
loading

Table of Contents