2005-01-20 [paul] 1.0.0cvs3.1
[claws.git] / src / addrindex.h
index e2cc4b4d2b41d52b15e5cc2f284d92f4f0848afe..0c940b639c4ee675ad1845dc357cc57ea28a4526 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2001 Match Grun
+ * Copyright (C) 2001-2003 Match Grun
  *
  * 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
@@ -27,6 +27,8 @@
 #include <stdio.h>
 #include <glib.h>
 #include "addritem.h"
+#include "addrcache.h"
+#include "addrquery.h"
 
 #define ADDRESSBOOK_MAX_IFACE  4
 #define ADDRESSBOOK_INDEX_FILE "addrbook--index.xml"
@@ -54,6 +56,9 @@ struct _AddressIndex {
        AddressIfType lastType;
        gboolean dirtyFlag;
        GList *interfaceList;
+       GHashTable *hashCache;
+       gboolean loadedFlag;
+       GList *searchOrder;
 };
 
 typedef struct _AddressInterface AddressInterface;
@@ -77,8 +82,13 @@ struct _AddressInterface {
        GList *(*getListFolder)( void * );
        GList *(*getListPerson)( void * );
        GList *(*getAllPersons)( void * );
-       gchar *(*getName) ( void * );
+       GList *(*getAllGroups)( void * );
+       gchar *(*getName)( void * );
        void (*setAccessFlag)( void *, void * );
+       gboolean externalQuery;
+       gint searchOrder;
+       void (*startSearch)( void * );
+       void (*stopSearch)( void * );
 };
 
 typedef struct _AddressDataSource AddressDataSource;
@@ -89,42 +99,96 @@ struct _AddressDataSource {
        gpointer rawDataSource;
 };
 
-AddressIndex *addrindex_create_index();
-void addrindex_set_file_path( AddressIndex *addrIndex, const gchar *value );
-void addrindex_set_file_name( AddressIndex *addrIndex, const gchar *value );
-void addrindex_set_dirty( AddressIndex *addrIndex, const gboolean value );
-GList *addrindex_get_interface_list( AddressIndex *addrIndex );
-void addrindex_free_index( AddressIndex *addrIndex );
-void addrindex_print_index( AddressIndex *addrIndex, FILE *stream );
-
-AddressInterface *addrindex_get_interface( AddressIndex *addrIndex, AddressIfType ifType );
-AddressDataSource *addrindex_index_add_datasource( AddressIndex *addrIndex, AddressIfType ifType, gpointer dataSource );
-AddressDataSource *addrindex_index_remove_datasource( AddressIndex *addrIndex, AddressDataSource *dataSource );
-void addrindex_free_datasource( AddressIndex *addrIndex, AddressDataSource *ds );
-
-gint addrindex_read_data( AddressIndex *addrIndex );
-gint addrindex_write_to( AddressIndex *addrIndex, const gchar *newFile );
-gint addrindex_save_data( AddressIndex *addrIndex );
-gint addrindex_create_new_books( AddressIndex *addrIndex );
-gint addrindex_save_all_books( AddressIndex *addrIndex );
-
-gboolean addrindex_ds_get_modify_flag( AddressDataSource *ds );
-gboolean addrindex_ds_get_access_flag( AddressDataSource *ds );
-gboolean addrindex_ds_get_read_flag( AddressDataSource *ds );
-gint addrindex_ds_get_status_code( AddressDataSource *ds );
-gint addrindex_ds_read_data( AddressDataSource *ds );
+void addrindex_initialize              ( void );
+void addrindex_teardown                        ( void );
+
+AddressIndex *addrindex_create_index   ( void );
+AddressIndex *addrindex_get_object     ( void );
+void addrindex_set_file_path           ( AddressIndex *addrIndex,
+                                         const gchar *value );
+void addrindex_set_file_name           ( AddressIndex *addrIndex,
+                                         const gchar *value );
+void addrindex_set_dirty               ( AddressIndex *addrIndex,
+                                         const gboolean value );
+gboolean addrindex_get_loaded          ( AddressIndex *addrIndex );
+
+GList *addrindex_get_interface_list    ( AddressIndex *addrIndex );
+void addrindex_free_index              ( AddressIndex *addrIndex );
+void addrindex_print_index             ( AddressIndex *addrIndex, FILE *stream );
+
+AddressInterface *addrindex_get_interface      ( AddressIndex *addrIndex,
+                                                 AddressIfType ifType );
+
+AddressDataSource *addrindex_create_datasource ( AddressIfType ifType );
+
+AddressDataSource *addrindex_index_add_datasource      ( AddressIndex *addrIndex,
+                                                         AddressIfType ifType,
+                                                         gpointer dataSource );
+AddressDataSource *addrindex_index_remove_datasource   ( AddressIndex *addrIndex,
+                                                         AddressDataSource *dataSource );
+
+void addrindex_free_datasource         ( AddressDataSource *ds );
+gchar *addrindex_get_cache_id          ( AddressIndex *addrIndex,
+                                         AddressDataSource *ds );
+AddressDataSource *addrindex_get_datasource    ( AddressIndex *addrIndex,
+                                                 const gchar *cacheID );
+AddressCache *addrindex_get_cache      ( AddressIndex *addrIndex,
+                                         const gchar *cacheID );
+
+gint addrindex_read_data               ( AddressIndex *addrIndex );
+gint addrindex_write_to                        ( AddressIndex *addrIndex,
+                                         const gchar *newFile );
+gint addrindex_save_data               ( AddressIndex *addrIndex );
+gint addrindex_create_new_books                ( AddressIndex *addrIndex );
+gint addrindex_save_all_books          ( AddressIndex *addrIndex );
+
+gboolean addrindex_ds_get_modify_flag  ( AddressDataSource *ds );
+gboolean addrindex_ds_get_access_flag  ( AddressDataSource *ds );
+gboolean addrindex_ds_get_read_flag    ( AddressDataSource *ds );
+gint addrindex_ds_get_status_code      ( AddressDataSource *ds );
+gint addrindex_ds_read_data            ( AddressDataSource *ds );
 ItemFolder *addrindex_ds_get_root_folder( AddressDataSource *ds );
