diff options
-rw-r--r-- | camel/ChangeLog | 33 | ||||
-rw-r--r-- | camel/Makefile.am | 1 | ||||
-rw-r--r-- | camel/camel-session.c | 12 | ||||
-rw-r--r-- | camel/camel-store.c | 25 | ||||
-rw-r--r-- | camel/camel-store.h | 4 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 2 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 13 | ||||
-rw-r--r-- | camel/providers/nntp/camel-nntp-store.c | 4 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 4 | ||||
-rw-r--r-- | camel/string-utils.c | 24 | ||||
-rw-r--r-- | camel/string-utils.h | 2 |
11 files changed, 103 insertions, 21 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index dca89bc6a1..803cd825da 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,36 @@ +2001-04-16 Jeffrey Stedfast <fejj@ximian.com> + + * Makefile.am: Remove the EXTRA_GNOME_CFLAGS include. + + * camel-store.c (camel_mkdir_hier): Convenience function that it + seems a number of camel-store implementations used gal for. + + * providers/nntp/camel-nntp-store.c (ensure_news_dir_exists): Lets + not depend on gal for just e_mkdir_hier() - use camel_mkdir_hier() + instead. + + * providers/nntp/camel-imap-store.c: Lets not depend on gal for + just e_mkdir_hier() - use camel_mkdir_hier() instead. + + * camel-session.c (camel_session_get_storage_path): Don't depend + on e_mkdir_heir() anymore, use the CamelStore version. + + * camel-folder-search.h: Removed gal dependency, why was this even + there in the first place? + + * providers/imap/camel-imap-folder.c: Don't need gal/util/e-util.h + here, so remove it. + + * string-utils.c (strstrcase): New function, well more like old + function brought back to life so we don't have to depend on gal. + + * providers/imap/camel-imap-store.c (imap_store_setup_online): Use + strstrcase rather than e_strstrcase so we don't depend on gal. + (get_unread_online): Same here. + + * providers/smtp/camel-smtp-transport.c (smtp_helo): Use + strstrcase. + 2001-04-15 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.c (header_raw_check_mailing_list): regex diff --git a/camel/Makefile.am b/camel/Makefile.am index 0a42ed8368..fd2126ea43 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -17,7 +17,6 @@ INCLUDES = -I.. -I$(srcdir)/.. \ $(KRB4_CFLAGS) \ $(NSPR_CFLAGS) \ $(NSS_CFLAGS) \ - $(EXTRA_GNOME_CFLAGS) \ -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \ -DG_LOG_DOMAIN=\"camel\" diff --git a/camel/camel-session.c b/camel/camel-session.c index 6550dd9ee1..9399364bde 100644 --- a/camel/camel-session.c +++ b/camel/camel-session.c @@ -42,7 +42,6 @@ #include "string-utils.h" #include "camel-url.h" #include "hash-table-utils.h" -#include <gal/util/e-util.h> #include "camel-vee-store.h" #include "camel-private.h" @@ -429,6 +428,7 @@ camel_session_get_service_connected (CamelSession *session, return svc; } + /** * camel_session_get_storage_path: * @session: session object @@ -449,22 +449,22 @@ camel_session_get_storage_path (CamelSession *session, CamelService *service, CamelException *ex) { char *path, *p; - + p = camel_service_get_path (service); path = g_strdup_printf ("%s/%s", session->storage_path, p); g_free (p); - + if (access (path, F_OK) == 0) return path; - - if (e_mkdir_hier (path, S_IRWXU) == -1) { + + if (camel_mkdir_hier (path, S_IRWXU) == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create directory %s:\n%s"), path, g_strerror (errno)); g_free (path); return NULL; } - + return path; } diff --git a/camel/camel-store.c b/camel/camel-store.c index e01509e029..3314b710d8 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -777,3 +777,28 @@ camel_store_unsubscribe_folder (CamelStore *store, CAMEL_STORE_UNLOCK(store, folder_lock); } + + +int +camel_mkdir_hier (const char *path, mode_t mode) +{ + char *copy, *p; + + p = copy = g_strdup (path); + do { + p = strchr (p + 1, '/'); + if (p) + *p = '\0'; + if (access (copy, F_OK) == -1) { + if (mkdir (copy, mode) == -1) { + g_free (copy); + return -1; + } + } + if (p) + *p = '/'; + } while (p); + + g_free (copy); + return 0; +} diff --git a/camel/camel-store.h b/camel/camel-store.h index 493720b24f..51d6570348 100644 --- a/camel/camel-store.h +++ b/camel/camel-store.h @@ -184,6 +184,10 @@ void camel_store_unsubscribe_folder (CamelStore *store, const char *folder_name, CamelException *ex); + +/* utility needed by some stores */ +int camel_mkdir_hier (const char *path, mode_t mode); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index f30c731e0c..9f325aae56 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -36,8 +36,6 @@ #include <fcntl.h> #include <ctype.h> -#include <gal/util/e-util.h> - #include "camel-imap-folder.h" #include "camel-imap-command.h" #include "camel-imap-message-cache.h" diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 214b9fe18b..d7aec42f2c 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -32,7 +32,6 @@ #include <unistd.h> #include <errno.h> -#include <gal/util/e-util.h> #include "e-util/e-path.h" #include "camel-imap-store.h" @@ -580,11 +579,11 @@ imap_store_setup_online (CamelImapStore *store, CamelException *ex) result = camel_imap_response_extract (response, "NAMESPACE", ex); if (!result) return FALSE; - - name = e_strstrcase (result, "NAMESPACE (("); + + name = strstrcase (result, "NAMESPACE (("); if (name) { char *sep; - + name += 12; store->namespace = imap_parse_string (&name, &len); if (name && *name++ == ' ') { @@ -870,7 +869,7 @@ get_folder (CamelStore *store, const char *folder_name, guint32 flags, folder_dir = e_path_to_physical (imap_store->storage_path, folder_name); - if (e_mkdir_hier (folder_dir, S_IRWXU) == 0) { + if (camel_mkdir_hier (folder_dir, S_IRWXU) == 0) { new_folder = camel_imap_folder_new (store, folder_name, short_name, folder_dir, ex); @@ -1064,8 +1063,8 @@ get_unread_online (CamelImapStore *imap_store, CamelFolderInfo *fi) status = camel_imap_response_extract (response, "STATUS", NULL); if (!status) return; - - p = e_strstrcase (status, "UNSEEN"); + + p = strstrcase (status, "UNSEEN"); if (p) fi->unread_message_count = strtoul (p + 6, NULL, 10); g_free (status); diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c index 009058dcd4..494e11f647 100644 --- a/camel/providers/nntp/camel-nntp-store.c +++ b/camel/providers/nntp/camel-nntp-store.c @@ -42,8 +42,6 @@ #include "camel-url.h" #include "string-utils.h" -#include <gal/util/e-util.h> - #define NNTP_PORT 119 #define DUMP_EXTENSIONS @@ -843,7 +841,7 @@ ensure_news_dir_exists (CamelNNTPStore *store) return TRUE; } - if (e_mkdir_hier (dir, S_IRWXU) == -1) { + if (camel_mkdir_hier (dir, S_IRWXU) == -1) { g_free (dir); return FALSE; } diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index f2037a83af..5241394058 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -56,7 +56,7 @@ #include "camel-session.h" #include "camel-exception.h" #include "camel-sasl.h" -#include <gal/util/e-util.h> +#include "string-utils.h" #define d(x) x @@ -690,7 +690,7 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex) return FALSE; } - if (e_strstrcase (respbuf, "8BITMIME")) { + if (strstrcase (respbuf, "8BITMIME")) { d(fprintf (stderr, "This server supports 8bit MIME\n")); CAMEL_TRANSPORT (transport)->supports_8bit = TRUE; } diff --git a/camel/string-utils.c b/camel/string-utils.c index 4a28b199ef..584e2dad0d 100644 --- a/camel/string-utils.c +++ b/camel/string-utils.c @@ -207,3 +207,27 @@ strip (gchar *string, gchar c) return string; } + +char * +strstrcase (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 (!g_strncasecmp (ptr, needle, len)) + return (char *) ptr; + + return NULL; +} diff --git a/camel/string-utils.h b/camel/string-utils.h index 1556faa1df..e20c2e6a77 100644 --- a/camel/string-utils.h +++ b/camel/string-utils.h @@ -61,6 +61,8 @@ void string_unquote (gchar *string); gchar *strip (gchar *string, gchar c); +char *strstrcase (char *haystack, const char *needle); + #ifdef __cplusplus } #endif /* __cplusplus */ |