Skip to content
Browse files

properly remove jids as they drop offline

  • Loading branch information...
1 parent b606f96 commit 0cd8abbaa3abc36883084e8668e535bf08974ee8 @RJ committed Jul 20, 2009
Showing with 6 additions and 5 deletions.
  1. +6 −5 src/jbot.cpp
View
11 src/jbot.cpp
@@ -364,17 +364,20 @@ void
jbot::handleRosterPresence( const RosterItem& item, const std::string& resource,
Presence::PresenceType presence, const std::string& /*msg*/ )
{
+ JID jid( item.jid() );
+ jid.setResource( resource );
+
// does this presence mean they are offline/un-queryable:
if ( presence == Presence::Unavailable ||
presence == Presence::Error ||
presence == Presence::Invalid )
{
- printf( "//////presence received (->OFFLINE): %s/%s\n", item.jid().c_str(), resource.c_str() );
+ printf( "//////presence received (->OFFLINE): %s\n", jid.full().c_str() );
// remove peer from list, if he exists
boost::mutex::scoped_lock lk(m_playdarpeers_mut);
- if( m_playdarpeers.erase(item.jid()) )
+ if( m_playdarpeers.erase(jid.full()) )
{
- printf("Removed %s from playdarpeers\n", item.jid().c_str());
+ printf("Removed %s from playdarpeers\n", jid.full().c_str());
}
return;
}
@@ -390,8 +393,6 @@ jbot::handleRosterPresence( const RosterItem& item, const std::string& resource,
printf( "//////presence received (->ONLINE) %s/%s -- %d\n",
item.jid().c_str(),resource.c_str(), presence );
- JID jid( item.jid() );
- jid.setResource( resource );
// /resource HACK: gtalk filters unrecognised disco features
// so we assume they are playdar-capable if resource contains "playdar"
if( jid.resource().find( "playdar" ) != string::npos )

0 comments on commit 0cd8abb

Please sign in to comment.
Something went wrong with that request. Please try again.