15 #include "bookmarkstorage.h"
16 #include "clientbase.h"
24 m_bookmarkHandler( 0 )
34 Tag* s =
new Tag(
"storage" );
37 BookmarkList::const_iterator itb = bList.begin();
38 for( ; itb != bList.end(); ++itb )
40 Tag* i =
new Tag( s,
"url",
"name", (*itb).
name );
44 ConferenceList::const_iterator itc = cList.begin();
45 for( ; itc != cList.end(); ++itc )
47 Tag* i =
new Tag( s,
"conference",
"name", (*itc).
name );
49 i->
addAttribute(
"autojoin", (*itc).autojoin ?
"true" :
"false" );
51 new Tag( i,
"nick", (*itc).nick );
52 new Tag( i,
"password", (*itc).password );
71 TagList::const_iterator it = l.begin();
72 for( ; it != l.end(); ++it )
74 if( (*it)->name() ==
"url" )
76 const std::string& url = (*it)->findAttribute(
"url" );
77 const std::string& name = (*it)->findAttribute(
"name" );
79 if( !url.empty() && !name.empty() )
84 bList.push_back( item );
87 else if( (*it)->name() ==
"conference" )
89 const std::string& jid = (*it)->findAttribute(
"jid" );
90 const std::string& name = (*it)->findAttribute(
"name" );
92 if( !jid.empty() && !name.empty() )
94 const std::string& join = (*it)->findAttribute(
"autojoin" );
104 item.
autojoin = ( join ==
"true" || join ==
"1" );
105 cList.push_back( item );
110 if( m_bookmarkHandler )
const TagList & children() const
std::string requestXML(const std::string &tag, const std::string &xmlns, PrivateXMLHandler *pxh)
std::string storeXML(const Tag *tag, PrivateXMLHandler *pxh)
virtual void handlePrivateXML(const Tag *xml)
virtual ~BookmarkStorage()
std::list< Tag * > TagList
virtual void handleBookmarks(const BookmarkList &bList, const ConferenceList &cList)=0
const std::string XMLNS_BOOKMARKS
The namespace for the gloox library.
This class implements XEP-0049 (Private XML Storage).
const std::string cdata() const
bool addAttribute(Attribute *attr)
BookmarkStorage(ClientBase *parent)
const std::string & name() const
std::list< ConferenceListItem > ConferenceList
virtual void handlePrivateXMLResult(const std::string &uid, PrivateXMLResult pxResult)
Tag * findChild(const std::string &name) const
void storeBookmarks(const BookmarkList &bList, const ConferenceList &cList)
This is the common base class for a Jabber/XMPP Client and a Jabber Component.
This is an abstraction of an XML element.
std::list< BookmarkListItem > BookmarkList