Undid clahey's e_strstrcase because e_strstrcase DOES NOT EXIST in
authorJeffrey Stedfast <fejj@helixcode.com>
Thu, 13 Jul 2000 01:35:25 +0000 (01:35 +0000)
committerJeffrey Stedfast <fejj@src.gnome.org>
Thu, 13 Jul 2000 01:35:25 +0000 (01:35 +0000)
2000-07-12  Jeffrey Stedfast  <fejj@helixcode.com>

Undid clahey's e_strstrcase because e_strstrcase DOES NOT EXIST
in e-utils/e-utils.c nor anywhere else in Evolution - besides,
Camel should remain independant of Evolution.

* providers/imap/camel-imap-store.c (imap_connect): Fixed Peter's
fix, we don't want to send a string to a %d.

camel/ChangeLog
camel/camel-folder-search.c
camel/providers/imap/camel-imap-store.c
camel/string-utils.c
camel/string-utils.h

index 83f4a92..388d950 100644 (file)
@@ -1,3 +1,12 @@
+2000-07-12  Jeffrey Stedfast  <fejj@helixcode.com>
+
+       Undid clahey's e_strstrcase because e_strstrcase DOES NOT EXIST 
+       in e-utils/e-utils.c nor anywhere else in Evolution - besides, 
+       Camel should remain independant of Evolution.
+       
+       * providers/imap/camel-imap-store.c (imap_connect): Fixed Peter's 
+       fix, we don't want to send a string to a %d.
+
 2000-07-12  Christopher James Lahey  <clahey@helixcode.com>
 
        * camel-folder-search.c, providers/imap/camel-imap-store.c:
index 4e77aea..714725e 100644 (file)
@@ -381,7 +381,7 @@ search_header_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, C
                        /* performs an OR of all words */
                        for (i=1;i<argc && !truth;i++) {
                                if (argv[i]->type == ESEXP_RES_STRING
-                                   && e_strstrcase(header, argv[i]->value.string)) {
+                                   && strstrcase (header, argv[i]->value.string)) {
                                        r(printf("%s got a match with %s of %s\n", search->current->uid, header, argv[i]->value.string));
                                        truth = TRUE;
                                        break;
index d31080d..bec33ed 100644 (file)
@@ -248,9 +248,9 @@ imap_connect (CamelService *service, CamelException *ex)
        fd = socket (h->h_addrtype, SOCK_STREAM, 0);
        if (fd == -1 || connect (fd, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-                                     "Could not connect to %s (port %s): %s",
+                                     "Could not connect to %s (port %d): %s",
                                      service->url->host ? service->url->host : "(unknown host)", 
-                                     service->url->port ? service->url->port : "(unknown port)",
+                                     service->url->port ? service->url->port : IMAP_PORT,
                                      strerror(errno));
                if (fd > -1)
                        close (fd);
@@ -333,7 +333,7 @@ imap_connect (CamelService *service, CamelException *ex)
                                      "Unknown error");
        }
        
-       if (e_strstrcase (result, "SEARCH"))
+       if (strstrcase (result, "SEARCH"))
                store->has_search_capability = TRUE;
        else
                store->has_search_capability = FALSE;
@@ -559,13 +559,13 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char
                        }
 
                        if (p) {
-                               if (e_strstrcase (p, "READ-WRITE"))
+                               if (strstrcase (p, "READ-WRITE"))
                                        mode = 
                        }
 #endif
                }
 #if 0
-               if ((recent = e_strstrcase (r, "RECENT"))) {
+               if ((recent = strstrcase (r, "RECENT"))) {
                        char *p;
                        
                        for (p = recent; p > r && *p != '*'; p--);
@@ -678,7 +678,7 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char **
                        return s;
                }
 #if 0
-               if ((recent = e_strstrcase (r, "RECENT"))) {
+               if ((recent = strstrcase (r, "RECENT"))) {
                        char *p;
                        
                        for (p = recent; p > r && *p != '*'; p--);
index 418092f..5291b12 100644 (file)
@@ -3,8 +3,8 @@
 
 /* 
  *
- * Author : 
- *  Bertrand Guiheneuf <bertrand@helixcode.com>
+ * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
+ *          Jeffrey Stedfast <fejj@helixcode.com>
  *
  * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
  *
@@ -174,3 +174,25 @@ string_prefix (const gchar *s, const gchar *suffix, gboolean *suffix_found)
 
        return result_string;
 }
+
+gchar *
+strstrcase (const gchar *haystack, const gchar *needle)
+{
+       /* find the needle in the haystack neglecting case */
+       gchar *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;
+
+       for (ptr = (gchar *) haystack; *(ptr + len - 1) != '\0'; ptr++)
+               if (!g_strncasecmp (ptr, needle, len))
+                       return ptr;
+
+       return NULL;
+}
+
index 6f5b9a5..1e4743f 100644 (file)
@@ -3,8 +3,8 @@
 
 /* 
  *
- * Author : 
- *  Bertrand Guiheneuf <bertrand@helixcode.com>
+ * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
+ *          Jeffrey Stedfast <fejj@helixcode.com>
  *
  * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
  *
@@ -56,6 +56,8 @@ void     string_trim            (gchar *string, const gchar *chars,
 
 gchar   *string_prefix (const gchar *s, const gchar *suffix, gboolean *suffix_found);
 
+gchar   *strstrcase (const gchar *haystack, const gchar *needle);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */