XIFF & Flex

Is there any example of an mxml file to try this out, just to explore how to implement this with flex?

Thanks

I’'m working on one right now actually, and will be posting to the examples section by this weekend.

In the meantime, the conference.as file in the examples folder is a great place to start. From there you just need to setup your Flex components and have the Actionscript between the:

mx:Script

</mx:Script>

You can reference the Flex components directly from the ActionScript similar to the Conference.as file.

So the rest of the mxml file will be the actual display components such as panels, hbox, controlbars, etc…

Let me know if you have any further questions, or need some more details before I get the sample up.

Okay, so I couldn’‘t go to bed without having a Flex demo out for you guys to play with. Plus, since Matt won’'t be able to post this to the Examples page until next week, I decided to attach the Flex example to this post.

This Flex example is loosely based on the ConferenceTest.as example code and will need to be modified with your server name, username, etc… The XIFF class library should be deployed at the same level as the Flex application. See the Readme file in the XIFF library download for more info.

Ways to improve this example:

  • create a login panel

  • create the ability to perform Ban / Kick / etc. actions on Roster members

  • implement Private Messages

Have fun! Let us know how it goes.
conferenceTest.mxml (5497 Bytes)

Well It’'s a great package,

I’‘m working now with it and I’'m amazed with the very good work.

I’'m still not able to get roster contacts.

When I try roster.getContactInformation(“my_jid@mydomain”) I always get a empty object

and roster.length always returns 0 length.

Any good way to debug this? I log in with the same account with gaim and I can see “my_jid@mydomain” contact in my list.

Thanks,

Just to clarify, you are not seeing your JID in the RosterList panel when you run the example? Did you make any changes to the example code? Also, are you running the Flex application on the same server as Jive Messenger?

Well I started to create my own file, not for chat but like a Jabber client so I try to get a list of contacts for that login ( I forced 1 I created).

What happens is that the roster doesn’'t seem to be populated with the contact list as it should.

Length is always 0. Even with Roster.fetchRoster() I don’'t have the Roster updated.

Presence events are dispatched correctly but when I try to get the contact info from the roster himself (trought the JID) nothing is returned.

I also noticed that events for the roster aren’'t dispatched (eg: Roster.userAvailable and userUnavailable)

Just to make sure (in case you haven’'t tried this), one way to debug is to listen to the incomingData and outgoingData events from the XMPPConnection class. These contain a data attribute with the actual XML stream going to and from the server - then you can make sure the fetchRoster() is doing the proper thing.

If the Roster/XMPPConnection association is made before a “login” event is broadcast by the XMPPConnection class (ie., you do new Roster( xmppConnectionInstance )), the Roster class instance should call fetchRoster automatically.

Not sure if that helps, but its some info

Here is how I’'m going things:

  1. like the demo posted here, I make a xmppConnection and set their eventHandlers

  2. A button dispatch a login(like the demo)

  3. When the login is dispatched by the connection I create the roster

and set their eventHandlers (the demo was setting as a var inside the function but I’'m doing it accesible for the application)

  1. a presence (xmppConnection event) dispatch when presence a presence is available and here I’'m trying to roster.fetchRoster() so I can access roster properties like length or roster Items but none exists. If at the same place I access roster.connection I got the xmppConnection Object perfectly.

For now I’‘m populating a userList based on the presence information but roster Information whould be very handful. It’‘s the only think I didn’'t manage to get.

I can send messages to the contact, remove it from de list as it goes offline but can’'t access any data from the roster himself (the connection I can).

Do you want me to post the code?

bogos - if you can’‘t attach the code, please send it to barry@jivesoftware.com and I’'ll post it here.

Have you any news about this barry?

tip: If you make each connection unique, it will not kick the last user out ( I think) . So add this code.

connection.resource = “xiff_”+Math.random()*5;

Message was edited by:

danp5648

I think this is not the problem.

I’'m not getting a contact buddy list populated by the roster.

I have added eventListeners to dispatch when users are available and they never get dispatched and roster.length is always equal to 0.

If I connect with both entities with gaim, both see each other. If I connect one with Flex, I got the other presence but roster keeps with length = 0.

I got also this with debugging

INCOMING: Informática

The roster relies on the DataProvider class - I’‘m wondering if the data provider in Flex has a different interface than the one in Flash (It’‘s been a while and I can’‘t remember). This would explain the problem if that’'s the case (and I think it is).

Line 458 in the Roster class is where items are added to the client’‘s roster locally. I’‘m pretty sure this is being called. But if you look at the Roster’‘s constructor on line 123, you’'ll see that there is a second optional parameter to the constructor that lets you specify an external DataProvider, instead of using the Array provided by the class.

Note that on line 141 this is where all Arrays are initialized as DataProviders. This decorates the Array class with the DataProvider API. I’‘m not sure if this works the same in Flex - this part of the code may be the problem, and the Roster relies on it if an external DataProvider is not provided in the Roster’'s constructor.

*Note: The external DataProvider option in the constructor was needed for Central support because Central had a different DataProvider API.

Might need more investigation because when I built the library I originally built it for Flash, there was never any testing done with Flex. But I know Flex support is the direction things are headed …

When I am trying to use the example, i am getting at 503 error: Service unavailable. I have whitelist the item in flex, and added a crossdomain policy file via the command: System.security.loadPolicyFile(“crossdomain.xml”);

I have updated the server, username, and password items in the example mxml file.

Our server is jivemessenger.

Thoughts?

Thanks

Ken

Message was edited by:

kyoung

Ken - i’'m assuming you have validated that the Flex samples and profiler are working? Which app server are you running Flex on as well…seems to be a Flex configuration issue (at least for now)

  • Barry

I am using Tomcat 5 on Windows XP with Flex 1.5. Actually, I created a folder in the flex samples and placed the mxml file. In addition, added the classes (org...*) into the WEB-INF\flex\user_classes directory.

For example, flex explorer is working find, as is RSL and photo viewer samples

Ken

Ken - i can’'t get to my dev environment right now, but try placing the class directory in the same folder as the MXML file. Also, can you send me the Flex log files (send me a private message). Thanks.

hello all,

I also encountered+ bogo’'s+ problem. Is there any update on the xiff library?

Thanks for advance.

For the class to work in Flex, 3 modifications in the classes:

1 . XMLStanza.as

add import import org.jivesoftware.xiff.data.ExtensionContainer;

extends ExtensionContainer

  1. XMPPStanza.as

deseralize function:

line 162

//var ext:IExtension = new extClass();

var ext:RosterExtension = new RosterExtension(nName);

ext.deserialize(children[i]);

3.ExtensionClassRegistry.as

register function:

//var extensionInstance:IExtension = new extensionClass(dummyXML);

var extensionInstance:RosterExtension = new extensionClass(dummyXML);

Is the approach correct or any other better approach suggested? Thank you.

Hi,

It would be so great if you could thought some insight…on the following…

How do you get your buddies list and update in the rooster ?.

How do I get the rooms list from the server.?

cheers

viv