From: Norman R. <no...@ra...> - 2010-09-17 08:53:46
|
You could call client.getRoster() on connect (and don't store it's return value anywhere), and then use client.Roster from your presence handler. On Tue, Sep 14, 2010 at 5:26 PM, David Gregory <da...@en...>wrote: > I’m trying to get my client UI respond to presence updates. Seems easy. > Set up presence and iq handlers and track them. > > But you end up repeating all the work that the roster has done already in > its own presence and iq handlers. > > > > It would be better to be notified when the roster has been updated for a > particular contact, so then I can go grab all of the item info and pass it > on to my client. I don’t see this mechanism in place – only the ability to > hook into the same raw presence and iq updates that the roster receives. > > > > I’ve tried several workarounds so I don’t have to modify XMPPPY. > > > > I’ve tried to cache the roster ptr after I retrieve it on connect, and then > look up into it in my own presence handler when any updates are received. > The problem with this is – there is a period of time during which the > presence updates I receive will not have a cached roster ptr to look up into > – because the “getRoster” method hasn’t returned yet. It means that my > “show”, “status” and other information is not correct during client connect, > until I receive the next presence update for each person. > > > > If, instead of caching the roster ptr, I actually call client.getRoster() > in my presence handler and then access the items that way, I will crash/have > a problem where the initial roster is still being pulled, and that > “Process(10)” call is blocking (in roster.py). > > > > Has anyone figured out a way to reliably access the roster at *any* time, > as the code is now? > > > > Seems like my fallback is to add a callback mechanism to roster.py to > notify me when a contact is updated, and pass “self” to the caller so he can > peek back at the roster item, and then pass it on. > > > > -Dave > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Xmpppy-devel mailing list > Xmp...@li... > https://lists.sourceforge.net/lists/listinfo/xmpppy-devel > > -- - Norman Rasmussen - Email: no...@ra... - Home page: http://norman.rasmussen.co.za/ |