Begin to work on a pop reimplementation, using jobs and the event loop
[apps/madmutt.git] / lib-mx / pop-new.c
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,
+};