camel-imap4 r9 - trunk/imap4
- From: fejj svn gnome org
- To: svn-commits-list gnome org
- Subject: camel-imap4 r9 - trunk/imap4
- Date: Mon, 12 May 2008 04:07:37 +0100 (BST)
Author: fejj
Date: Mon May 12 03:07:37 2008
New Revision: 9
URL: http://svn.gnome.org/viewvc/camel-imap4?rev=9&view=rev
Log:
2008-05-11 Jeffrey Stedfast <fejj novell com>
* camel-imap4-utils.c (camel_imap4_build_folder_info_tree): New
utility function.
Modified:
trunk/imap4/ChangeLog
trunk/imap4/camel-imap4-store-summary.c
trunk/imap4/camel-imap4-store.c
trunk/imap4/camel-imap4-utils.c
trunk/imap4/camel-imap4-utils.h
Modified: trunk/imap4/camel-imap4-store-summary.c
==============================================================================
--- trunk/imap4/camel-imap4-store-summary.c (original)
+++ trunk/imap4/camel-imap4-store-summary.c Mon May 12 03:07:37 2008
@@ -376,72 +376,6 @@
return fi;
}
-static CamelFolderInfo *
-imap4_build_folder_info_tree (GPtrArray *array, const char *top)
-{
- CamelFolderInfo *cur, *fi, *root = NULL;
- const char *p;
- size_t n = 0;
- char *pname;
- int i;
-
- if (array->len == 0)
- return NULL;
-
- if (array->len == 1)
- return array->pdata[0];
-
- if (top)
- n = strlen (top);
-
- cur = root = array->pdata[0];
-
- for (i = 1; i < array->len; i++) {
- fi = (CamelFolderInfo *) array->pdata[i];
- if (top && strncmp (fi->full_name, top, n) != 0) {
- /* this folder info was not requested */
- camel_folder_info_free (fi);
- continue;
- }
-
- if ((p = strrchr (fi->full_name, '/'))) {
- pname = g_strndup (fi->full_name, p - fi->full_name);
- if (!strcmp (cur->full_name, pname)) {
- /* cur is our parent */
- fi->parent = cur;
- cur->child = fi;
- cur = fi;
- } else if (cur->parent && !strcmp (cur->parent->full_name, pname)) {
- /* cur is our sibling */
- fi->parent = cur->parent;
- cur->next = fi;
- cur = fi;
- } else {
- /* search back for our parent */
- while (cur->parent) {
- if (!strcmp (cur->parent->full_name, pname))
- break;
- cur = cur->parent;
- }
-
- /* cur should now be our sibling */
- fi->parent = cur->parent;
- cur->next = fi;
- cur = fi;
- }
- g_free (pname);
- } else {
- /* traverse back to most recent top-level fi */
- while (cur->parent)
- cur = cur->parent;
-
- cur->next = fi;
- cur = fi;
- }
- }
-
- return root;
-}
CamelFolderInfo *
camel_imap4_store_summary_get_folder_info (CamelIMAP4StoreSummary *s, const char *top, guint32 flags)
@@ -475,7 +409,7 @@
g_ptr_array_add (folders, store_info_to_folder_info (ss, si));
}
- fi = imap4_build_folder_info_tree (folders, top);
+ fi = camel_imap4_build_folder_info_tree (folders, top);
g_ptr_array_free (folders, TRUE);
return fi;
Modified: trunk/imap4/camel-imap4-store.c
==============================================================================
--- trunk/imap4/camel-imap4-store.c (original)
+++ trunk/imap4/camel-imap4-store.c Mon May 12 03:07:37 2008
@@ -1363,73 +1363,6 @@
}
static CamelFolderInfo *
-imap4_build_folder_info_tree (GPtrArray *array, const char *top)
-{
- CamelFolderInfo *cur, *fi, *root = NULL;
- const char *p;
- size_t n = 0;
- char *pname;
- int i;
-
- if (array->len == 0)
- return NULL;
-
- if (array->len == 1)
- return array->pdata[0];
-
- if (top)
- n = strlen (top);
-
- cur = root = array->pdata[0];
-
- for (i = 1; i < array->len; i++) {
- fi = (CamelFolderInfo *) array->pdata[i];
- if (top && strncmp (fi->full_name, top, n) != 0) {
- /* this folder info was not requested */
- camel_folder_info_free (fi);
- continue;
- }
-
- if ((p = strrchr (fi->full_name, '/'))) {
- pname = g_strndup (fi->full_name, p - fi->full_name);
- if (!strcmp (cur->full_name, pname)) {
- /* cur is our parent */
- fi->parent = cur;
- cur->child = fi;
- cur = fi;
- } else if (cur->parent && !strcmp (cur->parent->full_name, pname)) {
- /* cur is our sibling */
- fi->parent = cur->parent;
- cur->next = fi;
- cur = fi;
- } else {
- /* search back for our parent */
- while (cur->parent) {
- if (!strcmp (cur->parent->full_name, pname))
- break;
- cur = cur->parent;
- }
-
- /* cur should now be our sibling */
- fi->parent = cur->parent;
- cur->next = fi;
- cur = fi;
- }
- g_free (pname);
- } else {
- /* traverse back to most recent top-level fi */
- while (cur->parent)
- cur = cur->parent;
-
- cur->next = fi;
- cur = fi;
- }
- }
-
- return root;
-}
-
-static CamelFolderInfo *
imap4_build_folder_info (CamelStore *store, const char *top, guint32 flags, GPtrArray *array)
{
CamelIMAP4Engine *engine = ((CamelIMAP4Store *) store)->engine;
@@ -1505,7 +1438,7 @@
g_free (list);
}
- fi = imap4_build_folder_info_tree (array, top);
+ fi = camel_imap4_build_folder_info_tree (array, top);
camel_url_free (url);
Modified: trunk/imap4/camel-imap4-utils.c
==============================================================================
--- trunk/imap4/camel-imap4-utils.c (original)
+++ trunk/imap4/camel-imap4-utils.c Mon May 12 03:07:37 2008
@@ -44,6 +44,73 @@
#define d(x)
+CamelFolderInfo *
+camel_imap4_build_folder_info_tree (GPtrArray *array, const char *top)
+{
+ CamelFolderInfo *cur, *fi, *root = NULL;
+ const char *p;
+ size_t n = 0;
+ char *pname;
+ int i;
+
+ if (array->len == 0)
+ return NULL;
+
+ if (array->len == 1)
+ return array->pdata[0];
+
+ if (top)
+ n = strlen (top);
+
+ cur = root = array->pdata[0];
+
+ for (i = 1; i < array->len; i++) {
+ fi = (CamelFolderInfo *) array->pdata[i];
+ if (top && strncmp (fi->full_name, top, n) != 0) {
+ /* this folder info was not requested */
+ camel_folder_info_free (fi);
+ continue;
+ }
+
+ if ((p = strrchr (fi->full_name, '/'))) {
+ pname = g_strndup (fi->full_name, p - fi->full_name);
+ if (!strcmp (cur->full_name, pname)) {
+ /* cur is our parent */
+ fi->parent = cur;
+ cur->child = fi;
+ cur = fi;
+ } else if (cur->parent && !strcmp (cur->parent->full_name, pname)) {
+ /* cur is our sibling */
+ fi->parent = cur->parent;
+ cur->next = fi;
+ cur = fi;
+ } else {
+ /* search back for our parent */
+ while (cur->parent) {
+ if (!strcmp (cur->parent->full_name, pname))
+ break;
+ cur = cur->parent;
+ }
+
+ /* cur should now be our sibling */
+ fi->parent = cur->parent;
+ cur->next = fi;
+ cur = fi;
+ }
+ g_free (pname);
+ } else {
+ /* traverse back to most recent top-level fi */
+ while (cur->parent)
+ cur = cur->parent;
+
+ cur->next = fi;
+ cur = fi;
+ }
+ }
+
+ return root;
+}
+
void
camel_imap4_flags_diff (flags_diff_t *diff, guint32 old, guint32 new)
{
Modified: trunk/imap4/camel-imap4-utils.h
==============================================================================
--- trunk/imap4/camel-imap4-utils.h (original)
+++ trunk/imap4/camel-imap4-utils.h Mon May 12 03:07:37 2008
@@ -40,6 +40,7 @@
guint32 camel_imap4_merge_flags (guint32 original, guint32 local, guint32 server);
+struct _CamelFolderInfo;
struct _CamelIMAP4Engine;
struct _CamelIMAP4Command;
struct _CamelFolderSummary;
@@ -48,6 +49,8 @@
struct _CamelIMAP4NamespaceList;
struct _CamelIMAP4Namespace;
+struct _CamelFolderInfo *camel_imap4_build_folder_info_tree (GPtrArray *array, const char *top);
+
void camel_imap4_namespace_clear (struct _CamelIMAP4Namespace **ns);
struct _CamelIMAP4NamespaceList *camel_imap4_namespace_list_copy (const struct _CamelIMAP4NamespaceList *nsl);
void camel_imap4_namespace_list_free (struct _CamelIMAP4NamespaceList *nsl);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]