virtual void handleMUCItems( MUCRoom * /*room*/, const Disco::ItemList& items )
 {
   Disco::ItemList::const_iterator it = items.begin();
   for( ; it != items.end(); ++it )
   {
     printf( "%s -- %s is an item here\n", (*it)->jid().full().c_str(), (*it)->name().c_str() );
   }
 }
Esempio n. 2
0
 virtual Disco::ItemList handleDiscoNodeItems( const JID&,
     const JID&, const std::string& = EmptyString )
 {
   Disco::ItemList dil;
   if( m_test == 7 )
     dil.push_back( new Disco::Item( JID( "6jid" ), "6node", "6name" ) );
   return dil;
 }
Esempio n. 3
0
 virtual void handleFlexibleOfflineMessageHeaders( const Disco::ItemList& headers )
 {
   printf( "FlexOff: %d headers received.\n", headers.size() );
   StringList l;
   l.push_back( "Fdd" );
   l.push_back( (*(headers.begin()))->node() );
   f->fetchMessages( l );
   f->removeMessages( l );
 }
Esempio n. 4
0
 Disco::ItemList Adhoc::handleDiscoNodeItems( const JID& from, const JID& /*to*/, const std::string& node )
 {
   Disco::ItemList l;
   if( node.empty() )
   {
     l.push_back( new Disco::Item( m_parent->jid(), XMLNS_ADHOC_COMMANDS, "Ad-Hoc Commands" ) );
   }
   else if( node == XMLNS_ADHOC_COMMANDS )
   {
     StringMap::const_iterator it = m_items.begin();
     for( ; it != m_items.end(); ++it )
     {
       AdhocCommandProviderMap::const_iterator itp = m_adhocCommandProviders.find( (*it).first );
       if( itp != m_adhocCommandProviders.end()
           && (*itp).second
           && (*itp).second->handleAdhocAccessRequest( from, (*it).first ) )
       {
         l.push_back( new Disco::Item( m_parent->jid(), (*it).first, (*it).second ) );
       }
     }
   }
   return l;
 }
Esempio n. 5
0
void AdhocTest::send( const IQ& iq, IqHandler*, int ctx )
{
  switch( m_test )
  {
    case 1: // getSupport()
    {
      Disco::Info i;
      i.m_features.push_back( XMLNS_ADHOC_COMMANDS );
      m_adhoc->handleDiscoInfo( g_jid, i, Adhoc::CheckAdhocSupport );
      break;
    }
    case 2: // getSupport() fails
    {
      Disco::Info i;
      m_adhoc->handleDiscoInfo( g_jid, i, Adhoc::CheckAdhocSupport );
      break;
    }
    case 3: // getCommands()
    {
      Disco::ItemList il;
      il.push_back( new Disco::Item( g_jid, "node", "name" ) );
      Disco::Items i;
      i.setItems( il );
      m_adhoc->handleDiscoItems( g_jid, i, Adhoc::FetchAdhocCommands );
      break;
    }
    case 4: // execute single stage command
    {
      IQ re( IQ::Result, iq.from(), iq.id() );
      re.setFrom( g_jid );
      re.addExtension( new Adhoc::Command( "foocmd", "somesess", Adhoc::Command::Completed, 0 ) );
      m_adhoc->handleIqID( re, ctx );
      break;
    }
  }
}