summaryrefslogtreecommitdiffstats
blob: 84b2887f18376f9590a1404e1b60c9d0b0c32758 (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
/*
 * Copyright (c) 2010 Remko Tronçon
 * Licensed under the GNU General Public License v3.
 * See Documentation/Licenses/GPLv3.txt for more information.
 */

#ifndef SWIFTEN_RosterItemPayloadPayload_H
#define SWIFTEN_RosterItemPayloadPayload_H

#include <vector>

#include "Swiften/JID/JID.h"
#include "Swiften/Base/String.h"

namespace Swift {
	class RosterItemPayload
	{
		public:
			enum Subscription { None, To, From, Both, Remove };

			RosterItemPayload() : subscription_(None), ask_(false) {}
			RosterItemPayload(const JID& jid, const String& name, Subscription subscription) : jid_(jid), name_(name), subscription_(subscription), ask_(false) { }
			
			void setJID(const JID& jid) { jid_ = jid; }
			const JID& getJID() const { return jid_; }

			void setName(const String& name) { name_ = name; }
			const String& getName() const { return name_; }

			void setSubscription(Subscription subscription) { subscription_ = subscription; }
			const Subscription& getSubscription() const { return subscription_; }

			void addGroup(const String& group) { groups_.push_back(group); }
			void setGroups(const std::vector<String>& groups) { groups_ = groups; }
			const std::vector<String>& getGroups() const { return groups_; }

			void setSubscriptionRequested() { ask_ = true; }
			bool getSubscriptionRequested() const { return ask_; }

			const String& getUnknownContent() const { return unknownContent_; }
			void addUnknownContent(const String& c) { 
				unknownContent_ += c;
			}

		private:
			JID jid_;
			String name_;
			Subscription subscription_;
			std::vector<String> groups_;
			bool ask_;
			String unknownContent_;
	};
}

#endif