Permalink
Browse files

disco response not arriving from gtalk, use resource hack when presen…

…ce arrives instead
  • Loading branch information...
1 parent 1488bca commit b606f961c7a01a953d11dbc330b0bdb1f71a6a74 @RJ committed Jul 20, 2009
Showing with 17 additions and 6 deletions.
  1. +17 −6 src/jbot.cpp
View
@@ -382,17 +382,30 @@ jbot::handleRosterPresence( const RosterItem& item, const std::string& resource,
// have just changed their status to Away or something asinine.
{
boost::mutex::scoped_lock lk(m_playdarpeers_mut);
- if( m_playdarpeers.find(item.jid()) != m_playdarpeers.end() )
+ if( m_playdarpeers.count(item.jid()) )
{
return; // already online and in our list.
}
}
printf( "//////presence received (->ONLINE) %s/%s -- %d\n",
item.jid().c_str(),resource.c_str(), presence );
-
- // Disco them to check if they are playdar-capable
+
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 )
+ {
+ boost::mutex::scoped_lock lk(m_playdarpeers_mut);
+ if( m_playdarpeers.count(jid.full()) == 0 )
+ {
+ printf("Adding '%s' to playdarpeers\n", jid.full().c_str());
+ m_playdarpeers.insert( jid.full() );
+ if( m_new_peer_cb ) m_new_peer_cb( jid.full() );
+ }
+ }
+
+ // Disco them to check if they are playdar-capable
//printf( "DISCOing: %s \n", jid.full().c_str() );
j->disco()->getDiscoInfo( jid, "", this, 0 );
}
@@ -434,9 +447,7 @@ jbot::handleNonrosterPresence( const Presence& presence )
void
jbot::handleDiscoInfo( const JID& from, const Disco::Info& info, int context)
{
- if ( info.hasFeature("playdar:resolver")
- || from.resource().find( "playdar") != string::npos )
- // /resource HACK: gtalk filters unrecognised disco features :(
+ if ( info.hasFeature("playdar:resolver") )
{
boost::mutex::scoped_lock lk(m_playdarpeers_mut);
if( m_playdarpeers.count(from.full()) == 0 )

0 comments on commit b606f96

Please sign in to comment.