Commit 887e7b3b 887e7b3b191eccce681c68947204abad634f8553 by Sergey Poznyakoff

Added to the repository

1 parent bd6ec5dd
1 *.la
2 *.lo
3 .deps
4 .libs
5 Makefile
6 Makefile.in
7 T
8 _*
9 .gdbinit
1 ## Process this file with GNU Automake to create Makefile.in
2
3 ## Copyright (C) 2003 Free Software Foundation, Inc.
4 ##
5 ## GNU Mailutils is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU General Public License as
7 ## published by the Free Software Foundation; either version 2, or (at
8 ## your option) any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc.
18 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 INCLUDES = -I${top_srcdir}/include -I${top_srcdir}/mailbox -I${top_srcdir}/mailbox/include -I${top_srcdir}/include/mailutils/gnu @INTLINCS@
21
22 noinst_LTLIBRARIES = libimap.la
23
24 libimap_la_SOURCES = \
25 folder.c\
26 mbox.c\
27 url.c
28
1 *.la
2 *.lo
3 .deps
4 .libs
5 Makefile
6 Makefile.in
7 T
8 _*
9 .gdbinit
1 ## Process this file with GNU Automake to create Makefile.in
2
3 ## Copyright (C) 2003 Free Software Foundation, Inc.
4 ##
5 ## GNU Mailutils is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU General Public License as
7 ## published by the Free Software Foundation; either version 2, or (at
8 ## your option) any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc.
18 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 INCLUDES = -I${top_srcdir}/include -I${top_srcdir}/mailbox -I${top_srcdir}/mailbox/include -I${top_srcdir}/include/mailutils/gnu @INTLINCS@
21
22 noinst_LTLIBRARIES = libmaildir.la
23
24 libmaildir_la_SOURCES = \
25 mbox.c
26
27
1 *.la
2 *.lo
3 .deps
4 .libs
5 Makefile
6 Makefile.in
7 T
8 _*
9 .gdbinit
1 ## Process this file with GNU Automake to create Makefile.in
2
3 ## Copyright (C) 2003 Free Software Foundation, Inc.
4 ##
5 ## GNU Mailutils is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU General Public License as
7 ## published by the Free Software Foundation; either version 2, or (at
8 ## your option) any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc.
18 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 INCLUDES = -I${top_srcdir}/include -I${top_srcdir}/mailbox -I${top_srcdir}/mailbox/include -I${top_srcdir}/include/mailutils/gnu @INTLINCS@
21
22 noinst_LTLIBRARIES = libmbox.la
23
24 libmbox_la_SOURCES = \
25 folder.c\
26 mbox.c\
27 mboxscan.c\
28 mbox0.h\
29 url.c
30
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2003 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
17
18 #include <stdlib.h>
19 #include <stdio.h>
20 #include <time.h>
21 #include <sys/stat.h>
22 #include <fcntl.h>
23 #include <unistd.h>
24 #include <signal.h>
25 #include <time.h>
26 #include <string.h>
27 #include <ctype.h>
28 #include <limits.h>
29 #include <errno.h>
30
31 #ifdef WITH_PTHREAD
32 # ifdef HAVE_PTHREAD_H
33 # define _XOPEN_SOURCE 500
34 # include <pthread.h>
35 # endif
36 #endif
37
38 #ifdef HAVE_ALLOCA_H
39 # include <alloca.h>
40 #endif
41
42 #ifdef HAVE_STRINGS_H
43 # include <strings.h>
44 #endif
45
46 #include <mailbox0.h>
47 #include <registrar0.h>
48
49 #include <mailutils/address.h>
50 #include <mailutils/attribute.h>
51 #include <mailutils/body.h>
52 #include <mailutils/debug.h>
53 #include <mailutils/envelope.h>
54 #include <mailutils/errno.h>
55 #include <mailutils/error.h>
56 #include <mailutils/header.h>
57 #include <mailutils/locker.h>
58 #include <mailutils/message.h>
59 #include <mailutils/mutil.h>
60 #include <mailutils/observer.h>
61 #include <mailutils/property.h>
62 #include <mailutils/stream.h>
63 #include <mailutils/url.h>
64
65 #define H_BCC 0
66 #define H_CC 1
67 #define H_CONTENT_LANGUAGE 2
68 #define H_CONTENT_TRANSFER_ENCODING 3
69 #define H_CONTENT_TYPE 4
70 #define H_DATE 5
71 #define H_FROM 6
72 #define H_IN_REPLY_TO 7
73 #define H_MESSAGE_ID 8
74 #define H_REFERENCE 9
75 #define H_REPLY_TO 10
76 #define H_SENDER 11
77 #define H_SUBJECT 12
78 #define H_TO 13
79 #define H_X_UIDL 14
80
81 #define HDRSIZE 15
82
83 struct _mbox_message;
84 struct _mbox_data;
85
86 typedef struct _mbox_data* mbox_data_t;
87 typedef struct _mbox_message* mbox_message_t;
88
89 /* Keep the file positions of where the headers and bodies start and end.
90 attr_flags is the "Status:" message. */
91 struct _mbox_message
92 {
93 /* Offset of the messages in the mailbox. */
94 off_t header_from;
95 off_t header_from_end;
96 off_t body;
97 off_t body_end;
98
99 /* Fast header retrieve, we save here the most common headers. This will
100 speed the header search. The entire headers are copied, when modified,
101 by the header_t object, we do not have to worry about updating them. */
102 char *fhdr[HDRSIZE];
103
104 size_t uid; /* IMAP uid. */
105
106 int attr_flags; /* The attr_flags contains the "Status:" attribute */
107
108 size_t header_lines;
109 size_t body_lines;
110
111 message_t message; /* A message attach to it. */
112 mbox_data_t mud; /* Back pointer. */
113 };
114
115 /* The umessages is an array of pointers that contains umessages_count of
116 mbox_message_t*; umessages[umessages_count]. We do it this way because
117 realloc() can move everything to a new memory region and invalidate all
118 the pointers. Thanks to <Dave Inglis> for pointing this out. The
119 messages_count is the count number of messages parsed so far. */
120 struct _mbox_data
121 {
122 mbox_message_t *umessages; /* Array. */
123 size_t umessages_count; /* How big is the umessages[]. */
124 size_t messages_count; /* How many valid entry in umessages[]. */
125 off_t size; /* Size of the mailbox. */
126 unsigned long uidvalidity;
127 size_t uidnext;
128 char *name;
129
130 /* The variables below are use to hold the state when appending messages. */
131 enum mbox_state
132 {
133 MBOX_NO_STATE = 0,
134 MBOX_STATE_APPEND_SENDER, MBOX_STATE_APPEND_DATE, MBOX_STATE_APPEND_HEADER,
135 MBOX_STATE_APPEND_ATTRIBUTE, MBOX_STATE_APPEND_UID, MBOX_STATE_APPEND_BODY,
136 MBOX_STATE_APPEND_MESSAGE
137 } state ;
138 char *sender;
139 char *date;
140 off_t off;
141 mailbox_t mailbox; /* Back pointer. */
142 };
143
144 int mbox_scan0 __P((mailbox_t mailbox, size_t msgno, size_t *pcount,
145 int do_notif));
146 #ifdef WITH_PTHREAD
147 void mbox_cleanup __P((void *arg));
148 #endif
1 *.la
2 *.lo
3 .deps
4 .libs
5 Makefile
6 Makefile.in
7 T
8 _*
9 .gdbinit
1 ## Process this file with GNU Automake to create Makefile.in
2
3 ## Copyright (C) 2003 Free Software Foundation, Inc.
4 ##
5 ## GNU Mailutils is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU General Public License as
7 ## published by the Free Software Foundation; either version 2, or (at
8 ## your option) any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc.
18 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 INCLUDES = -I${top_srcdir}/include -I${top_srcdir}/mailbox -I${top_srcdir}/mailbox/include -I${top_srcdir}/include/mailutils/gnu @INTLINCS@
21
22 noinst_LTLIBRARIES = libmh.la
23
24 libmh_la_SOURCES = \
25 folder.c\
26 mbox.c\
27 url.c
28
1 *.la
2 *.lo
3 .deps
4 .libs
5 Makefile
6 Makefile.in
7 T
8 _*
9 .gdbinit
1 ## Process this file with GNU Automake to create Makefile.in
2
3 ## Copyright (C) 2003 Free Software Foundation, Inc.
4 ##
5 ## GNU Mailutils is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU General Public License as
7 ## published by the Free Software Foundation; either version 2, or (at
8 ## your option) any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc.
18 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 INCLUDES = -I${top_srcdir}/include -I${top_srcdir}/mailbox -I${top_srcdir}/mailbox/include -I${top_srcdir}/include/mailutils/gnu @INTLINCS@
21
22 noinst_LTLIBRARIES = libpop.la
23
24 libpop_la_SOURCES = \
25 folder.c\
26 mbox.c\
27 url.c
28