From 8bbe0f34af2bd9906012106d8ee27187f05b6a15 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 7 Jul 2003 19:18:57 +0000 Subject: Updated for string-utils namespace changes. 2003-07-07 Jeffrey Stedfast * camel-session.c (camel_session_init): Updated for string-utils namespace changes. * camel-provider.c: Updated for string-utils namespace changes. * camel-mime-part.c (init_header_name_table): Updated for string-utils namespace changes. * camel-mime-message.c (camel_mime_message_class_init): Updated for string-utils namespace changes. (camel_mime_message_init): Same. * camel-mime-filter-enriched.c (camel_mime_filter_enriched_class_init): Updated for string-utils namespace changes. * camel-folder-summary.c (camel_folder_summary_init): Updated for string-utils namespace changes. * camel-string-utils.[c,h]: Renamed from string-utils.[c,h] and also namespaced all functions. svn path=/trunk/; revision=21751 --- camel/ChangeLog | 24 +++++ camel/Makefile.am | 8 +- camel/camel-charset-map.c | 2 - camel/camel-folder-search.c | 1 - camel/camel-folder-summary.c | 5 +- camel/camel-folder.c | 3 +- camel/camel-medium.c | 1 - camel/camel-mime-filter-enriched.c | 4 +- camel/camel-mime-message.c | 6 +- camel/camel-mime-part-utils.c | 1 - camel/camel-mime-part.c | 12 +-- camel/camel-provider.c | 8 +- camel/camel-session.c | 6 +- camel/camel-store-summary.c | 4 +- camel/camel-string-utils.c | 110 +++++++++++++++++++++++ camel/camel-string-utils.h | 47 ++++++++++ camel/camel-url.c | 1 - camel/providers/imap/camel-imap-folder.c | 2 +- camel/providers/imap/camel-imap-store-summary.c | 1 - camel/providers/imap/camel-imap-store.c | 21 ++++- camel/providers/imap/camel-imap-utils.c | 2 +- camel/providers/local/camel-local-folder.c | 3 +- camel/providers/local/camel-maildir-folder.c | 3 +- camel/providers/local/camel-mbox-folder.c | 3 +- camel/providers/local/camel-mbox-summary.c | 2 + camel/providers/local/camel-mh-folder.c | 3 +- camel/providers/local/camel-spool-folder.c | 3 +- camel/providers/smtp/camel-smtp-transport.c | 1 - camel/string-utils.c | 111 ------------------------ camel/string-utils.h | 47 ---------- 30 files changed, 240 insertions(+), 205 deletions(-) create mode 100644 camel/camel-string-utils.c create mode 100644 camel/camel-string-utils.h delete mode 100644 camel/string-utils.c delete mode 100644 camel/string-utils.h diff --git a/camel/ChangeLog b/camel/ChangeLog index 6b6bbced42..5e8962bc1f 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,27 @@ +2003-07-07 Jeffrey Stedfast + + * camel-session.c (camel_session_init): Updated for string-utils + namespace changes. + + * camel-provider.c: Updated for string-utils namespace changes. + + * camel-mime-part.c (init_header_name_table): Updated for + string-utils namespace changes. + + * camel-mime-message.c (camel_mime_message_class_init): Updated + for string-utils namespace changes. + (camel_mime_message_init): Same. + + * camel-mime-filter-enriched.c + (camel_mime_filter_enriched_class_init): Updated for string-utils + namespace changes. + + * camel-folder-summary.c (camel_folder_summary_init): Updated for + string-utils namespace changes. + + * camel-string-utils.[c,h]: Renamed from string-utils.[c,h] and + also namespaced all functions. + 2003-07-01 Jeffrey Stedfast * camel-sasl-digest-md5.c (digest_response): Don't quote the diff --git a/camel/Makefile.am b/camel/Makefile.am index b5469177d2..8baa5d322d 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -105,6 +105,7 @@ libcamel_la_SOURCES = \ camel-stream-mem.c \ camel-stream-null.c \ camel-stream.c \ + camel-string-utils.c \ camel-text-index.c \ camel-tcp-stream-raw.c \ camel-tcp-stream-ssl.c \ @@ -118,8 +119,7 @@ libcamel_la_SOURCES = \ camel-vee-folder.c \ camel-vee-store.c \ camel-vtrash-folder.c \ - camel.c \ - string-utils.c + camel.c libcamelinclude_HEADERS = \ broken-date-parser.h \ @@ -207,6 +207,7 @@ libcamelinclude_HEADERS = \ camel-stream-mem.h \ camel-stream-null.h \ camel-stream.h \ + camel-string-utils.h \ camel-text-index.h \ camel-tcp-stream-raw.h \ camel-tcp-stream-ssl.h \ @@ -220,8 +221,7 @@ libcamelinclude_HEADERS = \ camel-vee-folder.h \ camel-vee-store.h \ camel-vtrash-folder.h \ - camel.h \ - string-utils.h + camel.h libcamel_la_LDFLAGS = -version-info 0:0:0 diff --git a/camel/camel-charset-map.c b/camel/camel-charset-map.c index f81e3c5c6d..0066bfcaee 100644 --- a/camel/camel-charset-map.c +++ b/camel/camel-charset-map.c @@ -1,5 +1,4 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; -*- */ - /* * Authors: * Michael Zucchi @@ -203,7 +202,6 @@ int main (void) #include "camel-charset-map.h" #include "camel-charset-map-private.h" -#include "string-utils.h" #include #include diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c index 8ea952a042..fee38ab9c3 100644 --- a/camel/camel-folder-search.c +++ b/camel/camel-folder-search.c @@ -35,7 +35,6 @@ #include #include "camel-folder-search.h" -#include "string-utils.h" #include "camel-exception.h" #include "camel-medium.h" diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index d584750055..b85b8e77ce 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -50,7 +50,8 @@ #include #include -#include "string-utils.h" +#include + #include "e-util/md5-utils.h" #include "e-util/e-memory.h" @@ -151,7 +152,7 @@ camel_folder_summary_init (CamelFolderSummary *s) p = _PRIVATE(s) = g_malloc0(sizeof(*p)); - p->filter_charset = g_hash_table_new(g_strcase_hash, g_strcase_equal); + p->filter_charset = g_hash_table_new (camel_strcase_hash, camel_strcase_equal); s->message_info_size = sizeof(CamelMessageInfo); s->content_info_size = sizeof(CamelMessageContentInfo); diff --git a/camel/camel-folder.c b/camel/camel-folder.c index bca5f25e9f..7e52b08238 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -27,11 +27,12 @@ #endif #include + #include "camel-folder.h" #include "camel-exception.h" #include "camel-store.h" #include "camel-mime-message.h" -#include "string-utils.h" + #include "e-util/e-memory.h" #include "camel-operation.h" diff --git a/camel/camel-medium.c b/camel/camel-medium.c index 64814eda5e..5699a29ee6 100644 --- a/camel/camel-medium.c +++ b/camel/camel-medium.c @@ -31,7 +31,6 @@ #include #include "camel-medium.h" -#include "string-utils.h" #define d(x) diff --git a/camel/camel-mime-filter-enriched.c b/camel/camel-mime-filter-enriched.c index e653eea727..b31502ead6 100644 --- a/camel/camel-mime-filter-enriched.c +++ b/camel/camel-mime-filter-enriched.c @@ -28,7 +28,7 @@ #include #include -#include "string-utils.h" +#include #include "camel-mime-filter-enriched.h" @@ -141,7 +141,7 @@ camel_mime_filter_enriched_class_init (CamelMimeFilterEnrichedClass *klass) filter_class->complete = filter_complete; if (!enriched_hash) { - enriched_hash = g_hash_table_new (g_strcase_hash, g_strcase_equal); + enriched_hash = g_hash_table_new (camel_strcase_hash, camel_strcase_equal); for (i = 0; i < NUM_ENRICHED_TAGS; i++) g_hash_table_insert (enriched_hash, enriched_tags[i].enriched, enriched_tags[i].html); diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c index dab789cfaf..9398fa4eb2 100644 --- a/camel/camel-mime-message.c +++ b/camel/camel-mime-message.c @@ -39,7 +39,7 @@ #include "camel-mime-message.h" #include "camel-multipart.h" #include "camel-stream-mem.h" -#include "string-utils.h" +#include "camel-string-utils.h" #include "camel-url.h" #include "camel-stream-filter.h" @@ -101,7 +101,7 @@ camel_mime_message_class_init (CamelMimeMessageClass *camel_mime_message_class) parent_class = CAMEL_MIME_PART_CLASS(camel_type_get_global_classfuncs (camel_mime_part_get_type ())); - header_name_table = g_hash_table_new (g_strcase_hash, g_strcase_equal); + header_name_table = g_hash_table_new (camel_strcase_hash, camel_strcase_equal); for (i=0;header_names[i];i++) g_hash_table_insert (header_name_table, header_names[i], GINT_TO_POINTER(i+1)); @@ -124,7 +124,7 @@ camel_mime_message_init (gpointer object, gpointer klass) camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (object), "message/rfc822"); - mime_message->recipients = g_hash_table_new(g_strcase_hash, g_strcase_equal); + mime_message->recipients = g_hash_table_new (camel_strcase_hash, camel_strcase_equal); for (i=0;recipient_names[i];i++) { g_hash_table_insert(mime_message->recipients, recipient_names[i], camel_internet_address_new()); } diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c index 384e235dd6..4b815475e5 100644 --- a/camel/camel-mime-part-utils.c +++ b/camel/camel-mime-part-utils.c @@ -34,7 +34,6 @@ #include -#include "string-utils.h" #include "camel-charset-map.h" #include "camel-mime-part-utils.h" #include "camel-mime-message.h" diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index f049eb92bb..343248715b 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -44,7 +44,7 @@ #include "camel-mime-utils.h" #include "camel-exception.h" #include "camel-charset-map.h" -#include "string-utils.h" +#include "camel-string-utils.h" #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/ @@ -103,7 +103,7 @@ static int write_raw(CamelStream *stream, struct _header_raw *h); static void init_header_name_table() { - header_name_table = g_hash_table_new (g_strcase_hash, g_strcase_equal); + header_name_table = g_hash_table_new (camel_strcase_hash, camel_strcase_equal); g_hash_table_insert (header_name_table, "Content-Description", (gpointer)HEADER_DESCRIPTION); g_hash_table_insert (header_name_table, "Content-Disposition", (gpointer)HEADER_DISPOSITION); g_hash_table_insert (header_name_table, "Content-id", (gpointer)HEADER_CONTENT_ID); @@ -112,7 +112,7 @@ init_header_name_table() g_hash_table_insert (header_name_table, "Content-Location", (gpointer)HEADER_CONTENT_LOCATION); g_hash_table_insert (header_name_table, "Content-Type", (gpointer)HEADER_CONTENT_TYPE); - header_formatted_table = g_hash_table_new(g_strcase_hash, g_strcase_equal); + header_formatted_table = g_hash_table_new (camel_strcase_hash, camel_strcase_equal); g_hash_table_insert(header_formatted_table, "Content-Type", write_raw); g_hash_table_insert(header_formatted_table, "Content-Disposition", write_raw); g_hash_table_insert(header_formatted_table, "To", write_raw); @@ -174,7 +174,7 @@ camel_mime_part_finalize (CamelObject *object) g_free (mime_part->content_id); g_free (mime_part->content_MD5); g_free (mime_part->content_location); - string_list_free (mime_part->content_languages); + camel_string_list_free (mime_part->content_languages); header_disposition_unref(mime_part->disposition); if (mime_part->content_type) @@ -499,7 +499,9 @@ camel_mime_part_get_encoding (CamelMimePart *mime_part) void camel_mime_part_set_content_languages (CamelMimePart *mime_part, GList *content_languages) { - if (mime_part->content_languages) string_list_free (mime_part->content_languages); + if (mime_part->content_languages) + camel_string_list_free (mime_part->content_languages); + mime_part->content_languages = content_languages; /* FIXME: translate to a header and set it */ diff --git a/camel/camel-provider.c b/camel/camel-provider.c index 0d096a9f33..9beacc02f0 100644 --- a/camel/camel-provider.c +++ b/camel/camel-provider.c @@ -42,7 +42,7 @@ #include "camel-provider.h" #include "camel-exception.h" -#include "string-utils.h" +#include "camel-string-utils.h" /** @@ -66,12 +66,12 @@ camel_provider_init (void) struct dirent *d; char *p, *name, buf[80]; - providers = g_hash_table_new (g_strcase_hash, g_strcase_equal); + providers = g_hash_table_new (camel_strcase_hash, camel_strcase_equal); dir = opendir (CAMEL_PROVIDERDIR); if (!dir) { g_error ("Could not open camel provider directory: %s", - strerror (errno)); + g_strerror (errno)); return NULL; } @@ -86,7 +86,7 @@ camel_provider_init (void) fp = fopen (name, "r"); if (!fp) { g_warning ("Could not read provider info file %s: %s", - name, strerror (errno)); + name, g_strerror (errno)); g_free (name); continue; } diff --git a/camel/camel-session.c b/camel/camel-session.c index aa81b5672f..1f1c7ce259 100644 --- a/camel/camel-session.c +++ b/camel/camel-session.c @@ -7,7 +7,7 @@ * Jeffrey Stedfast * Bertrand Guiheneuf * - * Copyright 1999 - 2001 Ximian, Inc. + * Copyright 1999 - 2003 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -38,7 +38,7 @@ #include "camel-store.h" #include "camel-transport.h" #include "camel-exception.h" -#include "string-utils.h" +#include "camel-string-utils.h" #include "camel-url.h" #include "camel-vee-store.h" @@ -90,7 +90,7 @@ camel_session_init (CamelSession *session) { session->online = TRUE; session->modules = camel_provider_init (); - session->providers = g_hash_table_new (g_strcase_hash, g_strcase_equal); + session->providers = g_hash_table_new (camel_strcase_hash, camel_strcase_equal); session->priv = g_malloc0(sizeof(*session->priv)); #ifdef ENABLE_THREADS session->priv->lock = g_mutex_new(); diff --git a/camel/camel-store-summary.c b/camel/camel-store-summary.c index 75d2a3501f..f42a66c80b 100644 --- a/camel/camel-store-summary.c +++ b/camel/camel-store-summary.c @@ -1,5 +1,6 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Copyright (C) 2001 Ximian Inc. + * Copyright (C) 2001-2003 Ximian Inc. * * Authors: Michael Zucchi * @@ -35,7 +36,6 @@ #include "camel-file-utils.h" -#include "string-utils.h" #include "e-util/md5-utils.h" #include "e-util/e-memory.h" diff --git a/camel/camel-string-utils.c b/camel/camel-string-utils.c new file mode 100644 index 0000000000..d9927d629a --- /dev/null +++ b/camel/camel-string-utils.c @@ -0,0 +1,110 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast + * + * Copyright 2002 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA. + * + */ + + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include "camel-string-utils.h" + + +int +camel_strcase_equal (gconstpointer a, gconstpointer b) +{ + return (g_ascii_strcasecmp ((const char *) a, (const char *) b) == 0); +} + +guint +camel_strcase_hash (gconstpointer v) +{ + const char *p = (char *) v; + guint h = 0, g; + + for ( ; *p != '\0'; p++) { + h = (h << 4) + g_ascii_toupper (*p); + if ((g = h & 0xf0000000)) { + h = h ^ (g >> 24); + h = h ^ g; + } + } + + return h; +} + + +static void +free_string (gpointer string, gpointer user_data) +{ + g_free (string); +} + +void +camel_string_list_free (GList *string_list) +{ + if (string_list == NULL) + return; + + g_list_foreach (string_list, free_string, NULL); + g_list_free (string_list); +} + +char * +camel_strstrcase (const char *haystack, const char *needle) +{ + /* find the needle in the haystack neglecting case */ + const char *ptr; + guint len; + + g_return_val_if_fail (haystack != NULL, NULL); + g_return_val_if_fail (needle != NULL, NULL); + + len = strlen (needle); + if (len > strlen (haystack)) + return NULL; + + if (len == 0) + return (char *) haystack; + + for (ptr = haystack; *(ptr + len - 1) != '\0'; ptr++) + if (!strncasecmp (ptr, needle, len)) + return (char *) ptr; + + return NULL; +} + + +const char * +camel_strdown (char *str) +{ + register char *s = str; + + while (*s) { + if (*s >= 'A' && *s <= 'Z') + *s += 0x20; + s++; + } + + return str; +} diff --git a/camel/camel-string-utils.h b/camel/camel-string-utils.h new file mode 100644 index 0000000000..54cbad3fad --- /dev/null +++ b/camel/camel-string-utils.h @@ -0,0 +1,47 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast + * + * Copyright 2002 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA. + * + */ + + +#ifndef __CAMEL_STRING_UTILS_H__ +#define __CAMEL_STRING_UTILS_H__ + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus */ + +#include + +int camel_strcase_equal (gconstpointer a, gconstpointer b); +guint camel_strcase_hash (gconstpointer v); + +void camel_string_list_free (GList *string_list); + +char *camel_strstrcase (const char *haystack, const char *needle); + +const char *camel_strdown (char *str); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __CAMEL_STRING_UTILS_H__ */ diff --git a/camel/camel-url.c b/camel/camel-url.c index 78a5beec44..95d234977e 100644 --- a/camel/camel-url.c +++ b/camel/camel-url.c @@ -33,7 +33,6 @@ #include #include "camel-url.h" -#include "string-utils.h" #include "camel-exception.h" #include "camel-mime-utils.h" #include "camel-object.h" diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index a3fbb9baf3..860ce7026f 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -66,8 +66,8 @@ #include "camel-stream-filter.h" #include "camel-stream-mem.h" #include "camel-stream.h" -#include "string-utils.h" #include "camel-private.h" +#include "camel-string-utils.h" #define d(x) diff --git a/camel/providers/imap/camel-imap-store-summary.c b/camel/providers/imap/camel-imap-store-summary.c index 305bbfc0cd..d08fd9b66d 100644 --- a/camel/providers/imap/camel-imap-store-summary.c +++ b/camel/providers/imap/camel-imap-store-summary.c @@ -32,7 +32,6 @@ #include "camel-file-utils.h" -#include "string-utils.h" #include "e-util/md5-utils.h" #include "e-util/e-memory.h" diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index f4ec3579c8..bcaef3b96f 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -57,7 +57,7 @@ #include "camel-url.h" #include "camel-sasl.h" #include "camel-utf8.h" -#include "string-utils.h" +#include "camel-string-utils.h" #include "camel-imap-private.h" #include "camel-private.h" @@ -579,6 +579,8 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE tcp_stream = camel_tcp_stream_raw_new (); #endif /* HAVE_SSL */ + printf ("trying to connect to %s:%d...", service->url->host, port); + ret = camel_tcp_stream_connect (CAMEL_TCP_STREAM (tcp_stream), h, port); camel_free_host (h); if (ret == -1) { @@ -590,11 +592,15 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE _("Could not connect to %s (port %d): %s"), service->url->host, port, g_strerror (errno)); + printf ("failed: %s\n", g_strerror (errno)); + camel_object_unref (CAMEL_OBJECT (tcp_stream)); return FALSE; } + printf ("connected..."); + store->ostream = tcp_stream; store->istream = camel_stream_buffer_new (tcp_stream, CAMEL_STREAM_BUFFER_READ); @@ -603,6 +609,8 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE /* Read the greeting, if any. FIXME: deal with PREAUTH */ if (camel_imap_store_readline (store, &buf, ex) < 0) { + printf ("failed when trying to read greeting: %s\n", g_strerror (errno)); + if (store->istream) { camel_object_unref (CAMEL_OBJECT (store->istream)); store->istream = NULL; @@ -614,12 +622,15 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE } store->connected = FALSE; + return FALSE; } g_free (buf); /* get the imap server capabilities */ if (!imap_get_capability (service, ex)) { + printf ("failed to get capabilities: %s\n", g_strerror (errno)); + if (store->istream) { camel_object_unref (CAMEL_OBJECT (store->istream)); store->istream = NULL; @@ -656,6 +667,8 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE } #endif /* HAVE_SSL */ + printf ("success\n"); + return TRUE; #ifdef HAVE_SSL @@ -666,6 +679,7 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE response = camel_imap_command (store, NULL, ex, "STARTTLS"); if (!response) { + printf ("STARTTLS command failed: %s\n", g_strerror (errno)); camel_object_unref (CAMEL_OBJECT (store->istream)); camel_object_unref (CAMEL_OBJECT (store->ostream)); store->istream = store->ostream = NULL; @@ -676,6 +690,7 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE /* Okay, now toggle SSL/TLS mode */ if (camel_tcp_stream_ssl_enable_ssl (CAMEL_TCP_STREAM_SSL (tcp_stream)) == -1) { + printf ("failed toggling into STARTTLS mode: %s\n", g_strerror (errno)); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to connect to IMAP server %s in secure mode: %s"), service->url->host, _("SSL negotiations failed")); @@ -685,6 +700,8 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE /* rfc2595, section 4 states that after a successful STLS command, the client MUST discard prior CAPA responses */ if (!imap_get_capability (service, ex)) { + printf ("failed getting capabilities after STARTLS: %s\n", g_strerror (errno)); + if (store->istream) { camel_object_unref (CAMEL_OBJECT (store->istream)); store->istream = NULL; @@ -700,6 +717,8 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE return FALSE; } + printf ("success\n"); + return TRUE; exception: diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c index 91b88a7ec4..26a085739f 100644 --- a/camel/providers/imap/camel-imap-utils.c +++ b/camel/providers/imap/camel-imap-utils.c @@ -35,7 +35,7 @@ #include "camel-imap-summary.h" #include "camel-imap-store.h" #include "camel-folder.h" -#include "string-utils.h" +#include "camel-string-utils.h" #include "camel-utf8.h" #define d(x) diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index 74c876f226..80a9a1f1e9 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -2,7 +2,7 @@ * * Authors: Michael Zucchi * - * Copyright (C) 1999, 2000 Ximian Inc. + * Copyright (C) 1999, 2003 Ximian Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -39,7 +39,6 @@ #include "camel-local-folder.h" #include "camel-local-store.h" -#include "string-utils.h" #include "camel-stream-fs.h" #include "camel-local-summary.h" #include "camel-data-wrapper.h" diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c index d3cbc490b5..eca07efbef 100644 --- a/camel/providers/local/camel-maildir-folder.c +++ b/camel/providers/local/camel-maildir-folder.c @@ -2,7 +2,7 @@ * * Authors: Michael Zucchi * - * Copyright (C) 1999, 2000 Ximian Inc. + * Copyright (C) 1999, 2003 Ximian Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -34,7 +34,6 @@ #include "camel-maildir-folder.h" #include "camel-maildir-store.h" -#include "string-utils.h" #include "camel-stream-fs.h" #include "camel-maildir-summary.h" #include "camel-data-wrapper.h" diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c index f5332dc140..942610d5a9 100644 --- a/camel/providers/local/camel-mbox-folder.c +++ b/camel/providers/local/camel-mbox-folder.c @@ -2,7 +2,7 @@ * * Authors: Michael Zucchi * - * Copyright (C) 1999, 2000 Ximian Inc. + * Copyright (C) 1999, 2003 Ximian Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -34,7 +34,6 @@ #include "camel-mbox-folder.h" #include "camel-mbox-store.h" -#include "string-utils.h" #include "camel-stream-fs.h" #include "camel-mbox-summary.h" #include "camel-data-wrapper.h" diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c index 29eff1c83e..88d2a3e9a7 100644 --- a/camel/providers/local/camel-mbox-summary.c +++ b/camel/providers/local/camel-mbox-summary.c @@ -670,6 +670,8 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan xevtmp = header_unfold(xevnew); /* the raw header contains a leading ' ', so (dis)count that too */ if (strlen(xev)-1 != strlen(xevtmp)) { + printf ("strlen(xev)-1 = %d; strlen(xevtmp) = %d\n", strlen(xev)-1, strlen(xevtmp)); + printf ("xev='%s'; xevtmp='%s'\n", xev, xevtmp); g_free(xevnew); g_free(xevtmp); g_warning("Hmm, the xev headers shouldn't have changed size, but they did"); diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c index 02d3370428..25dbacc49a 100644 --- a/camel/providers/local/camel-mh-folder.c +++ b/camel/providers/local/camel-mh-folder.c @@ -2,7 +2,7 @@ * * Authors: Michael Zucchi * - * Copyright (C) 1999, 2000 Ximian Inc. + * Copyright (C) 1999, 2003 Ximian Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -34,7 +34,6 @@ #include "camel-mh-folder.h" #include "camel-mh-store.h" -#include "string-utils.h" #include "camel-stream-fs.h" #include "camel-mh-summary.h" #include "camel-data-wrapper.h" diff --git a/camel/providers/local/camel-spool-folder.c b/camel/providers/local/camel-spool-folder.c index d667310090..4c4a49fbf9 100644 --- a/camel/providers/local/camel-spool-folder.c +++ b/camel/providers/local/camel-spool-folder.c @@ -2,7 +2,7 @@ * * Authors: Michael Zucchi * - * Copyright (C) 2001 Ximian Inc (www.ximian.com/) + * Copyright (C) 2001-2003 Ximian, Inc. (www.ximian.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -34,7 +34,6 @@ #include "camel-spool-folder.h" #include "camel-spool-store.h" -#include "string-utils.h" #include "camel-stream-fs.h" #include "camel-spool-summary.h" #include "camel-data-wrapper.h" diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index c5947dc0ad..705fa2f5d8 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -55,7 +55,6 @@ #include "camel-session.h" #include "camel-exception.h" #include "camel-sasl.h" -#include "string-utils.h" extern int camel_verbose_debug; diff --git a/camel/string-utils.c b/camel/string-utils.c deleted file mode 100644 index d87d50663d..0000000000 --- a/camel/string-utils.c +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast - * - * Copyright 2002 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include "string-utils.h" - - -int -g_strcase_equal (gconstpointer a, gconstpointer b) -{ - return (strcasecmp ((const char *) a, (const char *) b) == 0); -} - -guint -g_strcase_hash (gconstpointer v) -{ - const char *p = (char *) v; - guint h = 0, g; - - for ( ; *p != '\0'; p++) { - h = (h << 4) + toupper (*p); - if ((g = h & 0xf0000000)) { - h = h ^ (g >> 24); - h = h ^ g; - } - } - - return h; -} - - -static void -free_string (gpointer string, gpointer user_data) -{ - g_free (string); -} - -void -string_list_free (GList *string_list) -{ - if (string_list == NULL) - return; - - g_list_foreach (string_list, free_string, NULL); - g_list_free (string_list); -} - -char * -camel_strstrcase (const char *haystack, const char *needle) -{ - /* find the needle in the haystack neglecting case */ - const char *ptr; - guint len; - - g_return_val_if_fail (haystack != NULL, NULL); - g_return_val_if_fail (needle != NULL, NULL); - - len = strlen (needle); - if (len > strlen (haystack)) - return NULL; - - if (len == 0) - return (char *) haystack; - - for (ptr = haystack; *(ptr + len - 1) != '\0'; ptr++) - if (!strncasecmp (ptr, needle, len)) - return (char *) ptr; - - return NULL; -} - - -const char * -camel_strdown (char *str) -{ - register char *s = str; - - while (*s) { - if (*s >= 'A' && *s <= 'Z') - *s += 0x20; - s++; - } - - return str; -} diff --git a/camel/string-utils.h b/camel/string-utils.h deleted file mode 100644 index ddfbda80a9..0000000000 --- a/camel/string-utils.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast - * - * Copyright 2002 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#ifndef STRING_UTIL_H -#define STRING_UTIL_H 1 - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include - -int g_strcase_equal (gconstpointer a, gconstpointer b); -guint g_strcase_hash (gconstpointer v); - -void string_list_free (GList *string_list); - -char *camel_strstrcase (const char *haystack, const char *needle); - -const char *camel_strdown (char *str); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* STRING_UTIL_H */ -- cgit v1.2.3