General cleanup of camel debug printfs.

2001-09-19    <NotZed@Ximian.com>

        * General cleanup of camel debug printfs.

        * camel-lock.c (camel_lock_fcntl): Changed to return 'success' if
        the error indicates file locking isn't supported on this
        filesystem.  Still return a warning just incase (if its the first
        time).  Might fix a lot of reported bugs.

        * providers/local/camel-spool-store.c (get_folder_info): Dont
        include the empty // host part in the uri.  This 'breaks' the
        service lookup.

svn path=/trunk/; revision=12973
This commit is contained in:
9
2001-09-19 08:28:36 +00:00
committed by Michael Zucci
parent d9775521ca
commit bef39dc4e0
18 changed files with 76 additions and 40 deletions

View File

@ -1,9 +1,29 @@
2001-09-19 <NotZed@Ximian.com>
* General cleanup of camel debug printfs.
* camel-lock.c (camel_lock_fcntl): Changed to return 'success' if
the error indicates file locking isn't supported on this
filesystem. Still return a warning just incase (if its the first
time). Might fix a lot of reported bugs.
* providers/local/camel-spool-store.c (get_folder_info): Dont
include the empty // host part in the uri. This 'breaks' the
service lookup.
2001-09-18 Jeffrey Stedfast <fejj@ximian.com>
* camel-mime-utils.c: Match mailing-list header List-Owner.
2001-09-18 <NotZed@Ximian.com>
* camel-vee-store.c (vee_get_folder): Fix the uri genereated for
the folderinfo for the folder_created event.
* camel-store.h: Added 'total' to CamelFolderInfo.
2000-09-18 <NotZed@Ximian.com>
* providers/local/camel-maildir-folder.c
(camel_maildir_folder_new): If filter inbox is set on the store,
and we're opening inbox '', then enable filtering on new messages.

View File

@ -382,7 +382,7 @@ camel_folder_search_execute_expression(CamelFolderSearch *search, const char *ex
unfree'd results as well. */
g_hash_table_insert(p->mempool_hash, matches, pool);
} else {
printf("no result!\n");
d(printf("no result!\n"));
}
search->folder = NULL;

View File

@ -40,7 +40,7 @@
#define d(x)
#define TIMEIT
/*#define TIMEIT*/
#ifdef TIMEIT
#include <sys/time.h>

View File

@ -1404,8 +1404,8 @@ folder_changed (CamelObject *obj, gpointer event_data)
GPtrArray *recents = g_ptr_array_new();
int i;
struct _folder_filter_msg *msg;
(printf("** Have '%d' recent messages, launching thread to process them\n", changed->uid_recent->len));
d(printf("** Have '%d' recent messages, launching thread to process them\n", changed->uid_recent->len));
folder->priv->frozen++;
msg = camel_session_thread_msg_new(session, &filter_ops, sizeof(*msg));

View File

@ -198,8 +198,20 @@ camel_lock_fcntl(int fd, CamelLockType type, CamelException *ex)
memset(&lock, 0, sizeof(lock));
lock.l_type = type==CAMEL_LOCK_READ?F_RDLCK:F_WRLCK;
if (fcntl(fd, F_SETLK, &lock) == -1) {
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to get lock using fcntl(2): %s"), strerror(errno));
return -1;
/* If we get a 'locking not vailable' type error,
we assume the filesystem doesn't support fcntl() locking */
/* this is somewhat system-dependent */
if (errno != EINVAL && errno != ENOLCK) {
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to get lock using fcntl(2): %s"),
strerror(errno));
return -1;
} else {
static int failed = 0;
if (failed == 0)
fprintf(stderr, "fcntl(2) locking appears not to work on this filesystem");
failed++;
}
}
#endif
return 0;

View File

@ -2922,7 +2922,7 @@ header_param_list_format_append (GString *out, struct _header_param *p)
else
quote_word (out, TRUE, inptr, ptr - inptr);
printf ("wrote: %s\n", out->str + here);
d(printf ("wrote: %s\n", out->str + here));
used += (out->len - here);

View File

