summaryrefslogtreecommitdiffstats
blob: 0fcb2b10ece0bb084328603c93faff42d85487cd (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * Copyright (c) 2010-2016 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

#pragma once

#include <memory>
#include <string>

#include <boost/optional.hpp>

#include <Swiften/Base/API.h>
#include <Swiften/Elements/Form.h>
#include <Swiften/Elements/Payload.h>

namespace Swift {
    /**
     * XEP-0055 search payload.
     */
    class SWIFTEN_API SearchPayload : public Payload {
        public:
            typedef std::shared_ptr<SearchPayload> ref;

            struct Item {
                std::string first;
                std::string last;
                std::string nick;
                std::string email;
                JID jid;
            };

            SearchPayload() {}

            Form::ref getForm() const { return form; }
            void setForm(Form::ref f) { form = f; }

            const boost::optional<std::string>& getInstructions() const {
                return instructions;
            }

            const boost::optional<std::string>& getNick() const {
                return nick;
            }

            const boost::optional<std::string>& getFirst() const {
                return first;
            }

            const boost::optional<std::string>& getLast() const {
                return last;
            }

            const boost::optional<std::string>& getEMail() const {
                return email;
            }

            void setInstructions(const std::string& v) {
                this->instructions = v;
            }

            void setNick(const std::string& v) {
                this->nick = v;
            }

            void setFirst(const std::string& v) {
                this->first = v;
            }

            void setLast(const std::string& v) {
                this->last = v;
            }

            void setEMail(const std::string& v) {
                this->email = v;
            }

            const std::vector<Item>& getItems() const {
                return items;
            }

            void addItem(const Item& item) {
                items.push_back(item);
            }

        private:
            Form::ref form;
            boost::optional<std::string> instructions;
            boost::optional<std::string> nick;
            boost::optional<std::string> first;
            boost::optional<std::string> last;
            boost::optional<std::string> email;
            std::vector<Item> items;
    };
}