Begin to work on a pop reimplementation, using jobs and the event loop
authorPierre Habouzit <madcoder@debian.org>
Sun, 13 Jan 2008 13:46:55 +0000 (14:46 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sun, 13 Jan 2008 13:46:55 +0000 (14:46 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
lib-mx/CMakeLists.txt
lib-mx/mx.c
lib-mx/pop-new.c [new file with mode: 0644]
lib-mx/pop.h

index 445cff7..56c55c0 100644 (file)
@@ -5,4 +5,5 @@ ADD_LIBRARY(mx
     mh.c
     mx.c
     pop.c
+    pop-new.c
 )
index 1a7db32..79eaad0 100644 (file)
@@ -42,6 +42,9 @@ static mx_t const *mxfmts[] = {
     &imap_mx,
     &pop_mx,
     &compress_mx,
+
+    /* hack so that it's linked together */
+    &pop_mx_ng,
 };
 
 #define MX_IDX(idx)          (idx >= 0 && idx < countof(mxfmts))
diff --git a/lib-mx/pop-new.c b/lib-mx/pop-new.c
new file mode 100644 (file)
index 0000000..c5130a0
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ *  MA 02110-1301, USA.
+ */
+/*
+ *  Copyright © 2007 Pierre Habouzit
+ *  Copyright © 2000-2002 Vsevolod Volkov <vvv@mutt.org.ua>
+ */
+
+#include <lib-sys/evtloop.h>
+#include "pop.h"
+
+typedef struct pop_data_t {
+    int refcnt;
+    job_t *w;
+} pop_data_t;
+DO_INIT(pop_data_t, pop_data);
+DO_WIPE(pop_data_t, pop_data);
+DO_REFCNT(pop_data_t, pop_data);
+DO_ARRAY_TYPE(pop_data_t, pop_data);
+DO_ARRAY_FUNCS(pop_data_t, pop_data, pop_data_delete);
+
+static pop_data_array conns;
+
+static __init void pop_initialize(void)
+{
+    pop_data_array_init(&conns);
+}
+static __fini void pop_shutdown(void)
+{
+    pop_data_array_wipe(&conns);
+}
+
+static int pop_setup(job_t *w, void *cfg)
+{
+    return 0;
+}
+
+static void pop_finalize(job_t *w, el_status reason)
+{
+}
+
+static machine_t const pop_machine = {
+    .name     = "POP3",
+    .setup    = &pop_setup,
+    .finalize = &pop_finalize,
+};
+
+mx_t const pop_mx_ng = {
+    M_POP,
+    0,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+};
index 859e5d3..fdb6f58 100644 (file)
@@ -14,6 +14,7 @@
 #include <lib-mx/mx.h>
 
 extern mx_t const pop_mx;
+extern mx_t const pop_mx_ng;
 void pop_fetch_mail(void);
 
 #endif