aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-mlist-magic.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mail-mlist-magic.c')
-rw-r--r--mail/mail-mlist-magic.c262
1 files changed, 0 insertions, 262 deletions
diff --git a/mail/mail-mlist-magic.c b/mail/mail-mlist-magic.c
deleted file mode 100644
index d02638572e..0000000000
--- a/mail/mail-mlist-magic.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* mail-mlist-magic.c
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-/* Procmail-style magic mail rules for mailing lists: (from Joakim's own
- `.procmailrc'.)
-
- :0:
- * ^Sender: owner-\/[^@]+
- lists/$MATCH
-
- :0:
- * ^X-BeenThere: \/[^@]+
- lists/$MATCH
-
- :0:
- * ^Delivered-To: mailing list \/[^@]+
- lists/$MATCH
-
- :0:
- * X-Mailing-List: <\/[^@]+
- lists/$MATCH
-
- :0:
- * X-Loop: \/[^@]+
- lists/$MATCH
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <ctype.h>
-
-#include "camel.h"
-
-#include "mail-mlist-magic.h"
-
-
-/* Utility functions. */
-
-static char *
-extract_until_at_sign (const char *s)
-{
- const char *at_sign;
-
- at_sign = strchr (s, '@');
- if (at_sign == NULL)
- return g_strdup (s);
-
- if (at_sign == s)
- return NULL;
-
- return g_strndup (s, at_sign - s);
-}
-
-static const char *
-get_header (CamelMimeMessage *message,
- const char *header_name)
-{
- const char *value;
-
- value = camel_medium_get_header (CAMEL_MEDIUM (message), header_name);
- if (value == NULL)
- return NULL;
-
- /* FIXME: Correct? */
- while (isspace ((int) *value))
- value++;
-
- return value;
-}
-
-
-/* The checks. */
-
-/* ^Sender: owner-\/[^@]+ */
-static char *
-check_sender (CamelMimeMessage *message,
- const char **header_name_return,
- char **header_value_return)
-{
- const char *value;
-
- value = get_header (message, "Sender");
- if (value == NULL)
- return NULL;
-
- if (strncmp (value, "owner-", 6) != 0)
- return NULL;
-
- if (value[6] == '\0' || value[6] == '@')
- return NULL;
-
- if (header_name_return != NULL)
- *header_name_return = "Sender";
- if (header_value_return != NULL)
- *header_value_return = g_strdup (value);
- return extract_until_at_sign (value + 6);
-}
-
-/* ^X-BeenThere: \/[^@]+ */
-static char *
-check_x_been_there (CamelMimeMessage *message,
- const char **header_name_return,
- char **header_value_return)
-{
- const char *value;
-
- value = get_header (message, "X-BeenThere");
- if (value == NULL || *value == '@')
- return NULL;
-
- if (header_name_return != NULL)
- *header_name_return = "X-BeenThere";
- if (header_value_return != NULL)
- *header_value_return = g_strdup (value);
-
- return extract_until_at_sign (value);
-}
-
-/* ^Delivered-To: mailing list \/[^@]+ */
-static char *
-check_delivered_to (CamelMimeMessage *message,
- const char **header_name_return,
- char **header_value_return)
-{
- const char *value;
-
- value = get_header (message, "Delivered-To");
- if (value == NULL)
- return NULL;
-
- /* FIXME uh? */
- if (strncmp (value, "mailing list ", 13) != 0)
- return NULL;
-
- if (value[13] == '\0' || value[13] == '@')
- return NULL;
-
- if (header_name_return != NULL)
- *header_name_return = "Delivered-To";
- if (header_value_return != NULL)
- *header_value_return = g_strdup (value);
- return extract_until_at_sign (value + 13);
-}
-
-/* X-Mailing-List: <\/[^@]+ */
-static char *
-check_x_mailing_list (CamelMimeMessage *message,
- const char **header_name_return,
- char **header_value_return)
-{
- const char *value;
- int value_length;
-
- value = get_header (message, "X-Mailing-List");
- if (value == NULL)
- return NULL;
-
- if (value[0] != '<' || value[1] == '\0' || value[1] == '@')
- return NULL;
-
- value_length = strlen (value);
- if (value[value_length - 1] != '>')
- return NULL;
-
- if (header_name_return != NULL)
- *header_name_return = "X-Mailing-List";
- if (header_value_return != NULL)
- *header_value_return = g_strdup (value);
- return extract_until_at_sign (value + 1);
-}
-
-/* X-Loop: \/[^@]+ */
-static char *
-check_x_loop (CamelMimeMessage *message,
- const char **header_name_return,
- char **header_value_return)
-{
- const char *value;
-
- value = get_header (message, "X-Loop");
- if (value == NULL)
- return NULL;
-
- if (*value == '\0' || *value == '@')
- return NULL;
-
- if (header_name_return != NULL)
- *header_name_return = "X-Loop";
- if (header_value_return != NULL)
- *header_value_return = g_strdup (value);
-
- return extract_until_at_sign (value);
-}
-
-
-/**
- * mail_mlist_magic_detect_list:
- * @message:
- * @header_name_return:
- * @header_value_return:
- *
- * Detect if message was delivered by a mailing list.
- *
- * Return value: The name of the mailing list, if the message appears to be
- * sent from a mailing list. NULL otherwise.
- **/
-char *
-mail_mlist_magic_detect_list (CamelMimeMessage *message,
- const char **header_name_return,
- char **header_value_return)
-{
- char *list_name;
-
- g_return_val_if_fail (message != NULL, NULL);
- g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
-
- list_name = check_sender (message, header_name_return, header_value_return);
- if (list_name != NULL)
- return list_name;
-
- list_name = check_x_been_there (message, header_name_return, header_value_return);
- if (list_name != NULL)
- return list_name;
-
- list_name = check_delivered_to (message, header_name_return, header_value_return);
- if (list_name != NULL)
- return list_name;
-
- list_name = check_x_mailing_list (message, header_name_return, header_value_return);
- if (list_name != NULL)
- return list_name;
-
- list_name = check_x_loop (message, header_name_return, header_value_return);
- if (list_name != NULL)
- return list_name;
-
- return NULL;
-}
ion 2.3.7lwhsu2008-06-153-15/+26 * - Update to version 0.4.6.5lwhsu2008-06-152-5/+5 * - Fix NOPORTDOCS casepav2008-06-121-1/+1 * - Pass maintainership to Pavel Volkov, who is already maintainingtrasz2008-06-111-1/+1 * Update to version 1.0-rc4 which brings bug fixes only, no new features.gerald2008-06-096-174/+28 * Bump portrevision due to upgrade of devel/gettext.edwin2008-06-062-2/+2 * Bump portrevision due to upgrade of devel/gettext.edwin2008-06-0660-44/+60 * - Call the tss fixup code before entering the monitor instead of after.nox2008-06-064-14/+16 * Fix the build with some (recent) versions of OpenSSL.gerald2008-06-052-0/+160 * - Update to version 2.4.14.alepulver2008-06-043-25/+4 * Fix NOPORTDOCS when texi2html is not installednox2008-06-042-0/+20 * - cleanup FreeBSD 5.xdinoex2008-06-021-7/+1 * Update to version 1.0-rc3 which brings (a lot of) bug fixes only.gerald2008-06-014-8/+8 * Xcpc is a portable Amstrad CPC464/CPC664/CPC6128 Emulatorlippe2008-05-315-0/+93 * Fix pkg-plist after itetcu@ PORTDATA police actions.edwin2008-05-302-2/+2 * Replace /usr/X11R6 with /usr/local in the Makefile rulesedwin2008-05-302-2/+13 * New Port: emulators/xjoypadedwin2008-05-287-0/+90 * Update to 3.5.1edwin2008-05-267-89/+79 * Update to version 1.0-rc2 which brings (a lot of) bug fixes only.gerald2008-05-256-12/+12 * - Update to 7.3miwi2008-05-225-76/+60 * - Update to version 0.4.6.3miwi2008-05-222-16/+12 * Unbreak by fixing the sloppy C-code, that the new gcc refuses to compile.mi2008-05-222-4/+802 * New port: emulators/mupen64plusacm2008-05-214-0/+75 * - New port: emulators/mupen64plus-soundacm2008-05-213-0/+32 * - New port: emulators/mupen64plus-sdlinputacm2008-05-215-0/+87 * - New port: emulators/mupen64plus-sdlaudioacm2008-05-213-0/+45 * - New port: emulators/mupen64plus-rspacm2008-05-213-0/+41 * - New port: emulators/mupen64plus-riceacm2008-05-215-0/+95 * - New port: emulators/mupen64plus-inputacm2008-05-212-0/+23 * - New port: emulators/mupen64plus-gln64acm2008-05-213-0/+63 * - New port: emulators/mupen64plus-glideacm2008-05-213-0/+81 * - New port: emulators/mupen64plus-dummyaudioacm2008-05-212-0/+21 * - New port: emulators/mupen64plus-baseacm2008-05-2115-0/+883 * - Fix wrong userland fsbase load after gdt move that caused qemu tonox2008-05-194-8/+8 * - Update to version 0.125.alepulver2008-05-192-9/+9 * - Add note about network boot issues to pkg-message.snox2008-05-186-382/+24 * - The emulators/dlx port is one of the last remaining ports that usesmiwi2008-05-161-0/+65 * Add PKGNAMESUFFIX -nox11 to fix INDEXmbr2008-05-161-0/+1 * New port: open-vm-tools-nox11mbr2008-05-161-0/+11 * Add open-vm-tools-nox11mbr2008-05-161-0/+1 * Change build to lib dependencies.mbr2008-05-161-2/+2 * Fix __asm macros for asm_x86_64mbr2008-05-161-0/+20 * - Add dependency on devel/icumbr2008-05-165-73/+98 * Accidently took the size of former distfile. Fix this.mbr2008-05-151-1/+1 * - Update to 3.05.trasz2008-05-158-155/+176 * Upgrade to build 90473mbr2008-05-144-117/+6 * - Add notes about how to autoload kqemu at boot and about the fact thatnox2008-05-144-8/+40 * - Fix multiple qemu processes on amd64 SMP by actually using seperatenox2008-05-134-18/+100 * Reset maintainer:lippe2008-05-132-2/+2 * - Get rid of the infamous "fpudna in kernel mode" messages on amd64 bynox2008-05-116-18/+174 * Fix "drive_init()" Disk Format Security Bypassnox2008-05-094-2/+118 * - Update to version 0.2.b2.alepulver2008-05-073-4/+26 * - Update to version 0.27.alepulver2008-05-072-4/+4 * - Needs an external (non-base) compiler on all FreeBSD 5.x (not only amd64).alepulver2008-05-062-2/+2 * Remove build dependency on fontforge since Wine now delivers the fontsgerald2008-05-052-2/+0 * - use gtk20 and make it defaultdinoex2008-05-051-1/+3 * - use gtk20 and make it defaultdinoex2008-05-051-7/+13 * Update to Wine 0.9.61. This release marks the beginning of the code freezegerald2008-05-036-8/+10 * - Add a workaround for the amd64 SMP shared gdt issue that caused thenox2008-05-016-4/+192 * Reset jylefort's port maintainerships. portmgr has taken his commit bitlinimon2008-04-295-5/+5 * - Force lnsat2008-04-281-1/+1 * - Works with gcc 4.xpav2008-04-282-2/+0 * - Update to 1.0.1miwi2008-04-252-4/+4 * - Update to version 0.124.alepulver2008-04-238-52/+60 * - Update to version 0.124.alepulver2008-04-2316-96/+92 * - Update to version 0.124 and and make fetchable.alepulver2008-04-222-9/+9 * 1. Create a hard link since a soft link happened to be insufficient [1]bsam2008-04-212-6/+6 * 1. Add a symlink from /compat/linux/lib/librt.so.1 tobsam2008-04-203-1/+7 * - Remove unneeded dependency from gtk12/gtk20 [1]miwi2008-04-20