" +
" " +
" ";
connection.sendXML(xml);
}
public function getUsers():void
{
var xml:String = "" +
" " +
" ";
connection.sendXML(xml);
}
public function getServices():void
{
var xml:String = "" +
" ";
connection.sendXML(xml);
}
public function registerAIM():void
{
var token:AsyncToken = gatewayObject.call("Manager.addRegistration","ORbOzn8&w",userInformation._JID,"aim",aim_username.text,aim_password.text);
var tresponder:ItemResponder = new ItemResponder(this.showAIMResult,this.onFault);
token.addResponder(tresponder);
}
public function showAIMResult(event:ResultEvent,token:AsyncToken = null):void
{
Alert.show("Successfully registered for AOL Instant Messanger!");
}
public function onFault(event:FaultEvent, token:AsyncToken = null):void
{
consoleMsg.text = consoleMsg.text + "\n\n\n\n" + event.fault.faultString + "\n\n" + event.fault.faultDetail;
Alert.show(event.fault.faultString,event.fault.faultCode);
}
/**
** Set User Presence
**/
public function setPresence():void
{
roster.setPresence(cbPresence.selectedItem.label,cbPresence.selectedItem.label,0);
AIMPresence();
}
public function AIMPresence():void
{
var xml:String = 'away';
connection.sendXML(xml);
}
private function doLogin():void
{
connection.username = username.text;
connection.password = password.text;
connection.connect("flash");
userInformation._username = username.text;
userInformation._password = password.text;
userInformation._JID = username.text + "@flexim/xiff";
currentState = '';
}
private function sendMessage():void
{
room.sendMessage(msg.text);
msg.text == "";
}
private function handleConnectSuccess(event:ConnectionSuccessEvent):void
{
consoleMsg.text = consoleMsg.text + "Connected!";
}
private function handleRoomJoin(event:RoomEvent):void{
room.sendMessage("test has joined the room");
}
private function handleServerLogin(event:LoginEvent):void{
trace("Login event recieved");
roster.setPresence(null, "Online", 5);
room.join();
}
private function handleIncomingData(event:IncomingDataEvent):void
{
if(event.data.firstChild.nodeName == "iq")
{
if(!event.data.firstChild.firstChild.firstChild.attributes.name == "")
{
var tmpObj:Object = {};
tmpObj.name = event.data.firstChild.firstChild.firstChild.attributes.name;
tmpObj.group = event.data.firstChild.firstChild.firstChild.firstChild.nodeValue;
tmpObj.jID = event.data.firstChild.firstChild.firstChild.attributes.jid;
//Alert.show(tmpObj.jID);
buddyListdp.addItem(tmpObj);
}
}
if(event.data.firstChild.nodeName == "message")
{
var tmpXML:XMLList = new XMLList(event.data);
if(tmpXML.body == null)
{
//do nothing
}else{
consoleMsg.text = consoleMsg.text + event.data.firstChild.attributes.from + ": " + tmpXML.body + "\n\n\n\n";
}
}else{
consoleMsg.text = consoleMsg.text + event.data + "\n\n\n\n";
}
}
private function handleOutgoingData(event:OutgoingDataEvent):void
{
consoleMsg.text = consoleMsg.text + ">>>Sent: " + event.data + "\n\n\n\n";
}
]]>