powered by Jive Software

Setting Presence via ColdFusion MX

Has anybody found out how to send a presence packet from within ColdFusion MX? So, how do I say:

Presence presence = new Presence(Presence.Type.UNAVAILABLE);

presence.setStatus(“Gone fishing”);

con.sendPacket(presence);

in CFMX? The obvious translation of the first line in CFSCRIPT would be:

presence = createObject(“java”, “org.jivesoftware.smack.packet.Presence”).init(presence.Type.UNAVAILABLE);

But that produces “Variable PRESENCE is undefined”. I tried doing the init after the createObject like this:

presence = createObject(“java”, “org.jivesoftware.smack.packet.Presence”);

presence.init(presence.Type.UNAVAILABLE);

But that throws some sort of Null Pointer Exception: “The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code. Null Pointers are another name for undefined values.”

Then I tried instantiating the subclass org.jivesoftware.smack.packet.Presence.Type as a separate object in order to get at this constant:

presence = createObject(“java”, “org.jivesoftware.smack.packet.Presence”);

presenceType = createObject(“java”, “org.jivesoftware.smack.packet.Presence.Type”);

presence.init(presenceType.UNAVAILABLE);

But although packet.Presence.Type should be public, I get “Object Instantiation Exception. Class not found: org.jivesoftware.smack.packet.Presence.Type”.

Any ideas what else I could do in order to create a presence-packet? As far as I understand, my problem would be solved as soon as I manage to get access to the constants in Presence.Type, like some working way of saying

statusUnavailable = org.jivesoftware.smack.packet.Presence.Type.UNAVAILABLE;

in ColdFusion. But how do I do this?