QXmpp Version: 1.13.0
Loading...
Searching...
No Matches
QXmppVCardIq.h
1// SPDX-FileCopyrightText: 2010 Manjeet Dahiya <manjeetdahiya@gmail.com>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPVCARDIQ_H
6#define QXMPPVCARDIQ_H
7
8#include "QXmppIq.h"
9
10#include <QDate>
11#include <QDomElement>
12#include <QMap>
13
14namespace QXmpp::Private {
15struct VCardData;
16}
17
18class QXmppVCardAddressPrivate;
19class QXmppVCardEmailPrivate;
20class QXmppVCardPhonePrivate;
21class QXmppVCardOrganizationPrivate;
22class QXmppVCardIqPrivate;
23
25
26class QXMPP_EXPORT QXmppVCardAddress
27{
28public:
30 enum TypeFlag {
31 None = 0x0,
32 Home = 0x1,
33 Work = 0x2,
34 Postal = 0x4,
35 Preferred = 0x8
36 };
37 Q_DECLARE_FLAGS(Type, TypeFlag)
38
43
46
47 QString country() const;
48 void setCountry(const QString &country);
49
50 QString locality() const;
51 void setLocality(const QString &locality);
52
53 QString postcode() const;
54 void setPostcode(const QString &postcode);
55
56 QString region() const;
57 void setRegion(const QString &region);
58
59 QString street() const;
60 void setStreet(const QString &street);
61
62 Type type() const;
63 void setType(Type type);
64
66 static constexpr std::tuple XmlTag = { u"ADR", QXmpp::Private::ns_vcard };
67 void parse(const QDomElement &element);
68 void toXml(QXmlStreamWriter *stream) const;
70
71private:
72 QSharedDataPointer<QXmppVCardAddressPrivate> d;
73};
74
75QXMPP_EXPORT bool operator==(const QXmppVCardAddress &, const QXmppVCardAddress &);
76QXMPP_EXPORT bool operator!=(const QXmppVCardAddress &, const QXmppVCardAddress &);
77
79
80class QXMPP_EXPORT QXmppVCardEmail
81{
82public:
84 enum TypeFlag {
85 None = 0x0,
86 Home = 0x1,
87 Work = 0x2,
88 Internet = 0x4,
89 Preferred = 0x8,
90 X400 = 0x10
91 };
92 Q_DECLARE_FLAGS(Type, TypeFlag)
93
97
99
100 QString address() const;
101 void setAddress(const QString &address);
102
103 Type type() const;
104 void setType(Type type);
105
107 static constexpr std::tuple XmlTag = { u"EMAIL", QXmpp::Private::ns_vcard };
108 void parse(const QDomElement &element);
109 void toXml(QXmlStreamWriter *stream) const;
111
112private:
113 QSharedDataPointer<QXmppVCardEmailPrivate> d;
114};
115
116QXMPP_EXPORT bool operator==(const QXmppVCardEmail &, const QXmppVCardEmail &);
117QXMPP_EXPORT bool operator!=(const QXmppVCardEmail &, const QXmppVCardEmail &);
118
120
121class QXMPP_EXPORT QXmppVCardPhone
122{
123public:
125 enum TypeFlag {
126 None = 0x0,
127 Home = 0x1,
128 Work = 0x2,
129 Voice = 0x4,
130 Fax = 0x8,
131 Pager = 0x10,
132 Messaging = 0x20,
133 Cell = 0x40,
134 Video = 0x80,
135 BBS = 0x100,
136 Modem = 0x200,
137 ISDN = 0x400,
138 PCS = 0x800,
139 Preferred = 0x1000
140 };
141 Q_DECLARE_FLAGS(Type, TypeFlag)
142
146
148
149 QString number() const;
150 void setNumber(const QString &number);
151
152 Type type() const;
153 void setType(Type type);
154
156 static constexpr std::tuple XmlTag = { u"TEL", QXmpp::Private::ns_vcard };
157 void parse(const QDomElement &element);
158 void toXml(QXmlStreamWriter *stream) const;
160
161private:
162 QSharedDataPointer<QXmppVCardPhonePrivate> d;
163};
164
165QXMPP_EXPORT bool operator==(const QXmppVCardPhone &, const QXmppVCardPhone &);
166QXMPP_EXPORT bool operator!=(const QXmppVCardPhone &, const QXmppVCardPhone &);
167
172
173class QXMPP_EXPORT QXmppVCardOrganization
174{
175public:
179
181
182 QString organization() const;
183 void setOrganization(const QString &);
184
185 QString unit() const;
186 void setUnit(const QString &);
187
188 QString title() const;
189 void setTitle(const QString &);
190
191 QString role() const;
192 void setRole(const QString &);
193
195 void parse(const QDomElement &element);
196 void toXml(QXmlStreamWriter *stream) const;
198
199private:
200 QSharedDataPointer<QXmppVCardOrganizationPrivate> d;
201};
202
203QXMPP_EXPORT bool operator==(const QXmppVCardOrganization &, const QXmppVCardOrganization &);
204QXMPP_EXPORT bool operator!=(const QXmppVCardOrganization &, const QXmppVCardOrganization &);
205
215
216class QXMPP_EXPORT QXmppVCardIq : public QXmppIq
217{
218public:
219 QXmppVCardIq(const QString &bareJid = QString());
220 QXmppVCardIq(const QXmppVCardIq &other);
221 ~QXmppVCardIq() override;
222
223 QXmppVCardIq &operator=(const QXmppVCardIq &other);
224
225 QDate birthday() const;
226 void setBirthday(const QDate &birthday);
227
228 QString description() const;
229 void setDescription(const QString &description);
230
231 QString email() const;
232 void setEmail(const QString &);
233
234 QString firstName() const;
235 void setFirstName(const QString &);
236
237 QString fullName() const;
238 void setFullName(const QString &);
239
240 QString lastName() const;
241 void setLastName(const QString &);
242
243 QString middleName() const;
244 void setMiddleName(const QString &);
245
246 QString nickName() const;
247 void setNickName(const QString &);
248
249 QByteArray photo() const;
250 void setPhoto(const QByteArray &);
251
252 QString photoType() const;
253 void setPhotoType(const QString &type);
254
255 QString url() const;
256 void setUrl(const QString &);
257
258 QList<QXmppVCardAddress> addresses() const;
259 void setAddresses(const QList<QXmppVCardAddress> &addresses);
260
261 QList<QXmppVCardEmail> emails() const;
262 void setEmails(const QList<QXmppVCardEmail> &emails);
263
264 QList<QXmppVCardPhone> phones() const;
265 void setPhones(const QList<QXmppVCardPhone> &phones);
266
269
271 static constexpr std::tuple PayloadXmlTag = { u"vCard", QXmpp::Private::ns_vcard };
272 [[deprecated("Use QXmpp::isIqElement()")]]
273 static bool isVCard(const QDomElement &element);
274 [[deprecated]]
275 static bool checkIqType(const QString &tagName, const QString &xmlNamespace);
277
278protected:
279 friend struct QXmpp::Private::VCardData;
280
282 void parseElementFromChild(const QDomElement &) override;
283 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
285
286private:
287 QSharedDataPointer<QXmppVCardIqPrivate> d;
288};
289
290QXMPP_EXPORT bool operator==(const QXmppVCardIq &, const QXmppVCardIq &);
291QXMPP_EXPORT bool operator!=(const QXmppVCardIq &, const QXmppVCardIq &);
292
293#endif // QXMPPVCARDIQ_H
QXmppIq(QXmppIq::Type type=QXmppIq::Get)
Definition QXmppIq.cpp:39
QXmppIq::Type type() const
Definition QXmppIq.cpp:60
Represent a vCard address.
Definition QXmppVCardIq.h:27
TypeFlag
Describes e-mail address types.
Definition QXmppVCardIq.h:30
void setPostcode(const QString &postcode)
Sets the postcode.
Definition QXmppVCardIq.cpp:141
QXmppVCardAddress(const QXmppVCardAddress &other)
Copy-constructor.
void setRegion(const QString &region)
Sets the region.
Definition QXmppVCardIq.cpp:153
void setType(Type type)
Sets the address type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:177
QXmppVCardAddress(QXmppVCardAddress &&)
Move-constructor.
Type type() const
Returns the address type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:171
QString region() const
Returns the region.
Definition QXmppVCardIq.cpp:147
QXmppVCardAddress & operator=(const QXmppVCardAddress &other)
Assignment operator.
void setLocality(const QString &locality)
Sets the locality.
Definition QXmppVCardIq.cpp:128
QString street() const
Returns the street address.
Definition QXmppVCardIq.cpp:159
void setStreet(const QString &street)
Sets the street address.
Definition QXmppVCardIq.cpp:165
QXmppVCardAddress()
Constructs an empty address.
Definition QXmppVCardIq.cpp:77
QString postcode() const
Returns the postcode.
Definition QXmppVCardIq.cpp:135
QString country() const
Returns the country.
Definition QXmppVCardIq.cpp:110
QString locality() const
Returns the locality.
Definition QXmppVCardIq.cpp:122
QXmppVCardAddress & operator=(QXmppVCardAddress &&)
Move-assignment operator.
void setCountry(const QString &country)
Sets the country.
Definition QXmppVCardIq.cpp:116
Represents a vCard e-mail address.
Definition QXmppVCardIq.h:81
TypeFlag
Describes e-mail address types.
Definition QXmppVCardIq.h:84
void setAddress(const QString &address)
Sets the e-mail address.
Definition QXmppVCardIq.cpp:264
QXmppVCardEmail(const QXmppVCardEmail &other)
Copy-constructor.
QString address() const
Returns the e-mail address.
Definition QXmppVCardIq.cpp:258
QXmppVCardEmail & operator=(const QXmppVCardEmail &other)
Copy-assignment operator.
QXmppVCardEmail()
Constructs an empty e-mail address.
Definition QXmppVCardIq.cpp:231
void setType(Type type)
Sets the e-mail type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:276
Type type() const
Returns the e-mail type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:270
Represents the XMPP vCard.
Definition QXmppVCardIq.h:217
void setPhoto(const QByteArray &)
Sets the photo's binary contents.
Definition QXmppVCardIq.cpp:778
QXmppVCardIq & operator=(const QXmppVCardIq &other)
Assigns other to this vCard IQ.
Definition QXmppVCardIq.cpp:604
QByteArray photo() const
Definition QXmppVCardIq.cpp:772
QString lastName() const
Returns the last name.
Definition QXmppVCardIq.cpp:704
QString nickName() const
Returns the nickname.
Definition QXmppVCardIq.cpp:728
QDate birthday() const
Returns the date of birth of the individual associated with the vCard.
Definition QXmppVCardIq.cpp:637
QString email() const
Returns the email address.
Definition QXmppVCardIq.cpp:661
QString photoType() const
Returns the photo's MIME type.
Definition QXmppVCardIq.cpp:784
void setOrganization(const QXmppVCardOrganization &)
Sets the organization info.
Definition QXmppVCardIq.cpp:838
void setFullName(const QString &)
Sets the full name.
Definition QXmppVCardIq.cpp:698
QString fullName() const
Returns the full name.
Definition QXmppVCardIq.cpp:692
QString firstName() const
Returns the first name.
Definition QXmppVCardIq.cpp:680
QString middleName() const
Returns the middle name.
Definition QXmppVCardIq.cpp:716
void setUrl(const QString &)
Definition QXmppVCardIq.cpp:754
QXmppVCardOrganization organization() const
Returns the organization info.
Definition QXmppVCardIq.cpp:832
QXmppVCardIq(const QString &bareJid=QString())
Constructs a QXmppVCardIq for the specified recipient.
Definition QXmppVCardIq.cpp:586
QList< QXmppVCardEmail > emails() const
Returns the e-mail addresses.
Definition QXmppVCardIq.cpp:808
QString url() const
Definition QXmppVCardIq.cpp:744
void setFirstName(const QString &)
Sets the first name.
Definition QXmppVCardIq.cpp:686
void setDescription(const QString &description)
Sets the free-form descriptive text.
Definition QXmppVCardIq.cpp:655
void setNickName(const QString &)
Sets the nickname.
Definition QXmppVCardIq.cpp:734
void setMiddleName(const QString &)
Sets the middle name.
Definition QXmppVCardIq.cpp:722
void setEmail(const QString &)
Sets the email address.
Definition QXmppVCardIq.cpp:671
QList< QXmppVCardPhone > phones() const
Returns the phone numbers.
Definition QXmppVCardIq.cpp:820
void setBirthday(const QDate &birthday)
Sets the date of birth of the individual associated with the vCard.
Definition QXmppVCardIq.cpp:643
void setPhotoType(const QString &type)
Sets the photo's MIME type.
Definition QXmppVCardIq.cpp:790
QString description() const
Returns the free-form descriptive text.
Definition QXmppVCardIq.cpp:649
void setAddresses(const QList< QXmppVCardAddress > &addresses)
Sets the addresses.
Definition QXmppVCardIq.cpp:802
void setLastName(const QString &)
Sets the last name.
Definition QXmppVCardIq.cpp:710
QList< QXmppVCardAddress > addresses() const
Returns the addresses.
Definition QXmppVCardIq.cpp:796
void setEmails(const QList< QXmppVCardEmail > &emails)
Sets the e-mail addresses.
Definition QXmppVCardIq.cpp:814
void setPhones(const QList< QXmppVCardPhone > &phones)
Sets the phone numbers.
Definition QXmppVCardIq.cpp:826
Represents organization information in XMPP vCards.
Definition QXmppVCardIq.h:174
QString title() const
Returns the job title within the organization.
Definition QXmppVCardIq.cpp:524
QString role() const
Returns the job role within the organization.
Definition QXmppVCardIq.cpp:512
QString unit() const
Returns the organization unit (also known as department).
Definition QXmppVCardIq.cpp:500
void setRole(const QString &)
Sets the job role within the organization.
Definition QXmppVCardIq.cpp:518
void setTitle(const QString &)
Sets the job title within the organization.
Definition QXmppVCardIq.cpp:530
void setUnit(const QString &)
Sets the unit within the organization.
Definition QXmppVCardIq.cpp:506
QString organization() const
Returns the name of the organization.
Definition QXmppVCardIq.cpp:488
void setOrganization(const QString &)
Sets the organization name.
Definition QXmppVCardIq.cpp:494
QXmppVCardOrganization & operator=(const QXmppVCardOrganization &other)
Assigns other to this organization info.
Definition QXmppVCardIq.cpp:466
QXmppVCardOrganization()
Constructs an empty organization information.
Definition QXmppVCardIq.cpp:452
Represents a vCard phone number.
Definition QXmppVCardIq.h:122
void setNumber(const QString &number)
Sets the phone number.
Definition QXmppVCardIq.cpp:358
TypeFlag
Describes phone number types.
Definition QXmppVCardIq.h:125
Type type() const
Returns the phone number type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:364
QXmppVCardPhone & operator=(const QXmppVCardPhone &other)
Copy-assignment operator.
QString number() const
Returns the phone number.
Definition QXmppVCardIq.cpp:339
QXmppVCardPhone()
Constructs an empty phone number.
Definition QXmppVCardIq.cpp:325
QXmppVCardPhone(const QXmppVCardPhone &other)
Copy-constructor.
void setType(Type type)
Sets the phone number type, which is a combination of TypeFlag.
Definition QXmppVCardIq.cpp:370