1#if defined(HAVE_CONFIG_H)
16#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
65 mEntity = rhs.mEntity;
66 mTuples = rhs.mTuples;
103std::vector<Pidf::Tuple>&
110const std::vector<Pidf::Tuple>&
121 return (
int)mTuples.size();
127 return new Pidf(*
this);
133 static Mime type(
"application",
"pidf+xml");
140 str <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" <<
Symbols::CRLF;
141 str <<
"<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"" <<
Symbols::CRLF;
143 for (vector<Tuple>::const_iterator i = mTuples.begin(); i != mTuples.end(); ++i)
145 Data status( (
char*)( (i->status) ?
"open" :
"closed" ) );
146 str <<
" <tuple id=\"" << i->id <<
"\" ";
150 str <<
" <status><basic>" << status <<
"</basic></status>" <<
Symbols::CRLF;
151 if ( !i->contact.empty() )
153 str <<
" <contact priority=\"" << i->contactPriority <<
"\">" << i->contact <<
"</contact>" <<
Symbols::CRLF;
155 if ( !i->timeStamp.empty() )
157 str <<
" <timestamp>" << i->timeStamp <<
"</timestamp>" <<
Symbols::CRLF;
159 if ( !i->note.empty() )
175 std::string pidf_namespace;
183 if ( it != attr.
end() )
186 std::string key(it->first.data(), it->first.size());
188 size_t pos = key.find(
':');
190 if ( pos != string::npos)
192 pidf_namespace.assign(key, pos+1, key.size()-pos-1);
193 pidf_namespace.append(1,
':');
197 const std::string presence = pidf_namespace +
"presence";
204 mEntity =
Uri(i->second);
215 const std::string tuple = pidf_namespace +
"tuple";
232 const std::string status = pidf_namespace +
"status";
233 const std::string contact = pidf_namespace +
"contact";
234 const std::string note = pidf_namespace +
"note";
235 const std::string timestamp = pidf_namespace +
"timestamp";
243 std::string basic = pidf_namespace +
"basic";
289 mTuples.push_back(t);
308 mTuples.push_back(t);
320 mTuples.push_back(t);
323 mTuples[0].status = online;
324 mTuples[0].contact = contact;
325 mTuples[0].contactPriority = 1000;
326 mTuples[0].note = note;
335 if (!mTuples.empty())
339 *note = mTuples[0].note;
342 return mTuples[0].status;
351 tuples.reserve(tuples.size() + other.
getTuples().size());
355 for (vector<Tuple>::const_iterator i = other.
getTuples().begin();
359 for (vector<Tuple>::iterator j =
getTuples().begin();
372 tuples.push_back(*i);
381 <<
" status=" << tuple.
status
382 <<
" id=" << tuple.
id
383 <<
" contact=" << tuple.
contact
Base class for all SIP body types.
Contents & operator=(const Contents &rhs)
Assignment operator.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
static const Data Empty
Constant that represents a zero-length data.
const char * c_str() const
Returns a null-terminated string representing.
iterator find(const Key &key)
List::const_iterator const_iterator
iterator erase(const_iterator pos)
Represents the "media-type" element in the RFC 3261 grammar.
Provides string-parsing functionality with protection from buffer overflow.
LinkedHashMap< Data, Data, KeyedDataHash > attributes
bool getSimpleStatus(Data *note=NULL) const
Pidf & operator=(const Pidf &rhs)
virtual void parse(ParseBuffer &pb)
virtual Contents * clone() const
duplicate an Pidf object
void merge(const Pidf &other)
void setSimpleId(const Data &id)
static const Mime & getStaticType()
std::vector< Tuple > & getTuples()
void setEntity(const Uri &entity)
virtual EncodeStream & encodeParsed(EncodeStream &str) const
const Uri & getEntity() const
void setSimpleStatus(bool online, const Data ¬e=Data::Empty, const Data &contact=Data::Empty)
Represents the "SIP-URI" and "SIPS-URI" elements in the RFC 3261 grammar.
const Data & getValue() const
const Data & getTag() const
const AttributeMap & getAttributes() const
static EncodeStream & encode(EncodeStream &strm, const AttributeMap &attrs)
dcm! – add UnusedChecking(_enum) below;
InserterClass< T > Inserter(const T &t)
Templatized function to construct an instance of InserterClass for a container to be inserted.
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)