1 /* 2 Copyright (C) 2007-2014 Inverse inc. 3 Copyright (C) 2004-2005 SKYRIX Software AG 4 5 This file is part of SOGo. 6 7 SOGo is free software; you can redistribute it and/or modify it under 8 the terms of the GNU Lesser General Public License as published by the 9 Free Software Foundation; either version 2, or (at your option) any 10 later version. 11 12 SOGo is distributed in the hope that it will be useful, but WITHOUT ANY 13 WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 15 License for more details. 16 17 You should have received a copy of the GNU Lesser General Public 18 License along with SOGo; see the file COPYING. If not, write to the 19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 20 02111-1307, USA. 21 */ 22 23 #ifndef __Mailer_SOGoDraftObject_H__ 24 #define __Mailer_SOGoDraftObject_H__ 25 26 #import "SOGoMailBaseObject.h" 27 28 /* 29 SOGoDraftsFolder 30 Parent object: SOGoDraftsFolder 31 Child objects: draft attachments? 32 33 The SOGoDraftObject is used for composing new messages. It is necessary 34 because we can't cache objects in a session. So the contents of the drafts 35 folder are some kind of "mail creation transaction". 36 37 TODO: store-info should be an own object, not NSDictionary. 38 */ 39 40 @class NSArray; 41 @class NSData; 42 @class NSDictionary; 43 @class NSException; 44 @class NSMutableDictionary; 45 @class NSString; 46 @class NGImap4Envelope; 47 @class NGMimeBodyPart; 48 @class NGMimeMessage; 49 50 @class SOGoMailObject; 51 52 @interface SOGoDraftObject : SOGoMailBaseObject 53 { 54 NSString *path; 55 int IMAP4ID; 56 int sourceIMAP4ID; 57 NSMutableDictionary *headers; 58 NSString *inReplyTo; 59 NSString *text; 60 NSString *sourceURL; 61 NSString *sourceFlag; 62 NSString *sourceFolder; 63 BOOL isHTML; 64 } 65 66 /* contents */ 67 - (void) fetchInfo; 68 - (NSException *) storeInfo; 69 70 - (void) fetchMailForEditing: (SOGoMailObject *) sourceMail; 71 - (void) fetchMailForReplying: (SOGoMailObject *) sourceMail 72 toAll: (BOOL) toAll; 73 - (void) fetchMailForForwarding: (SOGoMailObject *) sourceMail; 74 75 - (void) setHeaders: (NSDictionary *) newHeaders; 76 - (NSDictionary *) headers; 77 - (void) setText: (NSString *) newText; 78 - (NSString *) text; 79 - (void) setIsHTML: (BOOL) aBool; 80 - (BOOL) isHTML; 81 82 /* for replies and forwards */ 83 - (NSString *) inReplyTo; 84 - (void) setInReplyTo: (NSString *) newInReplyTo; 85 86 - (void) setSourceURL: (NSString *) newSurceURL; 87 - (void) setSourceFlag: (NSString *) newSourceFlag; 88 - (void) setSourceFolder: (NSString *) newSourceFolder; 89 - (NSString *) sourceFolder; 90 91 - (void) setSourceIMAP4ID: (int) newSourceIMAPID; 92 - (int) sourceIMAP4ID; 93 94 - (void) setIMAP4ID: (int) newIMAPID; 95 - (int) IMAP4ID; 96 97 /* attachments */ 98 99 - (NSArray *) fetchAttachmentAttrs; 100 - (BOOL) isValidAttachmentName: (NSString *) _name; 101 - (NGMimeBodyPart *) bodyPartForAttachmentWithName: (NSString *) _name; 102 - (NSString *) pathToAttachmentWithName: (NSString *) _name; 103 - (NSException *) saveAttachment: (NSData *) _attach 104 withMetadata: (NSDictionary *) metadata; 105 - (NSException *) deleteAttachmentWithName: (NSString *) _name; 106 107 /* NGMime representations */ 108 109 - (NGMimeMessage *) mimeMessage; 110 - (NSData *) mimeMessageAsData; 111 112 /* operations */ 113 - (NSArray *) allRecipients; 114 - (NSArray *) allBareRecipients; 115 116 - (NSException *) delete; 117 - (NSException *) sendMail; 118 - (NSException *) sendMailAndCopyToSent: (BOOL) copyToSent; /* default: YES */ 119 - (NSException *) save; 120 121 // /* fake being a SOGoMailObject */ 122 123 // - (id) fetchParts: (NSArray *) _parts; 124 125 @end 126 127 #endif /* __Mailer_SOGoDraftObject_H__ */ 128