summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-12-04 16:10:37 +0000
committerJeffrey Stedfast <fejj@src.gnome.org>2002-12-04 16:10:37 +0000
commitfd919b3a74e144199ffc4218d315580bae296a6f (patch)
treec1dfe0f5e61e21708dd3218462f5a119a0a4004d
parent5b47ba44fc33da12402032c37e46486aa69915bd (diff)
downloadevolution-data-server-fd919b3a74e144199ffc4218d315580bae296a6f.tar.gz
Properly handle the case where the namespace is "". Fixes bug #34975EVOLUTION_1_2_1
2002-12-03 Jeffrey Stedfast <fejj@ximian.com> * providers/imap/camel-imap-store-summary.c (camel_imap_store_summary_add_from_full): Properly handle the case where the namespace is "". Fixes bug #34975 * broken-date-parser.c (get_tzone): Fixed to not get false positives when the token is shorter than the actual timezone string (but matches the first little bit of it). (datetok): Modified to properly handle when the first char of a token is a special char (such as a '-') that is also used as a token delimiter.
-rw-r--r--camel/ChangeLog13
-rw-r--r--camel/broken-date-parser.c37
-rw-r--r--camel/providers/imap/camel-imap-store-summary.c13
3 files changed, 46 insertions, 17 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 695a4e869..052eafcad 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,16 @@
+2002-12-03 Jeffrey Stedfast <fejj@ximian.com>
+
+ * providers/imap/camel-imap-store-summary.c
+ (camel_imap_store_summary_add_from_full): Properly handle the case
+ where the namespace is "". Fixes bug #34975
+
+ * broken-date-parser.c (get_tzone): Fixed to not get false
+ positives when the token is shorter than the actual timezone
+ string (but matches the first little bit of it).
+ (datetok): Modified to properly handle when the first char of a
+ token is a special char (such as a '-') that is also used as a
+ token delimiter.
+
2002-11-22 Not Zed <NotZed@Ximian.com>
* camel-operation.c (camel_operation_cancel_prfd): Implement, gets
diff --git a/camel/broken-date-parser.c b/camel/broken-date-parser.c
index 238665cb9..f6e697896 100644
--- a/camel/broken-date-parser.c
+++ b/camel/broken-date-parser.c
@@ -123,14 +123,18 @@ datetok (const char *date)
start = date;
while (*start) {
/* kill leading whitespace */
- for ( ; *start && isspace ((int) *start); start++);
+ while (*start && isspace ((int) *start))
+ start++;
- mask = 0;
+ if (*start == '\0')
+ break;
+
+ mask = datetok_table[*start];
/* find the end of this token */
- for (end = start; *end && !strchr ("-/,\t\r\n ", *end); end++) {
- mask |= datetok_table[*end];
- }
+ end = start + 1;
+ while (*end && !strchr ("-/,\t\r\n ", *end))
+ mask |= datetok_table[*end++];
if (end != start) {
token = g_malloc (sizeof (struct _date_token));
@@ -277,22 +281,31 @@ get_time (const unsigned char *in, unsigned int inlen, int *hour, int *min, int
static int
get_tzone (struct _date_token **token)
{
- int i;
+ const unsigned char *inptr, *inend;
+ unsigned int inlen;
+ int i, t;
for (i = 0; *token && i < 2; *token = (*token)->next, i++) {
- const unsigned char *inptr = (*token)->start;
- unsigned int inlen = (*token)->len;
+ inptr = (*token)->start;
+ inlen = (*token)->len;
+ inend = inptr + inlen;
if (*inptr == '+' || *inptr == '-') {
return decode_int (inptr, inlen);
} else {
- int t;
-
- if (*inptr == '(')
+ if (*inptr == '(') {
inptr++;
+ if (*(inend - 1) == ')')
+ inlen -= 2;
+ else
+ inlen--;
+ }
for (t = 0; t < 15; t++) {
- unsigned int len = MIN (strlen (tz_offsets[t].name), inlen - 1);
+ unsigned int len = strlen (tz_offsets[t].name);
+
+ if (len != inlen)
+ continue;
if (!strncmp (inptr, tz_offsets[t].name, len))
return tz_offsets[t].offset;
diff --git a/camel/providers/imap/camel-imap-store-summary.c b/camel/providers/imap/camel-imap-store-summary.c
index d9225fbf8..63444f44c 100644
--- a/camel/providers/imap/camel-imap-store-summary.c
+++ b/camel/providers/imap/camel-imap-store-summary.c
@@ -318,9 +318,14 @@ camel_imap_store_summary_add_from_full(CamelImapStoreSummary *s, const char *ful
} else {
if (full_name[len] == ns->sep)
len++;
+
prefix = camel_imap_store_summary_full_to_path(s, full_name+len, ns->sep);
- pathu8 = g_strdup_printf("%s/%s", ns->path, prefix);
- g_free(prefix);
+ if (*ns->path) {
+ pathu8 = g_strdup_printf ("%s/%s", ns->path, prefix);
+ g_free (prefix);
+ } else {
+ pathu8 = prefix;
+ }
}
d(printf(" (pathu8 = '%s')", pathu8));
} else {
@@ -343,7 +348,6 @@ camel_imap_store_summary_add_from_full(CamelImapStoreSummary *s, const char *ful
char *
camel_imap_store_summary_full_from_path(CamelImapStoreSummary *s, const char *path)
{
- CamelImapStoreInfo *si;
CamelImapStoreNamespace *ns;
char *name = NULL;
@@ -362,8 +366,7 @@ CamelImapStoreNamespace *camel_imap_store_summary_namespace_new(CamelImapStoreSu
CamelImapStoreNamespace *ns;
char *p;
int len;
- GString *tmp;
-
+
ns = g_malloc0(sizeof(*ns));
ns->full_name = g_strdup(full_name);
len = strlen(ns->full_name)-1;