aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-folder-utils.c
blob: 601966ab0216a8aa27eb6091eba2fb37e6b8f571 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* camel-folder-utils : Utility for camel folders */


/* 
 *
 * Author : 
 *  Bertrand Guiheneuf <bertrand@helixcode.com>
 *
 * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
 *
 * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 */

#include <config.h>
#include "camel-folder-utils.h"
#include "camel-log.h"
#include "camel-mime-message.h"



/*  Active Message List utilities */

/* */
gint
camel_mime_message_number_cmp (gconstpointer a, gconstpointer b)
{
    CamelMimeMessage *m_a = CAMEL_MIME_MESSAGE (a);
    CamelMimeMessage *m_b = CAMEL_MIME_MESSAGE (b);

    return (m_a->message_number - (m_b->message_number));
}


/**
 * camel_aml_expunge_messages: Expunge the message marked as deleted in an Active Message List
 * @aml: active message list
 * @folder: folder object
 * 
 * Expunge the message flagged as "DELETED" in an active message list. 
 * The messages are not freed nor really expunged on the disk, they
 * are just removed from the active message list and marked as 
 * "EXPUNGED". The list of the message which have been expunged is
 * return in a GList which must be freed by the caller. 
 * To be really expunged the providers must provide or call
 * folder specific methods.
 * 
 * Return value: the list of expunged messages.
 **/
