From: Richard Russon <rich@flatcap.org>
Date: Sat, 7 Jul 2018 10:45:02 +0000 (+0100)
Subject: create libpop
X-Git-Tag: 2019-10-25~759^2~4
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62b8051f8d988a8dad6c2b56a2af057d255fe5c8;p=neomutt

create libpop
---

diff --git a/Makefile.autosetup b/Makefile.autosetup
index 1d168b2da..fd7901caa 100644
--- a/Makefile.autosetup
+++ b/Makefile.autosetup
@@ -68,7 +68,7 @@ NEOMUTTOBJS=	addrbook.o alias.o bcache.o browser.o buffy.o \
 		hdrline.o help.o history.o hook.o init.o keymap.o \
 		main.o mbox.o menu.o mh.o muttlib.o mutt_account.o mutt_attach.o mutt_body.o mutt_header.o \
 		mutt_logging.o mutt_signal.o mutt_socket.o mutt_thread.o mutt_window.o mx.o newsrc.o \
-		nntp.o pager.o parse.o pattern.o pop.o pop_auth.o pop_lib.o \
+		nntp.o pager.o parse.o pattern.o \
 		postpone.o progress.o query.o recvattach.o recvcmd.o resize.o rfc1524.o \
 		rfc2047.o rfc2231.o rfc3676.o safe_asprintf.o score.o send.o \
 		sendlib.o sidebar.o smtp.o sort.o state.o status.o system.o \
@@ -98,6 +98,14 @@ CLEANFILES+=	$(LIBEMAIL) $(LIBEMAILOBJS)
 MUTTLIBS+=	$(LIBEMAIL)
 ALLOBJS+=	$(LIBEMAILOBJS)
 
+###############################################################################
+# libpop
+LIBPOP=	libpop.a
+LIBPOPOBJS=	pop/pop_auth.o pop/pop.o pop/pop_lib.o
+CLEANFILES+=	$(LIBPOP) $(LIBPOPOBJS)
+MUTTLIBS+=	$(LIBPOP)
+ALLOBJS+=	$(LIBPOPOBJS)
+
 ###############################################################################
 # libmutt
 LIBMUTT=	libmutt.a
@@ -235,6 +243,13 @@ $(LIBEMAIL): $(PWD)/email $(LIBEMAILOBJS)
 $(PWD)/email:
 	$(MKDIR_P) $(PWD)/email
 
+# libpop
+$(LIBPOP): $(PWD)/pop $(LIBPOPOBJS)
+	$(AR) cr $@ $(LIBPOPOBJS)
+	$(RANLIB) $@
+$(PWD)/pop:
+	$(MKDIR_P) $(PWD)/pop
+
 # libncrypt
 $(LIBNCRYPT): $(PWD)/ncrypt $(LIBNCRYPTOBJS)
 	$(AR) cr $@ $(LIBNCRYPTOBJS)
diff --git a/curs_main.c b/curs_main.c
index 4d6c910c4..c8bb39343 100644
--- a/curs_main.c
+++ b/curs_main.c
@@ -58,7 +58,7 @@
 #include "sidebar.h"
 #endif
 #ifdef USE_POP
-#include "pop.h"
+#include "pop/pop.h"
 #endif
 #ifdef USE_IMAP
 #include "imap/imap.h"
diff --git a/mx.c b/mx.c
index e3b45cf81..fd928fc4c 100644
--- a/mx.c
+++ b/mx.c
@@ -66,7 +66,7 @@
 #include "imap/imap.h"
 #endif
 #ifdef USE_POP
-#include "pop.h"
+#include "pop/pop.h"
 #endif
 #ifdef USE_NNTP
 #include "nntp.h"
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a303a8eff..e35b136c7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -124,9 +124,9 @@ pager.c
 parse.c
 pattern.c
 pgpewrap.c
-pop.c
-pop_auth.c
-pop_lib.c
+pop/pop.c
+pop/pop_auth.c
+pop/pop_lib.c
 postpone.c
 progress.c
 query.c
diff --git a/pop.c b/pop/pop.c
similarity index 99%
rename from pop.c
rename to pop/pop.c
index 3d357b5b0..a1e38efc4 100644
--- a/pop.c
+++ b/pop/pop.c
@@ -35,6 +35,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include "pop_private.h"
 #include "mutt/mutt.h"
 #include "email/email.h"
 #include "conn/conn.h"
diff --git a/pop/pop.h b/pop/pop.h
new file mode 100644
index 000000000..09be41a8d
--- /dev/null
+++ b/pop/pop.h
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * POP network mailbox
+ *
+ * @authors
+ * Copyright (C) 2000-2003 Vsevolod Volkov <vvv@mutt.org.ua>
+ *
+ * @copyright
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _POP_POP_H
+#define _POP_POP_H
+
+#include "mx.h"
+
+void pop_fetch_mail(void);
+
+extern struct MxOps mx_pop_ops;
+
+#endif /* _POP_POP_H */
diff --git a/pop_auth.c b/pop/pop_auth.c
similarity index 99%
rename from pop_auth.c
rename to pop/pop_auth.c
index 0f43fb519..13e417589 100644
--- a/pop_auth.c
+++ b/pop/pop_auth.c
@@ -30,6 +30,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
+#include "pop_private.h"
 #include "mutt/mutt.h"
 #include "email/email.h"
 #include "conn/conn.h"
diff --git a/pop_lib.c b/pop/pop_lib.c
similarity index 99%
rename from pop_lib.c
rename to pop/pop_lib.c
index bfa07fffc..454da66a4 100644
--- a/pop_lib.c
+++ b/pop/pop_lib.c
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include "pop_private.h"
 #include "mutt/mutt.h"
 #include "email/email.h"
 #include "conn/conn.h"
diff --git a/pop.h b/pop/pop_private.h
similarity index 95%
rename from pop.h
rename to pop/pop_private.h
index ce3012d31..4dec9d786 100644
--- a/pop.h
+++ b/pop/pop_private.h
@@ -20,12 +20,11 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _MUTT_POP_H
-#define _MUTT_POP_H
+#ifndef _POP_PRIVATE_H
+#define _POP_PRIVATE_H
 
 #include <stdbool.h>
 #include <time.h>
-#include "mx.h"
 
 struct Account;
 struct Context;
@@ -125,9 +124,5 @@ int pop_fetch_data(struct PopData *pop_data, char *query, struct Progress *progr
 int pop_reconnect(struct Context *ctx);
 void pop_logout(struct Context *ctx);
 
-/* pop.c */
-void pop_fetch_mail(void);
 
-extern struct MxOps mx_pop_ops;
-
-#endif /* _MUTT_POP_H */
+#endif /* _POP_PRIVATE_H */