예제 #1
0
파일: ext_imap.cpp 프로젝트: 2bj/hhvm
Variant f_imap_fetchbody(const Resource& imap_stream, int64_t msg_number,
                         const String& section, int64_t options /* = 0 */) {
  if (options && ((options & ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
    raise_warning("invalid value for the options parameter");
    return false;
  }

  ImapStream *obj = imap_stream.getTyped<ImapStream>();

  if (!options || !(options & FT_UID)) {
    if (!obj->checkMsgNumber(msg_number)) {
      return false;
    }
  }

  unsigned long len;
  char *body = mail_fetchbody_full(obj->m_stream, msg_number,
                                   (char*)section.data(),
                                   &len, (options ? options : NIL));

  if (!body) {
    raise_warning("No body information available");
    return false;
  }

  return String(body, len, CopyString);
}
예제 #2
0
  std::string
  ImapClient::fetchBodyFull(const std::string& aHost,
                            const std::string& aUserName,
                            const std::string& aPassword,
                            const std::string& aMailbox,
                            const unsigned long aMessageNumber,
                            const std::string& aSection,
                            const bool aUid) 
  {
#include "linkage.c"
    MAILSTREAM* lSource = getMailStream(aHost, aUserName, aPassword, aMailbox, true); 
    unsigned long lLenght;
    // convert section int into char
    return std::string(mail_fetchbody_full(lSource, aMessageNumber, const_cast<char*>(aSection.c_str()), &lLenght, (aUid ? FT_UID : NIL)));
    
  }