summaryrefslogtreecommitdiffstats
path: root/libmail/addmessage.C
diff options
context:
space:
mode:
authorSam Varshavchik2018-04-27 19:17:42 -0400
committerSam Varshavchik2018-04-27 19:17:42 -0400
commit9ad6c58af31f682374bdbf136d6e9f337ea39209 (patch)
tree1607a69a4e70e79b905943b717670369cc08d523 /libmail/addmessage.C
parenta6074e9074e02423f879d2d8bf923ca815cee760 (diff)
downloadcourier-libs-9ad6c58af31f682374bdbf136d6e9f337ea39209.tar.bz2
curses and libmail subdirectories are now in the courier/cone repo.
Diffstat (limited to 'libmail/addmessage.C')
-rw-r--r--libmail/addmessage.C148
1 files changed, 0 insertions, 148 deletions
diff --git a/libmail/addmessage.C b/libmail/addmessage.C
deleted file mode 100644
index fe33dc2..0000000
--- a/libmail/addmessage.C
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-** Copyright 2002-2008, Double Precision Inc.
-**
-** See COPYING for distribution information.
-*/
-#include "libmail_config.h"
-#include "addmessage.H"
-#include "attachments.H"
-#include <cstring>
-#include <errno.h>
-
-// Default method implementation.
-
-mail::addMessage::addMessage(mail::account *ptr) : mail::ptr<mail::account>(ptr),
- messageDate(0)
-{
-}
-
-bool mail::addMessage::checkServer()
-{
- if (isDestroyed())
- {
- fail("Server connection closed.");
- return false;
- }
-
- return true;
-}
-
-mail::addMessage::~addMessage()
-{
-}
-
-mail::addMessagePull::addMessagePull() : messageDate(0)
-{
-}
-
-mail::addMessagePull::~addMessagePull()
-{
-}
-
-//
-// Default MIME assembly implementation
-//
-
-void mail::addMessage::assembleContent(size_t &handleRet,
- const mail::Attachment &a,
- mail::callback &cb)
-{
- att_list.push_back(a);
-
- std::list<mail::Attachment>::iterator i=att_list.end();
- att_list_vec.push_back(--i);
- handleRet=att_list_vec.size()-1;
- cb.success("Ok.");
-}
-
-void mail::addMessage::assembleMessageRfc822(size_t &handleRet,
- std::string headers,
- size_t n,
- mail::callback &cb)
-{
- if (n >= att_list_vec.size())
- {
- errno=EINVAL;
- throw strerror(errno);
- }
-
- std::vector<mail::Attachment *> a;
-
- a.push_back(&*att_list_vec[n]);
-
- assembleContent(handleRet, Attachment(headers, a), cb);
-}
-
-void mail::addMessage::assembleMultipart(size_t &handleRet,
- std::string headers,
- const std::vector<size_t> &atts,
- std::string type,
- const mail::mimestruct
- ::parameterList &typeParams,
- mail::callback &cb)
-{
- std::vector<Attachment *> parts;
- std::vector<size_t>::const_iterator b=atts.begin(), e=atts.end();
-
- while (b != e)
- {
- if (*b >= att_list_vec.size())
- {
- errno=EINVAL;
- throw strerror(errno);
- }
-
- parts.push_back(&*att_list_vec[*b]);
- ++b;
- }
-
- assembleContent(handleRet, Attachment(headers, parts, type,
- typeParams), cb);
-}
-
-bool mail::addMessage::assemble()
-{
- std::vector<std::list<mail::Attachment>::iterator>::const_iterator
- e=att_list_vec.end();
-
- if (e == att_list_vec.begin())
- return true;
-
- --e;
-
- (*e)->begin();
-
- bool errflag=false;
-
- std::string msg;
-
- while ((msg=(*e)->generate(errflag)).size() > 0)
- {
- saveMessageContents(msg);
- }
-
- if (errflag)
- return false;
- return true;
-}
-
-bool mail::addMessage::chkMsgNum(mail::account *ptr, std::string msgUid,
- size_t &n)
-{
- size_t msgCount=ptr->getFolderIndexSize();
- size_t i;
-
- if (n < msgCount && ptr->getFolderIndexInfo(n).uid == msgUid)
- return true;
- for (i=1; i<msgCount; i++)
- {
- size_t j= (n+msgCount-i) % msgCount;
-
- if (ptr->getFolderIndexInfo(j).uid == msgUid)
- {
- n=j;
- return true;
- }
- }
- return false;
-}