don't translate strings in debug_print(), log_print(), log_message(), and log_warning()
[claws.git] / src / addrquery.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 2003 Match Grun
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Functions to define an address query (a request).
22  */
23
24 #ifndef __ADDRQUERY_H__
25 #define __ADDRQUERY_H__
26
27 #include <glib.h>
28 #include <stdio.h>
29 #include <sys/time.h>
30 #include "addritem.h"
31
32 /* Query types */
33 #define ADDRQUERY_NONE  0
34 #define ADDRQUERY_LDAP  1
35
36 /* Search type */
37 typedef enum {
38         ADDRSEARCH_NONE,
39         ADDRSEARCH_DYNAMIC,
40         ADDRSEARCH_EXPLICIT,
41         ADDRSEARCH_LOCATE
42 } AddrSearchType;
43
44 /* Data structures */
45 typedef struct {
46         gint           queryID;
47         AddrSearchType searchType;
48         gchar          *searchTerm;
49         time_t         timeStart;
50         void           ( *callBackEnd ) ( void * );
51         void           ( *callBackEntry ) ( void * );
52         GList          *queryList;
53 }
54 QueryRequest;
55
56 /* Some macros */
57 #define ADDRQUERY_OBJECT(obj)           ((AddrQueryObject *)obj)
58 #define ADDRQUERY_TYPE(obj)             (ADDRQUERY_OBJECT(obj)->queryType)
59 #define ADDRQUERY_ID(obj)               (ADDRQUERY_OBJECT(obj)->queryID)
60 #define ADDRQUERY_SEARCHTYPE(obj)       (ADDRQUERY_OBJECT(obj)->searchType)
61 #define ADDRQUERY_NAME(obj)             (ADDRQUERY_OBJECT(obj)->queryName)
62 #define ADDRQUERY_RETVAL(obj)           (ADDRQUERY_OBJECT(obj)->retVal)
63 #define ADDRQUERY_FOLDER(obj)           (ADDRQUERY_OBJECT(obj)->folder)
64 #define ADDRQUERY_SEARCHVALUE(obj)      (ADDRQUERY_OBJECT(obj)->searchValue)
65
66 /* Generic address query (base class) */
67 typedef struct _AddrQueryObject AddrQueryObject;
68 struct _AddrQueryObject {
69         gint           queryType;
70         gint           queryID;
71         AddrSearchType searchType;
72         gchar          *queryName;
73         gint           retVal;
74         ItemFolder     *folder;         /* Reference to folder in cache */
75         gchar          *searchValue;
76 };
77
78 /* Address search call back functions */
79 typedef gint ( AddrSearchCallbackEntry ) ( gpointer sender,
80                                            gint queryID,
81                                            GList *listEMail,
82                                            gpointer data );
83
84 typedef void ( AddrSearchCallbackEnd ) ( gpointer sender,
85                                          gint queryID,
86                                          gint status,
87                                          gpointer data );
88
89 /* Function prototypes */
90 QueryRequest *qryreq_create     ( void );
91 void qryreq_clear               ( QueryRequest *req );
92 void qryreq_free                ( QueryRequest *req );
93 void qryreq_set_search_type     ( QueryRequest *req, const AddrSearchType value );
94 void qryreq_set_search_term     ( QueryRequest *req, const gchar *value );
95 void qryreq_add_query           ( QueryRequest *req, AddrQueryObject *aqo );
96 void qryreq_print               ( const QueryRequest *req, FILE *stream );
97
98 void qrymgr_initialize          ( void );
99 void qrymgr_teardown            ( void );
100 QueryRequest *qrymgr_add_request( const gchar *searchTerm,
101                                   void *callBackEnd,
102                                   void *callBackEntry );
103
104 QueryRequest *qrymgr_find_request( const gint queryID );
105 void qrymgr_delete_request      ( const gint queryID );
106 void qrymgr_print               ( FILE *stream );
107
108 #endif /* __ADDRQUERY_H__ */
109
110 /*
111 * End of Source.
112 */