hey guys and gals,
i’m basing myself on b0ris’ work done on xiffian in order to implement a presence module in our project for e-learning here at melcoe. now, basically i’ve set up a class which manages the connection, room, and flash movieclip that actually shows the people in the room. i try connect to our jabber server and the “error” callback is caught but the event has no data… i have no clue what i’m doing wrong really. here are a few snipets.
class Presence extends MovieClip {
// XIFF things
private var connection:XMPPConnection;
private var room:Room;
private var myHost:InviteListener;
private var buddyList:Roster;
private var vcardManager:VCardManager;
private var privateData:PrivateDataManager;
private var globalHandler:Object;
private var chatHandler:Object;
private var userListener:Object;
private var timerConnection;
private var timerTestConnection;
private var ROOMCONNECTTIMEOUT:Number =10000;
connection = new XMPPConnection();
connection.username = “blahh”;
connection.password = “blahblah”;
connection.server = “172.20.100.18”;
connection.port = 5222;var myDate = new Date(); var h = myDate.getHours().toString(), m = myDate.getMinutes().toString(), s = myDate.getSeconds().toString(); connection.resource = "XIFFIAN"+h+""+m+""+s;
connection.addEventListener(“message”, Proxy.create(this, handleGlobalEvent));
connection.addEventListener(“login”, Proxy.create(this, handleGlobalEvent));
connection.addEventListener(“connection”, Proxy.create(this, handleGlobalEvent));
connection.addEventListener(“disconnection”, Proxy.create(this, handleGlobalEvent));
connection.addEventListener(“presence”, Proxy.create(this, handleGlobalEvent));
connection.addEventListener(“error”, Proxy.create(this, handleGlobalEvent));
connection.addEventListener(“changePasswordSuccess”, Proxy.create(this, handleGlobalEvent));
connection.addEventListener(“outgoingData”, Proxy.create(this, handleGlobalEvent));
connection.addEventListener(“incomingData”, Proxy.create(this, handleGlobalEvent));
connection.addEventListener(“registrationSuccess”, Proxy.create(this, handleGlobalEvent));
connection.addEventListener(“registrationFields”, Proxy.create(this, handleGlobalEvent));
Stage.addListener(this);
attemptConnection();
// Attempts connection and keeps trying until connection is established
private function attemptConnection(){
// Try first time
connectionTimer();// Keep trying timerConnection = setInterval(connectionTimer, ROOMCONNECTTIMEOUT); } private function connectionTimer(){ Debugger.log('PRESENCE: attempting to connect',Debugger.MED,'connectionTimer','Presence'); connection.connect(); } // Checks to see if a connection has been established private function checkConnectionEstablished(){ // Check first time connectionEstablishedTimer(); // Keep trying afterwards timerTestConnection = setInterval(connectionEstablishedTimer,500); //Retry every half second } private function connectionEstablishedTimer(){ Debugger.log('PRESENCE: checking if connection is established',Debugger.MED,'connectionEstablishedTimer','Presence'); if(connection.isLoggedIn()){ Debugger.log('PRESENCE: connection established',Debugger.MED,'connectionEstablishedTimer','Presence'); clearInterval(timerTestConnection); joinChatRoom(); } Debugger.log('PRESENCE: is logged in?' + connection.isLoggedIn().toString(),Debugger.MED,'connectionEstablishedTimer','P resence'); }
private function handleGlobalEvent(eventObj) {
switch (eventObj.type) {
case “error”:
Debugger.log('PRESENCE: errorevent - error code: '+eventObj.data.errorCode+ ’ - errorMessage: ’ + eventObj.data.errorMessage,Debugger.MED,‘handleGlobalEvent’,‘Presence’);
break;
so what is going on here… does something seem extremely obvious? i’ve pretty much copy+pasted code from xiffian and mode mods from there. thanks a lot in advance!
p.s keep in mind that i’m using the same official v2 mxp library as b0ris is using for xiffian. the project i’m implementing this into is built in as2 with mx2004.