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

#pragma once

#include <boost/shared_ptr.hpp>

#include <string>
#include <Swiften/Base/ByteArray.h>
#include <Swiften/Elements/Payload.h>

namespace Swift {
	class VCard : public Payload {
		public:
			typedef boost::shared_ptr<VCard> ref;

			struct EMailAddress {
				EMailAddress() : isHome(false), isWork(false), isInternet(false), isPreferred(false), isX400(false) {
				}

				bool isHome;
				bool isWork;
				bool isInternet;
				bool isPreferred;
				bool isX400;
				std::string address;
			};

			VCard() {}

			void setVersion(const std::string& version) { version_ = version; }
			const std::string& getVersion() const { return version_; }

			void setFullName(const std::string& fullName) { fullName_ = fullName; }
			const std::string& getFullName() const { return fullName_; }

			void setFamilyName(const std::string& familyName) { familyName_ = familyName; }
			const std::string& getFamilyName() const { return familyName_; }

			void setGivenName(const std::string& givenName) { givenName_ = givenName; }
			const std::string& getGivenName() const { return givenName_; }

			void setMiddleName(const std::string& middleName) { middleName_ = middleName; }
			const std::string& getMiddleName() const { return middleName_; }

			void setPrefix(const std::string& prefix) { prefix_ = prefix; }
			const std::string& getPrefix() const { return prefix_; }

			void setSuffix(const std::string& suffix) { suffix_ = suffix; }
			const std::string& getSuffix() const { return suffix_; }


			//void setEMailAddress(const std::string& email) { email_ = email; }
			//const std::string& getEMailAddress() const { return email_; }

			void setNickname(const std::string& nick) { nick_ = nick; }
			const std::string& getNickname() const { return nick_; }

			void setPhoto(const ByteArray& photo) { photo_ = photo; }
			const ByteArray& getPhoto() { return photo_; }

			void setPhotoType(const std::string& photoType) { photoType_ = photoType; }
			const std::string& getPhotoType() { return photoType_; }

			const std::string& getUnknownContent() const { return unknownContent_; }
			void addUnknownContent(const std::string& c) { 
				unknownContent_ += c;
			}

			const std::vector<EMailAddress>& getEMailAddresses() const {
				return emailAddresses_;
			}

			void addEMailAddress(const EMailAddress& email) {
				emailAddresses_.push_back(email);
			}

			EMailAddress getPreferredEMailAddress() const;

		private:
			std::string version_;
			std::string fullName_;
			std::string familyName_;
			std::string givenName_;
			std::string middleName_;
			std::string prefix_;
			std::string suffix_;
			//std::string email_;
			ByteArray photo_;
			std::string photoType_;
			std::string nick_;
			std::string unknownContent_;
			std::vector<EMailAddress> emailAddresses_;
	};
}