<refentry id="camel-CamelIMAP4Engine">
<refmeta>
<refentrytitle role="top_of_page" id="camel-CamelIMAP4Engine.top_of_page">CamelIMAP4Engine</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAMEL Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>CamelIMAP4Engine</refname>
<refpurpose></refpurpose>
</refnamediv>

<refsynopsisdiv id="camel-CamelIMAP4Engine.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
                    <link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link>;
enum                <link linkend="camel-imap4-engine-t">camel_imap4_engine_t</link>;
enum                <link linkend="camel-imap4-level-t">camel_imap4_level_t</link>;
enum                <link linkend="camel-imap4-resp-code-t">camel_imap4_resp_code_t</link>;
                    <link linkend="CamelIMAP4RespCode">CamelIMAP4RespCode</link>;
                    <link linkend="CamelIMAP4Namespace">CamelIMAP4Namespace</link>;
                    <link linkend="CamelIMAP4NamespaceList">CamelIMAP4NamespaceList</link>;
<link linkend="gboolean">gboolean</link>            (<link linkend="CamelIMAP4ReconnectFunc">*CamelIMAP4ReconnectFunc</link>)          (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *  <link linkend="camel-imap4-engine-new">camel_imap4_engine_new</link>              (<link linkend="CamelService">CamelService</link> *service,
                                                         <link linkend="CamelIMAP4ReconnectFunc">CamelIMAP4ReconnectFunc</link> reconnect);
<link linkend="int">int</link>                 <link linkend="camel-imap4-engine-take-stream">camel_imap4_engine_take_stream</link>      (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelStream">CamelStream</link> *stream,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="void">void</link>                <link linkend="camel-imap4-engine-disconnect">camel_imap4_engine_disconnect</link>       (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine);
<link linkend="int">int</link>                 <link linkend="camel-imap4-engine-capability">camel_imap4_engine_capability</link>       (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-imap4-engine-namespace">camel_imap4_engine_namespace</link>        (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-imap4-engine-select-folder">camel_imap4_engine_select_folder</link>    (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelFolder">CamelFolder</link> *folder,
                                                         <link linkend="CamelException">CamelException</link> *ex);
struct <link linkend="CamelIMAP4Command">_CamelIMAP4Command</link> * <link linkend="camel-imap4-engine-queue">camel_imap4_engine_queue</link>    (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelFolder">CamelFolder</link> *folder,
                                                         const <link linkend="char">char</link> *format,
                                                         ...);
struct <link linkend="CamelIMAP4Command">_CamelIMAP4Command</link> * <link linkend="camel-imap4-engine-prequeue">camel_imap4_engine_prequeue</link> (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelFolder">CamelFolder</link> *folder,
                                                         const <link linkend="char">char</link> *format,
                                                         ...);
<link linkend="void">void</link>                <link linkend="camel-imap4-engine-dequeue">camel_imap4_engine_dequeue</link>          (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="struct--CamelIMAP4Command">struct _CamelIMAP4Command</link> *ic);
<link linkend="int">int</link>                 <link linkend="camel-imap4-engine-iterate">camel_imap4_engine_iterate</link>          (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine);
<link linkend="int">int</link>                 <link linkend="camel-imap4-engine-handle-untagged-1">camel_imap4_engine_handle_untagged_1</link>
                                                        (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="struct--camel-imap4-token-t">struct _camel_imap4_token_t</link> *token,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="void">void</link>                <link linkend="camel-imap4-engine-handle-untagged">camel_imap4_engine_handle_untagged</link>  (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-imap4-engine-next-token">camel_imap4_engine_next_token</link>       (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="struct--camel-imap4-token-t">struct _camel_imap4_token_t</link> *token,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-imap4-engine-line">camel_imap4_engine_line</link>             (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         unsigned <link linkend="char">char</link> **line,
                                                         <link linkend="size-t">size_t</link> *len,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-imap4-engine-literal">camel_imap4_engine_literal</link>          (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         unsigned <link linkend="char">char</link> **literal,
                                                         <link linkend="size-t">size_t</link> *len,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-imap4-engine-nstring">camel_imap4_engine_nstring</link>          (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         unsigned <link linkend="char">char</link> **nstring,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-imap4-engine-eat-line">camel_imap4_engine_eat_line</link>         (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-imap4-engine-parse-resp-code">camel_imap4_engine_parse_resp_code</link>  (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="void">void</link>                <link linkend="camel-imap4-resp-code-free">camel_imap4_resp_code_free</link>          (<link linkend="CamelIMAP4RespCode">CamelIMAP4RespCode</link> *rcode);
</synopsis>
</refsynopsisdiv>









<refsect1 id="camel-CamelIMAP4Engine.description" role="desc">
<title role="desc.title">Description</title>
<para>
</para>
</refsect1>

<refsect1 id="camel-CamelIMAP4Engine.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CamelIMAP4Engine" role="struct">
<title>CamelIMAP4Engine</title>
<indexterm zone="CamelIMAP4Engine"><primary sortas="CamelIMAP4Engine">CamelIMAP4Engine</primary></indexterm><programlisting>typedef struct {
	CamelObject parent_object;
	
	CamelIMAP4ReconnectFunc reconnect;
	gboolean reconnecting;
	
	CamelSession *session;
	CamelService *service;
	CamelURL *url;
	
	camel_imap4_engine_t state;
	camel_imap4_level_t level;
	guint32 capa;
	
	guint32 maxlen:31;
	guint32 maxlentype:1;
	
	CamelIMAP4NamespaceList namespaces;
	GHashTable *authtypes;                    /* supported authtypes */
	
	struct _CamelIMAP4Stream *istream;
	CamelStream *ostream;
	
	unsigned char tagprefix;             /* 'A'..'Z' */
	unsigned int tag;                    /* next command tag */
	int nextid;
	
	struct _CamelIMAP4Folder *folder;    /* currently selected folder */
	
	CamelDList queue;                    /* queue of waiting commands */
	struct _CamelIMAP4Command *current;
} CamelIMAP4Engine;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="camel-imap4-engine-t" role="enum">
<title>enum camel_imap4_engine_t</title>
<indexterm zone="camel-imap4-engine-t"><primary sortas="camel_imap4_engine_t">camel_imap4_engine_t</primary></indexterm><programlisting>typedef enum {
	CAMEL_IMAP4_ENGINE_DISCONNECTED,
	CAMEL_IMAP4_ENGINE_CONNECTED,
	CAMEL_IMAP4_ENGINE_PREAUTH,
	CAMEL_IMAP4_ENGINE_AUTHENTICATED,
	CAMEL_IMAP4_ENGINE_SELECTED,
} camel_imap4_engine_t;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="camel-imap4-level-t" role="enum">
<title>enum camel_imap4_level_t</title>
<indexterm zone="camel-imap4-level-t"><primary sortas="camel_imap4_level_t">camel_imap4_level_t</primary></indexterm><programlisting>typedef enum {
	CAMEL_IMAP4_LEVEL_UNKNOWN,
	CAMEL_IMAP4_LEVEL_IMAP4,
	CAMEL_IMAP4_LEVEL_IMAP4REV1
} camel_imap4_level_t;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="camel-imap4-resp-code-t" role="enum">
<title>enum camel_imap4_resp_code_t</title>
<indexterm zone="camel-imap4-resp-code-t"><primary sortas="camel_imap4_resp_code_t">camel_imap4_resp_code_t</primary></indexterm><programlisting>typedef enum {
	CAMEL_IMAP4_RESP_CODE_ALERT,
	CAMEL_IMAP4_RESP_CODE_BADCHARSET,
	CAMEL_IMAP4_RESP_CODE_CAPABILITY,
	CAMEL_IMAP4_RESP_CODE_PARSE,
	CAMEL_IMAP4_RESP_CODE_PERM_FLAGS,
	CAMEL_IMAP4_RESP_CODE_READONLY,
	CAMEL_IMAP4_RESP_CODE_READWRITE,
	CAMEL_IMAP4_RESP_CODE_TRYCREATE,
	CAMEL_IMAP4_RESP_CODE_UIDNEXT,
	CAMEL_IMAP4_RESP_CODE_UIDVALIDITY,
	CAMEL_IMAP4_RESP_CODE_UNSEEN,
	CAMEL_IMAP4_RESP_CODE_NEWNAME,
	CAMEL_IMAP4_RESP_CODE_APPENDUID,
	CAMEL_IMAP4_RESP_CODE_COPYUID,
	CAMEL_IMAP4_RESP_CODE_UNKNOWN,
} camel_imap4_resp_code_t;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CamelIMAP4RespCode" role="struct">
<title>CamelIMAP4RespCode</title>
<indexterm zone="CamelIMAP4RespCode"><primary sortas="CamelIMAP4RespCode">CamelIMAP4RespCode</primary></indexterm><programlisting>typedef struct {
	camel_imap4_resp_code_t code;
	union {
		guint32 flags;
		char *parse;
		guint32 uidnext;
		guint32 uidvalidity;
		guint32 unseen;
		char *newname[2];
		struct {
			guint32 uidvalidity;
			guint32 uid;
		} appenduid;
		struct {
			guint32 uidvalidity;
			char *srcset;
			char *destset;
		} copyuid;
	} v;
} CamelIMAP4RespCode;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CamelIMAP4Namespace" role="struct">
<title>CamelIMAP4Namespace</title>
<indexterm zone="CamelIMAP4Namespace"><primary sortas="CamelIMAP4Namespace">CamelIMAP4Namespace</primary></indexterm><programlisting>typedef struct {
	struct _CamelIMAP4Namespace *next;
	char *path;
	char sep;
} CamelIMAP4Namespace;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CamelIMAP4NamespaceList" role="struct">
<title>CamelIMAP4NamespaceList</title>
<indexterm zone="CamelIMAP4NamespaceList"><primary sortas="CamelIMAP4NamespaceList">CamelIMAP4NamespaceList</primary></indexterm><programlisting>typedef struct {
	CamelIMAP4Namespace *personal;
	CamelIMAP4Namespace *other;
	CamelIMAP4Namespace *shared;
} CamelIMAP4NamespaceList;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CamelIMAP4ReconnectFunc" role="function">
<title>CamelIMAP4ReconnectFunc ()</title>
<indexterm zone="CamelIMAP4ReconnectFunc"><primary sortas="CamelIMAP4ReconnectFunc">CamelIMAP4ReconnectFunc</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            (*CamelIMAP4ReconnectFunc)          (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-new" role="function">
<title>camel_imap4_engine_new ()</title>
<indexterm zone="camel-imap4-engine-new"><primary sortas="camel_imap4_engine_new">camel_imap4_engine_new</primary></indexterm><programlisting><link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *  camel_imap4_engine_new              (<link linkend="CamelService">CamelService</link> *service,
                                                         <link linkend="CamelIMAP4ReconnectFunc">CamelIMAP4ReconnectFunc</link> reconnect);</programlisting>
<para>
</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>service</parameter>&#160;:</term>
<listitem><simpara> service
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>reconnect</parameter>&#160;:</term>
<listitem><simpara> reconnect callback function
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new imap4 engine
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-take-stream" role="function">
<title>camel_imap4_engine_take_stream ()</title>
<indexterm zone="camel-imap4-engine-take-stream"><primary sortas="camel_imap4_engine_take_stream">camel_imap4_engine_take_stream</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_imap4_engine_take_stream      (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelStream">CamelStream</link> *stream,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Gives ownership of <parameter>stream</parameter> to <parameter>engine</parameter> and reads the greeting from
the stream.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> imap4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> tcp stream
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> 0 on success or -1 on fail.

Note: on error, <parameter>stream</parameter> will be unref'd.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-disconnect" role="function">
<title>camel_imap4_engine_disconnect ()</title>
<indexterm zone="camel-imap4-engine-disconnect"><primary sortas="camel_imap4_engine_disconnect">camel_imap4_engine_disconnect</primary></indexterm><programlisting><link linkend="void">void</link>                camel_imap4_engine_disconnect       (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine);</programlisting>
<para>
Closes the engine's connection to the IMAP4 server and sets state
to <link linkend="CAMEL-IMAP4-ENGINE-DISCONNECTED--CAPS"><type>CAMEL_IMAP4_ENGINE_DISCONNECTED</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-capability" role="function">
<title>camel_imap4_engine_capability ()</title>
<indexterm zone="camel-imap4-engine-capability"><primary sortas="camel_imap4_engine_capability">camel_imap4_engine_capability</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_imap4_engine_capability       (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Forces the IMAP4 engine to query the IMAP4 server for a list of capabilities.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="0--CAPS"><literal>0</literal></link> on success or <link linkend="1--CAPS"><literal>-1</literal></link> on fail.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-namespace" role="function">
<title>camel_imap4_engine_namespace ()</title>
<indexterm zone="camel-imap4-engine-namespace"><primary sortas="camel_imap4_engine_namespace">camel_imap4_engine_namespace</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_imap4_engine_namespace        (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Forces the IMAP4 engine to query the IMAP4 server for a list of namespaces.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> 0 on success or -1 on fail.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-select-folder" role="function">
<title>camel_imap4_engine_select_folder ()</title>
<indexterm zone="camel-imap4-engine-select-folder"><primary sortas="camel_imap4_engine_select_folder">camel_imap4_engine_select_folder</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_imap4_engine_select_folder    (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelFolder">CamelFolder</link> *folder,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Convenience function to select <parameter>folder</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>folder</parameter>&#160;:</term>
<listitem><simpara> folder to select
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> 0 on success or -1 on fail.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-queue" role="function">
<title>camel_imap4_engine_queue ()</title>
<indexterm zone="camel-imap4-engine-queue"><primary sortas="camel_imap4_engine_queue">camel_imap4_engine_queue</primary></indexterm><programlisting>struct <link linkend="CamelIMAP4Command">_CamelIMAP4Command</link> * camel_imap4_engine_queue    (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelFolder">CamelFolder</link> *folder,
                                                         const <link linkend="char">char</link> *format,
                                                         ...);</programlisting>
<para>
Basically the same as <link linkend="camel-imap4-command-new"><function>camel_imap4_command_new()</function></link> except that this
function also places the command in the engine queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>folder</parameter>&#160;:</term>
<listitem><simpara> IMAP4 folder that the command will affect (or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if it doesn't matter)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>format</parameter>&#160;:</term>
<listitem><simpara> command format
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&#160;:</term>
<listitem><simpara> arguments
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the CamelIMAP4Command.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-prequeue" role="function">
<title>camel_imap4_engine_prequeue ()</title>
<indexterm zone="camel-imap4-engine-prequeue"><primary sortas="camel_imap4_engine_prequeue">camel_imap4_engine_prequeue</primary></indexterm><programlisting>struct <link linkend="CamelIMAP4Command">_CamelIMAP4Command</link> * camel_imap4_engine_prequeue (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelFolder">CamelFolder</link> *folder,
                                                         const <link linkend="char">char</link> *format,
                                                         ...);</programlisting>
<para>
Same as <link linkend="camel-imap4-engine-queue"><function>camel_imap4_engine_queue()</function></link> except this places the new
command at the head of the queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>folder</parameter>&#160;:</term>
<listitem><simpara> IMAP4 folder that the command will affect (or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if it doesn't matter)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>format</parameter>&#160;:</term>
<listitem><simpara> command format
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&#160;:</term>
<listitem><simpara> arguments
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the CamelIMAP4Command.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-dequeue" role="function">
<title>camel_imap4_engine_dequeue ()</title>
<indexterm zone="camel-imap4-engine-dequeue"><primary sortas="camel_imap4_engine_dequeue">camel_imap4_engine_dequeue</primary></indexterm><programlisting><link linkend="void">void</link>                camel_imap4_engine_dequeue          (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="struct--CamelIMAP4Command">struct _CamelIMAP4Command</link> *ic);</programlisting>
<para>
Removes <parameter>ic</parameter> from the processing queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ic</parameter>&#160;:</term>
<listitem><simpara> IMAP4 command
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-iterate" role="function">
<title>camel_imap4_engine_iterate ()</title>
<indexterm zone="camel-imap4-engine-iterate"><primary sortas="camel_imap4_engine_iterate">camel_imap4_engine_iterate</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_imap4_engine_iterate          (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine);</programlisting>
<para>
Processes the first command in the queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the id of the processed command, <link linkend="0--CAPS"><literal>0</literal></link> if there were no
commands to process, or <link linkend="1--CAPS"><literal>-1</literal></link> on error.

Note: more details on the error will be held on the
<link linkend="CamelIMAP4Command"><type>CamelIMAP4Command</type></link> that failed.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-handle-untagged-1" role="function">
<title>camel_imap4_engine_handle_untagged_1 ()</title>
<indexterm zone="camel-imap4-engine-handle-untagged-1"><primary sortas="camel_imap4_engine_handle_untagged_1">camel_imap4_engine_handle_untagged_1</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_imap4_engine_handle_untagged_1
                                                        (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="struct--camel-imap4-token-t">struct _camel_imap4_token_t</link> *token,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Handles a single untagged response</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>token</parameter>&#160;:</term>
<listitem><simpara> IMAP4 token
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> -1 on error or one of
CAMEL_IMAP4_UNTAGGED_[OK,NO,BAD,PREAUTH,HANDLED] on success
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-handle-untagged" role="function">
<title>camel_imap4_engine_handle_untagged ()</title>
<indexterm zone="camel-imap4-engine-handle-untagged"><primary sortas="camel_imap4_engine_handle_untagged">camel_imap4_engine_handle_untagged</primary></indexterm><programlisting><link linkend="void">void</link>                camel_imap4_engine_handle_untagged  (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Handle a stream of untagged responses.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-next-token" role="function">
<title>camel_imap4_engine_next_token ()</title>
<indexterm zone="camel-imap4-engine-next-token"><primary sortas="camel_imap4_engine_next_token">camel_imap4_engine_next_token</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_imap4_engine_next_token       (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="struct--camel-imap4-token-t">struct _camel_imap4_token_t</link> *token,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Wraps <link linkend="camel-imap4-stream-next-token"><function>camel_imap4_stream_next_token()</function></link> to set an exception on
failure and updates the engine state to DISCONNECTED if the stream
gets disconencted.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>token</parameter>&#160;:</term>
<listitem><simpara> IMAP4 token
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="0--CAPS"><literal>0</literal></link> on success or <link linkend="1--CAPS"><literal>-1</literal></link> on fail.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-line" role="function">
<title>camel_imap4_engine_line ()</title>
<indexterm zone="camel-imap4-engine-line"><primary sortas="camel_imap4_engine_line">camel_imap4_engine_line</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_imap4_engine_line             (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         unsigned <link linkend="char">char</link> **line,
                                                         <link linkend="size-t">size_t</link> *len,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Reads in a single line of input from the IMAP4 server and updates
<parameter>line</parameter> to point to the line buffer. <parameter>len</parameter> is set to the length of the
line buffer. <parameter>line</parameter> must be free'd using <link linkend="g-free"><function>g_free()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>line</parameter>&#160;:</term>
<listitem><simpara> line pointer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> length pointer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> 0 on success or -1 on fail
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-literal" role="function">
<title>camel_imap4_engine_literal ()</title>
<indexterm zone="camel-imap4-engine-literal"><primary sortas="camel_imap4_engine_literal">camel_imap4_engine_literal</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_imap4_engine_literal          (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         unsigned <link linkend="char">char</link> **literal,
                                                         <link linkend="size-t">size_t</link> *len,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Reads in an entire literal string and updates <parameter>literal</parameter> to point to
it. <parameter>len</parameter> is set to the length of the literal. <parameter>literal</parameter> will also
conveniently be terminated with a nul-byte. <parameter>literal</parameter> must be free'd
using <link linkend="g-free"><function>g_free()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>literal</parameter>&#160;:</term>
<listitem><simpara> literal pointer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> len pointer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> 0 on success or -1 on fail.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-nstring" role="function">
<title>camel_imap4_engine_nstring ()</title>
<indexterm zone="camel-imap4-engine-nstring"><primary sortas="camel_imap4_engine_nstring">camel_imap4_engine_nstring</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_imap4_engine_nstring          (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         unsigned <link linkend="char">char</link> **nstring,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Reads in an nstring (NIL, atom, qstring or literal) and updates
<parameter>nstring</parameter> to point to it. <parameter>nstring</parameter> must be free'd using <link linkend="g-free"><function>g_free()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>nstring</parameter>&#160;:</term>
<listitem><simpara> nstring pointer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> 0 on success or -1 on fail.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-eat-line" role="function">
<title>camel_imap4_engine_eat_line ()</title>
<indexterm zone="camel-imap4-engine-eat-line"><primary sortas="camel_imap4_engine_eat_line">camel_imap4_engine_eat_line</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_imap4_engine_eat_line         (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Gobbles up the remainder of the response line.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> 0 on success or -1 on fail
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-engine-parse-resp-code" role="function">
<title>camel_imap4_engine_parse_resp_code ()</title>
<indexterm zone="camel-imap4-engine-parse-resp-code"><primary sortas="camel_imap4_engine_parse_resp_code">camel_imap4_engine_parse_resp_code</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_imap4_engine_parse_resp_code  (<link linkend="CamelIMAP4Engine">CamelIMAP4Engine</link> *engine,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Parses a RESP-CODE</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>engine</parameter>&#160;:</term>
<listitem><simpara> IMAP4 engine
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> exception
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> 0 on success or -1 on fail.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-imap4-resp-code-free" role="function">
<title>camel_imap4_resp_code_free ()</title>
<indexterm zone="camel-imap4-resp-code-free"><primary sortas="camel_imap4_resp_code_free">camel_imap4_resp_code_free</primary></indexterm><programlisting><link linkend="void">void</link>                camel_imap4_resp_code_free          (<link linkend="CamelIMAP4RespCode">CamelIMAP4RespCode</link> *rcode);</programlisting>
<para>
Free's the RESP-CODE</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>rcode</parameter>&#160;:</term>
<listitem><simpara> RESP-CODE
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
