1 /* gpgmsg.hh - The GpgMsg class
2 * Copyright (C) 2005 g10 Code GmbH
4 * This file is part of OutlGPG.
6 * OutlGPG is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * OutlGPG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 /* Type of a message. */
32 OPENPGP_PUBKEY, /* Note, that this type is only partly supported */
33 OPENPGP_SECKEY /* Note, that this type is only partly supported */
39 /* To manage a message we use our own class to keep track about all
40 the information we known on the content of a message. This is
41 useful to remember the state of conversion (sometimes we need to
42 copy between utf8 and the native character set) and to parse the
43 message down into the MIME structure. */
48 virtual void destroy () = 0;
49 void operator delete (void *p)
53 GpgMsg *m = (GpgMsg*)(p);
58 /* Set a new MAPI message into the object. */
59 virtual void setMapiMessage (LPMESSAGE msg);
61 /* Return the type of the message. */
62 virtual openpgp_t getMessageType (void);
64 /* Returns whether the message has any attachments. */
65 virtual bool hasAttachments (void);
67 /* Return the body text as received or composed. This is guaranteed
68 to never return NULL. Usually getMessageType is used to check
69 whether there is a suitable message. */
70 virtual const char *getOrigText (void);
72 /* Return the text of the message to be used for the display. The
73 message objects has intrinsic knowledge about the correct
75 virtual const char *getDisplayText (void);
77 /* Save STRING as the plaintext version of the message. WARNING:
78 ownership of STRING is transferred to this object. */
79 virtual void setPlainText (char *string);
81 /* Save STRING as the ciphertext version of the message. WARNING:
82 ownership of STRING is transferred to this object. */
83 virtual void setCipherText (char *string, bool html);
85 /* Save STRING as the signed version of the message. WARNING:
86 ownership of STRING is transferred to this object. */
87 virtual void setSignedText (char *string);
89 /* Save the changes made to the message. With PERMANENT set to true
90 they are really stored, when not set they are only saved
92 virtual void saveChanges (bool permanent);
94 /* Return true if STRING matches the actual message. */
95 virtual bool matchesString (const char *string);
97 /* Return a malloced array of malloced strings with the recipients
98 of the message. Caller is responsible for freeing this array and
99 the strings. On failure NULL is returned. */
100 virtual char **getRecipients (void);
102 /* Return the number of attachments. */
103 virtual unsigned int getAttachments (void);
105 /* Decrypt the attachment with the internal number POS.
106 SAVE_PLAINTEXT must be true to save the attachemnt; displaying a
107 attachemnt is not yet supported. */
108 virtual void decryptAttachment (HWND hwnd, int pos, bool save_plaintext);
113 /* Create a new instance and initialize with the MAPI message object
115 GpgMsg *CreateGpgMsg (LPMESSAGE msg);