Diffstat (limited to 'noncore/net/mail/libmailwrapper/storemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/storemail.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/net/mail/libmailwrapper/storemail.cpp b/noncore/net/mail/libmailwrapper/storemail.cpp index 595e7fc..914a11d 100644 --- a/noncore/net/mail/libmailwrapper/storemail.cpp +++ b/noncore/net/mail/libmailwrapper/storemail.cpp | |||
@@ -1,76 +1,77 @@ | |||
1 | #include "storemail.h" | 1 | #include "storemail.h" |
2 | #include "mailwrapper.h" | 2 | #include "mailwrapper.h" |
3 | #include "settings.h" | 3 | #include "settings.h" |
4 | #include "abstractmail.h" | 4 | #include "abstractmail.h" |
5 | 5 | ||
6 | #include <libetpan/libetpan.h> | 6 | #include <libetpan/libetpan.h> |
7 | 7 | ||
8 | #include <qstring.h> | 8 | #include <qstring.h> |
9 | 9 | ||
10 | #include <stdlib.h> | 10 | #include <stdlib.h> |
11 | 11 | ||
12 | using namespace Opie::Core; | ||
12 | Storemail::Storemail(Account*aAccount,const QString&aFolder) | 13 | Storemail::Storemail(Account*aAccount,const QString&aFolder) |
13 | : Generatemail() | 14 | : Generatemail() |
14 | { | 15 | { |
15 | wrapper = 0; | 16 | wrapper = 0; |
16 | m_Account = aAccount; | 17 | m_Account = aAccount; |
17 | m_tfolder = aFolder; | 18 | m_tfolder = aFolder; |
18 | wrapper = AbstractMail::getWrapper(m_Account); | 19 | wrapper = AbstractMail::getWrapper(m_Account); |
19 | if (wrapper) { | 20 | if (wrapper) { |
20 | wrapper->createMbox(m_tfolder); | 21 | wrapper->createMbox(m_tfolder); |
21 | } | 22 | } |
22 | } | 23 | } |
23 | 24 | ||
24 | Storemail::Storemail(const QString&dir,const QString&aFolder) | 25 | Storemail::Storemail(const QString&dir,const QString&aFolder) |
25 | : Generatemail() | 26 | : Generatemail() |
26 | { | 27 | { |
27 | wrapper = 0; | 28 | wrapper = 0; |
28 | m_Account = 0; | 29 | m_Account = 0; |
29 | m_tfolder = aFolder; | 30 | m_tfolder = aFolder; |
30 | wrapper = AbstractMail::getWrapper(dir); | 31 | wrapper = AbstractMail::getWrapper(dir); |
31 | if (wrapper) { | 32 | if (wrapper) { |
32 | wrapper->createMbox(m_tfolder); | 33 | wrapper->createMbox(m_tfolder); |
33 | } | 34 | } |
34 | } | 35 | } |
35 | 36 | ||
36 | Storemail::Storemail(const QString&aFolder) | 37 | Storemail::Storemail(const QString&aFolder) |
37 | : Generatemail() | 38 | : Generatemail() |
38 | { | 39 | { |
39 | wrapper = 0; | 40 | wrapper = 0; |
40 | m_Account = 0; | 41 | m_Account = 0; |
41 | m_tfolder = aFolder; | 42 | m_tfolder = aFolder; |
42 | wrapper = AbstractMail::getWrapper(AbstractMail::defaultLocalfolder()); | 43 | wrapper = AbstractMail::getWrapper(AbstractMail::defaultLocalfolder()); |
43 | if (wrapper) { | 44 | if (wrapper) { |
44 | wrapper->createMbox(m_tfolder); | 45 | wrapper->createMbox(m_tfolder); |
45 | } | 46 | } |
46 | } | 47 | } |
47 | 48 | ||
48 | Storemail::~Storemail() | 49 | Storemail::~Storemail() |
49 | { | 50 | { |
50 | } | 51 | } |
51 | 52 | ||
52 | int Storemail::storeMail(const Opie::OSmartPointer<Mail>&mail) | 53 | int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) |
53 | { | 54 | { |
54 | if (!wrapper) return 0; | 55 | if (!wrapper) return 0; |
55 | int ret = 1; | 56 | int ret = 1; |
56 | 57 | ||
57 | mailmime * mimeMail = 0; | 58 | mailmime * mimeMail = 0; |
58 | mimeMail = createMimeMail(mail ); | 59 | mimeMail = createMimeMail(mail ); |
59 | if ( mimeMail == NULL ) { | 60 | if ( mimeMail == NULL ) { |
60 | qDebug( "storeMail: error creating mime mail" ); | 61 | qDebug( "storeMail: error creating mime mail" ); |
61 | return 0; | 62 | return 0; |
62 | } | 63 | } |
63 | char *data; | 64 | char *data; |
64 | size_t size; | 65 | size_t size; |
65 | data = 0; | 66 | data = 0; |
66 | 67 | ||
67 | mailmessage * msg = 0; | 68 | mailmessage * msg = 0; |
68 | msg = mime_message_init(mimeMail); | 69 | msg = mime_message_init(mimeMail); |
69 | mime_message_set_tmpdir(msg,getenv( "HOME" )); | 70 | mime_message_set_tmpdir(msg,getenv( "HOME" )); |
70 | int r = mailmessage_fetch(msg,&data,&size); | 71 | int r = mailmessage_fetch(msg,&data,&size); |
71 | mime_message_detach_mime(msg); | 72 | mime_message_detach_mime(msg); |
72 | mailmessage_free(msg); | 73 | mailmessage_free(msg); |
73 | msg = 0; | 74 | msg = 0; |
74 | if (r != MAIL_NO_ERROR || !data) { | 75 | if (r != MAIL_NO_ERROR || !data) { |
75 | qDebug("Error fetching mime..."); | 76 | qDebug("Error fetching mime..."); |
76 | ret = 0; | 77 | ret = 0; |