While implementing *handleRoster( const Roster &roster )* I get the
feeling that list is probably un-stable. Sorry If I was mistaken.
1. This code never works for me:
* printf("RosterSize: %d\n", roster.size() );
Roster::const_iterator it = roster.begin();
for( ; it != roster.end(); ++it )
{
std::string id = it->second->jid();
std::string name = it->second->name();
printf("id: %s\n name : %s\n", id.c_str(), name.c_str());
};*
**
The loop runs 2 times even if the roster.size() return 1. Further more,
sometimes I can print-out an item which has no name, no id and subscription
= -876543...
It seems that there is an item there which points to nothing.
So I tried this code to work ok (if size == 1, the loop runs 1 times ):
* printf("RosterSize: %d\n", roster.size() );*
*int size = roster.size();
Roster::const_iterator it = roster.begin();*
* for( int i = 0; i < size; ++i )
{
std::string id = it->second->jid();
std::string name = it->second->name();
printf("id: %s\n name : %s\n", id.c_str(), name.c_str());
++it;
};*
**
2. The code above works until:
Once I tested: client A tried to add Client B as friend (and the reply was
accept and add ).
When A got a "subscribed", it's strange that B was not in A's roster. So I
got a "non-roster presence" event raised.
The next step : A got a "subscription request" from B (B also added A) => no
ID of B found in A's roster??? (If I was right, B is always added in A's
roster before a handleSubscriptionRequest() )....
So, from there on, A always gets "Connection refuse" while logging in to the
server. I found that at handleRoster I was trying to an get roster item
which was defected. So there was an item there, but if I try to get id ( e.g.
*id = it->first* ) => disconnect with ""Connection refuse" code.
I see that maybe the server has something to do here, but it would be good
if at handleRoster(Roster &) which is stable (e.g. items are safe to get )
Thanks a lot,
Son.
p/s: I am using rc1 and moving to rc3, but it would take time for me. I am
really sorry if it was my fault or the bug was posted and fixed in rc3.