-GList *addrindex_ds_get_list_folder( AddressDataSource *ds );
-GList *addrindex_ds_get_list_person( AddressDataSource *ds );
-gchar *addrindex_ds_get_name( AddressDataSource *ds );
-void addrindex_ds_set_access_flag( AddressDataSource *ds, gboolean *value );
-gboolean addrindex_ds_get_readonly( AddressDataSource *ds );
-GList *addrindex_ds_get_all_persons( AddressDataSource *ds );
+GList *addrindex_ds_get_list_folder    ( AddressDataSource *ds );
+GList *addrindex_ds_get_list_person    ( AddressDataSource *ds );
+gchar *addrindex_ds_get_name           ( AddressDataSource *ds );
+void addrindex_ds_set_access_flag      ( AddressDataSource *ds,
+                                         gboolean *value );
+gboolean addrindex_ds_get_readonly     ( AddressDataSource *ds );
+GList *addrindex_ds_get_all_persons    ( AddressDataSource *ds );
+GList *addrindex_ds_get_all_groups     ( AddressDataSource *ds );
+
+/* Search support */
+gint addrindex_setup_search            ( const gchar *searchTerm,
+                                         void *callBackEnd,
+                                         void *callBackEntry );
+
+gint addrindex_setup_static_search     ( AddressDataSource *ds,
+                                         const gchar *searchTerm,
+                                         ItemFolder *folder,
+                                         void *callBackEnd,
+                                         void *callBackEntry );
+
+gboolean addrindex_start_search                ( const gint queryID );
+void addrindex_stop_search             ( const gint queryID );
+gint addrindex_setup_explicit_search   ( AddressDataSource *ds, 
+                                         const gchar *searchTerm, 
+                                         ItemFolder *folder,
+                                         void *callBackEnd,
+                                         void *callBackEntry );
+void addrindex_remove_results          ( AddressDataSource *ds,
+                                         ItemFolder *folder );
+
+gboolean addrindex_load_completion(
+               gint (*callBackFunc)
+                       ( const gchar *, const gchar *, 
+                         const gchar *, const gchar * ) );
+
+gboolean addrindex_load_person_attribute( const gchar *attr,
+               gint (*callBackFunc)
+                       ( ItemPerson *, const gchar * ) );
 
 #endif /* __ADDRINDEX_H__ */
 
 /*
 * End of Source.
 */
-
-