summaryrefslogtreecommitdiff
path: root/user.cpp
blob: d3457b86344764cd932c6c987b8ca489160bfe1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "user.h"

namespace plexclient {

    user::user(std::istream *response) {
        try {
            InputSource src(*response);
            DOMParser parser;
            Poco::XML::AutoPtr<Document> pDoc = parser.parse(&src);

            NodeIterator it(pDoc, Poco::XML::NodeFilter::SHOW_ALL);
            Node *pNode = it.nextNode();

            while (pNode) {
                if (Poco::icompare(pNode->nodeName(), "authentication-token") == 0) {
                    pNode = it.nextNode();
                    authenticationToken = pNode->nodeValue();
                    break;
                }
                pNode = it.nextNode();
            }

        } catch (Exception &exc) {
            std::cerr << exc.displayText() << std::endl;
        }

    }

}