[evolution-kolab/ek-wip-porting] CamelIMAPXExtdConnManager: new "friend" API, relax param assertions



commit 29e89f167b83475d3d14aaebdcf377bc46c88e9b
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Wed Mar 7 16:00:53 2012 +0100

    CamelIMAPXExtdConnManager: new "friend" API, relax param assertions
    
    * added a "friend" API, so the descendant CamelKolabIMAPXConnManager
      can access otherwise-internal functions of its parent (this class)
    * allow NULL folder names in get_connection() function

 src/camel/providers/imapx/Makefile.am              |    1 +
 .../imapx/camel-imapx-extd-conn-manager-friend.h   |   46 ++++++++++++++++++++
 .../imapx/camel-imapx-extd-conn-manager.c          |   33 +++++++++++++-
 3 files changed, 78 insertions(+), 2 deletions(-)
---
diff --git a/src/camel/providers/imapx/Makefile.am b/src/camel/providers/imapx/Makefile.am
index 95e109b..4d8e944 100644
--- a/src/camel/providers/imapx/Makefile.am
+++ b/src/camel/providers/imapx/Makefile.am
@@ -46,6 +46,7 @@ noinst_HEADERS =				\
 	camel-imapx-conn-manager-defs.h		\
 	camel-imapx-conn-manager-friend.h	\
 	camel-imapx-extd-conn-manager.h		\
+	camel-imapx-extd-conn-manager-friend.h	\
 	camel-imapx-folder.h			\
 	camel-imapx-folder-defs.h		\
 	camel-imapx-folder-friend.h		\
diff --git a/src/camel/providers/imapx/camel-imapx-extd-conn-manager-friend.h b/src/camel/providers/imapx/camel-imapx-extd-conn-manager-friend.h
new file mode 100644
index 0000000..45d17a6
--- /dev/null
+++ b/src/camel/providers/imapx/camel-imapx-extd-conn-manager-friend.h
@@ -0,0 +1,46 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/***************************************************************************
+ *            camel-imapx-extd-conn-manager-friend.h
+ *
+ *  2011-12-20, 15:59:18
+ *  Copyright 2011, Christian Hilberg
+ *  <hilberg unix-ag org>
+ ****************************************************************************/
+
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with main.c; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
+ */
+
+/*----------------------------------------------------------------------------*/
+
+#ifndef _CAMEL_IMAPX_EXTD_CONN_MANAGER_FRIEND_H_
+#define _CAMEL_IMAPX_EXTD_CONN_MANAGER_FRIEND_H_
+
+/*----------------------------------------------------------------------------*/
+
+void
+camel_imapx_extd_conn_manager_conn_shutdown (CamelIMAPXServer *is,
+                                             CamelIMAPXConnManager *con_man);
+
+void
+camel_imapx_extd_conn_manager_conn_update_select (CamelIMAPXServer *is,
+                                                  const gchar *selected_folder,
+                                                  CamelIMAPXConnManager *con_man);
+
+/*----------------------------------------------------------------------------*/
+
+#endif /* _CAMEL_IMAPX_EXTD_CONN_MANAGER_FRIEND_H_ */
+
+/*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-extd-conn-manager.c b/src/camel/providers/imapx/camel-imapx-extd-conn-manager.c
index fb222df..1dc4323 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-conn-manager.c
+++ b/src/camel/providers/imapx/camel-imapx-extd-conn-manager.c
@@ -108,7 +108,7 @@ extd_conn_manager_new_connection_unlocked (CamelIMAPXConnManager *con_man,
 	gboolean success = FALSE;
 
 	g_assert (CAMEL_IS_IMAPX_EXTD_CONN_MANAGER (con_man));
-	g_assert (folder_name != NULL);
+	/* folder_name may be NULL */
 	/* cancellable may be NULL */
 	g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
@@ -201,7 +201,7 @@ imapx_extd_conn_manager_get_connection (CamelIMAPXConnManager *self,
 	CamelIMAPXServer *is = NULL;
 
 	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_CONN_MANAGER (self), NULL);
-	g_assert (foldername != NULL);
+	/* foldername may be NULL */
 	/* cancellable may be NULL */
 	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
 
@@ -383,3 +383,32 @@ camel_imapx_extd_conn_manager_update_con_info (CamelIMAPXConnManager *self,
 }
 
 /*----------------------------------------------------------------------------*/
+/* "friend" API */
+
+#include "camel-imapx-extd-conn-manager-friend.h"
+
+void
+camel_imapx_extd_conn_manager_conn_shutdown (CamelIMAPXServer *is,
+                                             CamelIMAPXConnManager *con_man)
+{
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (is));
+	g_assert (CAMEL_IS_IMAPX_EXTD_CONN_MANAGER (con_man));
+
+	extd_conn_manager_conn_shutdown (is, con_man);
+}
+
+void
+camel_imapx_extd_conn_manager_conn_update_select (CamelIMAPXServer *is,
+                                                  const gchar *selected_folder,
+                                                  CamelIMAPXConnManager *con_man)
+{
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (is));
+	g_assert (selected_folder != NULL);
+	g_assert (CAMEL_IS_IMAPX_EXTD_CONN_MANAGER (con_man));
+
+	extd_conn_manager_conn_update_select (is,
+	                                      selected_folder,
+	                                      con_man);
+}
+
+/*----------------------------------------------------------------------------*/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]