Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / servers / groupwise / e-gw-connection.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* 
3  * Authors : 
4  *  JP Rosevear <jpr@ximian.com>
5  *  Rodrigo Moya <rodrigo@ximian.com>
6  *
7  * Copyright 2003, Novell, Inc.
8  *
9  * This program is free software; you can redistribute it and/or 
10  * modify it under the terms of version 2 of the GNU Lesser General Public 
11  * License as published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
21  * USA
22  */
23
24 #ifndef E_GW_CONNECTION_H
25 #define E_GW_CONNECTION_H
26
27 #include <glib-object.h>
28 #include <libsoup/soup-soap-message.h>
29 #include "e-gw-proxy.h"
30 #include "e-gw-container.h"
31 #include "e-gw-item.h"
32 #include "e-gw-filter.h"
33 #include "e-gw-sendoptions.h"
34 #include "e-gw-recur-utils.h"
35
36 G_BEGIN_DECLS
37
38 #define E_TYPE_GW_CONNECTION            (e_gw_connection_get_type ())
39 #define E_GW_CONNECTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_GW_CONNECTION, EGwConnection))
40 #define E_GW_CONNECTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_GW_CONNECTION, EGwConnectionClass))
41 #define E_IS_GW_CONNECTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_GW_CONNECTION))
42 #define E_IS_GW_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_GW_CONNECTION))
43
44 typedef struct _EGwConnection        EGwConnection;
45 typedef struct _EGwConnectionClass   EGwConnectionClass;
46 typedef struct _EGwConnectionPrivate EGwConnectionPrivate;
47
48 struct _EGwConnection {
49         GObject parent;
50         EGwConnectionPrivate *priv;
51 };
52
53 struct _EGwConnectionClass {
54         GObjectClass parent_class;
55 };
56
57 /* TODO:This has to go either in a generic file or specific to junk*/
58 typedef struct {
59         char *id ;
60         char *match;
61         char *matchType;
62         char *lastUsed;
63         int version;
64         char *modified;
65 } EGwJunkEntry;
66
67 GType          e_gw_connection_get_type (void);
68 EGwConnection *e_gw_connection_new (const char *uri, const char *username, const char *password);
69
70 typedef enum {
71         E_GW_CONNECTION_STATUS_OK,
72         E_GW_CONNECTION_STATUS_INVALID_CONNECTION,
73         E_GW_CONNECTION_STATUS_INVALID_OBJECT,
74         E_GW_CONNECTION_STATUS_INVALID_RESPONSE,
75         E_GW_CONNECTION_STATUS_NO_RESPONSE,
76         E_GW_CONNECTION_STATUS_OBJECT_NOT_FOUND,
77         E_GW_CONNECTION_STATUS_UNKNOWN_USER,
78         E_GW_CONNECTION_STATUS_BAD_PARAMETER,
79         E_GW_CONNECTION_STATUS_ITEM_ALREADY_ACCEPTED,
80         E_GW_CONNECTION_STATUS_REDIRECT,
81         E_GW_CONNECTION_STATUS_OTHER,
82         E_GW_CONNECTION_STATUS_UNKNOWN
83 } EGwConnectionStatus;
84
85 #define E_GW_CURSOR_POSITION_CURRENT "current"
86 #define E_GW_CURSOR_POSITION_START "start"
87 #define E_GW_CURSOR_POSITION_END "end"
88
89 SoupSoapResponse   *e_gw_connection_send_message (EGwConnection *cnc, SoupSoapMessage *msg);
90 EGwConnectionStatus e_gw_connection_parse_response_status (SoupSoapResponse *response);
91 const char         *e_gw_connection_get_error_message (EGwConnectionStatus status);
92
93 EGwConnectionStatus e_gw_connection_logout (EGwConnection *cnc);
94 EGwConnectionStatus e_gw_connection_get_container_list (EGwConnection *cnc, const char *top, GList **container_list);
95 void                e_gw_connection_free_container_list (GList *container_list);
96 char               *e_gw_connection_get_container_id (EGwConnection *cnc, const char *name);
97 EGwConnectionStatus e_gw_connection_get_items (EGwConnection *cnc, const char *container,
98                                                const char *view, EGwFilter *filter, GList **list);
99 EGwConnectionStatus e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes, GSList **updates);
100 EGwConnectionStatus e_gw_connection_send_item (EGwConnection *cnc, EGwItem *item, GSList **id_list);
101 EGwConnectionStatus e_gw_connection_remove_item (EGwConnection *cnc, const char *container, const char *id);
102 EGwConnectionStatus e_gw_connection_remove_items (EGwConnection *cnc, const char *container, GList *item_ids);
103 EGwConnectionStatus e_gw_connection_get_items_delta_info (EGwConnection *cnc, const char *container, gdouble *first_sequence, gdouble *last_sequence, gdouble *last_po_rebuild_time);
104 EGwConnectionStatus e_gw_connection_get_items_delta (EGwConnection *cnc, const char *container, const char *view, const char *count, const char * start_sequence, GList **add_list, GList **delete_list);
105
106
107 const char         *e_gw_connection_get_uri (EGwConnection *cnc);
108 const char         *e_gw_connection_get_session_id (EGwConnection *cnc);
109 const char         *e_gw_connection_get_user_name (EGwConnection *cnc);
110 const char         *e_gw_connection_get_user_email (EGwConnection *cnc);
111 const char         *e_gw_connection_get_user_uuid (EGwConnection *cnc);
112 const char         *e_gw_connection_get_version (EGwConnection *cnc);
113 const char         *e_gw_connection_get_server_time (EGwConnection *cnc) ;
114
115
116 time_t              e_gw_connection_get_date_from_string (const char *dtstring);
117 char               *e_gw_connection_format_date_string (const char *dtstring);
118
119
120 EGwConnectionStatus e_gw_connection_create_item (EGwConnection *cnc, EGwItem *item, char** id);
121 EGwConnectionStatus e_gw_connection_get_item (EGwConnection *cnc, const char *container, const char *id, const char *view, EGwItem **item);
122 EGwConnectionStatus e_gw_connection_modify_item (EGwConnection *cnc, const char *id, EGwItem *item);
123 EGwConnectionStatus e_gw_connection_accept_request (EGwConnection *cnc, const char *id, const char *accept_level, const char *accept_comment, const char *recurrence_key);
124 EGwConnectionStatus e_gw_connection_decline_request (EGwConnection *cnc, const char *id, const char *decline_comment, const char *recurrence_key);
125 EGwConnectionStatus e_gw_connection_retract_request (EGwConnection *cnc, const char *id, const char *comment, gboolean retract_all, gboolean resend);
126 EGwConnectionStatus e_gw_connection_complete_request (EGwConnection *cnc, const char *id);
127 EGwConnectionStatus e_gw_connection_delegate_request (EGwConnection *cnc, EGwItem *item, const char *id, const char *comments_org, const char *comments_del, const char *recur_key);
128 EGwConnectionStatus e_gw_connection_create_book (EGwConnection *cnc, char *book_name, char**id);
129 EGwConnectionStatus e_gw_connection_remove_book (EGwConnection *cnc, char *book_uid);
130 EGwConnectionStatus e_gw_connection_get_address_book_list (EGwConnection *cnc, GList **container_list);
131 EGwConnectionStatus e_gw_connection_get_address_book_id ( EGwConnection *cnc, char *book_name, char**id , gboolean *is_writable);
132 EGwConnectionStatus e_gw_connection_get_categories  (EGwConnection *cnc, GHashTable **categories_by_id, GHashTable **categoreis_by_name);
133 EGwConnectionStatus e_gw_connection_add_members (EGwConnection *cnc, const char *group_id, GList *member_ids);
134 EGwConnectionStatus e_gw_connection_remove_members (EGwConnection *cnc, const char *group_id, GList *member_ids);
135 EGwConnectionStatus e_gw_connection_get_items_from_ids (EGwConnection *cnc, const char *container, const char *view, GPtrArray *item_ids, GList **list);
136
137 EGwConnectionStatus e_gw_connection_create_cursor (EGwConnection *cnc, const char *container, const char *view, EGwFilter *filter, int *cursor);
138 EGwConnectionStatus e_gw_connection_destroy_cursor (EGwConnection *cnc, const char *container,  int cursor);
139 EGwConnectionStatus e_gw_connection_read_cursor (EGwConnection *cnc, const char *container, int cursor, gboolean forward, int count, const char *cursor_seek, GList **item_list);
140 EGwConnectionStatus e_gw_connection_position_cursor (EGwConnection *cnc, const char *container, int cursor, const char *seek, int offset);
141
142 EGwConnectionStatus e_gw_connection_get_quick_messages (EGwConnection *cnc, const char *container, const char *view, char **start_date, const char *message_list, const char *item_types, const char *item_sources, int count, GSList **item_list);
143
144 EGwConnectionStatus e_gw_connection_create_folder(EGwConnection *cnc, const char *parent_name,const char *folder_name, char **container_id) ;
145 EGwConnectionStatus
146 e_gw_connection_get_attachment (EGwConnection *cnc, const char *id, int offset, int length, const char **attachment, int *attach_length) ;
147 EGwConnectionStatus e_gw_connection_get_attachment_base64 (EGwConnection *cnc, const char *id, int offset, int length, const char **attachment, int *attach_length, int *offset_r);
148 EGwConnectionStatus e_gw_connection_add_item (EGwConnection *cnc, const char *container, const char *id) ;
149 EGwConnectionStatus e_gw_connection_add_items (EGwConnection *cnc, const char *container, GList *item_ids) ;
150 EGwConnectionStatus e_gw_connection_move_item (EGwConnection *cnc, const char *id, const char *dest_container_id, const char *from_container_id);
151 EGwConnectionStatus e_gw_connection_rename_folder (EGwConnection *cnc, const char *id ,const char *new_name) ;
152 EGwConnectionStatus e_gw_connection_get_settings (EGwConnection *cnc, EGwSendOptions **opts);
153 EGwConnectionStatus e_gw_connection_modify_settings (EGwConnection *cnc, EGwSendOptions *opts);
154 EGwConnectionStatus e_gw_connection_add_items (EGwConnection *cnc, const char *container, GList *item_ids) ;
155 EGwConnectionStatus e_gw_connection_rename_folder (EGwConnection *cnc, const char *id ,const char *new_name) ;
156 EGwConnectionStatus e_gw_connection_share_folder (EGwConnection *cnc, gchar *id, GList *new_list, const char *sub, const char *mesg ,int flag); 
157 EGwConnectionStatus e_gw_connection_accept_shared_folder (EGwConnection *cnc, gchar *folder_name, gchar *container_id, gchar *item_id, gchar *desc);
158 EGwConnectionStatus e_gw_connection_purge_deleted_items (EGwConnection *cnc);
159 EGwConnectionStatus e_gw_connection_purge_selected_items (EGwConnection *cnc, GList *item_ids);
160
161 EGwConnectionStatus e_gw_connection_mark_read(EGwConnection *cnc, GList *item_ids) ;
162 EGwConnectionStatus e_gw_connection_mark_unread(EGwConnection *cnc, GList *item_ids) ;
163 EGwConnectionStatus e_gw_connection_reply_item (EGwConnection *cnc, const char *id, const char *view, EGwItem **item) ;
164 EGwConnectionStatus e_gw_connection_forward_item (EGwConnection *cnc, const char *id, const char *view, gboolean embed, EGwItem **item);
165 EGwConnectionStatus e_gw_connection_create_junk_entry (EGwConnection *cnc, const char *value, const char *match_type , const char *list_type);
166 EGwConnectionStatus e_gw_connection_get_junk_settings (EGwConnection *cnc, int *use_junk, int *use_block, int *use_pab,  int *persistence);
167 EGwConnectionStatus e_gw_connection_modify_junk_settings (EGwConnection *cnc, int use_junk, int use_block, int use_pab , int persistence);
168 EGwConnectionStatus e_gw_connection_get_junk_entries (EGwConnection *cnc, GList **entries);
169 EGwConnectionStatus  e_gw_connection_remove_junk_entry (EGwConnection *cnc, const char *id);
170 EGwConnectionStatus e_gw_connection_read_cal_ids (EGwConnection *cnc, const char *container, int cursor, gboolean forward, int count, const char *cursor_seek, GList **list);
171 EGwConnectionStatus e_gw_connection_get_proxy_access_list (EGwConnection *cnc, GList **proxy_list);
172 EGwConnectionStatus e_gw_connection_add_proxy (EGwConnection *cnc, proxyHandler *new_proxy);
173 EGwConnectionStatus e_gw_connection_remove_proxy (EGwConnection *cnc, proxyHandler *newProxy);
174 EGwConnectionStatus e_gw_connection_modify_proxy (EGwConnection *cnc, proxyHandler *newProxy);
175 EGwConnectionStatus e_gw_connection_get_proxy_list (EGwConnection *cnc, GList **proxy_info);
176 EGwConnection *e_gw_connection_get_proxy_connection (EGwConnection *cnc1, char *username, const char *password, const char *proxy, int* permissions);
177 EGwConnectionStatus e_gw_connection_get_all_mail_uids (EGwConnection *cnc, const char *container, int cursor, gboolean forward, int count, const char *cursor_seek, GList **list);
178
179 G_END_DECLS
180
181 #endif