1#if defined(HAVE_CONFIG_H)
16#define RESIPROCATE_SUBSYSTEM Subsystem::CONTENTS
39 for(
int i = 0; i < (int)
MW_MAX; i++)
50 for(
int i = 0; i < (int)
MW_MAX; i++)
61 for(
int i = 0; i < (int)
MW_MAX; i++)
70 mHasMessages(rhs.mHasMessages),
71 mAccountUri(rhs.mAccountUri ? new
Uri(*rhs.mAccountUri) : 0),
72 mExtensions(rhs.mExtensions)
74 for(
int i = 0; i < (int)
MW_MAX; i++)
76 if (rhs.mHeaders[i] != 0)
78 mHeaders[i] =
new Header(*rhs.mHeaders[i]);
93MessageWaitingContents::clear()
100 for (
int i = 0; i < (int)
MW_MAX; i++)
114 mHasMessages = rhs.mHasMessages;
115 mAccountUri = rhs.mAccountUri ?
new Uri(*rhs.mAccountUri) : 0;
116 mExtensions = rhs.mExtensions;
118 for(
int i = 0; i < (int)
MW_MAX; i++)
120 if (rhs.mHeaders[i] != 0)
122 mHeaders[i] =
new Header(*rhs.mHeaders[i]);
136 static Mime type(
"application",
"simple-message-summary");
160 for(
int i = 0; i < (int)
MW_MAX; i++)
162 if (mHeaders[i] != 0)
166 << mHeaders[i]->mOld;
168 if (mHeaders[i]->mHasUrgent)
179 if (!mExtensions.empty())
182 for (map<Data, Data>::const_iterator i = mExtensions.begin();
183 i != mExtensions.end(); i++)
212 enum {
WS, CR, LF, CR1};
299 pb.
data(has, anchor);
306 mHasMessages =
false;
310 pb.
fail(__FILE__, __LINE__);
321 pb.
data(accountHeader, anchor);
322 static const Data AccountMessage(
"message-account");
329 mAccountUri =
new Uri();
330 mAccountUri->
parse(pb);
341 switch (tolower(
static_cast< unsigned char >(*pb.
position())))
362 pb.
fail(__FILE__, __LINE__);
371 unsigned int numNew = pb.
integer();
376 unsigned int numOld = pb.
integer();
381 if (mHeaders[ht] != 0)
383 pb.
fail(__FILE__, __LINE__);
385 mHeaders[ht] =
new Header(numNew, numOld);
392 unsigned int numUrgentNew = pb.
integer();
397 unsigned int numUrgentOld = pb.
integer();
403 if (mHeaders[ht] != 0)
405 pb.
fail(__FILE__, __LINE__);
407 mHeaders[ht] =
new Header(numNew, numOld, numUrgentNew, numUrgentOld);
437 pb.
data(content, anchor);
438 mExtensions[
header] = content;
459 unsigned int numUrgentNew,
460 unsigned int numUrgentOld)
464 mUrgentNew(numUrgentNew),
465 mUrgentOld(numUrgentOld)
476 if (mHeaders[ht] == 0)
478 mHeaders[ht] =
new Header(0, 0);
480 return *mHeaders[ht];
491 if (mHeaders[ht] == 0)
494 "MessageWaitingContents::header(HeaderType ht) _const_ "
495 "without first calling exists(), and the header does not exist. Our"
496 " behavior in this scenario is to implicitly create the header(using const_cast!); "
497 "this is probably not what you want, but it is either this or "
498 "assert/throw an exception. Since this has been the behavior for "
499 "so long, we are not throwing here, _yet_. You need to fix your "
500 "code, before we _do_ start throwing. This is why const-correctness"
501 " should never be made a TODO item </rant>");
503 ncthis->mHeaders[ht] =
new Header(0, 0);
505 return *mHeaders[ht];
512 return mHeaders[ht] != 0;
531 if (mAccountUri == 0)
533 mAccountUri =
new Uri();
546 if (mAccountUri == 0)
549 "MessageWaitingContents::header(const AccountHeader& ht) _const_ "
550 "without first calling exists(), and the header does not exist. Our"
551 " behavior in this scenario is to implicitly create the header(using const_cast!); "
552 "this is probably not what you want, but it is either this or "
553 "assert/throw an exception. Since this has been the behavior for "
554 "so long, we are not throwing here, _yet_. You need to fix your "
555 "code, before we _do_ start throwing. This is why const-correctness"
556 " should never be made a TODO item </rant>");
558 ncthis->mAccountUri =
new Uri();
567 return mAccountUri != 0;
582 return mExtensions[hn];
589 std::map<Data, Data>::const_iterator h=mExtensions.find(hn);
590 if(h==mExtensions.end())
593 "MessageWaitingContents::header(const Data& hn) _const_ "
594 "without first calling exists(), and the header does not exist. Our"
595 " behavior in this scenario is to implicitly create the header(using const_cast!); "
596 "this is probably not what you want, but it is either this or "
597 "assert/throw an exception. Since this has been the behavior for "
598 "so long, we are not throwing here, _yet_. You need to fix your "
599 "code, before we _do_ start throwing. This is why const-correctness"
600 " should never be made a TODO item </rant>");
602 h=ncthis->mExtensions.insert(std::make_pair(hn,
Data::Empty)).first;
611 return mExtensions.find(hn) != mExtensions.end();
618 mExtensions.erase(hn);
const char * MessageHeaders[MW_MAX]
#define resip_assert(x)
This file needs to work for both C and C++ code.
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.
SIP body type for holding MWI contents (MIME content-type application/simple-message-summary).
virtual ~MessageWaitingContents()
static const Mime & getStaticType()
virtual EncodeStream & encodeParsed(EncodeStream &str) const
bool exists(HeaderType ht) const
Check if HeaderType is present.
virtual Contents * clone() const
duplicate an MessageWaitingContents object
Header & header(HeaderType ht)
Get the header correspoding to ht.
void remove(HeaderType ht)
Remove the header correspoding to ht.
virtual void parse(ParseBuffer &pb)
MessageWaitingContents & operator=(const MessageWaitingContents &rhs)
Represents the "media-type" element in the RFC 3261 grammar.
Provides string-parsing functionality with protection from buffer overflow.
CurrentPosition skipNonWhitespace()
CurrentPosition skipWhitespace()
CurrentPosition skipToChar(char c)
CurrentPosition position() const
void reset(const char *pos)
CurrentPosition skipChars(const char *cs)
CurrentPosition skipToOneOf(const char *cs)
CurrentPosition skipChar()
void fail(const char *file, unsigned int line, const Data &errmsg=Data::Empty) const
void data(Data &data, const char *start) const
make the passed in data share memory with the buffer (uses Data::Share)
static const char * Whitespace
static const char * RPAREN
static const char * LPAREN
static const char * SPACE
static const char * COLON
static const char * SLASH
Represents the "SIP-URI" and "SIPS-URI" elements in the RFC 3261 grammar.
virtual void parse(ParseBuffer &pb)
dcm! – add UnusedChecking(_enum) below;
bool isEqualNoCase(const Data &left, const Data &right)
MessageWaitingContents::AccountHeader mw_account
Used to access the Message-Account header in MessageWaiting docs.
const char * skipSipLWS(ParseBuffer &pb)
HeaderType
An enumeration of MessageWaiting header types for use with resip::MessageWaitingContents.