コード例 #1
0
ファイル: disco_test.cpp プロジェクト: jvalvert/societas
 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;
 }
コード例 #2
0
ファイル: adhoc.cpp プロジェクト: dvdjg/GoapCpp
 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;
 }
コード例 #3
0
ファイル: adhoc_test.cpp プロジェクト: hcmlab/mobileSSI
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;
    }
  }
}