virtual void handleAnnotations( const AnnotationsList &aList ) { printf( "received notes...\n" ); AnnotationsList::const_iterator it = aList.begin(); for( ; it != aList.end(); it++ ) { printf( "jid: %s, note: %s, cdate: %s, mdate: %s\n", (*it).jid.c_str(), (*it).note.c_str(), (*it).cdate.c_str(), (*it).mdate.c_str() ); } AnnotationsList mybList; AnnotationsListItem bItem; bItem.jid = "*****@*****.**"; bItem.note = "my lover & friend. 2 > 3"; mybList.push_back( bItem ); bItem.jid = "*****@*****.**"; bItem.note = "oh my sweetest love..."; bItem.cdate = "20040924T15:23:21"; bItem.mdate = "20040924T15:23:21"; mybList.push_back( bItem ); a->storeAnnotations( mybList ); }
void Annotations::storeAnnotations( const AnnotationsList& aList ) { Tag* s = new Tag( "storage", XMLNS, XMLNS_ANNOTATIONS ); AnnotationsList::const_iterator it = aList.begin(); for( ; it != aList.end(); ++it ) { Tag* n = new Tag( s, "note", (*it).note ); n->addAttribute( "jid", (*it).jid ); n->addAttribute( "cdate", (*it).cdate ); n->addAttribute( "mdate", (*it).mdate ); } storeXML( s, this ); }