ColdFusion 9.0 Resources |
Sending outgoing messagesYou use the SendGatewayMessage CFML function or the return value of a CFC listener method to send outgoing messages. The ColdFusion IM gateway accepts the following outgoing message commands:
The message structure that you return in the gateway listener CFC function or use as the second parameter in the CFML SendGatewayMessage function can have the following fields. The table lists the fields and the commands in which they are used, and describes each field’s use.
In typical use, a ColdFusion application uses the accept, decline, and noact commands in the return value of the onAddBuddyRequest method, and uses the submit command (or no command, because submit is the default command) in SendGatewayMessage CFML functions and the return value of the onIncomingMessage CFC method. The SendGatewayMessage CFML function can send any command, and can be used to send an accept or decline message. One possible use is in an application where someone must review all buddy requests before they are added. In this case, the onAddBuddyRequest CFC method could initially send a noact command in its return value, and save the request information in a database. Administrators could use a separate ColdFusion application to review the request information. This application could use the SendGatewayMessage function with an accept or decline command to act on the request and inform the requestor. The following example onIncomingMessage method of a listener CFC echoes incoming IM messages to the message originator: <cffunction name="onIncomingMessage" output="no"> <cfargument name="CFEvent" type="struct" required="yes"> <cfset retValue.MESSAGE = "echoing: " & CFEvent.DATA.message> <cfset retValue.BuddyID = arguments.CFEVENT.DATA.SENDER> <cfreturn retValue> </cffunction> |