00001
00002
00003
00004
00005
00006
00007 #pragma once
00008
00009 #include <boost/shared_ptr.hpp>
00010
00011 #include <Swiften/Base/API.h>
00012 #include <Swiften/Elements/Stanza.h>
00013 #include <Swiften/Elements/ErrorPayload.h>
00014
00015 namespace Swift {
00016 class SWIFTEN_API IQ : public Stanza {
00017 public:
00018 typedef boost::shared_ptr<IQ> ref;
00019
00020 enum Type { Get, Set, Result, Error };
00021
00022 IQ(Type type = Get) : type_(type) { }
00023
00024 Type getType() const { return type_; }
00025 void setType(Type type) { type_ = type; }
00026
00027 static boost::shared_ptr<IQ> createRequest(
00028 Type type,
00029 const JID& to,
00030 const std::string& id,
00031 boost::shared_ptr<Payload> payload);
00032 static boost::shared_ptr<IQ> createResult(
00033 const JID& to,
00034 const std::string& id,
00035 boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>());
00036 static boost::shared_ptr<IQ> createResult(
00037 const JID& to,
00038 const JID& from,
00039 const std::string& id,
00040 boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>());
00041 static boost::shared_ptr<IQ> createError(
00042 const JID& to,
00043 const std::string& id,
00044 ErrorPayload::Condition condition = ErrorPayload::BadRequest,
00045 ErrorPayload::Type type = ErrorPayload::Cancel,
00046 boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>());
00047 static boost::shared_ptr<IQ> createError(
00048 const JID& to,
00049 const JID& from,
00050 const std::string& id,
00051 ErrorPayload::Condition condition = ErrorPayload::BadRequest,
00052 ErrorPayload::Type type = ErrorPayload::Cancel,
00053 boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>());
00054
00055 private:
00056 Type type_;
00057 };
00058 }