aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/local
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-06-03 10:56:35 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-06-03 10:56:35 +0800
commitd0a6ed17b65560ed07ed005b38fab449dc507aef (patch)
tree11288ede158ffadd5a00ac0e3c6f527deb99221c /camel/providers/local
parentaa3bfbe4224ff1c99d358aeac464ce7e9f0963a8 (diff)
downloadgsoc2013-evolution-d0a6ed17b65560ed07ed005b38fab449dc507aef.tar
gsoc2013-evolution-d0a6ed17b65560ed07ed005b38fab449dc507aef.tar.gz
gsoc2013-evolution-d0a6ed17b65560ed07ed005b38fab449dc507aef.tar.bz2
gsoc2013-evolution-d0a6ed17b65560ed07ed005b38fab449dc507aef.tar.lz
gsoc2013-evolution-d0a6ed17b65560ed07ed005b38fab449dc507aef.tar.xz
gsoc2013-evolution-d0a6ed17b65560ed07ed005b38fab449dc507aef.tar.zst
gsoc2013-evolution-d0a6ed17b65560ed07ed005b38fab449dc507aef.zip
setup/free the mech string.
2002-06-02 Not Zed <NotZed@Ximian.com> * camel-sasl.c (camel_sasl_new): (camel_sasl_finalize): setup/free the mech string. * camel-sasl.h: Added 'mech' mechanism string. 2002-06-01 Not Zed <NotZed@Ximian.com> * providers/imap/camel-imap-folder.c (imap_getv): Implement. Only the object_description arg. (camel_imap_folder_get_type): Init parent_class holder. * providers/local/camel-local-folder.c (local_getv): Implement, object_description arg. * camel-folder.c (folder_getv): Implement, add a bunch of args you can get -> camel_folder_get_unread_count etc will be going RSN i hope. (camel_folder_finalize): Free cached description string. * camel-object.c (cobject_getv): Implement CAMEL_OBJECT_ARG_DESCRIPTION, just return the classname of the object. (camel_object_getv): (camel_object_get): (camel_object_setv): (camel_object_set): Take object = void *, to simplify usage. (camel_object_setv): Removed unecessary locals. (camel_object_getv): Same. (camel_object_free): New method, free an arg, upto implementations whether args are static/const or not. (cobject_free): Implement a dummy do nothing free. 2002-05-31 Not Zed <NotZed@Ximian.com> * camel-vee-folder.c (camel_vee_folder_get_location): new function to get the real location (folder) (and uid) of a vfolder object. Using the folderinfo, since we already have it, maybe it should use the uid. svn path=/trunk/; revision=17073
Diffstat (limited to 'camel/providers/local')
-rw-r--r--camel/providers/local/camel-local-folder.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
index 3ae6c74873..c12e9d5da7 100644
--- a/camel/providers/local/camel-local-folder.c
+++ b/camel/providers/local/camel-local-folder.c
@@ -65,6 +65,8 @@ static CamelFolderClass *parent_class = NULL;
#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
#define CLOCALS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
+static int local_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args);
+
static int local_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex);
static void local_unlock(CamelLocalFolder *lf);
@@ -83,12 +85,15 @@ static void
camel_local_folder_class_init(CamelLocalFolderClass * camel_local_folder_class)
{
CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS(camel_local_folder_class);
+ CamelObjectClass *oklass = (CamelObjectClass *)camel_local_folder_class;
parent_class = CAMEL_FOLDER_CLASS(camel_type_get_global_classfuncs(camel_folder_get_type()));
/* virtual method definition */
/* virtual method overload */
+ oklass->getv = local_getv;
+
camel_folder_class->sync = local_sync;
camel_folder_class->expunge = local_expunge;
@@ -297,6 +302,64 @@ int camel_local_folder_unlock(CamelLocalFolder *lf)
}
static int
+local_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
+{
+ CamelFolder *folder = (CamelFolder *)object;
+ int i, count=args->argc;
+ guint32 tag;
+
+ for (i=0;i<args->argc;i++) {
+ CamelArgGet *arg = &args->argv[i];
+
+ tag = arg->tag;
+
+ switch (tag & CAMEL_ARG_TAG) {
+ /* CamelObject args */
+ case CAMEL_OBJECT_ARG_DESCRIPTION:
+ if (folder->description == NULL) {
+ char *tmp, *path;
+
+ /* check some common prefixes to shorten the name */
+ tmp = ((CamelService *)folder->parent_store)->url->path;
+ if (tmp == NULL)
+ goto skip;
+
+ path = alloca(strlen(tmp)+strlen(folder->full_name)+1);
+ sprintf(path, "%s/%s", tmp, folder->full_name);
+
+ if ((tmp = getenv("HOME")) && strncmp(tmp, path, strlen(tmp)) == 0)
+ /* $HOME relative path + protocol string */
+ folder->description = g_strdup_printf(_("~%s (%s)"), path+strlen(tmp),
+ ((CamelService *)folder->parent_store)->url->protocol);
+ else if ((tmp = "/var/spool/mail") && strncmp(tmp, path, strlen(tmp)) == 0)
+ /* /var/spool/mail relative path + protocol */
+ folder->description = g_strdup_printf(_("mailbox:%s (%s)"), path+strlen(tmp),
+ ((CamelService *)folder->parent_store)->url->protocol);
+ else if ((tmp = "/var/mail") && strncmp(tmp, path, strlen(tmp)) == 0)
+ folder->description = g_strdup_printf(_("mailbox:%s (%s)"), path+strlen(tmp),
+ ((CamelService *)folder->parent_store)->url->protocol);
+ else
+ /* a full path + protocol */
+ folder->description = g_strdup_printf(_("%s (%s)"), path,
+ ((CamelService *)folder->parent_store)->url->protocol);
+ }
+ *arg->ca_str = folder->description;
+ break;
+ default: skip:
+ count--;
+ continue;
+ }
+
+ arg->tag = (tag & CAMEL_ARG_TYPE) | CAMEL_ARG_IGNORE;
+ }
+
+ if (count)
+ return ((CamelObjectClass *)parent_class)->getv(object, ex, args);
+
+ return 0;
+}
+
+static int
local_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex)
{
return 0;