GList *
camel_aml_expunge_messages (GList *aml, 
                CamelFolder *folder)
{
    CamelMimeMessage *message;
    GList *message_node;
    GList *next_message_node;
    guint nb_expunged = 0;  
    GList *expunged_messages;
    

    message_node = aml;
    /* look in folder message list which messages
     * need to be expunged  */
    while ( message_node) {
        message = CAMEL_MIME_MESSAGE (message_node->data);

        /* we may free message_node so get the next node now */
        next_message_node = message_node->next;

        if (message) {          
            if (camel_mime_message_get_flag (message, "DELETED")) {
                
                /* remove the message from active message list */
                g_list_remove_link (aml, message_node);
                g_list_free_1 (message_node);
                camel_mime_message_set_flag (message, "EXPUNGED", TRUE);
                expunged_messages = g_list_prepend (expunged_messages, message);
                
            } 
        }
        else {
            CAMEL_LOG_WARNING ("CamelFolder::expunge warning message_node contains no message\n");
        }
        message_node = next_message_node;
        CAMEL_LOG_FULL_DEBUG ("CamelFolder::expunge, examined message node %p\n", message_node);
    }
    
    return expunged_messages;
}
raph'>* Reset mita@FreeBSD.org due to no commits for 5 months and maintainer-timeouts.linimon2008-08-151-1/+1 * Reset rushani@FreeBSD.org due to maintainer-timeouts and no commits forlinimon2008-08-152-2/+2 * - Update to 0.5.1miwi2008-08-142-4/+4 * Update to 20080804 version.kuriyama2008-08-102-8/+8 * The KDE FreeBSD team is proud to announce the release of KDE 4.1.0miwi2008-08-105-304/+230 * - Update to qt 4.4.1miwi2008-08-053-17/+15 * - s/DOCDIR/DOCSDIR/ and use DATADIR both in Makefile and pkg-plistitetcu2008-07-292-80/+80 * Unbreak on amd64arved2008-07-283-8/+13 * Fix build (add auto-tools)vs2008-07-271-0/+1 * - Remove USE_GCC where it can be satisfied with base compiler on followingpav2008-07-251-1/+0 * - Remove duplicates from MAKE_ENV after inclusion of CC and CXX in default MA...pav2008-07-256-6/+1 * Remove japanese/kterm16c because japanese/kterm now supports thehrs2008-07-2422-677/+74 * - Fix build with NOPORTDOCS=yes.hrs2008-07-232-11/+13 * Fix USE_XORG for the upcoming bsd.port.mk changes (ports/122340).flz2008-07-232-2/+2 * Remove japanese/samba and suggest samba3 instead, after iterwin2008-07-2213-2670/+0 * Update to 8.1.2 Security Update 1. Quoted from the advisory:hrs2008-07-211-3/+3 * - Updates to 2.8.7.dev9.miwi2008-07-195-138/+208 * - Updates to 2.8.6.rel5miwi2008-07-192-6/+7 * Chase net/samba3-3.0.30 upgrade and unbreak.kuriyama2008-07-112-9/+8 * - Bump PORTREVISION after arp updatemiwi2008-07-071-1/+1 * Only run pre-install when NOPORTDOCS isn't setedwin2008-07-051-4/+6 * [Patch] japanese/mh: port to termiosedwin2008-07-054-0/+172 * Update to 20080630.kuriyama2008-07-022-7/+7 * Switch the japanese/sj3 port to termios instead of sgtty.ed2008-07-016-3/+471 * Bump PORTREVISION due to subversion upgrade.lev2008-06-301-1/+1 * (1) Upgrade subversion to version 1.5.0.lev2008-06-301-1/+1 * - respect NOPORTDOCS and NOPORTDATAitetcu2008-06-301-0/+92 * - respect NOPORTDOCS and NOPORTDATAitetcu2008-06-304-121/+28 * Fix installation of documentation (bump PORTREVISION)vs2008-06-252-14/+13 * - Fix build after devel/darts updatemiwi2008-06-232-4/+13 * - Make XLFD of IPA TrueType font more consistent.hrs2008-06-212-21/+21 * - Update to 3.2.5.lippe2008-06-204-20/+19 * Add more MASTER_SITES.hrs2008-06-191-1/+3 * Unbreak (old distfiles not found): update to version 1.3.1.matusita2008-06-192-6/+5 * Standardize placement and style of WWW: lines, and in some casesdougb2008-06-191-1/+2 * - This port has been BROKEN for more than 6 months. It will be removed unlesspav2008-06-191-0/+2 * - Resurrect japanese/lynxpav2008-06-191-0/+1 * - Resurrect, unbreak and update to 2.8.6.rel4pav2008-06-195-0/+226 * - Delete expired port japanese/vje30: depends on forbidden port misc/compat3xpav2008-06-199-465/+0 * - Delete expired japanese/lynx port: Leaves behind config file on deinstallpav2008-06-198-241/+0 * - Reset maintainer address:pav2008-06-194-4/+4 * Update to 0.08000okazaki2008-06-143-4/+11 * Update to 0.02.okazaki2008-06-123-5/+5 * Bump portrevision due to upgrade of devel/gettext.edwin2008-06-0676-55/+76 * Fix DEPENDS and bump PORTREVISIONitetcu2008-06-061-2/+3 * - Remove obsolete fp=[y|n] modifier in fonts.dir.hrs2008-05-314-10/+14 * Remove japanese/motoya-ttfonts. The EULA is too restrictive forhrs2008-05-319-421/+0 * Remove obsolete fp=[y|n] modifier in fonts.dir.hrs2008-05-3112-28/+30 * - Remove obsolete fp=[y|n] modifier in fonts.dir.hrs2008-05-316-15/+30 * - Sync with lastes p5-Mail-SpamAssassinmiwi2008-05-303-6/+24 * Update to 20080430 version.kuriyama2008-05-272-7/+7 * [MAINTAINER] japanese/latex-japanese: change portname to platex-japaneseedwin2008-05-266-89/+5 * Remove japanese/kochi-cidfonts. This CID-keyed font is suspectedhrs2008-05-255-51/+0 * Add Ume Font, another free Japanese TrueType font based onhrs2008-05-2515-0/+551 * Remove unused variables.hrs2008-05-252-18/+4 * - Add install script for adding XLFD.hrs2008-05-2512-112/+340 * Remove unused variables from $PLIST_SUB.hrs2008-05-253-9/+3 * Remove japanese/truetypefonts. This TrueType font is suspectedhrs2008-05-259-162/+0 * - Include some ports in perl5 category.araujo2008-05-191-1/+1 * Update to 0.2.0.nobutaka2008-05-197-96/+19 * Fix build with the latest uim.nobutaka2008-05-181-3/+11 * Remove ${DATADIR} properly.hrs2008-05-174-0/+4 * - Update to 20080429miwi2008-05-164-8/+8 * Add port japanese/p5-Lingua-JA-Kana:sat2008-05-165-0/+42 * Remove japanese/epson-ttfonts. The EULA is too restrictive forhrs2008-05-1310-199/+0 * - Improve fontconfig support.hrs2008-05-1318-424/+302 * - Add fontconfig support.hrs2008-05-1318-546/+378 * Use conf.avail/ directory and install symlinks into conf.d/ directory.hrs2008-05-126-12/+36 * Chase shlib version bump of uim.ume2008-05-121-2/+2 * Update to 1.5.0.nobutaka2008-05-113-5/+5 * Make migemo ports to properly handle a case that EMACS_PORT_NAME is defined i...nobutaka2008-05-064-4/+7 * Fix build error.nobutaka2008-05-061-1/+1 * 3dinoex2008-04-301-1/+1 * Reset aaron's port maintainerships due to many maintainer-timeouts.linimon2008-04-291-1/+1 * Fix autoconf build issue.lx2008-04-281-0/+11 * - Fix DESKTOP_ENTRIESmiwi2008-04-281-2/+2 * - Update to 3.2.1miwi2008-04-273-28/+66 * Fix BROKEN on gcc 4.2.motoyuki2008-04-262-11/+7 * - Update to version 20080420lwhsu2008-04-264-8/+8 * - Fix buildmiwi2008-04-241-2/+4 * - Fix build after xorg cleanupmiwi2008-04-231-1/+2 * - Remove unneeded dependency from gtk12/gtk20 [1]miwi2008-04-20