1 /* 2 ** Copyright 2002, Double Precision Inc. 3 ** 4 ** See COPYING for distribution information. 5 */ 6 #ifndef libmail_mboxfolderadd_H 7 #define libmail_mboxfolderadd_H 8 9 #include "libmail_config.h" 10 #include "mbox.H" 11 #include "mboxlock.H" 12 #include "addmessage.H" 13 14 #include <stdio.h> 15 16 LIBMAIL_START 17 18 /////////////////////////////////////////////////////////////////////////// 19 // 20 // Add a message to a folder. 21 22 class file; 23 24 class mbox::folder::add : public addMessage, 25 public mail::callback { 26 27 std::string path; 28 mail::callback &callback; 29 FILE *fp; 30 31 mail::ptr<mbox> mboxAccount; 32 33 void reportProgress(size_t bytesCompleted, 34 size_t bytesEstimatedTotal, 35 36 size_t messagesCompleted, 37 size_t messagesEstimatedTotal); 38 39 // 40 // Lock whatever folder's being added to. 41 // 42 43 class LockCurrentFolder : public mbox::LockTask { 44 45 add &me; 46 47 public: 48 LockCurrentFolder(add &meArg, std::string pathArg=""); 49 ~LockCurrentFolder(); 50 51 bool locked(file &lockedFile); 52 }; 53 54 public: 55 add(mbox &mboxArg, std::string pathArg, 56 mail::callback &callbackArg); 57 ~add(); 58 59 void saveMessageContents(std::string); 60 void go(); 61 void fail(std::string); 62 63 void success(std::string); 64 65 void copyTo(file &file); 66 }; 67 68 LIBMAIL_END 69 70 #endif 71 72