@ -367,7 +367,7 @@ camel_movemail_copy_filter(int fromfd, int tofd, off_t start, size_t bytes, Came
if (towrite == -1)
return -1;
printf("read %d unfiltered bytes\n", towrite);
d(printf("read %d unfiltered bytes\n", towrite));
/* check for 'end of file' */
if (towrite == 0) {
@ -383,7 +383,7 @@ camel_movemail_copy_filter(int fromfd, int tofd, off_t start, size_t bytes, Came
towrite = filterlen;
}
printf("writing %d filtered bytes\n", towrite);
d(printf("writing %d filtered bytes\n", towrite));
do {
toread = write(tofd, filterbuffer, towrite);

View File

@ -45,6 +45,8 @@
#include "camel-private.h"
#define d(x)
#define CS_CLASS(so) CAMEL_SESSION_CLASS (CAMEL_OBJECT_GET_CLASS (so))
static void register_provider (CamelSession *session, CamelProvider *provider);
@ -733,14 +735,14 @@ static void session_thread_msg_free(CamelSession *session, CamelSessionThreadMsg
{
g_assert(msg->ops != NULL);
printf("free message %p session %p\n", msg, session);
d(printf("free message %p session %p\n", msg, session));
CAMEL_SESSION_LOCK(session, thread_lock);
g_hash_table_remove(session->priv->thread_active, (void *)msg->id);
CAMEL_SESSION_UNLOCK(session, thread_lock);
printf("free msg, ops->free = %p\n", msg->ops->free);
d(printf("free msg, ops->free = %p\n", msg->ops->free));
if (msg->ops->free)
msg->ops->free(session, msg);
g_free(msg);
@ -748,13 +750,13 @@ static void session_thread_msg_free(CamelSession *session, CamelSessionThreadMsg
static void session_thread_destroy(EThread *thread, CamelSessionThreadMsg *msg, CamelSession *session)
{
printf("destroy message %p session %p\n", msg, session);
d(printf("destroy message %p session %p\n", msg, session));
session_thread_msg_free(session, msg);
}
static void session_thread_received(EThread *thread, CamelSessionThreadMsg *msg, CamelSession *session)
{
printf("receive message %p session %p\n", msg, session);
d(printf("receive message %p session %p\n", msg, session));
if (msg->ops->receive)
msg->ops->receive(session, msg);
}

View File

@ -249,15 +249,11 @@ camel_store_get_folder (CamelStore *store, const char *folder_name, guint32 flag
if (store->folders) {
CAMEL_STORE_LOCK(store, cache_lock);
printf("adding folder '%s' to folders hashtable\n", folder_name);
g_hash_table_insert (store->folders, g_strdup (folder_name), folder);
printf("store folders size = %d\n", g_hash_table_size(store->folders));
camel_object_hook_event (CAMEL_OBJECT (folder), "finalize", folder_finalize, store);
CAMEL_STORE_UNLOCK(store, cache_lock);
} else
printf("not adding folder '%s' to folders hashtable\n", folder_name);
}
}
}

View File

@ -41,8 +41,12 @@ extern "C" {
typedef struct _CamelFolderInfo {
struct _CamelFolderInfo *parent, *sibling, *child;
char *url, *full_name, *name;
struct _CamelFolderInfo *parent,
*sibling,
*child;
char *url;
char *full_name;
char *name;
int unread_message_count;
} CamelFolderInfo;

View File

@ -543,7 +543,7 @@ int
camel_url_equal(const void *v, const void *v2)
{
const CamelURL *u1 = v, *u2 = v2;
return check_equal(u1->protocol, u2->protocol)
&& check_equal(u1->user, u2->user)
&& check_equal(u1->authmech, u2->authmech)

View File

@ -215,7 +215,7 @@ camel_vee_folder_construct(CamelVeeFolder *vf, CamelStore *parent_store, const c
if (folder_unmatched == NULL) {
unmatched_uids = g_hash_table_new (g_str_hash, g_str_equal);
folder_unmatched = (CamelVeeFolder *)camel_object_new (camel_vee_folder_get_type ());
printf("created foldeer unmatched %p\n", folder_unmatched);
d(printf("created foldeer unmatched %p\n", folder_unmatched));
vee_folder_construct (folder_unmatched, parent_store, "UNMATCHED", CAMEL_STORE_FOLDER_PRIVATE);
}
@ -246,7 +246,7 @@ camel_vee_folder_new(CamelStore *parent_store, const char *name, guint32 flags)
if (folder_unmatched == NULL) {
unmatched_uids = g_hash_table_new(g_str_hash, g_str_equal);
folder_unmatched = vf = (CamelVeeFolder *)camel_object_new(camel_vee_folder_get_type());
printf("created foldeer unmatched %p\n", folder_unmatched);
d(printf("created foldeer unmatched %p\n", folder_unmatched));
vee_folder_construct (vf, parent_store, "UNMATCHED", CAMEL_STORE_FOLDER_PRIVATE);
}
@ -254,14 +254,14 @@ camel_vee_folder_new(CamelStore *parent_store, const char *name, guint32 flags)
if (strcmp(name, "UNMATCHED") == 0) {
camel_object_ref((CamelObject *)folder_unmatched);
printf("returning unmatched %p, count = %d\n", folder_unmatched, camel_folder_get_message_count((CamelFolder *)folder_unmatched));
d(printf("returning unmatched %p, count = %d\n", folder_unmatched, camel_folder_get_message_count((CamelFolder *)folder_unmatched)));
return (CamelFolder *)folder_unmatched;
}
vf = (CamelVeeFolder *)camel_object_new(camel_vee_folder_get_type());
vee_folder_construct(vf, parent_store, name, flags);
printf("returning folder %s %p, count = %d\n", name, vf, camel_folder_get_message_count((CamelFolder *)vf));
d(printf("returning folder %s %p, count = %d\n", name, vf, camel_folder_get_message_count((CamelFolder *)vf)));
return (CamelFolder *)vf;
}
@ -608,7 +608,7 @@ vee_folder_add_info(CamelVeeFolder *vf, CamelFolder *f, CamelMessageInfo *info,
uid = g_strdup_printf("%.8s%s", hash, camel_message_info_uid(info));
dinfo = camel_folder_summary_uid(folder->summary, uid);
if (dinfo) {
(printf("w:clash, we already have '%s' in summary\n", uid));
d(printf("w:clash, we already have '%s' in summary\n", uid));
g_free(uid);
camel_folder_summary_info_free(folder->summary, dinfo);
return NULL;

View File

@ -132,9 +132,9 @@ vee_get_folder (CamelStore *store, const char *folder_name, guint32 flags, Camel
if (name == NULL)
name = vf->vname;
fi->name = g_strdup(name);
fi->url = g_strdup_printf("vfolder:%s", vf->vname);
fi->unread_message_count = -1;
fi->url = g_strdup_printf("vfolder:%s#%s", ((CamelService *)store)->url->path,
((CamelFolder *)vf)->full_name);
fi->unread_message_count = camel_folder_get_message_count((CamelFolder *)vf);
camel_object_trigger_event(CAMEL_OBJECT(store), "folder_created", fi);
camel_folder_info_free(fi);
}

View File

@ -191,7 +191,7 @@ get_folder_info (CamelStore *store, const char *top,
* there before.
*/
printf("-- LOCAL STRE -- get folder info: %s\n", top);
d(printf("-- LOCAL STRE -- get folder info: %s\n", top));
return NULL;
}

View File

@ -36,6 +36,8 @@
#include "camel-exception.h"
#include "camel-url.h"
#define d(x)
static CamelLocalStoreClass *parent_class = NULL;
/* Returns the class for a CamelMaildirStore */
@ -245,7 +247,7 @@ static int scan_dir(GHashTable *visited, char *root, const char *path, guint32 f
/* look for folders matching the right structure, recursively */
name = g_strdup_printf("%s/%s", root, path);
printf("checking dir '%s' part '%s' for maildir content\n", root, path);
d(printf("checking dir '%s' part '%s' for maildir content\n", root, path));
tmp = g_strdup_printf("%s/tmp", name);
cur = g_strdup_printf("%s/cur", name);
@ -265,8 +267,8 @@ static int scan_dir(GHashTable *visited, char *root, const char *path, guint32 f
base = path;
fi = camel_folder_info_new(uri, path, base, -1);
printf("found! uri = %s\n", fi->url);
printf(" full_name = %s\n name = '%s'\n", fi->full_name, fi->name);
d(printf("found! uri = %s\n", fi->url));
d(printf(" full_name = %s\n name = '%s'\n", fi->full_name, fi->name));
fi->parent = parent;
fi->sibling = *fip;

View File

@ -250,7 +250,7 @@ summary_rebuild(CamelMboxSummary *mbs, off_t offset, CamelException *ex)
fd = open(cls->folder_path, O_RDONLY);
if (fd == -1) {
printf("%s failed to open: %s\n", cls->folder_path, strerror(errno));
d(printf("%s failed to open: %s\n", cls->folder_path, strerror(errno)));
camel_exception_setv(ex, 1, _("Could not open folder: %s: %s"),
cls->folder_path, strerror(errno));
camel_operation_end(NULL);

View File

@ -99,8 +99,8 @@ construct (CamelService *service, CamelSession *session, CamelProvider *provider
char *path, *name;
struct stat st;
printf("constructing store of type %s '%s:%s'\n",
camel_type_to_name(((CamelObject *)service)->s.type), url->protocol, url->path);
d(printf("constructing store of type %s '%s:%s'\n",
camel_type_to_name(((CamelObject *)service)->s.type), url->protocol, url->path));
CAMEL_SERVICE_CLASS (parent_class)->construct (service, session, provider, url, ex);
if (camel_exception_is_set (ex))
@ -150,7 +150,7 @@ get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelExce
char *path = ((CamelService *)store)->url->path;
CamelFolder *folder;
printf("opening folder %s on path %s\n", folder_name, path);
d(printf("opening folder %s on path %s\n", folder_name, path));
/* we only support an 'INBOX' */
if (strcmp(folder_name, "INBOX") != 0) {
@ -192,7 +192,7 @@ get_folder_info (CamelStore *store, const char *top,
fi = g_malloc0(sizeof(*fi));
fi->full_name = "/INBOX";
fi->name = "INBOX";
fi->url = g_strdup_printf("spool://%s#%s", service->url->path, fi->name);
fi->url = g_strdup_printf("spool:%s#%s", service->url->path, fi->name);
fi->unread_message_count = -1;
}

View File

@ -380,7 +380,7 @@ summary_rebuild(CamelSpoolSummary *cls, off_t offset, CamelException *ex)
fd = open(cls->folder_path, O_RDONLY);
if (fd == -1) {
printf("%s failed to open: %s\n", cls->folder_path, strerror(errno));
d(printf("%s failed to open: %s\n", cls->folder_path, strerror(errno)));
camel_exception_setv(ex, 1, _("Could not open folder: %s: summarising from position %ld: %s"),
cls->folder_path, offset, strerror(errno));
camel_operation_end(NULL);