Created function which returns configuration_id by file_hash and file_name
[irreco.git] / irreco / src / webdb / irreco_webdb_client.h
blobce568881818a3cf2e0b753086f655edd3f106767
1 /*
2 * irreco - Ir Remote Control
3 * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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.
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 Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 /**
21 * @addtogroup IrrecoWebdbClient
22 * @{
25 /**
26 * @file
27 * Header file of @ref IrrecoWebdbClient.
31 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
32 /* Typedef */
33 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
35 * Make sure that typedefs are available before we include anything elese.
37 * This makes sure that whatever other structures that depend on structures
38 * defined in this file will compile OK recardles of header inclusion order.
40 #ifndef __IRRECO_WEBDB_CLIENT_TYPEDEF__
41 #define __IRRECO_WEBDB_CLIENT_TYPEDEF__
42 typedef struct _IrrecoWebdbClient IrrecoWebdbClient;
43 #endif /* __IRRECO_WEBDB_CLIENT_TYPEDEF__ */
47 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
48 /* Include */
49 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
50 #ifndef __IRRECO_WEBDB_CLIENT__
51 #define __IRRECO_WEBDB_CLIENT__
52 #include "irreco_webdb.h"
54 #include <stdlib.h>
55 #include <stdio.h>
56 #include "irreco_webdb_conf.h"
57 #include "irreco_webdb_theme.h"
58 #include "irreco_webdb_remote.h"
59 #include <libsoup/soup.h>
60 #include <libsoup/soup-xmlrpc-message.h>
61 #include "irreco_sha1.h"
63 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
64 /* Datatypes */
65 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
67 struct _IrrecoWebdbClient
69 GString *error_msg;
74 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
75 /* Macro */
76 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
80 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
81 /* Prototypes */
82 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
83 IrrecoWebdbClient *irreco_webdb_client_new();
84 void irreco_webdb_client_free(IrrecoWebdbClient *self);
85 void irreco_webdb_client_get_error_msg(IrrecoWebdbClient *self, GString *msg);
86 gboolean irreco_webdb_client_add_user(IrrecoWebdbClient *self,
87 const gchar *name,
88 const gchar *email,
89 const gchar *passwd);
90 gboolean irreco_webdb_client_add_uber(IrrecoWebdbClient *self,
91 const gchar *name,
92 const gchar *email,
93 const gchar *passwd);
94 gboolean irreco_webdb_client_upload_configuration(IrrecoWebdbClient *self,
95 const gchar *backend,
96 const gchar *category,
97 const gchar *file_hash,
98 const gchar *file_name,
99 const gchar *manufacturer,
100 const gchar *model,
101 const gchar *password,
102 const gchar *user,
103 const gchar *data);
105 gboolean irreco_webdb_client_sum(IrrecoWebdbClient *self,
106 gint num_a,
107 gint num_b,
108 gint *sum);
109 gboolean irreco_webdb_client_get_categories(IrrecoWebdbClient *self,
110 IrrecoStringTable **category_list);
112 gboolean irreco_webdb_client_get_all_categories(IrrecoWebdbClient *self,
113 IrrecoStringTable **category_list);
115 gboolean irreco_webdb_client_get_manufacturers(IrrecoWebdbClient *self,
116 const gchar *category,
117 IrrecoStringTable **manufacturer_list);
119 gboolean irreco_webdb_client_get_all_manufacturers(IrrecoWebdbClient *self,
120 IrrecoStringTable **manufacturer_list);
122 gboolean irreco_webdb_client_get_models(IrrecoWebdbClient *self,
123 const gchar *category,
124 const gchar *manufacturer,
125 IrrecoStringTable **model_list);
127 gboolean irreco_webdb_client_get_configs(IrrecoWebdbClient *self,
128 const gchar *category,
129 const gchar *manufacturer,
130 const gchar *model,
131 IrrecoStringTable **config_list);
133 gboolean irreco_webdb_client_get_configuration(IrrecoWebdbClient *self,
134 gint id,
135 IrrecoWebdbConf **configuration);
137 gint irreco_webdb_client_get_config_id_by_file_hash_and_file_name(
138 IrrecoWebdbClient *self,
139 const gchar *file_hash,
140 const gchar *file_name);
142 gboolean irreco_webdb_client_get_file(IrrecoWebdbClient *self,
143 const gchar *file_hash,
144 const gchar *file_name,
145 GString **file_data);
147 gboolean irreco_webdb_client_get_user_exists(IrrecoWebdbClient *self,
148 const gchar *name, gboolean *user_exists);
150 gint irreco_webdb_client_get_max_image_size(IrrecoWebdbClient *self);
152 gint irreco_webdb_client_create_theme(IrrecoWebdbClient *self,
153 const gchar *name,
154 const gchar *comment,
155 const gchar *preview_button,
156 const gchar *folder,
157 const gchar *user,
158 const gchar *password);
160 gboolean irreco_webdb_client_set_theme_downloadable(IrrecoWebdbClient *self,
161 gint id,
162 gboolean downloadable,
163 const gchar *user,
164 const gchar *password);
166 gboolean irreco_webdb_client_get_themes(IrrecoWebdbClient *self,
167 IrrecoStringTable **theme_list);
169 gboolean irreco_webdb_client_get_theme_by_id(IrrecoWebdbClient *self,
170 gint theme_id,
171 IrrecoWebdbTheme **theme);
173 gboolean irreco_webdb_client_get_theme_versions_by_name(IrrecoWebdbClient *self,
174 const char *name,
175 IrrecoStringTable **theme_list);
177 gchar *irreco_webdb_client_get_theme_date_by_id(IrrecoWebdbClient *self,
178 gint theme_id);
180 gint irreco_webdb_client_get_theme_id_by_name_and_date(IrrecoWebdbClient *self,
181 const gchar *name,
182 const gchar *date);
184 gint irreco_webdb_client_add_bg_to_theme(IrrecoWebdbClient *self,
185 const gchar *name,
186 const gchar *image_hash,
187 const gchar *image_name,
188 const guchar *image,
189 gint image_len,
190 const gchar *folder,
191 gint theme_id,
192 const gchar *user,
193 const gchar *password);
195 gboolean irreco_webdb_client_get_backgrounds(IrrecoWebdbClient *self,
196 gint theme_id,
197 IrrecoStringTable **bg_list);
199 gboolean irreco_webdb_client_get_bg_by_id(IrrecoWebdbClient *self,
200 gint bg_id,
201 const char *theme_bg_dir);
203 gint irreco_webdb_client_add_button_to_theme(IrrecoWebdbClient *self,
204 const gchar *name,
205 gboolean allow_text,
206 const gchar *text_format_up,
207 const gchar *text_format_down,
208 gint text_padding,
209 gfloat text_h_align,
210 gfloat text_v_align,
211 const gchar *image_up_hash,
212 const gchar *image_up_name,
213 const guchar *image_up,
214 gint image_up_len,
215 const gchar *image_down_hash,
216 const gchar *image_down_name,
217 const guchar *image_down,
218 gint image_down_len,
219 const gchar *folder,
220 gint theme_id,
221 const gchar *user,
222 const gchar *password);
224 gboolean irreco_webdb_client_get_buttons(IrrecoWebdbClient *self,
225 gint theme_id,
226 IrrecoStringTable **button_list);
228 gboolean irreco_webdb_client_get_button_by_id(IrrecoWebdbClient *self,
229 gint button_id,
230 const char *theme_button_dir);
232 gboolean irreco_webdb_client_get_preview_button(IrrecoWebdbClient *self,
233 gint theme_id,
234 GdkPixbuf **preview_button);
236 gboolean irreco_webdb_client_login(IrrecoWebdbClient *self,
237 const gchar *user,
238 const gchar *password);
240 gint irreco_webdb_client_create_new_remote(IrrecoWebdbClient *self,
241 const gchar *comment,
242 const gchar *category,
243 const gchar *manufacturer,
244 const gchar *model,
245 const gchar *file_name,
246 const gchar *file_data,
247 const gchar *user,
248 const gchar *password);
250 gboolean irreco_webdb_client_set_remote_downloadable(IrrecoWebdbClient *self,
251 gint id,
252 gboolean downloadable,
253 const gchar *user,
254 const gchar *password);
256 gboolean irreco_webdb_client_add_configuration_to_remote(
257 IrrecoWebdbClient *self,
258 gint remote_id,
259 gint configuration_id,
260 const gchar *user,
261 const gchar *password);
263 gboolean irreco_webdb_client_add_theme_to_remote(IrrecoWebdbClient *self,
264 gint remote_id,
265 gint theme_id,
266 const gchar *user,
267 const gchar *password);
269 gboolean irreco_webdb_client_get_remote_categories(IrrecoWebdbClient *self,
270 IrrecoStringTable **category_list);
272 gboolean irreco_webdb_client_get_remote_manufacturers(IrrecoWebdbClient *self,
273 const gchar *category,
274 IrrecoStringTable **manufacturer_list);
276 gboolean irreco_webdb_client_get_remote_models(IrrecoWebdbClient *self,
277 const gchar *category,
278 const gchar *manufacturer,
279 IrrecoStringTable **model_list);
281 gboolean irreco_webdb_client_get_remote_creators(IrrecoWebdbClient *self,
282 const gchar *category,
283 const gchar *manufacturer,
284 const gchar *model,
285 IrrecoStringTable **creators);
287 gboolean irreco_webdb_client_get_remotes(IrrecoWebdbClient *self,
288 const gchar *category,
289 const gchar *manufacturer,
290 const gchar *model,
291 const gchar *creator,
292 GList **remote_list);
294 gboolean irreco_webdb_client_get_remote_by_id(IrrecoWebdbClient *self,
295 gint id,
296 IrrecoWebdbRemote **remote);
298 gboolean irreco_webdb_client_get_themes_of_remote(IrrecoWebdbClient *self,
299 gint remote_id,
300 GList **themes);
302 gboolean irreco_webdb_client_get_configurations_of_remote(
303 IrrecoWebdbClient *self,
304 gint remote_id,
305 GList **configs);
307 #endif /* __IRRECO_WEBDB_CLIENT__ */
309 /** @} */