summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Elements')
-rw-r--r--Swiften/Elements/Command.h2
-rw-r--r--Swiften/Elements/Delay.h12
-rw-r--r--Swiften/Elements/JingleIBBTransportPayload.h8
-rw-r--r--Swiften/Elements/JinglePayload.h2
-rw-r--r--Swiften/Elements/Last.h2
-rw-r--r--Swiften/Elements/Replace.h2
-rw-r--r--Swiften/Elements/StanzaAck.cpp19
-rw-r--r--Swiften/Elements/StanzaAck.h11
-rw-r--r--Swiften/Elements/StatusShow.h2
-rw-r--r--Swiften/Elements/StreamInitiationFileInfo.h18
-rw-r--r--Swiften/Elements/VCard.h193
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardOperation.h2
12 files changed, 242 insertions, 31 deletions
diff --git a/Swiften/Elements/Command.h b/Swiften/Elements/Command.h
index 91ae5a3..5454d8d 100644
--- a/Swiften/Elements/Command.h
+++ b/Swiften/Elements/Command.h
@@ -26,7 +26,7 @@ namespace Swift {
struct Note {
enum Type {Info, Warn, Error};
- Note(std::string note, Type type) : note(note), type(type) {};
+ Note(std::string note, Type type) : note(note), type(type) {}
std::string note;
Type type;
diff --git a/Swiften/Elements/Delay.h b/Swiften/Elements/Delay.h
index f7c4570..f4376dc 100644
--- a/Swiften/Elements/Delay.h
+++ b/Swiften/Elements/Delay.h
@@ -15,14 +15,14 @@
namespace Swift {
class Delay : public Payload {
public:
- Delay() {};
- Delay(const boost::posix_time::ptime& time, const JID& from = JID()) : time_(time), from_(from) {};
+ Delay() {}
+ Delay(const boost::posix_time::ptime& time, const JID& from = JID()) : time_(time), from_(from) {}
- const boost::posix_time::ptime& getStamp() const {return time_;};
- void setStamp(const boost::posix_time::ptime& time) {time_ = time;};
+ const boost::posix_time::ptime& getStamp() const {return time_;}
+ void setStamp(const boost::posix_time::ptime& time) {time_ = time;}
- const boost::optional<JID>& getFrom() const {return from_;};
- void setFrom(const JID& from) {from_ = from;};
+ const boost::optional<JID>& getFrom() const {return from_;}
+ void setFrom(const JID& from) {from_ = from;}
private:
boost::posix_time::ptime time_;
diff --git a/Swiften/Elements/JingleIBBTransportPayload.h b/Swiften/Elements/JingleIBBTransportPayload.h
index 8c174f0..7633f6b 100644
--- a/Swiften/Elements/JingleIBBTransportPayload.h
+++ b/Swiften/Elements/JingleIBBTransportPayload.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 Remko Tronçon
+ * Copyright (c) 2011-2013 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -29,16 +29,16 @@ namespace Swift {
return stanzaType;
}
- int getBlockSize() const {
+ unsigned int getBlockSize() const {
return blockSize;
}
- void setBlockSize(int blockSize) {
+ void setBlockSize(unsigned int blockSize) {
this->blockSize = blockSize;
}
private:
- int blockSize;
+ unsigned int blockSize;
StanzaType stanzaType;
};
}
diff --git a/Swiften/Elements/JinglePayload.h b/Swiften/Elements/JinglePayload.h
index 31d4448..5f12e90 100644
--- a/Swiften/Elements/JinglePayload.h
+++ b/Swiften/Elements/JinglePayload.h
@@ -15,8 +15,6 @@
#include <Swiften/Elements/Payload.h>
#include <Swiften/Elements/JingleContentPayload.h>
-#include <Swiften/Base/Log.h>
-
namespace Swift {
class JinglePayload : public Payload {
public:
diff --git a/Swiften/Elements/Last.h b/Swiften/Elements/Last.h
index fe0323a..cb7e0c6 100644
--- a/Swiften/Elements/Last.h
+++ b/Swiften/Elements/Last.h
@@ -11,7 +11,7 @@
namespace Swift {
class Last : public Payload {
public:
- Last(int seconds = 0) : seconds_(seconds) {};
+ Last(int seconds = 0) : seconds_(seconds) {}
int getSeconds() const {return seconds_;}
void setSeconds(int seconds) {seconds_ = seconds;}
diff --git a/Swiften/Elements/Replace.h b/Swiften/Elements/Replace.h
index 230bce7..96935f5 100644
--- a/Swiften/Elements/Replace.h
+++ b/Swiften/Elements/Replace.h
@@ -15,7 +15,7 @@ namespace Swift {
class Replace : public Payload {
public:
typedef boost::shared_ptr<Replace> ref;
- Replace(const std::string& id = std::string()) : replaceID_(id) {};
+ Replace(const std::string& id = std::string()) : replaceID_(id) {}
const std::string& getID() const {
return replaceID_;
}
diff --git a/Swiften/Elements/StanzaAck.cpp b/Swiften/Elements/StanzaAck.cpp
new file mode 100644
index 0000000..5bcab73
--- /dev/null
+++ b/Swiften/Elements/StanzaAck.cpp
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2013 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Elements/StanzaAck.h>
+
+#include <boost/numeric/conversion/cast.hpp>
+
+using namespace Swift;
+
+StanzaAck::~StanzaAck() {
+}
+
+void StanzaAck::setHandledStanzasCount(int i) {
+ handledStanzasCount = boost::numeric_cast<unsigned int>(i);
+ valid = true;
+}
diff --git a/Swiften/Elements/StanzaAck.h b/Swiften/Elements/StanzaAck.h
index 3aa2dfd..8fe64e0 100644
--- a/Swiften/Elements/StanzaAck.h
+++ b/Swiften/Elements/StanzaAck.h
@@ -1,13 +1,14 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2013 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
-#include <Swiften/Elements/Element.h>
+#include <boost/shared_ptr.hpp>
+#include <Swiften/Elements/Element.h>
namespace Swift {
class StanzaAck : public Element {
@@ -16,15 +17,13 @@ namespace Swift {
StanzaAck() : valid(false), handledStanzasCount(0) {}
StanzaAck(unsigned int handledStanzasCount) : valid(true), handledStanzasCount(handledStanzasCount) {}
+ virtual ~StanzaAck();
unsigned int getHandledStanzasCount() const {
return handledStanzasCount;
}
- void setHandledStanzasCount(int i) {
- handledStanzasCount = i;
- valid = true;
- }
+ void setHandledStanzasCount(int i);
bool isValid() const {
return valid;
diff --git a/Swiften/Elements/StatusShow.h b/Swiften/Elements/StatusShow.h
index 3eeb44e..afa30de 100644
--- a/Swiften/Elements/StatusShow.h
+++ b/Swiften/Elements/StatusShow.h
@@ -8,6 +8,7 @@
#include <Swiften/Base/API.h>
#include <Swiften/Elements/Payload.h>
+#include <cassert>
namespace Swift {
class SWIFTEN_API StatusShow : public Payload {
@@ -37,6 +38,7 @@ namespace Swift {
case DND: return 3;
case None: return 0;
}
+ assert(false);
return 0;
}
diff --git a/Swiften/Elements/StreamInitiationFileInfo.h b/Swiften/Elements/StreamInitiationFileInfo.h
index 6569c3d..d7907b9 100644
--- a/Swiften/Elements/StreamInitiationFileInfo.h
+++ b/Swiften/Elements/StreamInitiationFileInfo.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 Remko Tronçon
+ * Copyright (c) 2011-2013 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -19,7 +19,7 @@ public:
typedef boost::shared_ptr<StreamInitiationFileInfo> ref;
public:
- StreamInitiationFileInfo(const std::string& name = "", const std::string& description = "", int size = 0,
+ StreamInitiationFileInfo(const std::string& name = "", const std::string& description = "", unsigned long long size = 0,
const std::string& hash = "", const boost::posix_time::ptime &date = boost::posix_time::ptime(), const std::string& algo="md5") :
name(name), description(description), size(size), hash(hash), date(date), algo(algo), supportsRangeRequests(false), rangeOffset(0) {}
@@ -39,11 +39,11 @@ public:
return this->description;
}
- void setSize(const boost::uintmax_t size) {
+ void setSize(const unsigned long long size) {
this->size = size;
}
- boost::uintmax_t getSize() const {
+ unsigned long long getSize() const {
return this->size;
}
@@ -79,24 +79,24 @@ public:
return supportsRangeRequests;
}
- void setRangeOffset(const int offset) {
- supportsRangeRequests = offset >= 0 ? true : false;
+ void setRangeOffset(unsigned long long offset) {
+ supportsRangeRequests = true;
rangeOffset = offset;
}
- boost::uintmax_t getRangeOffset() const {
+ unsigned long long getRangeOffset() const {
return rangeOffset;
}
private:
std::string name;
std::string description;
- boost::uintmax_t size;
+ unsigned long long size;
std::string hash;
boost::posix_time::ptime date;
std::string algo;
bool supportsRangeRequests;
- boost::uintmax_t rangeOffset;
+ unsigned long long rangeOffset;
};
}
diff --git a/Swiften/Elements/VCard.h b/Swiften/Elements/VCard.h
index f9822c9..84b6cfe 100644
--- a/Swiften/Elements/VCard.h
+++ b/Swiften/Elements/VCard.h
@@ -7,8 +7,10 @@
#pragma once
#include <boost/shared_ptr.hpp>
+#include <boost/date_time/posix_time/ptime.hpp>
#include <string>
+#include <Swiften/JID/JID.h>
#include <Swiften/Base/ByteArray.h>
#include <Swiften/Elements/Payload.h>
@@ -29,6 +31,71 @@ namespace Swift {
std::string address;
};
+ struct Telephone {
+ Telephone() : isHome(false), isWork(false), isVoice(false), isFax(false), isPager(false), isMSG(false), isCell(false),
+ isVideo(false), isBBS(false), isModem(false), isISDN(false), isPCS(false), isPreferred(false) {
+ }
+
+ bool isHome;
+ bool isWork;
+ bool isVoice;
+ bool isFax;
+ bool isPager;
+ bool isMSG;
+ bool isCell;
+ bool isVideo;
+ bool isBBS;
+ bool isModem;
+ bool isISDN;
+ bool isPCS;
+ bool isPreferred;
+ std::string number;
+ };
+
+ enum DeliveryType {
+ DomesticDelivery,
+ InternationalDelivery,
+ None
+ };
+
+ struct Address {
+ Address() : isHome(false), isWork(false), isPostal(false), isParcel(false), deliveryType(None), isPreferred(false) {
+ }
+
+ bool isHome;
+ bool isWork;
+ bool isPostal;
+ bool isParcel;
+ DeliveryType deliveryType;
+ bool isPreferred;
+
+ std::string poBox;
+ std::string addressExtension;
+ std::string street;
+ std::string locality;
+ std::string region;
+ std::string postalCode;
+ std::string country;
+ };
+
+ struct AddressLabel {
+ AddressLabel() : isHome(false), isWork(false), isPostal(false), isParcel(false), deliveryType(None), isPreferred(false) {
+ }
+
+ bool isHome;
+ bool isWork;
+ bool isPostal;
+ bool isParcel;
+ DeliveryType deliveryType;
+ bool isPreferred;
+ std::vector<std::string> lines;
+ };
+
+ struct Organization {
+ std::string name;
+ std::vector<std::string> units;
+ };
+
VCard() {}
void setVersion(const std::string& version) { version_ = version; }
@@ -78,8 +145,124 @@ namespace Swift {
emailAddresses_.push_back(email);
}
+ void clearEMailAddresses() {
+ emailAddresses_.clear();
+ }
+
EMailAddress getPreferredEMailAddress() const;
+ void setBirthday(const boost::posix_time::ptime& birthday) {
+ birthday_ = birthday;
+ }
+
+ const boost::posix_time::ptime& getBirthday() const {
+ return birthday_;
+ }
+
+ const std::vector<Telephone>& getTelephones() const {
+ return telephones_;
+ }
+
+ void addTelephone(const Telephone& phone) {
+ telephones_.push_back(phone);
+ }
+
+ void clearTelephones() {
+ telephones_.clear();
+ }
+
+ const std::vector<Address>& getAddresses() const {
+ return addresses_;
+ }
+
+ void addAddress(const Address& address) {
+ addresses_.push_back(address);
+ }
+
+ void clearAddresses() {
+ addresses_.clear();
+ }
+
+ const std::vector<AddressLabel>& getAddressLabels() const {
+ return addressLabels_;
+ }
+
+ void addAddressLabel(const AddressLabel& addressLabel) {
+ addressLabels_.push_back(addressLabel);
+ }
+
+ void clearAddressLabels() {
+ addressLabels_.clear();
+ }
+
+ const std::vector<JID>& getJIDs() const {
+ return jids_;
+ }
+
+ void addJID(const JID& jid) {
+ jids_.push_back(jid);
+ }
+
+ void clearJIDs() {
+ jids_.clear();
+ }
+
+ const std::string& getDescription() const {
+ return description_;
+ }
+
+ void setDescription(const std::string& description) {
+ this->description_ = description;
+ }
+
+ const std::vector<Organization>& getOrganizations() const {
+ return organizations_;
+ }
+
+ void addOrganization(const Organization& organization) {
+ organizations_.push_back(organization);
+ }
+
+ void clearOrganizations() {
+ organizations_.clear();
+ }
+
+ const std::vector<std::string>& getTitles() const {
+ return titles_;
+ }
+
+ void addTitle(const std::string& title) {
+ titles_.push_back(title);
+ }
+
+ void clearTitles() {
+ titles_.clear();
+ }
+
+ const std::vector<std::string>& getRoles() const {
+ return roles_;
+ }
+
+ void addRole(const std::string& role) {
+ roles_.push_back(role);
+ }
+
+ void clearRoles() {
+ roles_.clear();
+ }
+
+ const std::vector<std::string>& getURLs() const {
+ return urls_;
+ }
+
+ void addURL(const std::string& url) {
+ urls_.push_back(url);
+ }
+
+ void clearURLs() {
+ urls_.clear();
+ }
+
private:
std::string version_;
std::string fullName_;
@@ -92,7 +275,17 @@ namespace Swift {
ByteArray photo_;
std::string photoType_;
std::string nick_;
+ boost::posix_time::ptime birthday_;
std::string unknownContent_;
std::vector<EMailAddress> emailAddresses_;
+ std::vector<Telephone> telephones_;
+ std::vector<Address> addresses_;
+ std::vector<AddressLabel> addressLabels_;
+ std::vector<JID> jids_;
+ std::string description_;
+ std::vector<Organization> organizations_;
+ std::vector<std::string> titles_;
+ std::vector<std::string> roles_;
+ std::vector<std::string> urls_;
};
}
diff --git a/Swiften/Elements/Whiteboard/WhiteboardOperation.h b/Swiften/Elements/Whiteboard/WhiteboardOperation.h
index 02c6438..75f6e6a 100644
--- a/Swiften/Elements/Whiteboard/WhiteboardOperation.h
+++ b/Swiften/Elements/Whiteboard/WhiteboardOperation.h
@@ -14,7 +14,7 @@ namespace Swift {
public:
typedef boost::shared_ptr<WhiteboardOperation> ref;
public:
- virtual ~WhiteboardOperation(){};
+ virtual ~WhiteboardOperation(){}
std::string getID() const {
return id_;