From: David G. <da...@en...> - 2010-09-14 16:48:15
|
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 |