virtual void handleBookmarks( const BookmarkList &bList, const ConferenceList &cList )
    {
      printf( "received bookmarks...\n" );

      BookmarkList::const_iterator it_b = bList.begin();
      for( ; it_b != bList.end(); it_b++ )
      {
        printf( "url: %s, name: %s\n", (*it_b).url.c_str(), (*it_b).name.c_str() );
      }
      ConferenceList::const_iterator it_c = cList.begin();
      for( ; it_c != cList.end(); it_c++ )
      {
        printf( "jid: %s, name: %s, nick: %s, pwd: %s\n", (*it_c).jid.c_str(), (*it_c).name.c_str(),
                (*it_c).nick.c_str(), (*it_c).password.c_str() );
      }

      BookmarkList mybList;
      ConferenceList mycList;

      BookmarkListItem bItem;
      bItem.url = "http://camaya.net/gloox";
      bItem.name = "gloox";
      mybList.push_back( bItem );

      bItem.url = "http://jabber.cc";
      bItem.name = "public jabber services";
      mybList.push_back( bItem );

      ConferenceListItem cItem;
      cItem.jid = "*****@*****.**";
      cItem.name = "jabber development";
      cItem.nick = "myNick";
      cItem.autojoin = false;
      mycList.push_back( cItem );

      cItem.jid = "*****@*****.**";
      cItem.name = "jabberd development";
      cItem.nick = "myOtherNick";
      cItem.password = "******";
      cItem.autojoin = true;
      mycList.push_back( cItem );

      b->storeBookmarks( mybList, mycList );
    }
Beispiel #2
0
BookmarkList
ConvertToBookmarkList(const vector<String>& lst)
{
	BookmarkList bookmarks;

	bookmarks.reserve(lst.size());
	for(const auto& str : lst)
		bookmarks.push_back(stoul(str.GetMBCS()));
	return bookmarks;
}
Beispiel #3
0
  void BookmarkStorage::handlePrivateXML( const Tag* xml )
  {
    if( !xml )
      return;

    BookmarkList bList;
    ConferenceList cList;
    const TagList& l = xml->children();
    TagList::const_iterator it = l.begin();
    for( ; it != l.end(); ++it )
    {
      if( (*it)->name() == "url" )
      {
        const std::string& url = (*it)->findAttribute( "url" );
        const std::string& name = (*it)->findAttribute( "name" );

        if( !url.empty() && !name.empty() )
        {
          BookmarkListItem item;
          item.url = url;
          item.name = name;
          bList.push_back( item );
        }
      }
      else if( (*it)->name() == "conference" )
      {
        const std::string& jid = (*it)->findAttribute( "jid" );
        const std::string& name = (*it)->findAttribute( "name" );

        if( !jid.empty() && !name.empty() )
        {
          const std::string& join = (*it)->findAttribute( "autojoin" );
          ConferenceListItem item;
          item.jid = jid;
          item.name = name;
          const Tag* nick = (*it)->findChild( "nick" );
          if( nick )
            item.nick = nick->cdata();
          const Tag* pwd = (*it)->findChild( "password" );
          if( pwd )
            item.password = pwd->cdata();
          item.autojoin = ( join == "true" || join == "1" );
          cList.push_back( item );
        }
      }
    }

    if( m_bookmarkHandler )
      m_bookmarkHandler->handleBookmarks( bList, cList );
  }