Update of /cvsroot/mahogany/M/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23263/include
Modified Files:
Mcclient.h MessageCC.h MessageView.h MimePartCC.h
Added Files:
MimePartCCBase.h MimePartVirtual.h
Log Message:
a lot of changes to make it possible to fully support PGP-MIME messages
(although not quite yet):
1. added MimePartVirtual class which can be created from raw text
2. use it instead of (not existing any longer) MimePartRaw in UUDecode.cpp
3. added MessageView::AddVirtualMimePart() which allows to attach a virtual
MIME part to the viewer, this replaces ugly hack used by UUDecode.cpp
4. added MimePartCCBase: common base for MimePartCC and MimePartVirtual
5. MimePartCC implementation is now in MimePartCC.cpp, not MessageCC.cpp
6. added CclientParseMessage() function, fixed CR LF confusion in MessageCC
ctor from text
***** Error reading new file: [Errno 2] No such file or directory: 'MimePartCCBase.h'
***** Error reading new file: [Errno 2] No such file or directory: 'MimePartVirtual.h'
Index: Mcclient.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/Mcclient.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -b -u -2 -r1.13 -r1.14
--- Mcclient.h 3 Aug 2003 23:57:12 -0000 1.13
+++ Mcclient.h 13 Jul 2004 21:58:41 -0000 1.14
@@ -58,3 +58,27 @@
}
+/**
+ @name Helper functions for working with c-client.
+
+ All of these functions are defined in MessageCC.cpp for historical reasons.
+ */
+//@{
+
+/**
+ Parse the complete message text into internal envelope and body structures.
+
+ @param msgText message text in Unix (LF-only) line ending convention
+ @param ppEnv filled with message ENVELOPE
+ @param ppBody filled with message BODY
+ @param pHdrLen filled with the length of the header if non-NULL
+ @return true if ok, false on error
+ */
+extern bool
+CclientParseMessage(const char *msgText,
+ ENVELOPE **ppEnv,
+ BODY **ppBody,
+ size_t *pHdrLen = NULL);
+
+//@}
+
#endif //MCCLIENT_H
Index: MessageCC.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MessageCC.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -b -u -2 -r1.61 -r1.62
--- MessageCC.h 16 Dec 2003 02:00:44 -0000 1.61
+++ MessageCC.h 13 Jul 2004 21:58:41 -0000 1.62
@@ -85,8 +85,4 @@
const char *GetRawPartData(const MimePart& mimepart, unsigned long *len = NULL);
- /** get the decoded part text
- */
- const void *GetPartData(const MimePart& mimepart, unsigned long *len = NULL);
-
/**
Get all headers of this message part.
@@ -110,5 +106,5 @@
@return folder pointer (not incref'ed)
*/
- virtual MailFolder * GetFolder(void) const { return m_folder; }
+ virtual MailFolder * GetFolder(void) const;
/** Return the numeric status of message.
@@ -204,9 +200,7 @@
bool ParseMIMEStructure();
- /// ParseMIMEStructure() helper
- void DecodeMIME(MimePartCC *mimepart, struct mail_bodystruct *body);
-
/// GetMimePart() helper
static MimePart *FindPartInMIMETree(MimePart *mimepart, int& n);
+
//@}
@@ -240,20 +234,4 @@
/// pointer to the main message MIME part, it links to all others
MimePartCC *m_mimePartTop;
-
- /// total number of MIME parts in the message
- size_t m_numParts;
-
- /**
- A temporarily allocated buffer for GetPartContent().
-
- It holds the information returned by that function and is only
- valid until its next call.
-
- We should free it only if m_ownsPartContent flag is true!
- */
- void *m_partContentPtr;
-
- /// Flag telling whether we should free m_partContentPtr or not
- bool m_ownsPartContent;
};
Index: MessageView.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MessageView.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -b -u -2 -r1.54 -r1.55
--- MessageView.h 12 Jul 2004 20:56:21 -0000 1.54
+++ MessageView.h 13 Jul 2004 21:58:41 -0000 1.55
@@ -286,4 +286,15 @@
void OnBodyText(const String& text) { m_textBody += text; }
+ /**
+ Give us ownership of a virtual mime part created on the fly.
+
+ This is a hack: sometimes we create virtual, i.e. not existing in the
+ original message, mime parts which don't exist in the original Message.
+ This creates a problem of disposing them: normally we don't free MimePart
+ objects at all because they belong to the Message, but the virtual ones
+ don't, so someone else has to delete them. This someone else is us.
+ */
+ void AddVirtualMimePart(MimePart *mimepart);
+
protected:
/** @name Initialization
@@ -683,4 +694,8 @@
+ /// list of all virtual MIME parts, created on demand
+ class VirtualMimePartsList *m_virtualMimeParts;
+
+
friend class ProcessEvtHandler;
friend class MessageViewer;
Index: MimePartCC.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MimePartCC.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -b -u -2 -r1.5 -r1.6
--- MimePartCC.h 12 Jul 2003 18:57:43 -0000 1.5
+++ MimePartCC.h 13 Jul 2004 21:58:41 -0000 1.6
@@ -19,5 +19,5 @@
// base class
-#include "MimePart.h"
+#include "MimePartCCBase.h"
class MessageCC;
@@ -27,45 +27,14 @@
// ----------------------------------------------------------------------------
-class MimePartCC : public MimePart
+class MimePartCC : public MimePartCCBase
{
public:
- // MIME tree navigation
- virtual MimePart *GetParent() const;
- virtual MimePart *GetNext() const;
- virtual MimePart *GetNested() const;
-
- // headers access
- virtual MimeType GetType() const;
- virtual String GetDescription() const;
- virtual String GetFilename() const;
- virtual String GetDisposition() const;
- virtual String GetPartSpec() const;
- virtual String GetParam(const String& name) const;
- virtual String GetDispositionParam(const String& name) const;
- virtual const MimeParameterList& GetParameters() const;
- virtual const MimeParameterList& GetDispositionParameters() const;
-
// data access
virtual const void *GetRawContent(unsigned long *len = NULL) const;
- virtual const void *GetContent(unsigned long *len = NULL) const;
- virtual String GetTextContent() const;
virtual String GetHeaders() const;
- virtual MimeXferEncoding GetTransferEncoding() const;
- virtual size_t GetSize() const;
-
- // text part additional info
- virtual wxFontEncoding GetTextEncoding() const;
- virtual size_t GetNumberOfLines() const;
protected:
- /// find the parameter in the list by name
- static String FindParam(const MimeParameterList& list, const String& name);
-
- /// fill our param list with values from c-client
- static void InitParamList(MimeParameterList *list,
- struct mail_body_parameter *par);
-
/// get the message we belong to
- MessageCC *GetMessage() const;
+ MessageCC *GetMessage() const { return m_message; }
private:
@@ -76,47 +45,21 @@
//@{
- /// common part of all ctors
- void Init();
-
/// ctor for the top level part
- MimePartCC(MessageCC *message);
+ MimePartCC(MessageCC *message, struct mail_bodystruct *body);
/// ctor for non top part
- MimePartCC(MimePartCC *parent, size_t nPart = 1);
-
- /// dtor deletes all subparts and siblings
- virtual ~MimePartCC();
+ MimePartCC(struct mail_bodystruct *body, MimePartCC *parent, size_t nPart);
//@}
- /// the parent part (NULL for top level one)
- MimePartCC *m_parent;
+ // create all subparts of this one, called from both ctors
+ void CreateSubParts();
- /// first child part for multipart or message parts
- MimePartCC *m_nested;
- // m_next and m_message could be in a union as only the top level message
- // has m_message pointer but it never has any siblings
- //
- // but is it worth it?
-
- /// next part in the message
- MimePartCC *m_next;
-
- /// the message we're part of (never NULL, not a ref for technical reasons)
+ // the message we're part of (never NULL and never changes)
MessageCC *m_message;
- /// the c-client BODY struct we stand for
- struct mail_bodystruct *m_body;
-
- /// MIME/IMAP4 part spec (#.#.#.#)
- String m_spec;
-
- /// list of parameters if we already have them: never access directly!
- MimeParameterList *m_parameterList;
-
- /// list of disposition parameters if we already have them
- MimeParameterList *m_dispositionParameterList;
+ // it creates us
friend class MessageCC;
};
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates