haiku/docs/apps/mail/Public API/PlainTextBodyComponent.html

615 lines
16 KiB
HTML
Raw Normal View History

<HTML>
<HEAD>
<TITLE>PlainTextBodyComponent</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#2222AA" BACKGROUND="../art/bodyBack.gif">
<P><A NAME=BCursor></A> <!--TOP LINKS--></P>
<CENTER><TABLE BORDER=2 BGCOLOR="#FFDD88">
<TR>
<TD>
<P><TABLE BGCOLOR="#550033" CELLPADDING=5>
<TR>
<TD>
<P><A HREF="../index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>Mail
Kit 2 Root</B></FONT></A></P>
</TD>
<TD>
<P><A HREF="index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>The
Public API</B></FONT></A></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<HR NOSHADE>
</CENTER>
<P><!--TOP LINKS--></P>
<H1><FONT SIZE="+4">PlainTextBodyComponent</FONT></H1>
<BLOCKQUOTE><FONT FACE="helvetica"><B>Derived
from:</B></FONT>&nbsp;<A HREF="MailComponent.html">MailComponent</A><BR>
<FONT FACE="helvetica"><B>Declared in:</B></FONT>&nbsp;
include/public/MailComponent.h<BR>
<FONT FACE="helvetica"><B>Library:</B></FONT>&nbsp;libmail.so<BR>
<P><BR>
</P>
<P>PlainTextBodyComponent stores plain text. It uses UTF8 text as
its canonical format and reads and writes RFC 2047 style text. As
such, it handles accents and other 8 bit characters with ease. If
you want to send text, this is the way to go.</P></BLOCKQUOTE>
<P>
<HR NOSHADE>
</P>
<H2><FONT SIZE="+3" COLOR="#430000">C</FONT><FONT COLOR="#430000">onstructor
and
</FONT><FONT SIZE="+3" COLOR="#430000">D</FONT><FONT COLOR="#430000">estructor</FONT></H2>
<P>
<HR>
<A NAME=PlainTextBodyComponent></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">PlainTextBodyComponent() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P><FONT SIZE="+1"><B><TT>PlainTextBodyComponent(</TT></B></FONT>const
char*<FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT>
=
<B>NULL</B><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Initializes the component and sets its content to <FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT>,
which can be NULL. The argument is a UTF8 null-terminated string.
Encoding defaults to quoted printable with the ISO-8859-1
charset.</P>
<P>&nbsp;</P></BLOCKQUOTE>
<P>
<HR>
<A NAME="~PlainTextBodyComponent"></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">~PlainTextBodyComponent() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual
<FONT SIZE="+1"><B><TT>~PlainTextBodyComponent()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Destroys the component and frees internal buffers. Does nothing
of interest.</P></BLOCKQUOTE>
<P>
<HR NOSHADE>
</P>
<H2><FONT SIZE="+3" COLOR="#430000">M</FONT><FONT COLOR="#430000">ember
</FONT><FONT SIZE="+3" COLOR="#430000">F</FONT><FONT COLOR="#430000">unctions</FONT></H2>
<P>
<HR>
<A NAME=GetDecodedData></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">GetDecodedData () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>GetDecodedData(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Retrieves the data contained in this component as a UTF8 string
and places the contents of this string in<FONT FACE="HELVETICA" COLOR="#991122"><I>
data</I></FONT>.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- <B>B_ERROR<I> </I></B>if something goes wrong.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=Text></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Text () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>const char *
<FONT SIZE="+1"><B><TT>Text()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the contents of this component as a UTF8
string.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=BStringText></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">BStringText () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>BString *
<FONT SIZE="+1"><B><TT>BStringText()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the internal UTF8 format BString used by this component.
As such, you can do raw text operations on the content of the message. The use of
this function is not reccomended.</P>
</BLOCKQUOTE>
<P>
<HR>
<A NAME=Quote></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Quote () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>Quote(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>message</I></FONT> = <B>NULL</B>,
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>quote_style</I></FONT> = <B>&quot;&gt;&nbsp;&quot;</B>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Quotes the contents of this component. Inserts <FONT FACE="HELVETICA" COLOR="#991122"><I>quote_style</I></FONT> at the start of every line,
and prefaces the content with <FONT FACE="HELVETICA" COLOR="#991122"><I>message</I></FONT>, if it is not NULL. <FONT FACE="HELVETICA" COLOR="#991122"><I>message</I></FONT>
should be something like &quot;On September 30, 2001, John Smith said:&quot;, or something in that vein. Note that the new line after <FONT FACE="HELVETICA" COLOR="#991122"><I>message</I></FONT>
is supplied for you, so you do not need to add it.</P>
</BLOCKQUOTE>
<P>
<HR>
<A NAME=SetDecodedData></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetDecodedData () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>SetDecodedData(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Sets the contents of this component to the UTF8 format data
contained in <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- <B>B_ERROR<I> </I></B>if something goes wrong.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=SetText></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetText () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetText(</TT></B></FONT>const
char *<FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Sets the contents of this component to the UTF8 string
contained in <FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT>.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=AppendText></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">AppendText () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>AppendText(</TT></B></FONT>const
char *<FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Appends <FONT FACE="HELVETICA" COLOR="#991122"><I>text
</I></FONT>to the current contents of this component. <FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT>
should be a UTF8 string.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=AppendText></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetEncoding () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetEncoding(</TT></B></FONT>mail_encoding
<FONT FACE="HELVETICA" COLOR="#991122"><I>encoding</I></FONT>,
int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>charset</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Sets the encoding and charset used by <A HREF="#Render"><B>Render()</B></A>
to <FONT FACE="HELVETICA" COLOR="#991122"><I>encoding</I></FONT>
and <FONT FACE="HELVETICA" COLOR="#991122"><I>charset</I></FONT>,
respectively. Use the conversion constants from <B>UTF8.h</B> for
<FONT FACE="HELVETICA" COLOR="#991122"><I>charset</I></FONT>. We
<I>strongly</I> reccomend that you always use the defaults for the
reasons outlined in <A HREF="http://www.faqs.org/rfcs/rfc2047.html">RFC
2047</A>.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=Instantiate></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Instantiate () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>Instantiate(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
size_t <FONT FACE="HELVETICA" COLOR="#991122"><I>length</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Initializes this component to the RFC 822 format data in
<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
starting at <FONT FACE="HELVETICA" COLOR="#991122"><I>data
</I></FONT>-&gt;Position(), for up to <FONT FACE="HELVETICA" COLOR="#991122"><I>length
</I></FONT>bytes. Handles encoded data according to RFC 2047</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- <B>B_BAD_TYPE</B> if <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT FACE="HELVETICA">
</FONT>does not seem to be plain text.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=Render></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Render () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>Render(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Renders the component into RFC 822 format and places the result
in <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
starting at <FONT FACE="HELVETICA" COLOR="#991122"><I>data
</I></FONT>-&gt;Position(). Encodes and translates charsets
according to the arguments passed to <A HREF="#SetEncoding"><B>SetEncoding()</B></A>.
Encoding defaults to quoted printable and charset to
ISO-8859-1.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.</BLOCKQUOTE>
<P></TABLE></P></BLOCKQUOTE>
<P><!--TOP LINKS-->
<HR NOSHADE>
</P>
<CENTER><TABLE BORDER=2 BGCOLOR="#FFDD88">
<TR>
<TD>
<P><TABLE BGCOLOR="#550033" CELLPADDING=5>
<TR>
<TD>
<P><A HREF="../index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>Mail
Kit 2 Root</B></FONT></A></P>
</TD>
<TD>
<P><A HREF="index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>The
Public API</B></FONT></A></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
</CENTER>
<P><!--TOP LINKS--> <!-- Footer for Release 5 HTML Be Book --><BR>
</P>
<CENTER><FONT SIZE="+3" COLOR="#555555"><I>Mail Daemon 2 API
Documentation</I></FONT>
<P><FONT SIZE="+1" COLOR="#555555"><I>&copy;2001 Dr. Zoidberg
Enterprises</I></FONT></P></CENTER>
</BODY>
</HTML>