Commit 190f7bed 190f7bed6ba91588bd144b9fa87d454c3f2e155c by Sergey Poznyakoff

(pop3d_mark_deleted,pop3d_is_deleted)

(pop3d_unset_deleted,pop3d_undelete_all): New functions
1 parent 8ff4fb1e
...@@ -269,3 +269,44 @@ pop3d_readline (char *buffer, size_t size) ...@@ -269,3 +269,44 @@ pop3d_readline (char *buffer, size_t size)
269 /* Caller should not free () this ... should we strdup() then? */ 269 /* Caller should not free () this ... should we strdup() then? */
270 return buffer; 270 return buffer;
271 } 271 }
272
273
274 /* Handling of the deletion marks */
275
276 void
277 pop3d_mark_deleted (attribute_t attr)
278 {
279 attribute_set_userflag (attr, POP3_ATTRIBUTE_DELE);
280 }
281
282 int
283 pop3d_is_deleted (attribute_t attr)
284 {
285 return attribute_is_deleted (attr)
286 || attribute_is_userflag (attr, POP3_ATTRIBUTE_DELE);
287 }
288
289 void
290 pop3d_unset_deleted (attribute_t attr)
291 {
292 if (attribute_is_userflag (attr, POP3_ATTRIBUTE_DELE))
293 attribute_unset_userflag (attr, POP3_ATTRIBUTE_DELE);
294 }
295
296 void
297 pop3d_undelete_all ()
298 {
299 size_t i;
300 size_t total = 0;
301
302 mailbox_messages_count (mbox, &total);
303
304 for (i = 1; i <= total; i++)
305 {
306 message_t msg = NULL;
307 attribute_t attr = NULL;
308 mailbox_get_message (mbox, i, &msg);
309 message_get_attribute (msg, &attr);
310 attribute_unset_deleted (attr);
311 }
312 }
......
...@@ -144,11 +144,10 @@ ...@@ -144,11 +144,10 @@
144 144
145 #ifndef MAXHOSTNAMELEN 145 #ifndef MAXHOSTNAMELEN
146 /* Maximum length of a hostname (is this defined somewhere else?). */ 146 /* Maximum length of a hostname (is this defined somewhere else?). */
147 /* MAXHOSTNAMELEN is already define on Solaris. */ 147 /* MAXHOSTNAMELEN is already defined on Solaris. */
148 #define MAXHOSTNAMELEN 64 148 # define MAXHOSTNAMELEN 64
149 #endif 149 #endif
150 150
151
152 #define POP3_ATTRIBUTE_DELE 0x0001 151 #define POP3_ATTRIBUTE_DELE 0x0001
153 152
154 #define AUTHORIZATION 0 153 #define AUTHORIZATION 0
...@@ -187,6 +186,7 @@ extern int debug_mode; ...@@ -187,6 +186,7 @@ extern int debug_mode;
187 extern int tls_available; 186 extern int tls_available;
188 extern int tls_done; 187 extern int tls_done;
189 #endif /* WITH_TLS */ 188 #endif /* WITH_TLS */
189 extern int undelete_on_startup;
190 190
191 extern void pop3d_bye __P ((void)); 191 extern void pop3d_bye __P ((void));
192 extern int pop3d_abquit __P ((int)); 192 extern int pop3d_abquit __P ((int));
...@@ -224,6 +224,11 @@ extern void pop3d_flush_output __P ((void)); ...@@ -224,6 +224,11 @@ extern void pop3d_flush_output __P ((void));
224 224
225 extern int pop3d_is_master __P ((void)); 225 extern int pop3d_is_master __P ((void));
226 226
227 extern void pop3d_mark_deleted __P((attribute_t attr));
228 extern int pop3d_is_deleted __P((attribute_t attr));
229 extern void pop3d_unset_deleted __P((attribute_t attr));
230 void pop3d_undelete_all __P((void));
231
227 #ifdef WITH_TLS 232 #ifdef WITH_TLS
228 extern int pop3d_init_tls_server __P ((void)); 233 extern int pop3d_init_tls_server __P ((void));
229 extern void pop3d_deinit_tls_server __P ((void)); 234 extern void pop3d_deinit_tls_server __P ((void));
......