26
26
#include "cd-mail-applet-accounts.h"
28
28
#define _add_icon(pMailAccount)\
29
pIcon = g_new0 (Icon, 1);\
30
pIcon->cName = g_strdup (pMailAccount->name);\
31
pIcon->cFileName = g_strdup (myConfig.cNoMailUserImage);\
32
pIcon->cQuickInfo = g_strdup ("...");\
36
pIcon->fWidthFactor = 1.;\
37
pIcon->fHeightFactor = 1.;\
38
pIcon->cCommand = g_strdup (pMailAccount->cMailApp);\
39
pIcon->cParentDockName = g_strdup (myIcon->cName);\
40
cd_debug (" + %s (%s)\n", pIcon->cName, pIcon->cFileName);\
41
pIconList = g_list_append (pIconList, pIcon);\
42
pMailAccount->icon = pIcon;
44
void cd_mail_create_pop3_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
29
pIcon = cairo_dock_create_dummy_launcher (g_strdup (pMailAccount->name),\
30
g_strdup (myConfig.cNoMailUserImage),\
31
g_strdup (pMailAccount->cMailApp),\
34
pIcon->cParentDockName = g_strdup (myIcon->cName);\
35
pIconList = g_list_append (pIconList, pIcon);\
36
pMailAccount->icon = pIcon;
39
const char *strings_to_translate[16] = {N_("Server address:"), N_("myHost"), N_("Username:"), N_("Password:"), N_("The password will be crypted."), N_("Port:"), N_("Enter 0 to use the default port. Default ports are 110 for POP3 or APOP and 995 for POP3S."), N_("Use a secure connection (SSL)"), N_("Timeout"), N_("In minutes."), N_("Specific mail application"), N_("Leave empty to use the default mail application."), N_("Directory on server:"), N_("Path of mbox file:"), N_("Path to Mail directory:"), N_("Address of feed:")};
41
void cd_mail_create_pop3_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
46
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "pop3");
47
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL); // on lui met un widget pour ne pas que la cle se fasse bazarder lors d'une mise a jour du fichier de conf.
49
g_key_file_set_string (pKeyFile, pMailAccountName, "host", "pop3.myhost.org");
50
g_key_file_set_comment (pKeyFile, pMailAccountName, "host", "s0 server address:", NULL);
52
g_key_file_set_string (pKeyFile, pMailAccountName, "username", "myLogin");
53
g_key_file_set_comment (pKeyFile, pMailAccountName, "username", "s0 username:", NULL);
55
g_key_file_set_string (pKeyFile, pMailAccountName, "password", "");
56
g_key_file_set_comment (pKeyFile, pMailAccountName, "password", "p0 password:\n{The password will be crypted.}", NULL);
58
g_key_file_set_integer (pKeyFile, pMailAccountName, "port", 0);
59
g_key_file_set_comment (pKeyFile, pMailAccountName, "port", "i0 port:\n{Enter 0 to use the default port. Default ports are 110 for POP3 or APOP and 995 for POP3S.}", NULL);
61
g_key_file_set_boolean (pKeyFile, pMailAccountName, "use secure connection", FALSE);
62
g_key_file_set_comment (pKeyFile, pMailAccountName, "use secure connection", "b0 use secure connection (SSL)", NULL);
64
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
65
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
67
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
68
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
43
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "pop3");
44
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL); // on lui met un widget pour ne pas que la cle se fasse bazarder lors d'une mise a jour du fichier de conf.
46
g_key_file_set_string (pKeyFile, pMailAccountName, "host", "pop3.myHost.org");
47
g_key_file_set_comment (pKeyFile, pMailAccountName, "host", "s0 Server address:", NULL);
49
g_key_file_set_string (pKeyFile, pMailAccountName, "username", N_("myLogin"));
50
g_key_file_set_comment (pKeyFile, pMailAccountName, "username", "s0 Username:", NULL);
52
g_key_file_set_string (pKeyFile, pMailAccountName, "password", "");
53
g_key_file_set_comment (pKeyFile, pMailAccountName, "password", "p0 Password:\n{The password will be crypted.}", NULL);
55
g_key_file_set_integer (pKeyFile, pMailAccountName, "port", 0);
56
g_key_file_set_comment (pKeyFile, pMailAccountName, "port", "i0 Port:\n{Enter 0 to use the default port. Default ports are 110 for POP3 or APOP and 995 for POP3S.}", NULL);
58
g_key_file_set_boolean (pKeyFile, pMailAccountName, "use secure connection", FALSE);
59
g_key_file_set_comment (pKeyFile, pMailAccountName, "use secure connection", "b0 Use a secure connection (SSL)", NULL);
61
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
62
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
64
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
65
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
71
void cd_mail_retrieve_pop3_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
68
void cd_mail_retrieve_pop3_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
73
70
if( !mailaccount || !pKeyFile || !mailbox_name ) return;
104
100
mailaccount->connection_type = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT (mailbox_name, "use secure connection", FALSE)?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN;
105
101
mailaccount->port = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "port", 0);
107
mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
110
void cd_mail_create_imap_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
104
void cd_mail_create_imap_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
112
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "imap");
113
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
115
g_key_file_set_string (pKeyFile, pMailAccountName, "host", "imap.myhost.org");
116
g_key_file_set_comment (pKeyFile, pMailAccountName, "host", "s0 server address:", NULL);
118
g_key_file_set_string (pKeyFile, pMailAccountName, "username", "myLogin");
119
g_key_file_set_comment (pKeyFile, pMailAccountName, "username", "s0 username:", NULL);
121
g_key_file_set_string (pKeyFile, pMailAccountName, "password", "");
122
g_key_file_set_comment (pKeyFile, pMailAccountName, "password", "p0 password:", NULL);
124
g_key_file_set_integer (pKeyFile, pMailAccountName, "port", 0);
125
g_key_file_set_comment (pKeyFile, pMailAccountName, "port", "i0 port:\n{Enter 0 to use the default port. Default ports are 143 for IMAP4 and 993 for IMAP4 over SSL.}", NULL);
127
g_key_file_set_boolean (pKeyFile, pMailAccountName, "use secure connection", FALSE);
128
g_key_file_set_comment (pKeyFile, pMailAccountName, "use secure connection", "b0 use secure connection (SSL)", NULL);
130
g_key_file_set_string (pKeyFile, pMailAccountName, "server_directory", "Inbox");
131
g_key_file_set_comment (pKeyFile, pMailAccountName, "server_directory", "s0 directory on server:", NULL);
133
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
134
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
136
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
137
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
106
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "imap");
107
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
109
g_key_file_set_string (pKeyFile, pMailAccountName, "host", "imap.myHost.org");
110
g_key_file_set_comment (pKeyFile, pMailAccountName, "host", "s0 Server address:", NULL);
112
g_key_file_set_string (pKeyFile, pMailAccountName, "username", N_("myLogin"));
113
g_key_file_set_comment (pKeyFile, pMailAccountName, "username", "s0 Username:", NULL);
115
g_key_file_set_string (pKeyFile, pMailAccountName, "password", "");
116
g_key_file_set_comment (pKeyFile, pMailAccountName, "password", "p0 Password:", NULL);
118
g_key_file_set_integer (pKeyFile, pMailAccountName, "port", 0);
119
g_key_file_set_comment (pKeyFile, pMailAccountName, "port", "i0 port:\n{Enter 0 to use the default port. Default ports are 143 for IMAP4 and 993 for IMAP4 over SSL.}", NULL);
121
g_key_file_set_boolean (pKeyFile, pMailAccountName, "use secure connection", FALSE);
122
g_key_file_set_comment (pKeyFile, pMailAccountName, "use secure connection", "b0 use secure connection (SSL)", NULL);
124
g_key_file_set_string (pKeyFile, pMailAccountName, "server_directory", "Inbox");
125
g_key_file_set_comment (pKeyFile, pMailAccountName, "server_directory", "s0 Directory on server:", NULL);
127
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
128
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
130
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
131
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
140
void cd_mail_retrieve_imap_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
134
void cd_mail_retrieve_imap_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
142
136
if( !mailaccount || !pKeyFile || !mailbox_name ) return;
186
void cd_mail_create_mbox_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
188
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "mbox");
189
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
191
g_key_file_set_string (pKeyFile, pMailAccountName, "filename", "");
192
g_key_file_set_comment (pKeyFile, pMailAccountName, "filename", "s0 path of mbox file:", NULL);
194
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
195
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
197
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
198
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
201
void cd_mail_retrieve_mbox_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
203
if( !mailaccount || !pKeyFile || !mailbox_name ) return;
205
gboolean bFlushConfFileNeeded = FALSE;
207
mailaccount->driver = MBOX_STORAGE;
208
mailaccount->storage = mailstorage_new(NULL);
209
mailaccount->folder = NULL;
210
mailaccount->server = NULL;
211
mailaccount->port = 0;
212
mailaccount->connection_type = CONNECTION_TYPE_PLAIN;
213
mailaccount->user = NULL;
214
mailaccount->password = NULL;
215
mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN;
216
mailaccount->timeout = 0;
217
if (g_key_file_has_key (pKeyFile, mailbox_name, "filename", NULL))
218
mailaccount->path = CD_CONFIG_GET_STRING_WITH_DEFAULT (mailbox_name, "filename", "/");
219
if (mailaccount->path == NULL)
220
mailaccount->path = g_strdup("/");
221
mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
223
//{"filename", "ctime", "size", "interval", NULL, NULL}
226
void cd_mail_create_mh_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
228
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "mh");
229
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
231
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
232
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
234
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
235
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
238
void cd_mail_retrieve_mh_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
178
void cd_mail_create_mbox_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
180
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "mbox");
181
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
183
g_key_file_set_string (pKeyFile, pMailAccountName, "filename", "");
184
g_key_file_set_comment (pKeyFile, pMailAccountName, "filename", "s0 Path of mbox file:", NULL);
186
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
187
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
189
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
190
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
193
void cd_mail_retrieve_mbox_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
240
195
if( !mailaccount || !pKeyFile || !mailbox_name ) return;
242
197
gboolean bFlushConfFileNeeded = FALSE;
199
mailaccount->driver = MBOX_STORAGE;
200
mailaccount->storage = mailstorage_new(NULL);
201
mailaccount->folder = NULL;
202
mailaccount->server = NULL;
203
mailaccount->port = 0;
204
mailaccount->connection_type = CONNECTION_TYPE_PLAIN;
205
mailaccount->user = NULL;
206
mailaccount->password = NULL;
207
mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN;
209
if (g_key_file_has_key (pKeyFile, mailbox_name, "filename", NULL))
210
mailaccount->path = CD_CONFIG_GET_STRING_WITH_DEFAULT (mailbox_name, "filename", "/");
211
if (mailaccount->path == NULL)
212
mailaccount->path = g_strdup("/");
214
//{"filename", "ctime", "size", "interval", NULL, NULL}
217
void cd_mail_create_mh_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
219
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "mh");
220
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
222
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
223
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
225
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
226
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
229
void cd_mail_retrieve_mh_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
231
if( !mailaccount || !pKeyFile || !mailbox_name ) return;
244
233
mailaccount->driver = MH_STORAGE;
245
234
mailaccount->storage = mailstorage_new(NULL);
246
235
mailaccount->folder = NULL;
251
240
mailaccount->password = NULL;
252
241
mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN;
253
242
mailaccount->path = g_strdup("/");
254
mailaccount->timeout = 0;
256
mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
259
void cd_mail_create_maildir_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
245
void cd_mail_create_maildir_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
261
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "maildir");
262
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
264
g_key_file_set_string (pKeyFile, pMailAccountName, "path", "");
265
g_key_file_set_comment (pKeyFile, pMailAccountName, "path", "s0 path to mail directory:", NULL);
267
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
268
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
270
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
271
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
247
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "maildir");
248
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
250
g_key_file_set_string (pKeyFile, pMailAccountName, "path", "");
251
g_key_file_set_comment (pKeyFile, pMailAccountName, "path", "s0 Path to Mail directory:", NULL);
253
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
254
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
256
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
257
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
274
void cd_mail_retrieve_maildir_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
260
void cd_mail_retrieve_maildir_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
276
262
if( !mailaccount || !pKeyFile || !mailbox_name ) return;
287
273
mailaccount->password = NULL;
288
274
mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN;
289
275
mailaccount->path = g_strdup("/");
290
mailaccount->timeout = 0;
292
277
if (g_key_file_has_key (pKeyFile, mailbox_name, "path", NULL))
294
mailaccount->path = CD_CONFIG_GET_STRING (mailbox_name, "path");
279
mailaccount->path = CD_CONFIG_GET_STRING (mailbox_name, "path");
296
mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
298
281
//{"path", "mtime", "interval", NULL, NULL, NULL, NULL}
301
void cd_mail_create_gmail_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
284
void cd_mail_create_gmail_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
303
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "gmail");
304
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
306
g_key_file_set_string (pKeyFile, pMailAccountName, "username", "myLogin");
307
g_key_file_set_comment (pKeyFile, pMailAccountName, "username", "s0 username:", NULL);
309
g_key_file_set_string (pKeyFile, pMailAccountName, "password", "");
310
g_key_file_set_comment (pKeyFile, pMailAccountName, "password", "p0 password:", NULL);
312
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
313
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
315
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
316
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
286
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "gmail");
287
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
289
g_key_file_set_string (pKeyFile, pMailAccountName, "username", N_("myLogin"));
290
g_key_file_set_comment (pKeyFile, pMailAccountName, "username", "s0 Username:", NULL);
292
g_key_file_set_string (pKeyFile, pMailAccountName, "password", "");
293
g_key_file_set_comment (pKeyFile, pMailAccountName, "password", "p0 Password:", NULL);
295
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
296
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
298
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
299
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
319
void cd_mail_retrieve_gmail_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
302
void cd_mail_retrieve_gmail_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
321
304
if( !mailaccount || !pKeyFile || !mailbox_name ) return;
399
379
mailaccount->path = g_strdup( "https://mail.google.com/mail/feed/atom" );
401
mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
403
382
g_free( user_without_column );
404
383
g_free( password_without_column );
408
void cd_mail_create_feed_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
387
void cd_mail_create_feed_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
410
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "feed");
411
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
413
g_key_file_set_string (pKeyFile, pMailAccountName, "path", "http://www.glx-dock.org/rss/cd_svn.xml");
414
g_key_file_set_comment (pKeyFile, pMailAccountName, "path", "s0 address of feed:", NULL);
416
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
417
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
419
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
420
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
389
g_key_file_set_string (pKeyFile, pMailAccountName, "type", "feed");
390
g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
392
g_key_file_set_string (pKeyFile, pMailAccountName, "path", "http://identi.ca/api/statuses/user_timeline/cairodock.rss");
393
g_key_file_set_comment (pKeyFile, pMailAccountName, "path", "s0 Address of feed:", NULL);
395
g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
396
g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
398
g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
399
g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
423
void cd_mail_retrieve_feed_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
402
void cd_mail_retrieve_feed_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
425
404
if( !mailaccount || !pKeyFile || !mailbox_name ) return;
427
extern int mailstream_debug;
428
mailstream_debug = 1;
430
407
gboolean bFlushConfFileNeeded = FALSE;
463
438
void cd_mail_init_accounts(CairoDockModuleInstance *myApplet)
465
if (myData.pMailAccounts == NULL)
467
g_print ("%s (%d comptes)\n", __func__, myData.pMailAccounts->len);
469
//\_______________________ On initialise chaque compte.
470
CDMailAccount *pMailAccount;
471
GList *pIconList = NULL;
476
for (i = 0; i < myData.pMailAccounts->len; i ++)
478
pMailAccount = g_ptr_array_index (myData.pMailAccounts, i);
479
if( !pMailAccount ) continue;
482
switch (pMailAccount->driver) {
484
r = pop3_mailstorage_init(pMailAccount->storage, pMailAccount->server, pMailAccount->port,
485
NULL, pMailAccount->connection_type,
486
pMailAccount->auth_type, pMailAccount->user, pMailAccount->password,
487
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
491
r = imap_mailstorage_init(pMailAccount->storage, pMailAccount->server, pMailAccount->port,
492
NULL, pMailAccount->connection_type,
493
IMAP_AUTH_TYPE_PLAIN, pMailAccount->user, pMailAccount->password,
494
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/);
498
r = nntp_mailstorage_init(pMailAccount->storage, pMailAccount->server, pMailAccount->port,
499
NULL, pMailAccount->connection_type,
500
NNTP_AUTH_TYPE_PLAIN, pMailAccount->user, pMailAccount->password,
501
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
505
r = mbox_mailstorage_init(pMailAccount->storage, pMailAccount->path,
506
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
510
r = mh_mailstorage_init(pMailAccount->storage, pMailAccount->path,
511
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
514
case MAILDIR_STORAGE:
515
r = maildir_mailstorage_init(pMailAccount->storage, pMailAccount->path,
516
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
520
r = feed_mailstorage_init(pMailAccount->storage, pMailAccount->path,
521
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
527
// add an icon for this account.
528
if (myData.pMailAccounts->len == 1) // 1 seul compte
534
_add_icon (pMailAccount);
538
// if all is OK, then set a timeout for this mail account
539
if (r == MAIL_NO_ERROR)
541
CD_APPLET_SET_QUICK_INFO_ON_MY_ICON ("...");
542
pMailAccount->pAccountMailTimer = cairo_dock_new_task (pMailAccount->timeout * 60,
543
(CairoDockGetDataAsyncFunc) cd_mail_get_folder_data,
544
(CairoDockUpdateSyncFunc) cd_mail_update_account_status,
546
cairo_dock_launch_task (pMailAccount->pAccountMailTimer);
550
cd_warning ("mail : the mail account %s couldn't be initialized !", pMailAccount->name);
551
CairoContainer *pContainer = (myData.pMailAccounts->len == 1 ? myContainer : CD_APPLET_MY_ICONS_LIST_CONTAINER);
552
cairo_dock_set_quick_info (myDrawContext, pIcon, pContainer, "N/A");
556
//\_______________________ On efface l'ancienne liste.
557
CD_APPLET_DELETE_MY_ICONS_LIST;
559
//\_______________________ On charge la nouvelle liste.
560
if (myData.pMailAccounts->len > 1)
562
gpointer pConfig[2] = {GINT_TO_POINTER (FALSE), GINT_TO_POINTER (FALSE)};
563
CD_APPLET_LOAD_MY_ICONS_LIST (pIconList, myConfig.cRenderer, (iNbIcons > 1 ? "Caroussel" : "Simple"), (iNbIcons > 1 ? pConfig : NULL));
566
//\_______________ On dessine l'icone principale initialement.
567
CD_APPLET_SET_IMAGE_ON_MY_ICON (myConfig.cNoMailUserImage);
569
CD_APPLET_SET_QUICK_INFO_ON_MY_ICON ("...");
440
if (myData.pMailAccounts == NULL)
442
cd_debug ("%s (%d comptes)\n", __func__, myData.pMailAccounts->len);
444
//\_______________________ On initialise chaque compte.
445
CDMailAccount *pMailAccount;
446
GList *pIconList = NULL;
450
gboolean bIsGettingMail = FALSE;
452
for (i = 0; i < myData.pMailAccounts->len; i ++)
454
pMailAccount = g_ptr_array_index (myData.pMailAccounts, i);
455
if( !pMailAccount ) continue;
458
switch (pMailAccount->driver) {
460
r = pop3_mailstorage_init(pMailAccount->storage, pMailAccount->server, pMailAccount->port,
461
NULL, pMailAccount->connection_type,
462
pMailAccount->auth_type, pMailAccount->user, pMailAccount->password,
463
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
467
r = imap_mailstorage_init(pMailAccount->storage, pMailAccount->server, pMailAccount->port,
468
NULL, pMailAccount->connection_type,
469
IMAP_AUTH_TYPE_PLAIN, pMailAccount->user, pMailAccount->password,
470
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/);
474
r = nntp_mailstorage_init(pMailAccount->storage, pMailAccount->server, pMailAccount->port,
475
NULL, pMailAccount->connection_type,
476
NNTP_AUTH_TYPE_PLAIN, pMailAccount->user, pMailAccount->password,
477
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
481
r = mbox_mailstorage_init(pMailAccount->storage, pMailAccount->path,
482
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
486
r = mh_mailstorage_init(pMailAccount->storage, pMailAccount->path,
487
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
490
case MAILDIR_STORAGE:
491
r = maildir_mailstorage_init(pMailAccount->storage, pMailAccount->path,
492
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
496
r = feed_mailstorage_init(pMailAccount->storage, pMailAccount->path,
497
myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
503
// add an icon for this account.
504
if (myData.pMailAccounts->len == 1) // 1 seul compte
510
_add_icon (pMailAccount);
514
// if all is OK, then set a timeout for this mail account
515
if (r == MAIL_NO_ERROR)
517
CD_APPLET_SET_QUICK_INFO_ON_MY_ICON ("...");
518
pMailAccount->pAccountMailTimer = cairo_dock_new_task (pMailAccount->timeout * 60,
519
(CairoDockGetDataAsyncFunc) cd_mail_get_folder_data,
520
(CairoDockUpdateSyncFunc) cd_mail_update_account_status,
522
cairo_dock_launch_task (pMailAccount->pAccountMailTimer);
523
bIsGettingMail = TRUE;
527
cd_warning ("mail : the mail account %s couldn't be initialized !", pMailAccount->name);
528
CairoContainer *pContainer = (myData.pMailAccounts->len == 1 ? myContainer : CD_APPLET_MY_ICONS_LIST_CONTAINER);
529
cairo_dock_set_quick_info (pIcon, pContainer, "N/A");
533
//\_______________________ On efface l'ancienne liste.
534
CD_APPLET_DELETE_MY_ICONS_LIST;
536
//\_______________________ On charge la nouvelle liste.
539
gpointer pConfig[2] = {GINT_TO_POINTER (FALSE), GINT_TO_POINTER (FALSE)};
540
CD_APPLET_LOAD_MY_ICONS_LIST (pIconList, myConfig.cRenderer, "Caroussel", pConfig);
543
//\_______________ On dessine l'icone principale initialement.
544
CD_APPLET_SET_IMAGE_ON_MY_ICON (myConfig.cNoMailUserImage);
546
CD_APPLET_SET_QUICK_INFO_ON_MY_ICON ("...");
573
550
void cd_mail_free_account (CDMailAccount *pMailAccount)
575
if (pMailAccount == NULL)
578
cairo_dock_free_task( pMailAccount->pAccountMailTimer );
580
g_free( pMailAccount->name );
581
g_free( pMailAccount->server );
582
g_free( pMailAccount->user );
583
g_free( pMailAccount->password );
584
g_free( pMailAccount->path );
585
g_free( pMailAccount->cMailApp );
552
if (pMailAccount == NULL)
555
cairo_dock_free_task( pMailAccount->pAccountMailTimer );
557
g_free( pMailAccount->name );
558
g_free( pMailAccount->server );
559
g_free( pMailAccount->user );
560
g_free( pMailAccount->password );
561
g_free( pMailAccount->path );
562
g_free( pMailAccount->cMailApp );
587
if( pMailAccount->folder )
588
mailfolder_free(pMailAccount->folder);
589
if( pMailAccount->storage )
590
mailstorage_free(pMailAccount->storage);
592
g_list_foreach (pMailAccount->pUnseenMessageList, (GFunc) g_free, NULL);
593
g_list_free (pMailAccount->pUnseenMessageList);
595
g_list_foreach (pMailAccount->pUnseenMessageUid, (GFunc) g_free, NULL);
596
g_list_free (pMailAccount->pUnseenMessageUid);
598
g_free( pMailAccount );
564
if( pMailAccount->folder )
565
mailfolder_free(pMailAccount->folder);
566
if( pMailAccount->storage )
567
mailstorage_free(pMailAccount->storage);
569
g_list_foreach (pMailAccount->pUnseenMessageList, (GFunc) g_free, NULL);
570
g_list_free (pMailAccount->pUnseenMessageList);
572
g_list_foreach (pMailAccount->pUnseenMessageUid, (GFunc) g_free, NULL);
573
g_list_free (pMailAccount->pUnseenMessageUid);
575
g_free( pMailAccount );
601
578
void cd_mail_free_all_accounts (CairoDockModuleInstance *myApplet)
603
if (myData.pMailAccounts == NULL)
605
CDMailAccount *pMailAccount;
607
for (i = 0; i < myData.pMailAccounts->len; i ++)
609
pMailAccount = g_ptr_array_index (myData.pMailAccounts, i);
610
cd_mail_free_account (pMailAccount);
612
g_ptr_array_free (myData.pMailAccounts, TRUE);
613
myData.pMailAccounts = NULL;
580
if (myData.pMailAccounts == NULL)
582
CDMailAccount *pMailAccount;
584
for (i = 0; i < myData.pMailAccounts->len; i ++)
586
pMailAccount = g_ptr_array_index (myData.pMailAccounts, i);
587
cd_mail_free_account (pMailAccount);
589
g_ptr_array_free (myData.pMailAccounts, TRUE);
590
myData.pMailAccounts = NULL;