00001 /* 00002 * Copyright (c) 2010 Remko Tronçon 00003 * Licensed under the GNU General Public License v3. 00004 * See Documentation/Licenses/GPLv3.txt for more information. 00005 */ 00006 00007 #pragma once 00008 00009 #include <boost/shared_ptr.hpp> 00010 00011 #include <string> 00012 #include <Swiften/Base/ByteArray.h> 00013 #include <Swiften/Elements/Payload.h> 00014 00015 namespace Swift { 00016 class VCard : public Payload { 00017 public: 00018 typedef boost::shared_ptr<VCard> ref; 00019 00020 struct EMailAddress { 00021 EMailAddress() : isHome(false), isWork(false), isInternet(false), isPreferred(false), isX400(false) { 00022 } 00023 00024 bool isHome; 00025 bool isWork; 00026 bool isInternet; 00027 bool isPreferred; 00028 bool isX400; 00029 std::string address; 00030 }; 00031 00032 VCard() {} 00033 00034 void setVersion(const std::string& version) { version_ = version; } 00035 const std::string& getVersion() const { return version_; } 00036 00037 void setFullName(const std::string& fullName) { fullName_ = fullName; } 00038 const std::string& getFullName() const { return fullName_; } 00039 00040 void setFamilyName(const std::string& familyName) { familyName_ = familyName; } 00041 const std::string& getFamilyName() const { return familyName_; } 00042 00043 void setGivenName(const std::string& givenName) { givenName_ = givenName; } 00044 const std::string& getGivenName() const { return givenName_; } 00045 00046 void setMiddleName(const std::string& middleName) { middleName_ = middleName; } 00047 const std::string& getMiddleName() const { return middleName_; } 00048 00049 void setPrefix(const std::string& prefix) { prefix_ = prefix; } 00050 const std::string& getPrefix() const { return prefix_; } 00051 00052 void setSuffix(const std::string& suffix) { suffix_ = suffix; } 00053 const std::string& getSuffix() const { return suffix_; } 00054 00055 00056 //void setEMailAddress(const std::string& email) { email_ = email; } 00057 //const std::string& getEMailAddress() const { return email_; } 00058 00059 void setNickname(const std::string& nick) { nick_ = nick; } 00060 const std::string& getNickname() const { return nick_; } 00061 00062 void setPhoto(const ByteArray& photo) { photo_ = photo; } 00063 const ByteArray& getPhoto() const { return photo_; } 00064 00065 void setPhotoType(const std::string& photoType) { photoType_ = photoType; } 00066 const std::string& getPhotoType() const { return photoType_; } 00067 00068 const std::string& getUnknownContent() const { return unknownContent_; } 00069 void addUnknownContent(const std::string& c) { 00070 unknownContent_ += c; 00071 } 00072 00073 const std::vector<EMailAddress>& getEMailAddresses() const { 00074 return emailAddresses_; 00075 } 00076 00077 void addEMailAddress(const EMailAddress& email) { 00078 emailAddresses_.push_back(email); 00079 } 00080 00081 EMailAddress getPreferredEMailAddress() const; 00082 00083 private: 00084 std::string version_; 00085 std::string fullName_; 00086 std::string familyName_; 00087 std::string givenName_; 00088 std::string middleName_; 00089 std::string prefix_; 00090 std::string suffix_; 00091 //std::string email_; 00092 ByteArray photo_; 00093 std::string photoType_; 00094 std::string nick_; 00095 std::string unknownContent_; 00096 std::vector<EMailAddress> emailAddresses_; 00097 }; 00098 }