Stefan Sayer writes:

> the reply objects themselves are accessible in
> sc_sess->avar[DSM_AVAR_REPLY], so you'd only need to add some DSM
> actions to add body parts with the normal AmMimeBody::addPart()
> method.

below is my first try to introduce new dlg.addReplyBodyPart function.
compiler tells that reply's body is constant to which nothing can be
added:

ModDlg.cpp: In member function 'virtual bool 
DLGAddReplyBodyPartAction::execute(AmSession*, DSMSession*, 
DSMCondition::EventType, std::map<std::basic_string<char>, 
std::basic_string<char> >*)':
ModDlg.cpp:447:55: error: passing 'const AmMimeBody' as 'this' argument of 
'AmMimeBody* AmMimeBody::addPart(const string&)' discards qualifiers 
[-fpermissive]
make: *** [ModDlg.o] Error 1

-- juha

CONST_ACTION_2P(DLGAddReplyBodyPartAction, ',', false);
EXEC_ACTION_START(DLGAddReplyBodyPartAction) {
  DSMSipReply* sip_req;

  AVarMapT::iterator it = sc_sess->avar.find(DSM_AVAR_REPLY);
  if (it == sc_sess->avar.end() ||
      !isArgAObject(it->second) ||
      !(sip_req = dynamic_cast<DSMSipReply*>(it->second.asObject()))) {
    throw DSMException("dlg", "cause", "no reply");
  }

  string content_type = resolveVars(par1, sess, sc_sess, event_params);
  string body_part = resolveVars(par2, sess, sc_sess, event_params);

  AmMimeBody* new_part;
  new_part = sip_req->reply->body.addPart(content_type);  /* compiler error 
line */
  new_part->setPayload((const unsigned char*)body_part.c_str(),
                       body_part.length());
  DBG("added to reply body part %s='%s'\n",
      content_type.c_str(), body_part.c_str());
} EXEC_ACTION_END;
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems

Reply via email to