diff --git a/backends/twitter/TwitterResponseParser.cpp b/backends/twitter/TwitterResponseParser.cpp index 2e403da6194177a46ccb29e1d06718faa499ad74..350f25c8453cb5cadc92d850dda6c40c237a0c9c 100644 --- a/backends/twitter/TwitterResponseParser.cpp +++ b/backends/twitter/TwitterResponseParser.cpp @@ -52,7 +52,6 @@ std::vector getTimeline(std::string &xml) const std::string xmlns = rootElement->getNamespace(); const std::vector children = rootElement->getChildren(TwitterReponseTypes::status, xmlns); -// const std::vector::iterator it; for(int i = 0; i < children.size() ; i++) { const Swift::ParserElement::ref status = children[i]; @@ -61,6 +60,26 @@ std::vector getTimeline(std::string &xml) return statuses; } +std::vector getUsers(std::string &xml) +{ + std::vector users; + Swift::ParserElement::ref rootElement = Swift::StringTreeParser::parse(xml); + + if(rootElement->getName() != TwitterReponseTypes::users) { + LOG4CXX_ERROR(logger, "XML doesn't correspond to user list") + return users; + } + + const std::string xmlns = rootElement->getNamespace(); + const std::vector children = rootElement->getChildren(TwitterReponseTypes::user, xmlns); + + for(int i = 0 ; i < children.size() ; i++) { + const Swift::ParserElement::ref user = children[i]; + users.push_back(getUser(user, xmlns)); + } + return users; +} + std::vector getIDs(std::string &xml) { std::vector IDs;