summaryrefslogtreecommitdiffstats
blob: 15173f1a2ca70a538372331e7bf6e9e68c0cd50e (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
/*
 * 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 "Swiften/Base/String.h"
#include "Swiften/Base/Shared.h"
#include "Swiften/Base/ByteArray.h"
#include "Swiften/Elements/Payload.h"

namespace Swift {
	class VCard : public Payload, public Shared<VCard> {
		public:
			struct EMailAddress {
				EMailAddress() : isHome(false), isWork(false), isInternet(false), isPreferred(false), isX400(false) {
				}

				bool isHome;
				bool isWork;
				bool isInternet;
				bool isPreferred;
				bool isX400;
				String address;
			};

			VCard() {}

			void setVersion(const String& version) { version_ = version; }
			const String& getVersion() const { return version_; }

			void setFullName(const String& fullName) { fullName_ = fullName; }
			const String& getFullName() const { return fullName_; }

			void setFamilyName(const String& familyName) { familyName_ = familyName; }
			const String& getFamilyName() const { return familyName_; }

			void setGivenName(const String& givenName) { givenName_ = givenName; }
			const String& getGivenName() const { return givenName_; }

			void setMiddleName(const String& middleName) { middleName_ = middleName; }
			const String& getMiddleName() const { return middleName_; }

			void setPrefix(const String& prefix) { prefix_ = prefix; }
			const String& getPrefix() const { return prefix_; }

			void setSuffix(const String& suffix) { suffix_ = suffix; }
			const String& getSuffix() const { return suffix_; }


			//void setEMailAddress(const String& email) { email_ = email; }
			//const String& getEMailAddress() const { return email_; }

			void setNickname(const String& nick) { nick_ = nick; }
			const String& getNickname() const { return nick_; }

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

			void setPhotoType(const String& photoType) { photoType_ = photoType; }
			const String& getPhotoType() { return photoType_; }

			const String& getUnknownContent() const { return unknownContent_; }
			void addUnknownContent(const 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:
			String version_;
			String fullName_;
			String familyName_;
			String givenName_;
			String middleName_;
			String prefix_;
			String suffix_;
			//String email_;
			ByteArray photo_;
			String photoType_;
			String nick_;
			String unknownContent_;
			std::vector<EMailAddress> emailAddresses_;
	};
}