User Guide

IM Gateway CFC incoming message methods 1009
onAddBuddyResponse
Description
Handles incoming responses from other users to requests from the gateway to be added to their
buddy lists. Also receives requests from buddies to have you remove them from your buddy list.
Syntax
onAddBuddyResponse(CFEvent)
See also
onIncomingMessage
, onAddBuddyRequest, onBuddyStatus, onIMServerMessage
Parameters
The method must take one parameter, a CFEvent structure with the following fields:
Returns
The function does not return a value.
Example
The following example adds the buddys status to the Application scope buddyStatus structure if
the message sender accepted an add buddy request. It logs all responses.
<cffunction name="onAddBuddyResponse">
<cfargument name="CFEvent" type="struct" required="YES">
<cflock scope="APPLICATION" timeout="10" type="EXCLUSIVE">
<cfscript>
//Do the following only if the buddy accepted the request.
if (NOT StructKeyExists(Application, "buddyStatus")) {
Application.buddyStatus=StructNew();
}
if (#CFEVENT.Data.MESSAGE# IS "accept") {
//Create a new entry in the buddyStatus record for the buddy.
if (NOT StructKeyExists(Application.buddyStatus,
CFEvent.Data.SENDER)) {
Field Description
gatewayType Gateway type, either XMPP or SAMETIME.
gatewayID The ID of the gateway instance, as configured in ColdFusion MX Administrator.
originatorID The IM ID of the message originator.
cfcMethod This CFC method; by default, onAddBuddyResponse.
data.MESSAGE One of the following:
accept The request was accepted.
decline The request was declined, or the buddy is asking you to remove
them from your list.
data.SENDER The sender’s ID; identical to the originatorID.
data.RECIPIENT The recipient’s ID, as specified in the gateway’s configuration file.
data.TIMESTAMP The date and time when the message was sent.