From: Pierre Habouzit Date: Sun, 13 Jan 2008 13:46:55 +0000 (+0100) Subject: Begin to work on a pop reimplementation, using jobs and the event loop X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=44747a633c2e79acd5a6f29c6eef489ab9d62cda Begin to work on a pop reimplementation, using jobs and the event loop Signed-off-by: Pierre Habouzit --- diff --git a/lib-mx/CMakeLists.txt b/lib-mx/CMakeLists.txt index 445cff7..56c55c0 100644 --- a/lib-mx/CMakeLists.txt +++ b/lib-mx/CMakeLists.txt @@ -5,4 +5,5 @@ ADD_LIBRARY(mx mh.c mx.c pop.c + pop-new.c ) diff --git a/lib-mx/mx.c b/lib-mx/mx.c index 1a7db32..79eaad0 100644 --- a/lib-mx/mx.c +++ b/lib-mx/mx.c @@ -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 index 0000000..c5130a0 --- /dev/null +++ b/lib-mx/pop-new.c @@ -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 + */ + +#include +#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, +}; diff --git a/lib-mx/pop.h b/lib-mx/pop.h index 859e5d3..fdb6f58 100644 --- a/lib-mx/pop.h +++ b/lib-mx/pop.h @@ -14,6 +14,7 @@ #include extern mx_t const pop_mx; +extern mx_t const pop_mx_ng; void pop_fetch_mail(void); #endif