2004-06-03 Not Zed <NotZed@Ximian.com> * providers/nntp/camel-nntp-folder.c (nntp_folder_sync_online): only save the summary, don't update from server, thats what refresh info does. (nntp_folder_download_message): fix exception handling. (nntp_folder_cache_message): same. (nntp_folder_get_message): ditto, plus major cleanup. (nntp_folder_download_message): take combined uid so it can cache and lookup properly. duh. * providers/nntp/camel-nntp-store.c (nntp_store_get_subscribed_folder_info): if not fast, then open the folder, and update it. Yeah i've given up trying to worry about performance vs usability. * providers/nntp/camel-nntp-summary.c (camel_nntp_summary_check): update the storesummary if we update the folder summary. Hmm, isn't duplicated data meant to be a bad thing? :P * providers/nntp/camel-nntp-store.c (camel_nntp_store_set_folder): removed, now handled by nntp_command. (nntp_connected): removed, now handled by nntp_command. * camel-string-utils.c (camel_tolower): added ascii to-lower function. (camel_toupper): and upper, for completeness. * camel-store-summary.c (CAMEL_STORE_SUMMARY_VERSION): bumped file version by 1. This is a mess, version 1 files treated the bitfield 'flags' with bit number values not bits. Messy. * providers/nntp/camel-nntp-store-summary.c (store_info_save): write last/first count. (CAMEL_NNTP_STORE_SUMMARY_VERSION): bump version to 1. (store_info_load): if we're loading >= version 1, then load last/first counts. * providers/nntp/camel-nntp-store.c (nntp_store_get_folder_info_all): pass the whole line to store_info_from_line, dont strip last/first info. (nntp_store_info_update): renamed from info_new_from_line. only add if not present. handle updates, try and handle unread counts and readonly status. 2004-06-02 Not Zed <NotZed@Ximian.com> * providers/nntp/camel-nntp-store.c: setup xover once we've started. * providers/nntp/camel-nntp-summary.c: (xover_setup): moved to nntp store. * providers/nntp/camel-nntp-folder.c (folder_check) (folder_check_free, camel_nntp_folder_new): remove async summary stuff. * providers/nntp/camel-nntp-store.c (camel_nntp_command): take exception argument again, and folder argument. do retry logic and auth logic differently. (camel_nntp_raw_command): raw command interface, dont try reconnect or anything fancy. pass i/o errors straight out, etc. (camel_nntp_try_authenticate): change to return return codes & take exception. * providers/nntp/camel-nntp-summary.c (camel_nntp_summary_new): just take path argument. (camel_nntp_summary_check): take a store, and a folder name. (add_range_head, add_range_xover): remove the time based update events, they never had any effect anyway. Take store argument. (xover_setup): take store argument. * camel-folder-search.c (search_match_threads): remove debug. svn path=/trunk/; revision=26164
144 lines
2.6 KiB
C
144 lines
2.6 KiB
C
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
|
/*
|
|
* Authors: Jeffrey Stedfast <fejj@ximian.com>
|
|
*
|
|
* 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 <config.h>
|
|
#endif
|
|
|
|
#include <string.h>
|
|
|
|
#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;
|
|
}
|
|
|
|
/**
|
|
* camel_tolower:
|
|
* @c:
|
|
*
|
|
* ASCII to-lower function.
|
|
*
|
|
* Return value:
|
|
**/
|
|
char camel_tolower(char c)
|
|
{
|
|
if (c >= 'A' && c <= 'Z')
|
|
c |= 0x20;
|
|
|
|
return c;
|
|
}
|
|
|
|
/**
|
|
* camel_toupper:
|
|
* @c:
|
|
*
|
|
* ASCII to-upper function.
|
|
*
|
|
* Return value:
|
|
**/
|
|
char camel_toupper(char c)
|
|
{
|
|
if (c >= 'a' && c <= 'z')
|
|
c &= ~0x20;
|
|
|
|
return c;
|
|
}
|
|
|