Bug Summary

File:rc/mail.c
Location:line 2980, column 6
Description:Value stored to 'pwd' is never read

Annotated Source Code

1/* GKrellM
2| Copyright (C) 1999-2010 Bill Wilson
3|
4| Author: Bill Wilson billw@gkrellm.net
5| Latest versions might be found at: http://gkrellm.net
6|
7|
8| GKrellM is free software: you can redistribute it and/or modify it
9| under the terms of the GNU General Public License as published by
10| the Free Software Foundation, either version 3 of the License, or
11| (at your option) any later version.
12|
13| GKrellM is distributed in the hope that it will be useful, but WITHOUT
14| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15| or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16| License for more details.
17|
18| You should have received a copy of the GNU General Public License
19| along with this program. If not, see http://www.gnu.org/licenses/
20|
21|
22| Additional permission under GNU GPL version 3 section 7
23|
24| If you modify this program, or any covered work, by linking or
25| combining it with the OpenSSL project's OpenSSL library (or a
26| modified version of that library), containing parts covered by
27| the terms of the OpenSSL or SSLeay licenses, you are granted
28| additional permission to convey the resulting work.
29| Corresponding Source for a non-source form of such a combination
30| shall include the source code for the parts of OpenSSL used as well
31| as that of the covered work.
32*/
33
34#include "gkrellm.h"
35#include "gkrellm-private.h"
36
37#include <utime.h>
38#include <sys/time.h>
39#include <errno(*__errno_location ()).h>
40
41#include "pixmaps/mail/decal_mail.xpm"
42
43#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
44#define HAVE_MD5_H
45#endif
46
47#if defined(HAVE_GNUTLS)
48#include <gnutls/openssl.h>
49
50#define MD5InitMD5_Init MD5_Init
51#define MD5UpdateMD5_Update MD5_Update
52#define MD5FinalMD5_Final MD5_Final
53
54#if GNUTLS_VERSION_NUMBER <= 0x020b00
55#include <gcrypt.h>
56/* gcrypt mutex setup is only needed for GnuTLS < 2.12 */
57
58static int gk_gcry_glib_mutex_init (void **priv) {
59 GMutex *lock = g_mutex_new();
60 if (!lock)
61 return ENOMEM12;
62 *priv = lock;
63 return 0;
64}
65
66static int gk_gcry_glib_mutex_destroy (void **lock) {
67 if (!lock || !*lock)
68 return 1; // what to return?
69 g_mutex_free((GMutex *)*lock);
70 return 0;
71}
72
73static int gk_gcry_glib_mutex_lock (void **lock) {
74 if (!lock || !*lock)
75 return 1; // what to return?
76 g_mutex_lock((GMutex*)*lock);
77 return 0;
78}
79
80static int gk_gcry_glib_mutex_unlock (void **lock) {
81 if (!lock || !*lock)
82 return 1; // what to return?
83 g_mutex_unlock((GMutex*)*lock);
84 return 0;
85}
86
87static struct gcry_thread_cbs gk_gcry_threads_glib = {
88 (GCRY_THREAD_OPTION_USER | (GCRY_THREAD_OPTION_VERSION << 8)),
89 NULL((void*)0) /* init() */,
90 gk_gcry_glib_mutex_init,
91 gk_gcry_glib_mutex_destroy,
92 gk_gcry_glib_mutex_lock,
93 gk_gcry_glib_mutex_unlock,
94 NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0)
95};
96
97#endif
98
99#else
100
101#if defined(HAVE_SSL1)
102#include <openssl/ssl.h>
103#include <openssl/md5.h>
104#define MD5InitMD5_Init MD5_Init
105#define MD5UpdateMD5_Update MD5_Update
106#define MD5FinalMD5_Final MD5_Final
107#else
108#if defined(HAVE_MD5_H)
109#include <md5.h>
110#else
111#include "md5.h"
112#endif
113#endif
114#endif
115
116#if defined(HAVE_NTLM1)
117#include <ntlm.h>
118#endif
119
120#define MUTE_FLAG-1 -1
121
122/* msg_count_mode has 3 states
123*/
124#define MSG_NEW_TOTAL_COUNT0 0
125#define MSG_NEW_COUNT1 1
126#define MSG_NO_COUNT2 2
127
128/* animation_mode states
129*/
130#define ANIMATION_NONE0 0
131#define ANIMATION_ENVELOPE1 1
132#define ANIMATION_PENGUIN2 2
133#define ANIMATION_BOTH3 3
134
135/* # of seconds to wait for a response from a POP3 or IMAP server
136*/
137#define TCP_TIMEOUT30 30
138#define DEFAULT_POP3_PORT"110" "110"
139#define DEFAULT_IMAP_PORT"143" "143"
140#define DEFAULT_IMAPS_PORT"993" "993"
141#define DEFAULT_POP3S_PORT"995" "995"
142
143
144 /* A mailbox type has bits encoding how to check the mailbox (inline code
145 | check or threaded check).
146 | Threaded checks and the fetch program are remote checks
147 */
148#define MBOX_CHECK_FETCH0x1000 0x1000
149#define MBOX_CHECK_INLINE0x2000 0x2000
150#define MBOX_CHECK_THREADED0x4000 0x4000
151#define MBOX_CHECK_TYPE_MASK0xf000 0xf000
152
153 /* Counts for mailboxes created and checked in other plugins can be shown */
154#define MBOX_EXTERNAL0x10 0x10
155
156 /* Mailboxes internally checked and created via the Mail->Mailboxes config */
157#define MBOX_INTERNAL0x20 0x20
158
159
160 /* Here's the list of all the mailbox types the Mail monitor knows about.
161 | The MBOX_FETCH is a pseudo internal mailbox where the counts read from
162 | the fetch program are kept. Additionally MBOX_FETCH_TOOLTIP types
163 | are constructed just so the fetch programs output lines can be
164 | reported in a tooltip. Real mailboxes that GKrellM creates in its
165 | config and knows how to check have MBOX_INTERNAL set. And
166 | finally there can be external (plugin) mailboxes created which
167 | can have their check function called at the update intervals. If the
168 | plugin reports back the count results, the animation/sound can be
169 | triggered for the plugin. (Don't know if EXTERNAL guys will ever be used)
170 | Internal mailboxes can be remote or local. Remote mailboxes have an
171 | authorization protocol that subdivides them into types. Local mailboxes
172 | currently have separate mboxtype values but I may later group them
173 | into a MBOX_LOCAL type with a subdivision protocol like is currently
174 | done for remote mailboxes.
175 */
176#define MBOX_FETCH(0x1000) (MBOX_CHECK_FETCH0x1000)
177#define MBOX_MBOX(0x2000 | 0x20 | 0) (MBOX_CHECK_INLINE0x2000 | MBOX_INTERNAL0x20 | 0)
178#define MBOX_MAILDIR(0x2000 | 0x20 | 1) (MBOX_CHECK_INLINE0x2000 | MBOX_INTERNAL0x20 | 1)
179#define MBOX_MH_DIR(0x2000 | 0x20 | 2) (MBOX_CHECK_INLINE0x2000 | MBOX_INTERNAL0x20 | 2)
180#define MBOX_REMOTE(0x4000 | 0x20 | 3) (MBOX_CHECK_THREADED0x4000 | MBOX_INTERNAL0x20 | 3)
181#define MBOX_FETCH_TOOLTIP(6) (6)
182
183#define MBOX_LOCAL_PLUGIN(0x2000 | 0x10) (MBOX_CHECK_INLINE0x2000 | MBOX_EXTERNAL0x10)
184#define MBOX_REMOTE_PLUGIN(0x4000 | 0x10) (MBOX_CHECK_THREADED0x4000 | MBOX_EXTERNAL0x10)
185
186#define PROTO_POP30 0
187#define PROTO_IMAP1 1
188
189#define AUTH_PLAINTEXT0 0
190#define AUTH_USER0 AUTH_PLAINTEXT0 /* POP3 only */
191#define AUTH_APOP1 1 /* POP3 only */
192#define AUTH_LOGIN0 AUTH_PLAINTEXT0 /* IMAP4 only */
193#define AUTH_CRAM_MD52 2
194#define AUTH_NTLM3 3
195
196#define SSL_NONE0 0
197#define SSL_TRANSPORT1 1
198#define SSL_STARTTLS2 2
199
200
201 /* Authorization protocol strings to write into the config for remote
202 | mailboxes.
203 */
204typedef struct
205 {
206 gchar *string;
207 gint protocol;
208 gint authmech;
209 }
210 AuthType;
211
212static AuthType auth_strings[] =
213 {
214 { "POP3", PROTO_POP30, AUTH_USER0 },
215 { "POP3_(APOP)", PROTO_POP30, AUTH_APOP1 },
216 { "POP3_(CRAM-MD5)",PROTO_POP30, AUTH_CRAM_MD52 },
217#ifdef HAVE_NTLM1
218 { "POP3_(NTLM)", PROTO_POP30, AUTH_NTLM3 },
219#endif
220 { "IMAP", PROTO_IMAP1, AUTH_LOGIN0 },
221 { "IMAP_(CRAM-MD5)",PROTO_IMAP1, AUTH_CRAM_MD52 },
222#ifdef HAVE_NTLM1
223 { "IMAP_(NTLM)", PROTO_IMAP1, AUTH_NTLM3 },
224#endif
225 { NULL((void*)0), -1, -1 }
226 };
227
228
229 /* Save local mailbox type strings in the config in case I later change
230 | to an option_menu selection for subdividing a MBOX_LOCAL type.
231 | Currently local mailbox types are determined in get_local_mboxtype().
232 */
233static gchar *mbox_strings[3] =
234 {
235 "mbox",
236 "Maildir",
237 "MH_mail"
238 };
239
240static GkrellmMonitor *mon_mail;
241
242typedef struct
243 {
244 gchar *path,
245 *homedir_path;
246 gchar *server;
247 gchar *username;
248 gchar *password;
249 gchar *imapfolder;
250 gint mboxtype;
251 gint protocol;
252 gint authmech;
253 gint port;
254 gint use_ssl; /* Always SSL_NONE if !HAVE_SSL */
255 }
256 MailAccount;
257
258typedef struct
259 {
260 MailAccount *account;
261 gboolean busy;
262 GString *tcp_in;
263 gboolean (*check_func)();
264 gpointer data; /* For external mailboxes (in plugins) */
265 GThread* thread;
266 gint mail_count;
267 gint new_mail_count;
268 gint old_mail_count;
269 gint prev_mail_count,
270 prev_new_mail_count;
271 time_t last_mtime;
272 off_t last_size;
273 gboolean is_internal; /* Internal mail message (ie: localmachine) */
274 gboolean need_animation,
275 prev_need_animation;
276 gchar *warn_msg;
277 gchar *uidl;
278 gboolean warned;
279 void *private;
280 }
281 Mailbox;
282
283static GList *mailbox_list;
284
285typedef struct
286 {
287 gchar *command;
288 GString *read_gstring; /* Bytes read from pipe stored here */
289 gint pipe;
290 }
291 Mailproc;
292
293typedef struct
294 {
295 gint fd;
296#ifdef HAVE_SSL1
297 SSL *ssl;
298 SSL_CTX *ssl_ctx;
299#endif
300 }
301 ConnInfo;
302
303Mailbox *mail_fetch; /* Internal mailbox: fetch command */
304
305static Mailproc mail_user_agent;
306static gchar *mail_notify; /* Sound */
307
308static GkrellmPiximage *decal_mail_piximage;
309
310static gint run_animation,
311 decal_frame;
312
313static gint remote_check_timeout = 5; /* Minutes */
314static gint local_check_timeout = 4; /* Seconds */
315static gboolean fetch_check_is_local;
316
317static GkrellmPanel *mail;
318
319#if !GTK_CHECK_VERSION(2,12,0)((2) > (2) || ((2) == (2) && (24) > (12)) || ((
2) == (2) && (24) == (12) && (23) >= (0)))
320static GtkTooltips *tooltip;
321#endif
322
323static GkrellmDecalbutton *mua_button;
324
325static gboolean enable_mail,
326 mute_mode,
327 super_mute_mode,
328 cont_animation_mode,
329 mua_inhibit_mode, /* Inhibit checking if MUA launched */
330 enable_multimua, /* allow multiple MUA instances */
331 count_mode,
332 fetch_check_only_mode,
333 reset_remote_mode,
334 unseen_is_new, /* Accessed but unread */
335 local_supported = TRUE(!(0));
336
337static gboolean mh_seq_ignore,
338 have_mh_sequences,
339 checking_mh_mail;
340
341static gint animation_mode = ANIMATION_BOTH3;
342
343static gboolean force_mail_check;
344static gint new_mail_count, total_mail_count;
345static gint check_timeout;
346static gint show_tooltip = FALSE(0);
347
348static gint anim_frame,
349 anim_dir,
350 anim_pause;
351
352static gint style_id;
353
354#ifdef HAVE_SSL1
355#ifndef HAVE_GNUTLS
356static GMutex **ssl_locks;
357
358static void
359ssl_locking_cb(int mode, int n, const char *file, int line)
360 {
361 if (mode & CRYPTO_LOCK1)
362 g_mutex_lock(ssl_locks[n]);
363 else
364 g_mutex_unlock(ssl_locks[n]);
365 }
366#endif
367#endif
368
369 /* This may be called from gkrellm_sys_main_init()
370 */
371void
372gkrellm_mail_local_unsupported(void)
373 {
374 local_supported = FALSE(0);
375 }
376
377GThread *
378gkrellm_mail_get_active_thread(void)
379 {
380 GList *list;
381 Mailbox *mbox;
382 GThread *thread;
383
384 for (list = mailbox_list; list; list = list->next)
385 {
386 mbox = (Mailbox *) list->data;
387 thread = mbox->thread;
388 if (thread)
389 return thread;
390 }
391 return NULL((void*)0);
392 }
393
394static void
395free_account(MailAccount *account)
396 {
397 if (!account)
398 return;
399 g_free(account->path);
400 g_free(account->homedir_path);
401 g_free(account->server);
402 g_free(account->username);
403 g_free(account->password);
404 g_free(account->imapfolder);
405 g_free(account);
406 }
407
408static void
409free_mailbox(Mailbox *mbox)
410 {
411 /* If user changes mailbox config list while a mailbox thread is busy,
412 | freeing the mbox can cause a segfault. Rare, so allow the leak.
413 */
414 if (mbox->busy)
415 return;
416 free_account(mbox->account);
417 g_free(mbox->warn_msg);
418 g_free(mbox);
419 }
420
421
422static gboolean
423format_remote_mbox_name(Mailbox *mbox, gchar *buf, size_t len)
424 {
425 MailAccount *account = mbox->account;
426
427 if (account->imapfolder && *account->imapfolder)
428 snprintf(buf, len, "%s-%s@%s", account->username,
429 account->imapfolder, account->server);
430 else if (account->server)
431 snprintf(buf, len, "%s@%s", account->username, account->server);
432 else if (account->username)
433 snprintf(buf, len, "%s", account->username);
434 else
435 {
436 snprintf(buf, len, "??");
437 return FALSE(0);
438 }
439 return TRUE(!(0));
440 }
441
442 /* Make tooltip visible/invisible and fill it with mailbox names
443 | containing new mail.
444 */
445static void
446update_tooltip(void)
447 {
448 GList *list;
449 Mailbox *mbox;
450 MailAccount *account;
451 GString *mboxes = NULL((void*)0);
452 gchar buf[128];
453
454 if (show_tooltip)
455 {
456 mboxes = g_string_sized_new(512);
457 for (list = mailbox_list; list; list = list->next)
458 {
459 mbox = (Mailbox *) list->data;
460 account = mbox->account;
461 if (mbox->new_mail_count > 0)
462 {
463 if (( account->mboxtype == MBOX_MBOX(0x2000 | 0x20 | 0)
464 || account->mboxtype == MBOX_MAILDIR(0x2000 | 0x20 | 1)
465 || account->mboxtype == MBOX_MH_DIR(0x2000 | 0x20 | 2)
466 || account->mboxtype == MBOX_LOCAL_PLUGIN(0x2000 | 0x10)
467 || account->mboxtype == MBOX_REMOTE_PLUGIN(0x4000 | 0x10)
468 ) && account->path
469 )
470 snprintf(buf, sizeof(buf), "%s", account->homedir_path ?
471 account->homedir_path : account->path);
472 else if (! format_remote_mbox_name(mbox, buf, sizeof(buf)))
473 continue; /* Can't get a name, so no tooltip for you! */
474
475 if (mboxes->len > 0)
476 g_string_append_c(mboxes, '\n')g_string_append_c_inline (mboxes, '\n');
477 g_string_append(mboxes, buf);
478
479 if (count_mode == MSG_NEW_TOTAL_COUNT0)
480 snprintf(buf, sizeof(buf), "(%d/%d)",
481 mbox->new_mail_count, mbox->mail_count);
482 else
483 snprintf(buf, sizeof(buf), "(%d)", mbox->new_mail_count);
484 g_string_append(mboxes, buf);
485 }
486 }
487 }
488
489 if (show_tooltip && mboxes && mboxes->len > 0)
490 {
491#if GTK_CHECK_VERSION(2,12,0)((2) > (2) || ((2) == (2) && (24) > (12)) || ((
2) == (2) && (24) == (12) && (23) >= (0)))
492 gtk_widget_set_tooltip_text(mail->drawing_area, mboxes->str);
493#else
494 gtk_tooltips_set_tip(tooltip, mail->drawing_area, mboxes->str, "");
495 gtk_tooltips_enable(tooltip);
496#endif
497 }
498 else
499 {
500#if GTK_CHECK_VERSION(2,12,0)((2) > (2) || ((2) == (2) && (24) > (12)) || ((
2) == (2) && (24) == (12) && (23) >= (0)))
501 gtk_widget_set_has_tooltip(mail->drawing_area, FALSE(0));
502#else
503 gtk_tooltips_disable(tooltip);
504#endif
505 }
506
507 if (mboxes)
508 g_string_free(mboxes, TRUE(!(0)));
509 }
510
511
512 /* Look at a From line to see if it is valid, lines look like:
513 | From sending_address dayofweek month dayofmonth timeofday year
514 | eg: From billw@gkrellm.net Fri Oct 22 13:52:49 2010
515 */
516static gint
517is_From_line(Mailbox *mbox, gchar *buf)
518 {
519 gchar sender[512];
520 gint dayofmonth = 0;
521
522 if (strncmp(buf, "From ", 5)(__extension__ (__builtin_constant_p (5) && ((__builtin_constant_p
(buf) && strlen (buf) < ((size_t) (5))) || (__builtin_constant_p
("From ") && strlen ("From ") < ((size_t) (5)))) ?
__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(buf) && __builtin_constant_p ("From ") && (
__s1_len = strlen (buf), __s2_len = strlen ("From "), (!((size_t
)(const void *)((buf) + 1) - (size_t)(const void *)(buf) == 1
) || __s1_len >= 4) && (!((size_t)(const void *)((
"From ") + 1) - (size_t)(const void *)("From ") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (buf, "From ") : (__builtin_constant_p
(buf) && ((size_t)(const void *)((buf) + 1) - (size_t
)(const void *)(buf) == 1) && (__s1_len = strlen (buf
), __s1_len < 4) ? (__builtin_constant_p ("From ") &&
((size_t)(const void *)(("From ") + 1) - (size_t)(const void
*)("From ") == 1) ? __builtin_strcmp (buf, "From ") : (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) ("From "); int __result = (((const unsigned char *) (
const char *) (buf))[0] - __s2[0]); if (__s1_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (buf))[1] - __s2[1]); if (__s1_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (buf))[2] - __s2[2]); if (__s1_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) (buf))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p
("From ") && ((size_t)(const void *)(("From ") + 1) -
(size_t)(const void *)("From ") == 1) && (__s2_len =
strlen ("From "), __s2_len < 4) ? (__builtin_constant_p (
buf) && ((size_t)(const void *)((buf) + 1) - (size_t)
(const void *)(buf) == 1) ? __builtin_strcmp (buf, "From ") :
(- (__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) (buf); int __result = (((const unsigned
char *) (const char *) ("From "))[0] - __s2[0]); if (__s2_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("From "))[1] - __s2[1]); if (__s2_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("From "))[2] - __s2[2]); if (__s2_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) ("From "))[3] - __s2[3]); } } __result
; })))) : __builtin_strcmp (buf, "From ")))); }) : strncmp (buf
, "From ", 5)))
)
523 return FALSE(0);
524
525 /* In case sending address missing, look for a day of month
526 | number in field 3 or 4 (0 based).
527 */
528 sender[0] = '\0';
529 if (sscanf(buf, "%*s %*s %*s %d", &dayofmonth) != 1)
530 {
531 if (sscanf(buf, "%*s %511s %*s %*s %d", sender, &dayofmonth) != 2)
532 return FALSE(0);
533 }
534 if (dayofmonth < 1 || dayofmonth > 31)
535 return FALSE(0);
536 if (strcmp(sender, "MAILER-DAEMON")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(sender) && __builtin_constant_p ("MAILER-DAEMON") &&
(__s1_len = strlen (sender), __s2_len = strlen ("MAILER-DAEMON"
), (!((size_t)(const void *)((sender) + 1) - (size_t)(const void
*)(sender) == 1) || __s1_len >= 4) && (!((size_t)
(const void *)(("MAILER-DAEMON") + 1) - (size_t)(const void *
)("MAILER-DAEMON") == 1) || __s2_len >= 4)) ? __builtin_strcmp
(sender, "MAILER-DAEMON") : (__builtin_constant_p (sender) &&
((size_t)(const void *)((sender) + 1) - (size_t)(const void *
)(sender) == 1) && (__s1_len = strlen (sender), __s1_len
< 4) ? (__builtin_constant_p ("MAILER-DAEMON") &&
((size_t)(const void *)(("MAILER-DAEMON") + 1) - (size_t)(const
void *)("MAILER-DAEMON") == 1) ? __builtin_strcmp (sender, "MAILER-DAEMON"
) : (__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) ("MAILER-DAEMON"); int __result = (((
const unsigned char *) (const char *) (sender))[0] - __s2[0])
; if (__s1_len > 0 && __result == 0) { __result = (
((const unsigned char *) (const char *) (sender))[1] - __s2[1
]); if (__s1_len > 1 && __result == 0) { __result =
(((const unsigned char *) (const char *) (sender))[2] - __s2
[2]); if (__s1_len > 2 && __result == 0) __result =
(((const unsigned char *) (const char *) (sender))[3] - __s2
[3]); } } __result; }))) : (__builtin_constant_p ("MAILER-DAEMON"
) && ((size_t)(const void *)(("MAILER-DAEMON") + 1) -
(size_t)(const void *)("MAILER-DAEMON") == 1) && (__s2_len
= strlen ("MAILER-DAEMON"), __s2_len < 4) ? (__builtin_constant_p
(sender) && ((size_t)(const void *)((sender) + 1) - (
size_t)(const void *)(sender) == 1) ? __builtin_strcmp (sender
, "MAILER-DAEMON") : (- (__extension__ ({ const unsigned char
*__s2 = (const unsigned char *) (const char *) (sender); int
__result = (((const unsigned char *) (const char *) ("MAILER-DAEMON"
))[0] - __s2[0]); if (__s2_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("MAILER-DAEMON"
))[1] - __s2[1]); if (__s2_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("MAILER-DAEMON"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("MAILER-DAEMON"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (sender
, "MAILER-DAEMON")))); })
== 0)
537 mbox->is_internal = TRUE(!(0));
538 return TRUE(!(0));
539 }
540
541
542 /* Check if this is a Content-Type-line. If it contains a boundary
543 | field, copy boundary string to buffer (including two leading and
544 | trailing dashes marking the end of a multipart mail) and return
545 | true. Otherwise, return false.
546 */
547static gint
548is_multipart_mail(gchar *buf, gchar *separator)
549 {
550 gchar *fieldstart;
551 gchar *sepstart;
552 gint seplen;
553
554 if (strncmp(buf, "Content-Type: ", 14)(__extension__ (__builtin_constant_p (14) && ((__builtin_constant_p
(buf) && strlen (buf) < ((size_t) (14))) || (__builtin_constant_p
("Content-Type: ") && strlen ("Content-Type: ") <
((size_t) (14)))) ? __extension__ ({ size_t __s1_len, __s2_len
; (__builtin_constant_p (buf) && __builtin_constant_p
("Content-Type: ") && (__s1_len = strlen (buf), __s2_len
= strlen ("Content-Type: "), (!((size_t)(const void *)((buf)
+ 1) - (size_t)(const void *)(buf) == 1) || __s1_len >= 4
) && (!((size_t)(const void *)(("Content-Type: ") + 1
) - (size_t)(const void *)("Content-Type: ") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (buf, "Content-Type: ") : (__builtin_constant_p
(buf) && ((size_t)(const void *)((buf) + 1) - (size_t
)(const void *)(buf) == 1) && (__s1_len = strlen (buf
), __s1_len < 4) ? (__builtin_constant_p ("Content-Type: "
) && ((size_t)(const void *)(("Content-Type: ") + 1) -
(size_t)(const void *)("Content-Type: ") == 1) ? __builtin_strcmp
(buf, "Content-Type: ") : (__extension__ ({ const unsigned char
*__s2 = (const unsigned char *) (const char *) ("Content-Type: "
); int __result = (((const unsigned char *) (const char *) (buf
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (buf))[
3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("Content-Type: "
) && ((size_t)(const void *)(("Content-Type: ") + 1) -
(size_t)(const void *)("Content-Type: ") == 1) && (__s2_len
= strlen ("Content-Type: "), __s2_len < 4) ? (__builtin_constant_p
(buf) && ((size_t)(const void *)((buf) + 1) - (size_t
)(const void *)(buf) == 1) ? __builtin_strcmp (buf, "Content-Type: "
) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) (buf); int __result = (((const unsigned
char *) (const char *) ("Content-Type: "))[0] - __s2[0]); if
(__s2_len > 0 && __result == 0) { __result = (((const
unsigned char *) (const char *) ("Content-Type: "))[1] - __s2
[1]); if (__s2_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) ("Content-Type: "
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("Content-Type: "
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (buf
, "Content-Type: ")))); }) : strncmp (buf, "Content-Type: ", 14
)))
!= 0)
555 return FALSE(0);
556 if (strncmp(&buf[14], "multipart/", 10)(__extension__ (__builtin_constant_p (10) && ((__builtin_constant_p
(&buf[14]) && strlen (&buf[14]) < ((size_t
) (10))) || (__builtin_constant_p ("multipart/") && strlen
("multipart/") < ((size_t) (10)))) ? __extension__ ({ size_t
__s1_len, __s2_len; (__builtin_constant_p (&buf[14]) &&
__builtin_constant_p ("multipart/") && (__s1_len = strlen
(&buf[14]), __s2_len = strlen ("multipart/"), (!((size_t
)(const void *)((&buf[14]) + 1) - (size_t)(const void *)(
&buf[14]) == 1) || __s1_len >= 4) && (!((size_t
)(const void *)(("multipart/") + 1) - (size_t)(const void *)(
"multipart/") == 1) || __s2_len >= 4)) ? __builtin_strcmp (
&buf[14], "multipart/") : (__builtin_constant_p (&buf
[14]) && ((size_t)(const void *)((&buf[14]) + 1) -
(size_t)(const void *)(&buf[14]) == 1) && (__s1_len
= strlen (&buf[14]), __s1_len < 4) ? (__builtin_constant_p
("multipart/") && ((size_t)(const void *)(("multipart/"
) + 1) - (size_t)(const void *)("multipart/") == 1) ? __builtin_strcmp
(&buf[14], "multipart/") : (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) ("multipart/"
); int __result = (((const unsigned char *) (const char *) (&
buf[14]))[0] - __s2[0]); if (__s1_len > 0 && __result
== 0) { __result = (((const unsigned char *) (const char *) (
&buf[14]))[1] - __s2[1]); if (__s1_len > 1 && __result
== 0) { __result = (((const unsigned char *) (const char *) (
&buf[14]))[2] - __s2[2]); if (__s1_len > 2 && __result
== 0) __result = (((const unsigned char *) (const char *) (&
buf[14]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p
("multipart/") && ((size_t)(const void *)(("multipart/"
) + 1) - (size_t)(const void *)("multipart/") == 1) &&
(__s2_len = strlen ("multipart/"), __s2_len < 4) ? (__builtin_constant_p
(&buf[14]) && ((size_t)(const void *)((&buf[
14]) + 1) - (size_t)(const void *)(&buf[14]) == 1) ? __builtin_strcmp
(&buf[14], "multipart/") : (- (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (&buf
[14]); int __result = (((const unsigned char *) (const char *
) ("multipart/"))[0] - __s2[0]); if (__s2_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("multipart/"))[1] - __s2[1]); if (__s2_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("multipart/"))[2] - __s2[2]); if (__s2_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) ("multipart/"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp
(&buf[14], "multipart/")))); }) : strncmp (&buf[14],
"multipart/", 10)))
!= 0)
557 return FALSE(0);
558 fieldstart = &buf[14];
559 while (*fieldstart!=0)
560 {
561 while (*fieldstart!=0 && *fieldstart!=';')
562 fieldstart++;
563 if (*fieldstart==';') fieldstart++;
564 while (*fieldstart!=0 && *fieldstart==' ')
565 fieldstart++;
566 if (strncmp(fieldstart, "boundary=", 9)(__extension__ (__builtin_constant_p (9) && ((__builtin_constant_p
(fieldstart) && strlen (fieldstart) < ((size_t) (
9))) || (__builtin_constant_p ("boundary=") && strlen
("boundary=") < ((size_t) (9)))) ? __extension__ ({ size_t
__s1_len, __s2_len; (__builtin_constant_p (fieldstart) &&
__builtin_constant_p ("boundary=") && (__s1_len = strlen
(fieldstart), __s2_len = strlen ("boundary="), (!((size_t)(const
void *)((fieldstart) + 1) - (size_t)(const void *)(fieldstart
) == 1) || __s1_len >= 4) && (!((size_t)(const void
*)(("boundary=") + 1) - (size_t)(const void *)("boundary=") ==
1) || __s2_len >= 4)) ? __builtin_strcmp (fieldstart, "boundary="
) : (__builtin_constant_p (fieldstart) && ((size_t)(const
void *)((fieldstart) + 1) - (size_t)(const void *)(fieldstart
) == 1) && (__s1_len = strlen (fieldstart), __s1_len <
4) ? (__builtin_constant_p ("boundary=") && ((size_t
)(const void *)(("boundary=") + 1) - (size_t)(const void *)("boundary="
) == 1) ? __builtin_strcmp (fieldstart, "boundary=") : (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) ("boundary="); int __result = (((const unsigned char
*) (const char *) (fieldstart))[0] - __s2[0]); if (__s1_len >
0 && __result == 0) { __result = (((const unsigned char
*) (const char *) (fieldstart))[1] - __s2[1]); if (__s1_len >
1 && __result == 0) { __result = (((const unsigned char
*) (const char *) (fieldstart))[2] - __s2[2]); if (__s1_len >
2 && __result == 0) __result = (((const unsigned char
*) (const char *) (fieldstart))[3] - __s2[3]); } } __result;
}))) : (__builtin_constant_p ("boundary=") && ((size_t
)(const void *)(("boundary=") + 1) - (size_t)(const void *)("boundary="
) == 1) && (__s2_len = strlen ("boundary="), __s2_len
< 4) ? (__builtin_constant_p (fieldstart) && ((size_t
)(const void *)((fieldstart) + 1) - (size_t)(const void *)(fieldstart
) == 1) ? __builtin_strcmp (fieldstart, "boundary=") : (- (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) (fieldstart); int __result = (((const unsigned char *
) (const char *) ("boundary="))[0] - __s2[0]); if (__s2_len >
0 && __result == 0) { __result = (((const unsigned char
*) (const char *) ("boundary="))[1] - __s2[1]); if (__s2_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("boundary="))[2] - __s2[2]); if (__s2_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) ("boundary="))[3] - __s2[3]); } } __result
; })))) : __builtin_strcmp (fieldstart, "boundary=")))); }) :
strncmp (fieldstart, "boundary=", 9)))
== 0)
567 {
568 sepstart = fieldstart + 9;
569 if (sepstart[0]=='"')
570 {
571 sepstart++;
572 seplen = 0;
573 while (sepstart[seplen]!='"' && sepstart[seplen]>=32)
574 seplen++;
575 }
576 else
577 {
578 seplen = 0;
579 while (sepstart[seplen]!=';' && sepstart[seplen]>32)
580 seplen++;
581 }
582 strcpy(separator,"--");
583 strncpy(&separator[2],sepstart,seplen)__builtin_strncpy (&separator[2], sepstart, seplen);
584 strcpy(&separator[seplen+2],"--");
585 return TRUE(!(0));
586 }
587 }
588 return FALSE(0);
589 }
590
591 /* Hide a password that is embedded in a string.
592 */
593static void
594hide_password(gchar *line, gint offset, const gchar *pass)
595 {
596 gint n;
597
598 n = strlen(pass);
599 while (n--)
600 line[offset + n] = '*';
601 }
602
603static gint
604read_select(gint fd, gchar *buf, size_t size, time_t timeout)
605 {
606 fd_set readfds;
607 struct timeval tv;
608 gint n = 0;
609 gint s;
610
611 do
612 {
613 FD_ZERO(&readfds)do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq"
: "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) /
sizeof (__fd_mask)), "1" (&((&readfds)->fds_bits)
[0]) : "memory"); } while (0)
;
614 FD_SET(fd, &readfds)((void) (((&readfds)->fds_bits)[((fd) / (8 * (int) sizeof
(__fd_mask)))] |= ((__fd_mask) (1UL << ((fd) % (8 * (int
) sizeof (__fd_mask)))))))
;
615 tv.tv_sec = timeout;
616 tv.tv_usec = 0;
617
618 if ((s = select(fd+1, &readfds, NULL((void*)0), NULL((void*)0), &tv)) > 0)
619#if defined(WIN32)
620 n = recv(fd, buf, size, 0);
621#else
622 n = read(fd, buf, size);
623#endif
624 } while (s < 0 && errno(*__errno_location ()) == EINTR4);
625
626 return n;
627 }
628
629 /* Read \r\n terminated lines from a remote IMAP or POP3 mail server,
630 */
631static void
632tcp_getline(ConnInfo *conn, Mailbox *mbox)
633 {
634 gchar buf[256];
635 gint n;
636 gchar *s;
637
638 if (mbox->tcp_in)
639 mbox->tcp_in = g_string_truncate(mbox->tcp_in, 0);
640 else
641 mbox->tcp_in = g_string_new("");
642 s = buf;
643 for (;;)
644 {
645#ifdef HAVE_SSL1
646 if (conn->ssl)
647 n = SSL_read(conn->ssl, s, 1);
648 else
649#endif
650 n = read_select(conn->fd, s, 1, TCP_TIMEOUT30);
651 if (n <= 0)
652 {
653 if (n < 0)
654 g_warning("tcp_getline: %s", g_strerror(errno(*__errno_location ())));
655 break;
656 }
657 *(s+1) = '\0';
658 if (*s++ == '\n')
659 break;
660 if (s >= buf + sizeof(buf) - 2)
661 {
662 g_string_append(mbox->tcp_in, buf);
663 s = buf;
664 }
665 }
666 if (s > buf)
667 g_string_append(mbox->tcp_in, buf);
668
669 if (_GK.debug_level & DEBUG_MAIL0x10)
670 {
671 format_remote_mbox_name(mbox, buf, sizeof(buf));
672 g_debug("server_response( %s )<%d>:%s", buf,
673 (gint) mbox->tcp_in->len, mbox->tcp_in->str);
674 }
675 }
676
677static void
678tcp_putline(ConnInfo *conn, gchar *line)
679 {
680 gint n;
681
682#ifdef HAVE_SSL1
683 if (conn->ssl)
684 n = SSL_write(conn->ssl, line, strlen(line));
685 else
686#endif
687 {
688#if defined(WIN32)
689 n = send(conn->fd, line, strlen(line), 0);
690#else
691 n = write(conn->fd, line, strlen(line));
692#endif
693 }
694 if (n < 0)
695 g_warning("tcp_putline: %s", g_strerror(errno(*__errno_location ())));
696 }
697
698 /* Get a server response line and verify the beginning of the line
699 | matches a string.
700 */
701static gboolean
702server_response(ConnInfo *conn, Mailbox *mbox, gchar *match)
703 {
704 tcp_getline(conn, mbox);
705 return (!strncmp(match, mbox->tcp_in->str, strlen(match))(__extension__ (__builtin_constant_p (strlen(match)) &&
((__builtin_constant_p (match) && strlen (match) <
((size_t) (strlen(match)))) || (__builtin_constant_p (mbox->
tcp_in->str) && strlen (mbox->tcp_in->str) <
((size_t) (strlen(match))))) ? __extension__ ({ size_t __s1_len
, __s2_len; (__builtin_constant_p (match) && __builtin_constant_p
(mbox->tcp_in->str) && (__s1_len = strlen (match
), __s2_len = strlen (mbox->tcp_in->str), (!((size_t)(const
void *)((match) + 1) - (size_t)(const void *)(match) == 1) ||
__s1_len >= 4) && (!((size_t)(const void *)((mbox
->tcp_in->str) + 1) - (size_t)(const void *)(mbox->tcp_in
->str) == 1) || __s2_len >= 4)) ? __builtin_strcmp (match
, mbox->tcp_in->str) : (__builtin_constant_p (match) &&
((size_t)(const void *)((match) + 1) - (size_t)(const void *
)(match) == 1) && (__s1_len = strlen (match), __s1_len
< 4) ? (__builtin_constant_p (mbox->tcp_in->str) &&
((size_t)(const void *)((mbox->tcp_in->str) + 1) - (size_t
)(const void *)(mbox->tcp_in->str) == 1) ? __builtin_strcmp
(match, mbox->tcp_in->str) : (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (mbox->
tcp_in->str); int __result = (((const unsigned char *) (const
char *) (match))[0] - __s2[0]); if (__s1_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (match))[1] - __s2[1]); if (__s1_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (match))[2] - __s2[2]); if (__s1_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) (match))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p
(mbox->tcp_in->str) && ((size_t)(const void *)
((mbox->tcp_in->str) + 1) - (size_t)(const void *)(mbox
->tcp_in->str) == 1) && (__s2_len = strlen (mbox
->tcp_in->str), __s2_len < 4) ? (__builtin_constant_p
(match) && ((size_t)(const void *)((match) + 1) - (size_t
)(const void *)(match) == 1) ? __builtin_strcmp (match, mbox->
tcp_in->str) : (- (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) (match); int __result
= (((const unsigned char *) (const char *) (mbox->tcp_in->
str))[0] - __s2[0]); if (__s2_len > 0 && __result ==
0) { __result = (((const unsigned char *) (const char *) (mbox
->tcp_in->str))[1] - __s2[1]); if (__s2_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (mbox->tcp_in->str))[2] - __s2[2]); if (__s2_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) (mbox->tcp_in->str))[3] - __s2[
3]); } } __result; })))) : __builtin_strcmp (match, mbox->
tcp_in->str)))); }) : strncmp (match, mbox->tcp_in->
str, strlen(match))))
? TRUE(!(0)) : FALSE(0));
706 }
707
708 /* Get a imap server completion result response for a tagged command.
709 | Skip over any untagged responses the server may send.
710 */
711static gboolean
712imap_completion_result(ConnInfo *conn, Mailbox *mbox, gchar *tag)
713 {
714 while (1)
715 {
716 tcp_getline(conn, mbox);
717 if (*(mbox->tcp_in->str) == '*') /* untagged response */
718 continue;
719 return (!strncmp(tag, mbox->tcp_in->str, strlen(tag))(__extension__ (__builtin_constant_p (strlen(tag)) &&
((__builtin_constant_p (tag) && strlen (tag) < ((
size_t) (strlen(tag)))) || (__builtin_constant_p (mbox->tcp_in
->str) && strlen (mbox->tcp_in->str) < ((
size_t) (strlen(tag))))) ? __extension__ ({ size_t __s1_len, __s2_len
; (__builtin_constant_p (tag) && __builtin_constant_p
(mbox->tcp_in->str) && (__s1_len = strlen (tag
), __s2_len = strlen (mbox->tcp_in->str), (!((size_t)(const
void *)((tag) + 1) - (size_t)(const void *)(tag) == 1) || __s1_len
>= 4) && (!((size_t)(const void *)((mbox->tcp_in
->str) + 1) - (size_t)(const void *)(mbox->tcp_in->str
) == 1) || __s2_len >= 4)) ? __builtin_strcmp (tag, mbox->
tcp_in->str) : (__builtin_constant_p (tag) && ((size_t
)(const void *)((tag) + 1) - (size_t)(const void *)(tag) == 1
) && (__s1_len = strlen (tag), __s1_len < 4) ? (__builtin_constant_p
(mbox->tcp_in->str) && ((size_t)(const void *)
((mbox->tcp_in->str) + 1) - (size_t)(const void *)(mbox
->tcp_in->str) == 1) ? __builtin_strcmp (tag, mbox->
tcp_in->str) : (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) (mbox->tcp_in->
str); int __result = (((const unsigned char *) (const char *)
(tag))[0] - __s2[0]); if (__s1_len > 0 && __result
== 0) { __result = (((const unsigned char *) (const char *) (
tag))[1] - __s2[1]); if (__s1_len > 1 && __result ==
0) { __result = (((const unsigned char *) (const char *) (tag
))[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (tag))[
3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (mbox
->tcp_in->str) && ((size_t)(const void *)((mbox
->tcp_in->str) + 1) - (size_t)(const void *)(mbox->tcp_in
->str) == 1) && (__s2_len = strlen (mbox->tcp_in
->str), __s2_len < 4) ? (__builtin_constant_p (tag) &&
((size_t)(const void *)((tag) + 1) - (size_t)(const void *)(
tag) == 1) ? __builtin_strcmp (tag, mbox->tcp_in->str) :
(- (__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) (tag); int __result = (((const unsigned
char *) (const char *) (mbox->tcp_in->str))[0] - __s2[
0]); if (__s2_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) (mbox->tcp_in->
str))[1] - __s2[1]); if (__s2_len > 1 && __result ==
0) { __result = (((const unsigned char *) (const char *) (mbox
->tcp_in->str))[2] - __s2[2]); if (__s2_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) (mbox->tcp_in->str))[3] - __s2[3]); } } __result; }
)))) : __builtin_strcmp (tag, mbox->tcp_in->str)))); })
: strncmp (tag, mbox->tcp_in->str, strlen(tag))))
? TRUE(!(0)) : FALSE(0));
720 }
721 }
722
723static void
724server_command(ConnInfo *conn, Mailbox *mbox, gchar *line)
725 {
726 gchar buf[128];
727
728 tcp_putline(conn, line);
729
730 if (_GK.debug_level & DEBUG_MAIL0x10)
731 {
732 format_remote_mbox_name(mbox, buf, sizeof(buf));
733 g_debug("server_command( %s ):%s", buf, line);
734 }
735 }
736
737static gchar *tcp_error_message[] =
738 {
739 N_("Unable to connect.")("Unable to connect."),
740 N_("Bad response after connect.")("Bad response after connect."),
741 N_("Bad response after username.")("Bad response after username."),
742 N_("Bad response after password.")("Bad response after password."),
743 N_("Bad response after STAT or STATUS.")("Bad response after STAT or STATUS."),
744 N_("Bad response after UIDL.")("Bad response after UIDL."),
745 N_("Bad APOP response after connect.")("Bad APOP response after connect."),
746 N_("Bad CRAM_MD5 response after connect.")("Bad CRAM_MD5 response after connect."),
747 };
748
749static void
750tcp_close(ConnInfo *conn)
751 {
752#ifdef HAVE_SSL1
753#ifndef HAVE_GNUTLS
754 SSL_SESSION *session;
755#endif
756#endif
757
758 if (conn->fd != -1)
759 {
760#ifdef WIN32
761 closesocket(conn->fd);
762#else
763 close(conn->fd);
764#endif
765 conn->fd = -1;
766 }
767#ifdef HAVE_SSL1
768 if (conn->ssl)
769 {
770#ifndef HAVE_GNUTLS
771 session = SSL_get_session(conn->ssl);
772 if (session)
773 SSL_CTX_remove_session(conn->ssl_ctx, session);
774#endif
775 SSL_free(conn->ssl);
776 conn->ssl = NULL((void*)0);
777 }
778 if (conn->ssl_ctx)
779 {
780 SSL_CTX_free(conn->ssl_ctx);
781 conn->ssl_ctx = NULL((void*)0);
782 }
783#endif
784}
785
786static gboolean
787tcp_warn(Mailbox *mbox, gchar *message, gboolean warn)
788 {
789 gchar buf[128];
790
791 if (_GK.debug_level & DEBUG_MAIL0x10)
792 {
793 format_remote_mbox_name(mbox, buf, sizeof(buf));
794 g_debug(_("Mail TCP Error: %s - %s\n")dcgettext ("gkrellm", "Mail TCP Error: %s - %s\n", 5), buf, _(message)dcgettext ("gkrellm", message, 5));
795 }
796 if (warn && !mbox->warned)
797 {
798 g_free(mbox->warn_msg);
799 format_remote_mbox_name(mbox, buf, sizeof(buf));
800 mbox->warn_msg = g_strdup_printf("%s\n%s\n%s\n", buf,
801 _(message)dcgettext ("gkrellm", message, 5), mbox->tcp_in->str);
802 }
803 return FALSE(0);
804 }
805
806static gboolean
807tcp_shutdown(ConnInfo *conn, Mailbox *mbox, gchar *message, gboolean warn)
808 {
809 tcp_close(conn);
810 return tcp_warn(mbox, message, warn);
811 }
812
813#ifdef HAVE_SSL1
814static gboolean
815ssl_negotiate(ConnInfo *conn, Mailbox *mbox)
816 {
817 SSL_METHOD *ssl_method;
818
819 if (mbox->account->use_ssl == SSL_TRANSPORT1)
820 ssl_method = SSLv23_client_method();
821 else
822 ssl_method = TLSv1_client_method();
823 if (ssl_method == NULL((void*)0))
824 return tcp_shutdown(conn, mbox,
825 N_("Cannot initialize SSL method.")("Cannot initialize SSL method."),
826 FALSE(0));
827 if ((conn->ssl_ctx = SSL_CTX_new(ssl_method)) == NULL((void*)0))
828 return tcp_shutdown(conn, mbox,
829 N_("Cannot initialize SSL server certificate handler.")("Cannot initialize SSL server certificate handler."),
830 FALSE(0));
831 SSL_CTX_set_options(conn->ssl_ctx, SSL_OP_ALL)SSL_CTX_ctrl((conn->ssl_ctx),32,(0x80000BFFL),((void*)0));
832 SSL_CTX_set_verify(conn->ssl_ctx, SSL_VERIFY_NONE0x00, NULL((void*)0));
833 if ((conn->ssl = SSL_new(conn->ssl_ctx)) == NULL((void*)0))
834 return tcp_shutdown(conn, mbox,
835 N_("Cannot initialize SSL handler.")("Cannot initialize SSL handler."),
836 FALSE(0));
837#ifndef HAVE_GNUTLS
838 SSL_clear(conn->ssl);
839#endif
840
841 SSL_set_fd(conn->ssl, conn->fd);
842 SSL_set_connect_state(conn->ssl);
843 if (SSL_connect(conn->ssl) < 0)
844 return tcp_shutdown(conn, mbox, tcp_error_message[0], FALSE(0));
845
846 return TRUE(!(0));
847 }
848#endif
849
850static gboolean
851tcp_connect(ConnInfo *conn, Mailbox *mbox)
852 {
853 MailAccount *account = mbox->account;
854 gchar buf[128];
855
856 memset(conn, 0, sizeof(*conn));
857 if (_GK.debug_level & DEBUG_MAIL0x10)
858 {
859 format_remote_mbox_name(mbox, buf, sizeof(buf));
860 g_debug("tcp_connect: connecting to %s\n", buf);
861 }
862 conn->fd = gkrellm_connect_to(account->server, account->port);
863 if (conn->fd < 0)
864 return tcp_warn(mbox, tcp_error_message[0], FALSE(0));
865#ifdef HAVE_SSL1
866 if (account->use_ssl == SSL_TRANSPORT1 && !ssl_negotiate(conn, mbox))
867 return FALSE(0);
868#endif
869 return TRUE(!(0));
870 }
871
872extern void to64frombits(unsigned char *, const unsigned char *, int);
873extern int from64tobits(char *, const char *, int);
874
875static void
876hmac_md5(unsigned char *password, size_t pass_len,
877 unsigned char *challenge, size_t chal_len,
878 unsigned char *response, size_t resp_len)
879 {
880 int i;
881 unsigned char ipad[64];
882 unsigned char opad[64];
883 unsigned char hash_passwd[16];
884
885 MD5_CTX ctx;
886
887 if (resp_len != 16)
888 return;
889
890 if (pass_len > sizeof(ipad))
891 {
892 MD5InitMD5_Init(&ctx);
893 MD5UpdateMD5_Update(&ctx, password, pass_len);
894 MD5FinalMD5_Final(hash_passwd, &ctx);
895 password = hash_passwd;
896 pass_len = sizeof(hash_passwd);
897 }
898
899 memset(ipad, 0, sizeof(ipad));
900 memset(opad, 0, sizeof(opad));
901 memcpy(ipad, password, pass_len);
902 memcpy(opad, password, pass_len);
903
904 for (i = 0; i < 64; i++)
905 {
906 ipad[i] ^= 0x36;
907 opad[i] ^= 0x5c;
908 }
909
910 MD5InitMD5_Init(&ctx);
911 MD5UpdateMD5_Update(&ctx, ipad, sizeof(ipad));
912 MD5UpdateMD5_Update(&ctx, challenge, chal_len);
913 MD5FinalMD5_Final(response, &ctx);
914
915 MD5InitMD5_Init(&ctx);
916 MD5UpdateMD5_Update(&ctx, opad, sizeof(opad));
917 MD5UpdateMD5_Update(&ctx, response, resp_len);
918 MD5FinalMD5_Final(response, &ctx);
919 }
920
921/* authenticate as per RFC2195 */
922static int
923do_cram_md5(ConnInfo *conn, char *command, Mailbox *mbox, char *strip)
924 {
925 MailAccount *account = mbox->account;
926 gint len;
927 gchar buf1[1024];
928 gchar msg_id[768];
929 gchar reply[1024];
930 gchar *respdata;
931 guchar response[16];
932
933 snprintf(buf1, sizeof(buf1), "%s CRAM-MD5\r\n", command);
934 server_command(conn, mbox, buf1);
935
936 /* From RFC2195:
937 * The data encoded in the first ready response contains an
938 * presumptively arbitrary string of random digits, a
939 * timestamp, and the * fully-qualified primary host name of
940 * the server. The syntax of the * unencoded form must
941 * correspond to that of an RFC 822 'msg-id' * [RFC822] as
942 * described in [POP3].
943 */
944
945 if (!server_response(conn, mbox, "+ "))
946 return FALSE(0);
947
948 /* caller may specify a response prefix we should strip if present */
949 respdata = mbox->tcp_in->str;
950 len = strlen(respdata);
951 if (respdata[len - 1] == '\n')
952 respdata[--len] = '\0';
953 if (respdata[len - 1] == '\r')
954 respdata[--len] = '\0';
955 if (strip && strncmp(respdata, strip, strlen(strip))(__extension__ (__builtin_constant_p (strlen(strip)) &&
((__builtin_constant_p (respdata) && strlen (respdata
) < ((size_t) (strlen(strip)))) || (__builtin_constant_p (
strip) && strlen (strip) < ((size_t) (strlen(strip
))))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(respdata) && __builtin_constant_p (strip) &&
(__s1_len = strlen (respdata), __s2_len = strlen (strip), (!
((size_t)(const void *)((respdata) + 1) - (size_t)(const void
*)(respdata) == 1) || __s1_len >= 4) && (!((size_t
)(const void *)((strip) + 1) - (size_t)(const void *)(strip) ==
1) || __s2_len >= 4)) ? __builtin_strcmp (respdata, strip
) : (__builtin_constant_p (respdata) && ((size_t)(const
void *)((respdata) + 1) - (size_t)(const void *)(respdata) ==
1) && (__s1_len = strlen (respdata), __s1_len < 4
) ? (__builtin_constant_p (strip) && ((size_t)(const void
*)((strip) + 1) - (size_t)(const void *)(strip) == 1) ? __builtin_strcmp
(respdata, strip) : (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) (strip); int __result
= (((const unsigned char *) (const char *) (respdata))[0] - __s2
[0]); if (__s1_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) (respdata))[1] - __s2
[1]); if (__s1_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) (respdata))[2] - __s2
[2]); if (__s1_len > 2 && __result == 0) __result =
(((const unsigned char *) (const char *) (respdata))[3] - __s2
[3]); } } __result; }))) : (__builtin_constant_p (strip) &&
((size_t)(const void *)((strip) + 1) - (size_t)(const void *
)(strip) == 1) && (__s2_len = strlen (strip), __s2_len
< 4) ? (__builtin_constant_p (respdata) && ((size_t
)(const void *)((respdata) + 1) - (size_t)(const void *)(respdata
) == 1) ? __builtin_strcmp (respdata, strip) : (- (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) (respdata); int __result = (((const unsigned char *)
(const char *) (strip))[0] - __s2[0]); if (__s2_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (strip))[1] - __s2[1]); if (__s2_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (strip))[2] - __s2[2]); if (__s2_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) (strip))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp
(respdata, strip)))); }) : strncmp (respdata, strip, strlen(
strip))))
== 0)
956 respdata += strlen(strip);
957 len = from64tobits(msg_id, respdata, sizeof(msg_id));
958
959 if (len < 0)
960 {
961 gkrellm_debug(DEBUG_MAIL0x10, _("could not decode BASE64 challenge\n")dcgettext ("gkrellm", "could not decode BASE64 challenge\n", 5
)
);
962 return FALSE(0);
963 }
964 else if (len < sizeof(msg_id))
965 msg_id[len] = 0;
966 else
967 msg_id[sizeof(msg_id) - 1] = 0;
968 gkrellm_debug(DEBUG_MAIL0x10, _("decoded as %s\n")dcgettext ("gkrellm", "decoded as %s\n", 5), msg_id);
969
970 /* The client makes note of the data and then responds with a string
971 * consisting of the user name, a space, and a 'digest'. The latter is
972 * computed by applying the keyed MD5 algorithm from [KEYED-MD5] where
973 * the key is a shared secret and the digested text is the timestamp
974 * (including angle-brackets).
975 */
976
977 hmac_md5((guchar *) account->password, strlen(account->password),
978 (guchar *) msg_id, strlen(msg_id), response, sizeof(response));
979
980 snprintf(reply, sizeof(reply),
981 "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
982 account->username,
983 response[0], response[1], response[2], response[3],
984 response[4], response[5], response[6], response[7],
985 response[8], response[9], response[10], response[11],
986 response[12], response[13], response[14], response[15]);
987
988 to64frombits((guchar *) buf1, (guchar *) reply, strlen(reply));
989
990 len = strlen(buf1);
991 if (len + 3 > sizeof(buf1))
992 return FALSE(0);
993 strcpy(buf1 + len, "\r\n");
994 server_command(conn, mbox, buf1);
995 return TRUE(!(0));
996 }
997
998#ifdef HAVE_NTLM1
999/* NTLM authentication */
1000static int
1001do_ntlm(ConnInfo *conn, char *command, Mailbox *mbox)
1002 {
1003 gint len;
1004 gchar msgbuf[2048];
1005 tSmbNtlmAuthRequest request;
1006 tSmbNtlmAuthChallenge challenge;
1007 tSmbNtlmAuthResponse response;
1008
1009 snprintf(msgbuf, sizeof(msgbuf), "%s NTLM\r\n", command);
1010 server_command(conn, mbox, msgbuf);
1011
1012 if (!server_response(conn, mbox, "+ "))
1013 return FALSE(0);
1014
1015 buildSmbNtlmAuthRequest(&request, mbox->account->username, NULL((void*)0));
1016 if (_GK.debug_level & DEBUG_MAIL0x10)
1017 dumpSmbNtlmAuthRequest(stdoutstdout, &request);
1018 memset(msgbuf, 0, sizeof(msgbuf));
1019 to64frombits((guchar *) msgbuf, (guchar *) &request, SmbLength(&request)(((&request)->buffer - (uint8*)(&request)) + (&
request)->bufIndex)
);
1020 len = strlen(msgbuf);
1021 if (len + 3 > sizeof(msgbuf))
1022 return FALSE(0);
1023 strcpy(msgbuf + len, "\r\n");
1024 server_command(conn, mbox, msgbuf);
1025
1026 if (!server_response(conn, mbox, "+ "))
1027 return FALSE(0);
1028
1029 len = from64tobits((char *)&challenge, mbox->tcp_in->str,
1030 sizeof(challenge));
1031 if (len < 0)
1032 {
1033 gkrellm_debug(DEBUG_MAIL0x10, _("could not decode BASE64 challenge\n")dcgettext ("gkrellm", "could not decode BASE64 challenge\n", 5
)
);
1034 return FALSE(0);
1035 }
1036 if (_GK.debug_level & DEBUG_MAIL0x10)
1037 dumpSmbNtlmAuthChallenge(stdoutstdout, &challenge);
1038
1039 buildSmbNtlmAuthResponse(&challenge, &response,
1040 mbox->account->username,
1041 mbox->account->password);
1042 if (_GK.debug_level & DEBUG_MAIL0x10)
1043 dumpSmbNtlmAuthResponse(stdoutstdout, &response);
1044 memset(msgbuf, 0, sizeof msgbuf);
1045 to64frombits((guchar *)msgbuf, (guchar *) &response, SmbLength(&response)(((&response)->buffer - (uint8*)(&response)) + (&
response)->bufIndex)
);
1046 len = strlen(msgbuf);
1047 if (len + 3 > sizeof(msgbuf))
1048 return FALSE(0);
1049 strcpy(msgbuf + len, "\r\n");
1050 server_command(conn, mbox, msgbuf);
1051 return TRUE(!(0));
1052 }
1053#endif // HAVE_NTLM
1054
1055static gboolean
1056check_pop3(Mailbox *mbox)
1057 {
1058 MailAccount *account = mbox->account;
1059 ConnInfo conn;
1060 gchar line[256], buf[256];
1061 gchar *challenge = NULL((void*)0);
1062
1063 if (!tcp_connect(&conn, mbox))
1064 return FALSE(0);
1065
1066 /* Is the machine we are connected to really a POP3 server?
1067 */
1068 if (! server_response(&conn, mbox, "+OK"))
1069 return tcp_shutdown(&conn, mbox, tcp_error_message[1], FALSE(0));
1070
1071 if (account->authmech == AUTH_APOP1 &&
1072 (strlen(mbox->tcp_in->str) < 3 ||
1073 (challenge = g_strdup(mbox->tcp_in->str + 3)) == NULL((void*)0)))
1074 return tcp_shutdown(&conn, mbox, tcp_error_message[1], FALSE(0));
1075
1076#ifdef HAVE_SSL1
1077 if (account->use_ssl == SSL_STARTTLS2)
1078 {
1079 server_command(&conn, mbox, "STLS\r\n");
1080 if (!server_response(&conn, mbox, "+OK"))
1081 {
1082 if (challenge)
1083 g_free(challenge);
1084 return tcp_shutdown(&conn, mbox,
1085 N_("Bad response after STLS.")("Bad response after STLS."),
1086 FALSE(0));
1087 }
1088 if (!ssl_negotiate(&conn, mbox))
1089 {
1090 if (challenge)
1091 g_free(challenge);
1092 return FALSE(0);
1093 }
1094 }
1095#endif
1096
1097 if (account->authmech == AUTH_APOP1)
1098 {
1099 static const gchar hex[] = "0123456789abcdef";
1100 MD5_CTX ctx;
1101 gint i;
1102 gchar *key, *p;
1103 guchar digest[16];
1104 gchar ascii_digest[33];
1105
1106 if ((key = strchr(challenge, '<')(__extension__ (__builtin_constant_p ('<') && !__builtin_constant_p
(challenge) && ('<') == '\0' ? (char *) __rawmemchr
(challenge, '<') : __builtin_strchr (challenge, '<')))
) == NULL((void*)0))
1107 {
1108 g_free(challenge);
1109 return tcp_shutdown(&conn, mbox, tcp_error_message[6],
1110 TRUE(!(0)));
1111 }
1112 if ((p = strchr(key, '>')(__extension__ (__builtin_constant_p ('>') && !__builtin_constant_p
(key) && ('>') == '\0' ? (char *) __rawmemchr (key
, '>') : __builtin_strchr (key, '>')))
) == NULL((void*)0))
1113 {
1114 g_free(challenge);
1115 return tcp_shutdown(&conn, mbox, tcp_error_message[6],
1116 TRUE(!(0)));
1117 }
1118 *(p + 1) = '\0';
1119 snprintf(line, sizeof(line), "%s%s", key, account->password);
1120 g_free(challenge);
1121 MD5InitMD5_Init(&ctx);
1122 MD5UpdateMD5_Update(&ctx, line, strlen(line));
1123 MD5FinalMD5_Final(digest, &ctx);
1124 for (i = 0; i < 16; i++)
1125 {
1126 ascii_digest[i + i] = hex[digest[i] >> 4];
1127 ascii_digest[i + i + 1] = hex[digest[i] & 0x0f];
1128 }
1129 ascii_digest[i + i] = '\0';
1130 snprintf(line, sizeof(line),
1131 "APOP %s %s\r\n", account->username, ascii_digest);
1132 server_command(&conn, mbox, line);
1133 }
1134 else if (account->authmech == AUTH_CRAM_MD52)
1135 {
1136 if (!do_cram_md5(&conn, "AUTH", mbox, NULL((void*)0)))
1137 {
1138 /* SASL cancellation of authentication */
1139 server_command(&conn, mbox, "*\r\n");
1140 return tcp_shutdown(&conn, mbox, tcp_error_message[7], TRUE(!(0)));
1141 }
1142 }
1143#ifdef HAVE_NTLM1
1144 else if (account->authmech == AUTH_NTLM3)
1145 {
1146 if (!do_ntlm(&conn, "AUTH", mbox))
1147 {
1148 /* SASL cancellation of authentication */
1149 server_command(&conn, mbox, "*\r\n");
1150 return tcp_shutdown(&conn, mbox, tcp_error_message[7], TRUE(!(0)));
1151 }
1152 }
1153#endif // HAVE_NTLM
1154 else /* AUTH_USER */
1155 {
1156 snprintf (line, sizeof (line), "USER %s\r\n", account->username);
1157 server_command(&conn, mbox, line);
1158 if (! server_response(&conn, mbox, "+OK"))
1159 return tcp_shutdown(&conn, mbox, tcp_error_message[2], TRUE(!(0)));
1160
1161 snprintf (line, sizeof (line), "PASS %s\r\n", account->password);
1162 tcp_putline(&conn, line);
1163
1164 if (_GK.debug_level & DEBUG_MAIL0x10)
1165 {
1166 hide_password(line, 5, account->password);
1167 format_remote_mbox_name(mbox, buf, sizeof(buf));
1168 g_debug("server_command( %s ):%s", buf, line);
1169 }
1170 }
1171 if (! server_response(&conn, mbox, "+OK"))
1172 return tcp_shutdown(&conn, mbox, tcp_error_message[3], TRUE(!(0)));
1173
1174 server_command(&conn, mbox, "STAT\r\n");
1175 if (! server_response(&conn, mbox, "+OK"))
1176 return tcp_shutdown(&conn, mbox, tcp_error_message[4], FALSE(0));
1177
1178 sscanf(mbox->tcp_in->str, "+OK %d", &mbox->mail_count);
1179 snprintf (line, sizeof (line), "UIDL %d\r\n", mbox->mail_count);
1180 server_command(&conn, mbox, line);
1181
1182 if (! server_response(&conn, mbox, "+OK"))
1183 mbox->new_mail_count = mbox->mail_count;
1184 else
1185 /* Set the new_mail_count only if the UIDL is changed to avoid
1186 | re-reporting mail is new after MUA button has been clicked.
1187 */
1188 if ( sscanf(mbox->tcp_in->str, "+OK %*d %127s", line) == 1
1189 && ( gkrellm_dup_string(&mbox->uidl, line)
1190 || unseen_is_new
1191 )
1192 )
1193 mbox->new_mail_count = mbox->mail_count;
1194
1195 server_command(&conn, mbox, "QUIT\r\n");
1196 tcp_close(&conn);
1197 return TRUE(!(0));
1198 }
1199
1200static gchar *imap_strescape(const gchar *source)
1201 {
1202 const guchar *p; /* running pointer inside source */
1203 gchar *dst; /* resulting string */
1204 gchar *q; /* running pointer inside dst */
1205 /* Each source byte needs at most two destination chars due to escaping */
1206 dst = g_malloc (strlen(source) * 2 + 1);
1207 p = (guchar *)source;
1208 q = dst;
1209 while (*p)
1210 {
1211 switch (*p)
1212 {
1213 case '\\':
1214 *q++ = '\\';
1215 *q++ = '\\';
1216 break;
1217 case '"':
1218 *q++ = '\\';
1219 *q++ = '"';
1220 break;
1221 default:
1222 *q++ = *p; // copy
1223 break;
1224 } // switch
1225 p++;
1226 } // while
1227 *q = 0; // final 0-byte
1228 return dst;
1229}
1230
1231static gboolean
1232check_imap(Mailbox *mbox)
1233 {
1234 MailAccount *account = mbox->account;
1235 ConnInfo conn;
1236 gint messages = 0;
1237 gint unseen = 0;
1238 gint seq = 0;
1239 gchar line[256], *ss;
1240 gchar buf[256];
1241 gchar *user_escaped, *pass_escaped, *fold_escaped;
1242
1243 if (!tcp_connect(&conn, mbox))
1244 return FALSE(0);
1245
1246 /* Is the machine we are connected to really a IMAP server?
1247 */
1248 if (! server_response(&conn, mbox, "* OK"))
1249 return tcp_shutdown(&conn, mbox, tcp_error_message[1], FALSE(0));
1250
1251#ifdef HAVE_SSL1
1252 if (account->use_ssl == SSL_STARTTLS2)
1253 {
1254 gkrellm_debug(DEBUG_MAIL0x10, "check_imap: Issuing STARTTLS\n");
1255 snprintf(line, sizeof(line), "a%03d STARTTLS\r\n", ++seq);
1256 server_command(&conn, mbox, line);
1257 snprintf(line, sizeof(line), "a%03d OK", seq);
1258 if (!imap_completion_result(&conn, mbox, line))
1259 return tcp_shutdown(&conn, mbox,
1260 N_("Bad response after STARTTLS.")("Bad response after STARTTLS."),
1261 TRUE(!(0)));
1262 if (!ssl_negotiate(&conn, mbox))
1263 return FALSE(0);
1264 gkrellm_debug(DEBUG_MAIL0x10, "check_imap: STARTTLS successful\n");
1265 }
1266#endif
1267
1268 /* For debugging purposes we ask for capabilities (helps debugging
1269 authentication problems) */
1270 if (_GK.debug_level & DEBUG_MAIL0x10)
1271 {
1272 gkrellm_debug(DEBUG_MAIL0x10, "check_imap: Asking for capabilities\n");
1273 snprintf(line, sizeof(line), "a%03d CAPABILITY\r\n", ++seq);
1274 server_command(&conn, mbox, line);
1275 snprintf(line, sizeof(line), "a%03d OK", seq);
1276 if (!imap_completion_result(&conn, mbox, line))
1277 {
1278 return tcp_shutdown(&conn, mbox, N_("Bad response after CAPABILITY.")("Bad response after CAPABILITY."),
1279 TRUE(!(0)));
1280 }
1281 }
1282
1283 if (account->authmech == AUTH_CRAM_MD52)
1284 {
1285 gkrellm_debug(DEBUG_MAIL0x10, "check_imap: Using CRAM-MD5 for authentication\n");
1286 snprintf(line, sizeof(line), "a%03d AUTHENTICATE", ++seq);
1287 if (!do_cram_md5(&conn, line, mbox, NULL((void*)0)))
1288 {
1289 /* SASL cancellation of authentication */
1290 server_command(&conn, mbox, "*\r\n");
1291 return tcp_shutdown(&conn, mbox, tcp_error_message[7], TRUE(!(0)));
1292 }
1293 }
1294#ifdef HAVE_NTLM1
1295 else if (account->authmech == AUTH_NTLM3)
1296 {
1297 gkrellm_debug(DEBUG_MAIL0x10, "check_imap: Using NTLM for authentication\n");
1298 snprintf(line, sizeof(line), "a%03d AUTHENTICATE", ++seq);
1299 if (!do_ntlm(&conn, line, mbox))
1300 {
1301 /* SASL cancellation of authentication */
1302 server_command(&conn, mbox, "*\r\n");
1303 return tcp_shutdown(&conn, mbox, tcp_error_message[7], TRUE(!(0)));
1304 }
1305 }
1306#endif // HAVE_NTLM
1307 else /* AUTH_LOGIN */
1308 {
1309 gkrellm_debug(DEBUG_MAIL0x10, "check_imap: Using plaintext LOGIN for authentication\n");
1310 user_escaped = imap_strescape(account->username);
1311 pass_escaped = imap_strescape(account->password);
1312 snprintf(line, sizeof(line), "a%03d LOGIN \"%s\" \"%s\"\r\n",
1313 ++seq, user_escaped, pass_escaped);
1314 tcp_putline(&conn, line);
1315 if (_GK.debug_level & DEBUG_MAIL0x10)
1316 {
1317 hide_password(line, 15 + strlen(user_escaped), pass_escaped);
1318 format_remote_mbox_name(mbox, buf, sizeof(buf));
1319 g_debug("server_command( %s ):%s", buf, line);
1320 }
1321 g_free(user_escaped);
1322 g_free(pass_escaped);
1323 }
1324 snprintf(line, sizeof(line), "a%03d OK", seq);
1325 if (! imap_completion_result(&conn, mbox, line))
1326 return tcp_shutdown(&conn, mbox, tcp_error_message[2], TRUE(!(0)));
1327
1328 /* I expect the only untagged response to STATUS will be "* STATUS ..."
1329 */
1330 fold_escaped = imap_strescape(account->imapfolder);
1331 snprintf(line, sizeof(line),
1332 "a%03d STATUS \"%s\" (MESSAGES UNSEEN)\r\n",
1333 ++seq, fold_escaped);
1334 g_free(fold_escaped);
1335 server_command(&conn, mbox, line);
1336 if (! server_response(&conn, mbox, "*"))
1337 return tcp_shutdown(&conn, mbox, tcp_error_message[4], FALSE(0));
1338
1339 if ((ss = strstr(mbox->tcp_in->str, "MESSAGES")) == NULL((void*)0))
1340 {
1341 if (strrchr(mbox->tcp_in->str, '}'))
1342 {
1343 if (! server_response(&conn, mbox, ""))
1344 return tcp_shutdown(&conn, mbox, tcp_error_message[4], FALSE(0));
1345 if ((ss = strstr(mbox->tcp_in->str, "MESSAGES")) == NULL((void*)0))
1346 return tcp_shutdown(&conn, mbox, tcp_error_message[4], FALSE(0));
1347 }
1348 else
1349 return tcp_shutdown(&conn, mbox, tcp_error_message[4], FALSE(0));
1350 }
1351 if (sscanf(ss, "MESSAGES %d", &messages) == 1)
1352 {
1353 if ((ss = strstr(mbox->tcp_in->str, "UNSEEN")) != NULL((void*)0))
1354 sscanf(ss, "UNSEEN %d", &unseen);
1355
1356 gkrellm_debug(DEBUG_MAIL0x10, "check_imap: messages: %d; unseen: %d\n",
1357 messages, unseen);
1358 }
1359 mbox->mail_count = messages;
1360 mbox->new_mail_count = unseen;
1361 snprintf(line, sizeof(line), "a%03d OK", seq);
1362 imap_completion_result(&conn, mbox, line);
1363
1364 snprintf(line, sizeof(line), "a%03d LOGOUT\r\n", ++seq);
1365 server_command(&conn, mbox, line);
1366 snprintf(line, sizeof(line), "a%03d OK", seq);
1367 imap_completion_result(&conn, mbox, line);
1368
1369 tcp_close(&conn);
1370 return TRUE(!(0));
1371 }
1372
1373static gboolean
1374mh_sequences_new_count(Mailbox *mbox)
1375 {
1376 FILE *f;
1377 gchar buf[1024];
1378 gchar *path, *tok;
1379 gint n0, n1;
1380
1381 path = g_strconcat(mbox->account->path, G_DIR_SEPARATOR_S"/",
1382 ".mh_sequences", NULL((void*)0));
1383 f = g_fopenfopen(path, "r");
1384 g_free(path);
1385 if (!f)
1386 return FALSE(0);
1387 have_mh_sequences = TRUE(!(0));
1388 if (mh_seq_ignore)
1389 {
1390 fclose(f);
1391 return FALSE(0);
1392 }
1393 while (fgets(buf, sizeof(buf), f))
1394 {
1395 /* Look for unseen sequence like "unseen: 4 7-9 23"
1396 */
1397 if (strncmp(buf, "unseen:", 7)(__extension__ (__builtin_constant_p (7) && ((__builtin_constant_p
(buf) && strlen (buf) < ((size_t) (7))) || (__builtin_constant_p
("unseen:") && strlen ("unseen:") < ((size_t) (7)
))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(buf) && __builtin_constant_p ("unseen:") &&
(__s1_len = strlen (buf), __s2_len = strlen ("unseen:"), (!(
(size_t)(const void *)((buf) + 1) - (size_t)(const void *)(buf
) == 1) || __s1_len >= 4) && (!((size_t)(const void
*)(("unseen:") + 1) - (size_t)(const void *)("unseen:") == 1
) || __s2_len >= 4)) ? __builtin_strcmp (buf, "unseen:") :
(__builtin_constant_p (buf) && ((size_t)(const void *
)((buf) + 1) - (size_t)(const void *)(buf) == 1) && (
__s1_len = strlen (buf), __s1_len < 4) ? (__builtin_constant_p
("unseen:") && ((size_t)(const void *)(("unseen:") +
1) - (size_t)(const void *)("unseen:") == 1) ? __builtin_strcmp
(buf, "unseen:") : (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) ("unseen:"); int __result
= (((const unsigned char *) (const char *) (buf))[0] - __s2[
0]); if (__s1_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) (buf))[1] - __s2[
1]); if (__s1_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) (buf))[2] - __s2[
2]); if (__s1_len > 2 && __result == 0) __result =
(((const unsigned char *) (const char *) (buf))[3] - __s2[3]
); } } __result; }))) : (__builtin_constant_p ("unseen:") &&
((size_t)(const void *)(("unseen:") + 1) - (size_t)(const void
*)("unseen:") == 1) && (__s2_len = strlen ("unseen:"
), __s2_len < 4) ? (__builtin_constant_p (buf) && (
(size_t)(const void *)((buf) + 1) - (size_t)(const void *)(buf
) == 1) ? __builtin_strcmp (buf, "unseen:") : (- (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) (buf); int __result = (((const unsigned char *) (const
char *) ("unseen:"))[0] - __s2[0]); if (__s2_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("unseen:"))[1] - __s2[1]); if (__s2_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("unseen:"))[2] - __s2[2]); if (__s2_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) ("unseen:"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp
(buf, "unseen:")))); }) : strncmp (buf, "unseen:", 7)))
)
1398 continue;
1399 tok = strtok(buf, " \t\n");
1400 while ((tok = strtok(NULL((void*)0), " \t\n")) != NULL((void*)0))
1401 {
1402 if (sscanf(tok, "%d-%d", &n0, &n1) == 2)
1403 mbox->new_mail_count += n1 - n0 + 1;
1404 else
1405 mbox->new_mail_count++;
1406 }
1407 break;
1408 }
1409 fclose(f);
1410 return TRUE(!(0));
1411 }
1412
1413 /* Sylpheed procmsg.h enums MSG_NEW as (1 << 0) and MSG_UNREAD as (1 << 1)
1414 | And procmsg_write_flags() in Sylpheeds procmsg.c writes a mail record as
1415 | a pair of ints with msgnum first followed by flags.
1416 */
1417#define SYLPHEED_MSG_NEW1 1
1418#define SYLPHEED_MSG_UNREAD2 2
1419#define SYLPHEED_MARK_VERSION2 2
1420
1421static gboolean
1422sylpheed_mark_new_count(Mailbox *mbox)
1423 {
1424 FILE *f = NULL((void*)0);
1425 gchar *path;
1426 gint msgnum, flags, ver, mark_files = 0;
1427 static const gchar *mark_file_names[] = {
1428 ".sylpheed_mark", ".claws_mark", NULL((void*)0)
1429 };
1430 const gchar **fname;
1431
1432 for (fname = mark_file_names; *fname; fname++) {
1433 path = g_strconcat(mbox->account->path, G_DIR_SEPARATOR_S"/",
1434 *fname, NULL((void*)0));
1435 f = g_fopenfopen(path, "rb");
1436 g_free(path);
1437 if (f)
1438 break;
1439 }
1440
1441 if (!f)
1442 return FALSE(0);
1443
1444 if ( fread(&ver, sizeof(ver), 1, f) == 1
1445 && SYLPHEED_MARK_VERSION2 == ver
1446 )
1447 {
1448 while ( fread(&msgnum, sizeof(msgnum), 1, f) == 1
1449 && fread(&flags, sizeof(flags), 1, f) == 1
1450 )
1451 {
1452 if ( (flags & SYLPHEED_MSG_NEW1)
1453 || ((flags & SYLPHEED_MSG_UNREAD2) && unseen_is_new)
1454 )
1455 mbox->new_mail_count += 1;
1456 ++mark_files;
1457 }
1458 if (mark_files < mbox->mail_count)
1459 mbox->new_mail_count += mbox->mail_count - mark_files;
1460 }
1461 fclose(f);
1462 return TRUE(!(0));
1463 }
1464
1465 /* Check a mh directory for mail. The way that messages are marked as new
1466 | depends on the MUA being using. Only .mh_sequences and .sylpheed_mark
1467 | are currently checked, otherwise all mail found is considered new mail.
1468 */
1469static gboolean
1470check_mh_dir(Mailbox *mbox)
1471 {
1472 GDir *dir;
1473 gchar *name;
1474
1475 mbox->mail_count = mbox->new_mail_count = 0;
1476
1477 if ((dir = g_dir_open(mbox->account->path, 0, NULL((void*)0))) == NULL((void*)0))
1478 return FALSE(0);
1479 while ((name = (gchar *) g_dir_read_name(dir)) != NULL((void*)0))
1480 {
1481 /* Files starting with a digit are messages. */
1482 if (isdigit((unsigned char)name[0])((*__ctype_b_loc ())[(int) (((unsigned char)name[0]))] & (
unsigned short int) _ISdigit)
)
1483 mbox->mail_count++;
1484 }
1485 g_dir_close(dir);
1486
1487 /* Some MH dir clients use .mh_sequences, others such as mutt or gnus
1488 | do not. For mixed cases, it's a user option to ignore .mh_sequences.
1489 | Sylpheed uses .sylpheed_mark.
1490 */
1491 if ( !mh_sequences_new_count(mbox)
1492 && !sylpheed_mark_new_count(mbox)
1493 )
1494 mbox->new_mail_count = mbox->mail_count;
1495
1496 return TRUE(!(0));
1497 }
1498
1499
1500 /* A maildir has new, cur, and tmp subdirectories. Any file in new
1501 | or cur that does not begin with a '.' is a mail message. It is
1502 | suggested that messages begin with the output of time() (9 digits)
1503 | but while mutt and qmail use this standard, procmail does not.
1504 | maildir(5) says:
1505 | It is a good idea for readers to skip all filenames in
1506 | new and cur starting with a dot. Other than this,
1507 | readers should not attempt to parse filenames.
1508 | So check_maildir() simply looks for files in new and cur.
1509 | But if unseen_is_new flag is set, look for ":2,*S" file suffix where
1510 | the 'S' indicates the mail is seen.
1511 | See http://cr.yp.to/proto/maildir.html
1512 */
1513static gboolean
1514check_maildir(Mailbox *mbox)
1515 {
1516 gchar path[256], *s;
1517 gchar *name;
1518 GDir *dir;
1519
1520 mbox->new_mail_count = 0;
1521 snprintf(path, sizeof(path), "%s%cnew", mbox->account->path,
1522 G_DIR_SEPARATOR'/');
1523 if ((dir = g_dir_open(path, 0, NULL((void*)0))) != NULL((void*)0))
1524 {
1525 while ((name = (gchar *) g_dir_read_name(dir)) != NULL((void*)0))
1526 mbox->new_mail_count++;
1527 g_dir_close(dir);
1528 }
1529 mbox->mail_count = mbox->new_mail_count;
1530 snprintf(path, sizeof(path), "%s%ccur", mbox->account->path,
1531 G_DIR_SEPARATOR'/');
1532 if ((dir = g_dir_open(path, 0, NULL((void*)0))) != NULL((void*)0))
1533 {
1534 while ((name = (gchar *) g_dir_read_name(dir)) != NULL((void*)0))
1535 {
1536 mbox->mail_count++;
1537 if ( unseen_is_new
1538 && ( (s = strchr(name, ':')(__extension__ (__builtin_constant_p (':') && !__builtin_constant_p
(name) && (':') == '\0' ? (char *) __rawmemchr (name
, ':') : __builtin_strchr (name, ':')))
) == NULL((void*)0)
1539 || !strchr(s, 'S')(__extension__ (__builtin_constant_p ('S') && !__builtin_constant_p
(s) && ('S') == '\0' ? (char *) __rawmemchr (s, 'S')
: __builtin_strchr (s, 'S')))
1540 )
1541 )
1542 mbox->new_mail_count++;
1543 }
1544 g_dir_close(dir);
1545 }
1546
1547 gkrellm_debug(DEBUG_MAIL0x10, "check_maildir %s: total=%d old=%d new=%d\n",
1548 mbox->account->path, mbox->mail_count, mbox->old_mail_count,
1549 mbox->new_mail_count);
1550 return TRUE(!(0));
1551 }
1552
1553
1554 /* Count total mail and old mail in a mailbox. Old mail can be read
1555 | with a Status: R0, or can be accessed and not read with Status: O
1556 | So, new mail will be the diff - note that unread mail is not
1557 | necessarily new mail. According to stat() man page:
1558 | st_atime is changed by mknod(), utime(), read(), write(), truncate()
1559 | st_mtime is changed by mknod(), utime(), write()
1560 | But, new mail arriving (writing mailbox) sets st_mtime while reading
1561 | the mailbox (mail program reading) sets st_atime. So the test
1562 | st_atime > st_mtime is testing if mbox has been read since last new mail.
1563 | Mail readers may restore st_mtime after writting status.
1564 | And Netscape mail does status with X-Mozilla-Status: xxxS
1565 | where S is bitwise or of status flags:
1566 | 1: read 2: replied 4: marked 8: deleted
1567 |
1568 | Evolution uses status with X-Evolution: 00000000-xxxx where xxxx status is
1569 | a bitfield in hexadecimal (see enum _CamelMessageFlags in evolution/camel
1570 | source) and most importantly CAMEL_MESSAGE_SEEN = 1<<4.
1571 */
1572 /* test if buf is a status for standard mail, mozilla or evolution
1573 */
1574static gboolean
1575is_status(gchar *buf)
1576 {
1577 if (buf[0] != 'S' && buf[0] != 'X')
1578 return FALSE(0);
1579
1580 if ( !strncmp(buf, "Status:", 7)(__extension__ (__builtin_constant_p (7) && ((__builtin_constant_p
(buf) && strlen (buf) < ((size_t) (7))) || (__builtin_constant_p
("Status:") && strlen ("Status:") < ((size_t) (7)
))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(buf) && __builtin_constant_p ("Status:") &&
(__s1_len = strlen (buf), __s2_len = strlen ("Status:"), (!(
(size_t)(const void *)((buf) + 1) - (size_t)(const void *)(buf
) == 1) || __s1_len >= 4) && (!((size_t)(const void
*)(("Status:") + 1) - (size_t)(const void *)("Status:") == 1
) || __s2_len >= 4)) ? __builtin_strcmp (buf, "Status:") :
(__builtin_constant_p (buf) && ((size_t)(const void *
)((buf) + 1) - (size_t)(const void *)(buf) == 1) && (
__s1_len = strlen (buf), __s1_len < 4) ? (__builtin_constant_p
("Status:") && ((size_t)(const void *)(("Status:") +
1) - (size_t)(const void *)("Status:") == 1) ? __builtin_strcmp
(buf, "Status:") : (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) ("Status:"); int __result
= (((const unsigned char *) (const char *) (buf))[0] - __s2[
0]); if (__s1_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) (buf))[1] - __s2[
1]); if (__s1_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) (buf))[2] - __s2[
2]); if (__s1_len > 2 && __result == 0) __result =
(((const unsigned char *) (const char *) (buf))[3] - __s2[3]
); } } __result; }))) : (__builtin_constant_p ("Status:") &&
((size_t)(const void *)(("Status:") + 1) - (size_t)(const void
*)("Status:") == 1) && (__s2_len = strlen ("Status:"
), __s2_len < 4) ? (__builtin_constant_p (buf) && (
(size_t)(const void *)((buf) + 1) - (size_t)(const void *)(buf
) == 1) ? __builtin_strcmp (buf, "Status:") : (- (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) (buf); int __result = (((const unsigned char *) (const
char *) ("Status:"))[0] - __s2[0]); if (__s2_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("Status:"))[1] - __s2[1]); if (__s2_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("Status:"))[2] - __s2[2]); if (__s2_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) ("Status:"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp
(buf, "Status:")))); }) : strncmp (buf, "Status:", 7)))
/* Standard mail clients */
1581 || !strncmp(buf, "X-Mozilla-Status:", 17)(__extension__ (__builtin_constant_p (17) && ((__builtin_constant_p
(buf) && strlen (buf) < ((size_t) (17))) || (__builtin_constant_p
("X-Mozilla-Status:") && strlen ("X-Mozilla-Status:"
) < ((size_t) (17)))) ? __extension__ ({ size_t __s1_len, __s2_len
; (__builtin_constant_p (buf) && __builtin_constant_p
("X-Mozilla-Status:") && (__s1_len = strlen (buf), __s2_len
= strlen ("X-Mozilla-Status:"), (!((size_t)(const void *)((buf
) + 1) - (size_t)(const void *)(buf) == 1) || __s1_len >= 4
) && (!((size_t)(const void *)(("X-Mozilla-Status:") +
1) - (size_t)(const void *)("X-Mozilla-Status:") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (buf, "X-Mozilla-Status:") : (__builtin_constant_p
(buf) && ((size_t)(const void *)((buf) + 1) - (size_t
)(const void *)(buf) == 1) && (__s1_len = strlen (buf
), __s1_len < 4) ? (__builtin_constant_p ("X-Mozilla-Status:"
) && ((size_t)(const void *)(("X-Mozilla-Status:") + 1
) - (size_t)(const void *)("X-Mozilla-Status:") == 1) ? __builtin_strcmp
(buf, "X-Mozilla-Status:") : (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) ("X-Mozilla-Status:"
); int __result = (((const unsigned char *) (const char *) (buf
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (buf))[
3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("X-Mozilla-Status:"
) && ((size_t)(const void *)(("X-Mozilla-Status:") + 1
) - (size_t)(const void *)("X-Mozilla-Status:") == 1) &&
(__s2_len = strlen ("X-Mozilla-Status:"), __s2_len < 4) ?
(__builtin_constant_p (buf) && ((size_t)(const void *
)((buf) + 1) - (size_t)(const void *)(buf) == 1) ? __builtin_strcmp
(buf, "X-Mozilla-Status:") : (- (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (buf); int
__result = (((const unsigned char *) (const char *) ("X-Mozilla-Status:"
))[0] - __s2[0]); if (__s2_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("X-Mozilla-Status:"
))[1] - __s2[1]); if (__s2_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("X-Mozilla-Status:"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("X-Mozilla-Status:"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (buf
, "X-Mozilla-Status:")))); }) : strncmp (buf, "X-Mozilla-Status:"
, 17)))
/* Netscape */
1582 || !strncmp(buf, "X-Evolution:", 12)(__extension__ (__builtin_constant_p (12) && ((__builtin_constant_p
(buf) && strlen (buf) < ((size_t) (12))) || (__builtin_constant_p
("X-Evolution:") && strlen ("X-Evolution:") < ((size_t
) (12)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(buf) && __builtin_constant_p ("X-Evolution:") &&
(__s1_len = strlen (buf), __s2_len = strlen ("X-Evolution:")
, (!((size_t)(const void *)((buf) + 1) - (size_t)(const void *
)(buf) == 1) || __s1_len >= 4) && (!((size_t)(const
void *)(("X-Evolution:") + 1) - (size_t)(const void *)("X-Evolution:"
) == 1) || __s2_len >= 4)) ? __builtin_strcmp (buf, "X-Evolution:"
) : (__builtin_constant_p (buf) && ((size_t)(const void
*)((buf) + 1) - (size_t)(const void *)(buf) == 1) &&
(__s1_len = strlen (buf), __s1_len < 4) ? (__builtin_constant_p
("X-Evolution:") && ((size_t)(const void *)(("X-Evolution:"
) + 1) - (size_t)(const void *)("X-Evolution:") == 1) ? __builtin_strcmp
(buf, "X-Evolution:") : (__extension__ ({ const unsigned char
*__s2 = (const unsigned char *) (const char *) ("X-Evolution:"
); int __result = (((const unsigned char *) (const char *) (buf
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (buf))[
3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("X-Evolution:"
) && ((size_t)(const void *)(("X-Evolution:") + 1) - (
size_t)(const void *)("X-Evolution:") == 1) && (__s2_len
= strlen ("X-Evolution:"), __s2_len < 4) ? (__builtin_constant_p
(buf) && ((size_t)(const void *)((buf) + 1) - (size_t
)(const void *)(buf) == 1) ? __builtin_strcmp (buf, "X-Evolution:"
) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) (buf); int __result = (((const unsigned
char *) (const char *) ("X-Evolution:"))[0] - __s2[0]); if (
__s2_len > 0 && __result == 0) { __result = (((const
unsigned char *) (const char *) ("X-Evolution:"))[1] - __s2[
1]); if (__s2_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) ("X-Evolution:"))
[2] - __s2[2]); if (__s2_len > 2 && __result == 0)
__result = (((const unsigned char *) (const char *) ("X-Evolution:"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (buf
, "X-Evolution:")))); }) : strncmp (buf, "X-Evolution:", 12))
)
) /* Mozilla */
1583 return TRUE(!(0));
1584 else
1585 return FALSE(0);
1586 }
1587
1588static gboolean
1589status_is_old(gchar *buf)
1590 {
1591 gchar c;
1592 guint tmp;
1593
1594 /* Standard mail clients
1595 */
1596 if ( !strncmp(buf, "Status:", 7)(__extension__ (__builtin_constant_p (7) && ((__builtin_constant_p
(buf) && strlen (buf) < ((size_t) (7))) || (__builtin_constant_p
("Status:") && strlen ("Status:") < ((size_t) (7)
))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(buf) && __builtin_constant_p ("Status:") &&
(__s1_len = strlen (buf), __s2_len = strlen ("Status:"), (!(
(size_t)(const void *)((buf) + 1) - (size_t)(const void *)(buf
) == 1) || __s1_len >= 4) && (!((size_t)(const void
*)(("Status:") + 1) - (size_t)(const void *)("Status:") == 1
) || __s2_len >= 4)) ? __builtin_strcmp (buf, "Status:") :
(__builtin_constant_p (buf) && ((size_t)(const void *
)((buf) + 1) - (size_t)(const void *)(buf) == 1) && (
__s1_len = strlen (buf), __s1_len < 4) ? (__builtin_constant_p
("Status:") && ((size_t)(const void *)(("Status:") +
1) - (size_t)(const void *)("Status:") == 1) ? __builtin_strcmp
(buf, "Status:") : (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) ("Status:"); int __result
= (((const unsigned char *) (const char *) (buf))[0] - __s2[
0]); if (__s1_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) (buf))[1] - __s2[
1]); if (__s1_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) (buf))[2] - __s2[
2]); if (__s1_len > 2 && __result == 0) __result =
(((const unsigned char *) (const char *) (buf))[3] - __s2[3]
); } } __result; }))) : (__builtin_constant_p ("Status:") &&
((size_t)(const void *)(("Status:") + 1) - (size_t)(const void
*)("Status:") == 1) && (__s2_len = strlen ("Status:"
), __s2_len < 4) ? (__builtin_constant_p (buf) && (
(size_t)(const void *)((buf) + 1) - (size_t)(const void *)(buf
) == 1) ? __builtin_strcmp (buf, "Status:") : (- (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) (buf); int __result = (((const unsigned char *) (const
char *) ("Status:"))[0] - __s2[0]); if (__s2_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("Status:"))[1] - __s2[1]); if (__s2_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("Status:"))[2] - __s2[2]); if (__s2_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) ("Status:"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp
(buf, "Status:")))); }) : strncmp (buf, "Status:", 7)))
1597 && (strchr(buf, 'R')(__extension__ (__builtin_constant_p ('R') && !__builtin_constant_p
(buf) && ('R') == '\0' ? (char *) __rawmemchr (buf, 'R'
) : __builtin_strchr (buf, 'R')))
|| (!unseen_is_new && strchr(buf, 'O')(__extension__ (__builtin_constant_p ('O') && !__builtin_constant_p
(buf) && ('O') == '\0' ? (char *) __rawmemchr (buf, 'O'
) : __builtin_strchr (buf, 'O')))
))
1598 )
1599 return TRUE(!(0));
1600
1601 /* Netscape
1602 */
1603 if (!strncmp(buf, "X-Mozilla-Status:", 17)(__extension__ (__builtin_constant_p (17) && ((__builtin_constant_p
(buf) && strlen (buf) < ((size_t) (17))) || (__builtin_constant_p
("X-Mozilla-Status:") && strlen ("X-Mozilla-Status:"
) < ((size_t) (17)))) ? __extension__ ({ size_t __s1_len, __s2_len
; (__builtin_constant_p (buf) && __builtin_constant_p
("X-Mozilla-Status:") && (__s1_len = strlen (buf), __s2_len
= strlen ("X-Mozilla-Status:"), (!((size_t)(const void *)((buf
) + 1) - (size_t)(const void *)(buf) == 1) || __s1_len >= 4
) && (!((size_t)(const void *)(("X-Mozilla-Status:") +
1) - (size_t)(const void *)("X-Mozilla-Status:") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (buf, "X-Mozilla-Status:") : (__builtin_constant_p
(buf) && ((size_t)(const void *)((buf) + 1) - (size_t
)(const void *)(buf) == 1) && (__s1_len = strlen (buf
), __s1_len < 4) ? (__builtin_constant_p ("X-Mozilla-Status:"
) && ((size_t)(const void *)(("X-Mozilla-Status:") + 1
) - (size_t)(const void *)("X-Mozilla-Status:") == 1) ? __builtin_strcmp
(buf, "X-Mozilla-Status:") : (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) ("X-Mozilla-Status:"
); int __result = (((const unsigned char *) (const char *) (buf
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (buf))[
3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("X-Mozilla-Status:"
) && ((size_t)(const void *)(("X-Mozilla-Status:") + 1
) - (size_t)(const void *)("X-Mozilla-Status:") == 1) &&
(__s2_len = strlen ("X-Mozilla-Status:"), __s2_len < 4) ?
(__builtin_constant_p (buf) && ((size_t)(const void *
)((buf) + 1) - (size_t)(const void *)(buf) == 1) ? __builtin_strcmp
(buf, "X-Mozilla-Status:") : (- (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (buf); int
__result = (((const unsigned char *) (const char *) ("X-Mozilla-Status:"
))[0] - __s2[0]); if (__s2_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("X-Mozilla-Status:"
))[1] - __s2[1]); if (__s2_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("X-Mozilla-Status:"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("X-Mozilla-Status:"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (buf
, "X-Mozilla-Status:")))); }) : strncmp (buf, "X-Mozilla-Status:"
, 17)))
)
1604 {
1605 c = buf[21];
1606 if (c < '8') /* Not deleted */
1607 c -= '0';
1608 if (c >= '8' || (c & 0x1))
1609 return TRUE(!(0));
1610 }
1611
1612 /* Evolution
1613 */
1614 if (!strncmp(buf, "X-Evolution:", 12)(__extension__ (__builtin_constant_p (12) && ((__builtin_constant_p
(buf) && strlen (buf) < ((size_t) (12))) || (__builtin_constant_p
("X-Evolution:") && strlen ("X-Evolution:") < ((size_t
) (12)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(buf) && __builtin_constant_p ("X-Evolution:") &&
(__s1_len = strlen (buf), __s2_len = strlen ("X-Evolution:")
, (!((size_t)(const void *)((buf) + 1) - (size_t)(const void *
)(buf) == 1) || __s1_len >= 4) && (!((size_t)(const
void *)(("X-Evolution:") + 1) - (size_t)(const void *)("X-Evolution:"
) == 1) || __s2_len >= 4)) ? __builtin_strcmp (buf, "X-Evolution:"
) : (__builtin_constant_p (buf) && ((size_t)(const void
*)((buf) + 1) - (size_t)(const void *)(buf) == 1) &&
(__s1_len = strlen (buf), __s1_len < 4) ? (__builtin_constant_p
("X-Evolution:") && ((size_t)(const void *)(("X-Evolution:"
) + 1) - (size_t)(const void *)("X-Evolution:") == 1) ? __builtin_strcmp
(buf, "X-Evolution:") : (__extension__ ({ const unsigned char
*__s2 = (const unsigned char *) (const char *) ("X-Evolution:"
); int __result = (((const unsigned char *) (const char *) (buf
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (buf))[
3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("X-Evolution:"
) && ((size_t)(const void *)(("X-Evolution:") + 1) - (
size_t)(const void *)("X-Evolution:") == 1) && (__s2_len
= strlen ("X-Evolution:"), __s2_len < 4) ? (__builtin_constant_p
(buf) && ((size_t)(const void *)((buf) + 1) - (size_t
)(const void *)(buf) == 1) ? __builtin_strcmp (buf, "X-Evolution:"
) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) (buf); int __result = (((const unsigned
char *) (const char *) ("X-Evolution:"))[0] - __s2[0]); if (
__s2_len > 0 && __result == 0) { __result = (((const
unsigned char *) (const char *) ("X-Evolution:"))[1] - __s2[
1]); if (__s2_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) ("X-Evolution:"))
[2] - __s2[2]); if (__s2_len > 2 && __result == 0)
__result = (((const unsigned char *) (const char *) ("X-Evolution:"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (buf
, "X-Evolution:")))); }) : strncmp (buf, "X-Evolution:", 12))
)
)
1615 {
1616 sscanf(buf+22, "%04x", &tmp);
1617 if (tmp & (1<<4))
1618 return TRUE(!(0));
1619 }
1620
1621 return FALSE(0);
1622 }
1623
1624 /* test if a mail is marked as deleted
1625 | Evolution uses status with X-Evolution: 00000000-xxxx where xxxx status is
1626 | a bitfield in hexadecimal (see enum _CamelMessageFlags in evolution/camel source)
1627 | and most importantly CAMEL_MESSAGE_DELETED = 1<<1.
1628 */
1629static gboolean
1630status_is_deleted(gchar *buf)
1631 {
1632 guint tmp;
1633
1634 /* Standard mail clients
1635 if ( !strncmp(buf, "Status:", 7) )
1636 */
1637 /* Netscape
1638 if (!strncmp(buf, "X-Mozilla-Status:", 17))
1639 */
1640 /* Evolution
1641 */
1642 if (!strncmp(buf, "X-Evolution:", 12)(__extension__ (__builtin_constant_p (12) && ((__builtin_constant_p
(buf) && strlen (buf) < ((size_t) (12))) || (__builtin_constant_p
("X-Evolution:") && strlen ("X-Evolution:") < ((size_t
) (12)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(buf) && __builtin_constant_p ("X-Evolution:") &&
(__s1_len = strlen (buf), __s2_len = strlen ("X-Evolution:")
, (!((size_t)(const void *)((buf) + 1) - (size_t)(const void *
)(buf) == 1) || __s1_len >= 4) && (!((size_t)(const
void *)(("X-Evolution:") + 1) - (size_t)(const void *)("X-Evolution:"
) == 1) || __s2_len >= 4)) ? __builtin_strcmp (buf, "X-Evolution:"
) : (__builtin_constant_p (buf) && ((size_t)(const void
*)((buf) + 1) - (size_t)(const void *)(buf) == 1) &&
(__s1_len = strlen (buf), __s1_len < 4) ? (__builtin_constant_p
("X-Evolution:") && ((size_t)(const void *)(("X-Evolution:"
) + 1) - (size_t)(const void *)("X-Evolution:") == 1) ? __builtin_strcmp
(buf, "X-Evolution:") : (__extension__ ({ const unsigned char
*__s2 = (const unsigned char *) (const char *) ("X-Evolution:"
); int __result = (((const unsigned char *) (const char *) (buf
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (buf))[
3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("X-Evolution:"
) && ((size_t)(const void *)(("X-Evolution:") + 1) - (
size_t)(const void *)("X-Evolution:") == 1) && (__s2_len
= strlen ("X-Evolution:"), __s2_len < 4) ? (__builtin_constant_p
(buf) && ((size_t)(const void *)((buf) + 1) - (size_t
)(const void *)(buf) == 1) ? __builtin_strcmp (buf, "X-Evolution:"
) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) (buf); int __result = (((const unsigned
char *) (const char *) ("X-Evolution:"))[0] - __s2[0]); if (
__s2_len > 0 && __result == 0) { __result = (((const
unsigned char *) (const char *) ("X-Evolution:"))[1] - __s2[
1]); if (__s2_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) ("X-Evolution:"))
[2] - __s2[2]); if (__s2_len > 2 && __result == 0)
__result = (((const unsigned char *) (const char *) ("X-Evolution:"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (buf
, "X-Evolution:")))); }) : strncmp (buf, "X-Evolution:", 12))
)
)
1643 {
1644 sscanf(buf+22, "%04x", &tmp);
1645 if (tmp & (1<<1))
1646 return TRUE(!(0));
1647 /* Junk is not explicitly marked as deleted but is shown as if
1648 | where in evolution
1649 */
1650 if (tmp & (1<<7))
1651 return TRUE(!(0));
1652 }
1653
1654 return FALSE(0);
1655 }
1656
1657static gboolean
1658check_mbox(Mailbox *mbox)
1659 {
1660 FILE *f;
1661 struct utimbuf ut;
1662 struct stat s;
1663 gchar buf[1024];
1664 gchar mpart_sep[1024];
1665 gint in_header = FALSE(0);
1666 gint marked_read = FALSE(0);
1667 gint is_multipart = FALSE(0);
1668 gint content_len = 0;
1669
1670 if (g_statstat(mbox->account->path, &s) != 0)
1671 {
1672 mbox->mail_count = mbox->old_mail_count = mbox->new_mail_count = 0;
1673 mbox->last_mtime = 0;
1674 mbox->last_size = 0;
1675 gkrellm_debug(DEBUG_MAIL0x10, "check_mbox can't stat(%s): %s\n",
1676 mbox->account->path, g_strerror(errno(*__errno_location ())));
1677 return FALSE(0);
1678 }
1679
1680 /* Message no-counting mode reports new mail based on mailbox
1681 | modified time and size.
1682 */
1683 if (count_mode == MSG_NO_COUNT2)
1684 {
1685 if ( s.st_size > 0
1686 && s.st_size >= mbox->last_size
1687 && s.st_mtimest_mtim.tv_sec >= s.st_atimest_atim.tv_sec
1688 )
1689 mbox->new_mail_count = TRUE(!(0));
1690 else
1691 mbox->new_mail_count = FALSE(0);
1692 mbox->mail_count = (s.st_size > 0) ? 1 : 0; /* boolean, not used */
1693 mbox->old_mail_count = 0; /* not used */
1694 mbox->last_size = s.st_size;
1695 mbox->last_mtime = s.st_mtimest_mtim.tv_sec;
1696 return TRUE(!(0));
1697 }
1698
1699 /* If the mailboxes have been modified since last check, count
1700 | the new/total messages.
1701 */
1702 if ( s.st_mtimest_mtim.tv_sec != mbox->last_mtime
1703 || s.st_size != mbox->last_size
1704 || force_mail_check
1705 )
1706 {
1707 if ((f = g_fopenfopen(mbox->account->path, "r")) == NULL((void*)0))
1708 {
1709 gkrellm_debug(DEBUG_MAIL0x10, "check_mbox can't fopen(%s): %s\n",
1710 mbox->account->path, g_strerror(errno(*__errno_location ())));
1711 return FALSE(0);
1712 }
1713 mbox->mail_count = 0;
1714 mbox->old_mail_count = 0;
1715 while(fgets(buf, sizeof(buf), f))
1716 {
1717 if (is_multipart && !in_header)
1718 {
1719 /* Skip to last line of multipart mail */
1720 if (strncmp(buf,mpart_sep,strlen(mpart_sep))(__extension__ (__builtin_constant_p (strlen(mpart_sep)) &&
((__builtin_constant_p (buf) && strlen (buf) < ((
size_t) (strlen(mpart_sep)))) || (__builtin_constant_p (mpart_sep
) && strlen (mpart_sep) < ((size_t) (strlen(mpart_sep
))))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(buf) && __builtin_constant_p (mpart_sep) &&
(__s1_len = strlen (buf), __s2_len = strlen (mpart_sep), (!(
(size_t)(const void *)((buf) + 1) - (size_t)(const void *)(buf
) == 1) || __s1_len >= 4) && (!((size_t)(const void
*)((mpart_sep) + 1) - (size_t)(const void *)(mpart_sep) == 1
) || __s2_len >= 4)) ? __builtin_strcmp (buf, mpart_sep) :
(__builtin_constant_p (buf) && ((size_t)(const void *
)((buf) + 1) - (size_t)(const void *)(buf) == 1) && (
__s1_len = strlen (buf), __s1_len < 4) ? (__builtin_constant_p
(mpart_sep) && ((size_t)(const void *)((mpart_sep) +
1) - (size_t)(const void *)(mpart_sep) == 1) ? __builtin_strcmp
(buf, mpart_sep) : (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) (mpart_sep); int __result
= (((const unsigned char *) (const char *) (buf))[0] - __s2[
0]); if (__s1_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) (buf))[1] - __s2[
1]); if (__s1_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) (buf))[2] - __s2[
2]); if (__s1_len > 2 && __result == 0) __result =
(((const unsigned char *) (const char *) (buf))[3] - __s2[3]
); } } __result; }))) : (__builtin_constant_p (mpart_sep) &&
((size_t)(const void *)((mpart_sep) + 1) - (size_t)(const void
*)(mpart_sep) == 1) && (__s2_len = strlen (mpart_sep
), __s2_len < 4) ? (__builtin_constant_p (buf) && (
(size_t)(const void *)((buf) + 1) - (size_t)(const void *)(buf
) == 1) ? __builtin_strcmp (buf, mpart_sep) : (- (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) (buf); int __result = (((const unsigned char *) (const
char *) (mpart_sep))[0] - __s2[0]); if (__s2_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (mpart_sep))[1] - __s2[1]); if (__s2_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (mpart_sep))[2] - __s2[2]); if (__s2_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) (mpart_sep))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp
(buf, mpart_sep)))); }) : strncmp (buf, mpart_sep, strlen(mpart_sep
))))
==0)
1721 is_multipart = FALSE(0);
1722 }
1723 else if (buf[0] == '\n')
1724 {
1725 in_header = FALSE(0);
1726 mbox->is_internal = FALSE(0);
1727 if (content_len > 0) { /* Then see if we can jump to the next message in sequence */
1728 long this_pos, jump_to;
1729 this_pos = ftell(f);
1730 jump_to = content_len + this_pos + 1;
1731 if (fseek(f, jump_to, SEEK_SET0) != 0 ||
1732 fgets(buf, sizeof(buf), f) == NULL((void*)0) ||
1733 strncmp("From ", buf, 5)(__extension__ (__builtin_constant_p (5) && ((__builtin_constant_p
("From ") && strlen ("From ") < ((size_t) (5))) ||
(__builtin_constant_p (buf) && strlen (buf) < ((size_t
) (5)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
("From ") && __builtin_constant_p (buf) && (
__s1_len = strlen ("From "), __s2_len = strlen (buf), (!((size_t
)(const void *)(("From ") + 1) - (size_t)(const void *)("From "
) == 1) || __s1_len >= 4) && (!((size_t)(const void
*)((buf) + 1) - (size_t)(const void *)(buf) == 1) || __s2_len
>= 4)) ? __builtin_strcmp ("From ", buf) : (__builtin_constant_p
("From ") && ((size_t)(const void *)(("From ") + 1) -
(size_t)(const void *)("From ") == 1) && (__s1_len =
strlen ("From "), __s1_len < 4) ? (__builtin_constant_p (
buf) && ((size_t)(const void *)((buf) + 1) - (size_t)
(const void *)(buf) == 1) ? __builtin_strcmp ("From ", buf) :
(__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) (buf); int __result = (((const unsigned
char *) (const char *) ("From "))[0] - __s2[0]); if (__s1_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("From "))[1] - __s2[1]); if (__s1_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("From "))[2] - __s2[2]); if (__s1_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) ("From "))[3] - __s2[3]); } } __result
; }))) : (__builtin_constant_p (buf) && ((size_t)(const
void *)((buf) + 1) - (size_t)(const void *)(buf) == 1) &&
(__s2_len = strlen (buf), __s2_len < 4) ? (__builtin_constant_p
("From ") && ((size_t)(const void *)(("From ") + 1) -
(size_t)(const void *)("From ") == 1) ? __builtin_strcmp ("From "
, buf) : (- (__extension__ ({ const unsigned char *__s2 = (const
unsigned char *) (const char *) ("From "); int __result = ((
(const unsigned char *) (const char *) (buf))[0] - __s2[0]); if
(__s2_len > 0 && __result == 0) { __result = (((const
unsigned char *) (const char *) (buf))[1] - __s2[1]); if (__s2_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) (buf))[2] - __s2[2]); if (__s2_len >
2 && __result == 0) __result = (((const unsigned char
*) (const char *) (buf))[3] - __s2[3]); } } __result; })))) :
__builtin_strcmp ("From ", buf)))); }) : strncmp ("From ", buf
, 5)))
)
1734 {
1735 fseek(f, this_pos, SEEK_SET0);
1736 }
1737 else /* We have an apparently valid From line */
1738 {
1739 if (is_From_line(mbox, buf))
1740 {
1741 mbox->mail_count += 1;
1742 in_header = TRUE(!(0));
1743 marked_read = FALSE(0);
1744 content_len = 0;
1745 is_multipart = FALSE(0);
1746 }
1747 else
1748 {
1749 fseek(f, this_pos, SEEK_SET0);
1750 }
1751 }
1752 }
1753 }
1754 else if (is_From_line(mbox, buf))
1755 {
1756 mbox->mail_count += 1;
1757 in_header = TRUE(!(0));
1758 marked_read = FALSE(0);
1759 content_len = 0;
1760 }
1761 else if (in_header && !strncmp(buf, "Content-Length: ", 16)(__extension__ (__builtin_constant_p (16) && ((__builtin_constant_p
(buf) && strlen (buf) < ((size_t) (16))) || (__builtin_constant_p
("Content-Length: ") && strlen ("Content-Length: ") <
((size_t) (16)))) ? __extension__ ({ size_t __s1_len, __s2_len
; (__builtin_constant_p (buf) && __builtin_constant_p
("Content-Length: ") && (__s1_len = strlen (buf), __s2_len
= strlen ("Content-Length: "), (!((size_t)(const void *)((buf
) + 1) - (size_t)(const void *)(buf) == 1) || __s1_len >= 4
) && (!((size_t)(const void *)(("Content-Length: ") +
1) - (size_t)(const void *)("Content-Length: ") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (buf, "Content-Length: ") : (__builtin_constant_p
(buf) && ((size_t)(const void *)((buf) + 1) - (size_t
)(const void *)(buf) == 1) && (__s1_len = strlen (buf
), __s1_len < 4) ? (__builtin_constant_p ("Content-Length: "
) && ((size_t)(const void *)(("Content-Length: ") + 1
) - (size_t)(const void *)("Content-Length: ") == 1) ? __builtin_strcmp
(buf, "Content-Length: ") : (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) ("Content-Length: "
); int __result = (((const unsigned char *) (const char *) (buf
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (buf)
)[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (buf))[
3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("Content-Length: "
) && ((size_t)(const void *)(("Content-Length: ") + 1
) - (size_t)(const void *)("Content-Length: ") == 1) &&
(__s2_len = strlen ("Content-Length: "), __s2_len < 4) ? (
__builtin_constant_p (buf) && ((size_t)(const void *)
((buf) + 1) - (size_t)(const void *)(buf) == 1) ? __builtin_strcmp
(buf, "Content-Length: ") : (- (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (buf); int
__result = (((const unsigned char *) (const char *) ("Content-Length: "
))[0] - __s2[0]); if (__s2_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("Content-Length: "
))[1] - __s2[1]); if (__s2_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("Content-Length: "
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("Content-Length: "
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (buf
, "Content-Length: ")))); }) : strncmp (buf, "Content-Length: "
, 16)))
)
1762 {
1763 content_len = atoi(buf + 16);
1764 }
1765 else if (in_header && is_status(buf))
1766 {
1767 if (status_is_old(buf) && !marked_read)
1768 {
1769 mbox->old_mail_count += 1;
1770 marked_read = TRUE(!(0));
1771 }
1772 if (status_is_deleted(buf))
1773 {
1774 if (marked_read)
1775 mbox->old_mail_count -= 1;
1776 mbox->mail_count -= 1;
1777 }
1778 }
1779 else if (in_header && mbox->is_internal)
1780 {
1781 if (strncmp(buf, "From: Mail System Internal Data", 31)(__extension__ (__builtin_constant_p (31) && ((__builtin_constant_p
(buf) && strlen (buf) < ((size_t) (31))) || (__builtin_constant_p
("From: Mail System Internal Data") && strlen ("From: Mail System Internal Data"
) < ((size_t) (31)))) ? __extension__ ({ size_t __s1_len, __s2_len
; (__builtin_constant_p (buf) && __builtin_constant_p
("From: Mail System Internal Data") && (__s1_len = strlen
(buf), __s2_len = strlen ("From: Mail System Internal Data")
, (!((size_t)(const void *)((buf) + 1) - (size_t)(const void *
)(buf) == 1) || __s1_len >= 4) && (!((size_t)(const
void *)(("From: Mail System Internal Data") + 1) - (size_t)(
const void *)("From: Mail System Internal Data") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (buf, "From: Mail System Internal Data"
) : (__builtin_constant_p (buf) && ((size_t)(const void
*)((buf) + 1) - (size_t)(const void *)(buf) == 1) &&
(__s1_len = strlen (buf), __s1_len < 4) ? (__builtin_constant_p
("From: Mail System Internal Data") && ((size_t)(const
void *)(("From: Mail System Internal Data") + 1) - (size_t)(
const void *)("From: Mail System Internal Data") == 1) ? __builtin_strcmp
(buf, "From: Mail System Internal Data") : (__extension__ ({
const unsigned char *__s2 = (const unsigned char *) (const char
*) ("From: Mail System Internal Data"); int __result = (((const
unsigned char *) (const char *) (buf))[0] - __s2[0]); if (__s1_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) (buf))[1] - __s2[1]); if (__s1_len >
1 && __result == 0) { __result = (((const unsigned char
*) (const char *) (buf))[2] - __s2[2]); if (__s1_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) (buf))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p
("From: Mail System Internal Data") && ((size_t)(const
void *)(("From: Mail System Internal Data") + 1) - (size_t)(
const void *)("From: Mail System Internal Data") == 1) &&
(__s2_len = strlen ("From: Mail System Internal Data"), __s2_len
< 4) ? (__builtin_constant_p (buf) && ((size_t)(const
void *)((buf) + 1) - (size_t)(const void *)(buf) == 1) ? __builtin_strcmp
(buf, "From: Mail System Internal Data") : (- (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) (buf); int __result = (((const unsigned char *) (const
char *) ("From: Mail System Internal Data"))[0] - __s2[0]); if
(__s2_len > 0 && __result == 0) { __result = (((const
unsigned char *) (const char *) ("From: Mail System Internal Data"
))[1] - __s2[1]); if (__s2_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("From: Mail System Internal Data"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("From: Mail System Internal Data"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (buf
, "From: Mail System Internal Data")))); }) : strncmp (buf, "From: Mail System Internal Data"
, 31)))
== 0)
1782 {
1783 in_header = FALSE(0);
1784 mbox->mail_count -= 1;
1785 mbox->is_internal = FALSE(0);
1786 }
1787 }
1788 else if (in_header && is_multipart_mail(buf,mpart_sep))
1789 {
1790 is_multipart = TRUE(!(0));
1791 }
1792 }
1793 fclose(f);
1794
1795 /* Restore the mbox stat times for other mail checking programs and
1796 | so the (st_atime > st_mtime) animation override below will work.
1797 */
1798 ut.actime = s.st_atimest_atim.tv_sec;
1799 ut.modtime = s.st_mtimest_mtim.tv_sec;
1800 utime(mbox->account->path, &ut);
1801
1802 mbox->last_mtime = s.st_mtimest_mtim.tv_sec;
1803 mbox->last_size = s.st_size;
1804 gkrellm_debug(DEBUG_MAIL0x10, "check_mbox %s: total=%d old=%d\n",
1805 mbox->account->path, mbox->mail_count, mbox->old_mail_count);
1806 }
1807 /* Set the animation state when new mail count changes, and override
1808 | the animation to false if mbox has been accessed since last modify
1809 | (A MUA has probably read the mbox).
1810 */
1811 mbox->new_mail_count = mbox->mail_count - mbox->old_mail_count;
1812 if (s.st_atimest_atim.tv_sec > s.st_mtimest_mtim.tv_sec)
1813 {
1814 mbox->need_animation = FALSE(0);
1815 mbox->prev_new_mail_count = mbox->new_mail_count;
1816 }
1817 return TRUE(!(0));
1818 }
1819
1820static GkrellmDecal *mail_text_decal;
1821static GkrellmDecal *mail_icon_decal;
1822
1823static void
1824draw_mail_text_decal(gint new_mail_count, gint mail_count)
1825 {
1826 GkrellmTextstyle ts, ts_save;
1827 gint x, w;
1828 GkrellmPanel *p;
1829 GkrellmDecal *d;
1830 GkrellmStyle *style;
1831 GkrellmMargin *m;
1832 gchar buf[32], nbuf[16], tbuf[16];
1833
1834 p = mail;
1835 d = mail_text_decal;
1836
1837 ts_save = d->text_style;
1838 if (new_mail_count == MUTE_FLAG-1)
1839 {
1840 snprintf(buf, sizeof(buf), _("mute")dcgettext ("gkrellm", "mute", 5));
1841 ts = *gkrellm_meter_alt_textstyle(style_id); /* Use the alt color */
1842 ts.font = d->text_style.font;
1843 }
1844 else
1845 {
1846 ts = d->text_style;
1847 if (count_mode == MSG_NO_COUNT2)
1848 buf[0] = '\0';
1849 else if (count_mode == MSG_NEW_COUNT1)
1850 {
1851 if (new_mail_count == 0)
1852 strcpy(buf, "-");
1853 else
1854 snprintf(buf, sizeof(buf), "%d", new_mail_count);
1855 }
1856 else /* MSG_NEW_TOTAL_COUNT */
1857 {
1858 if (new_mail_count == 0)
1859 strcpy(nbuf, "-");
1860 else
1861 snprintf(nbuf, sizeof(nbuf), "%d", new_mail_count);
1862 if (mail_count == 0)
1863 strcpy(tbuf, "-");
1864 else
1865 snprintf(tbuf, sizeof(tbuf), "%d", mail_count);
1866 snprintf(buf, sizeof(buf), "%s/%s", nbuf, tbuf);
1867 }
1868 }
1869 w = gkrellm_gdk_string_width(ts.font, buf);
1870 if (w > d->w)
1871 {
1872 ts.font = gkrellm_meter_alt_textstyle(style_id)->font;
1873 w = gkrellm_gdk_string_width(ts.font, buf);
1874 }
1875 style = gkrellm_meter_style(style_id);
1876 m = gkrellm_get_style_margins(style);
1877 x = gkrellm_chart_width() * p->label->position / GKRELLM_LABEL_MAX100;
1878 x -= m->right + w / 2;
1879 if (p->label->position >= 50)
1880 x -= mail_icon_decal->w;
1881 if (x > d->w - w)
1882 x = d->w - w;
1883 if (x < 0)
1884 x = 0;
1885 d->text_style = ts;
1886 d->x_off = x;
1887 gkrellm_draw_decal_text(p, d, buf, 0);
1888 d->text_style = ts_save;
1889 }
1890
1891static void
1892mbox_set_animation_state(Mailbox *mbox)
1893 {
1894 if (mbox->new_mail_count != mbox->prev_new_mail_count)
1895 mbox->need_animation =
1896 (mbox->new_mail_count > mbox->prev_new_mail_count);
1897 }
1898
1899static void
1900update_krell_animation_frame(void)
1901 {
1902 /* Run the animation. Just go back and forth with a pause on
1903 | frames 1 and full_scale - 1 (frames 0 and full_scale are cut off).
1904 | Frame 0 is blank anyway, and frame full_scale is just not used.
1905 */
1906 if (anim_pause-- <= 0)
1907 {
1908 if (anim_frame <= 1)
1909 anim_dir = 1;
1910 if (anim_frame >= KRELL(mail)((GkrellmKrell *)(((mail)->krell_list)->data))->full_scale - 1)
1911 anim_dir = -1;
1912 anim_frame += anim_dir;
1913 anim_frame %= KRELL(mail)((GkrellmKrell *)(((mail)->krell_list)->data))->full_scale;
1914 if (anim_frame == 1 || anim_frame == KRELL(mail)((GkrellmKrell *)(((mail)->krell_list)->data))->full_scale - 1)
1915 anim_pause = 4;
1916 }
1917 }
1918
1919 /* I popen the mail_user_agent so I can know if it is running and
1920 | the mail_fetch so I can process fetchmail/flist/fetcho/... output.
1921 | Reading the pipes need to not block so GKrellM won't freeze.
1922 | So, I need a special non-blocking pipe line reading routine.
1923 */
1924static void
1925pipe_command(Mailproc *mp)
1926 {
1927 gchar **argv;
1928 GError *err = NULL((void*)0);
1929 gboolean res;
1930
1931 if (mp->pipe >= 0) /* Still running? */
1932 {
1933 gkrellm_debug(DEBUG_MAIL0x10, "mail pipe_command: <%s> still running.\n",
1934 mp->command);
1935 return;
1936 }
1937 if (!mp->command || *mp->command == '\0')
1938 return;
1939
1940 g_shell_parse_argv(mp->command, NULL((void*)0), &argv, NULL((void*)0));
1941
1942 gkrellm_debug(DEBUG_MAIL0x10, "mail pipe_command <%s>\n", mp->command);
1943
1944 mp->pipe = -1;
1945 res = g_spawn_async_with_pipes(NULL((void*)0), argv, NULL((void*)0),
1946 G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL,
1947 NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0), &mp->pipe, NULL((void*)0), &err);
1948
1949 if (!res && err)
1950 {
1951 gkrellm_message_dialog(NULL((void*)0), err->message);
1952 g_error_free(err);
1953 }
1954
1955 if (mp->read_gstring)
1956 mp->read_gstring = g_string_truncate(mp->read_gstring, 0);
1957 else
1958 mp->read_gstring = g_string_new("");
1959#if !defined(WIN32)
1960 if (mp->pipe != -1)
1961 fcntl(mp->pipe, F_SETFL4, O_NONBLOCK04000);
1962#endif
1963 g_strfreev(argv);
1964 }
1965
1966
1967 /* Accumulate non-blocking reads from a pipe into a gstring. Then
1968 | try to read a single line from the gstring. If a line is read,
1969 | return the count of chars in the line. But if no line can be read
1970 | and the other end of the pipe has exited (pipe eof), return -1.
1971 | Otherwise return 0 to indicate no line is available but the pipe
1972 | producer is still alive.
1973 | Why this trouble?: the stdio fgets() reading from a non-blocking
1974 | stream is not guaranteed to return complete '\n' delimited lines.
1975 */
1976static gint
1977fgets_pipe(gchar *line, gint len, Mailproc *mp)
1978 {
1979 gchar buf[512];
1980 gint n;
1981
1982 if (mp->pipe >= 0)
1983 {
1984#if defined(WIN32)
1985 DWORD bytesAvailable = 0;
1986 HANDLE hPipe = (HANDLE)_get_osfhandle(mp->pipe);
1987 // pipe is blocking on windows so check before ending up in a
1988 // blocking call to read()
1989 if (!PeekNamedPipe(hPipe, NULL((void*)0), 0, NULL((void*)0), &bytesAvailable, NULL((void*)0)))
1990 {
1991 DWORD err = GetLastError();
1992 // this is no real error if the started mua was closed in the meantime
1993 if (err == ERROR_BROKEN_PIPE)
1994 mp->pipe = -1;
1995 else if (_GK.debug_level & DEBUG_MAIL0x10)
1996 g_debug("fgets_pipe: PeekNamedPipe() FAILED, error was %lu\n", err);
1997 return 0;
1998 }
1999 if (bytesAvailable == 0)
2000 return 0;
2001 n = read(mp->pipe, buf, min(sizeof(buf) - 1, bytesAvailable));
2002#else
2003 n = read(mp->pipe, buf, sizeof(buf) - 1);
2004#endif
2005 if (n <= 0)
2006 {
2007 if ((n == 0) || (errno(*__errno_location ()) != EINTR4 && errno(*__errno_location ()) != EAGAIN11))
2008 {
2009 if (close(mp->pipe) < 0 && errno(*__errno_location ()) == EINTR4)
2010 close(mp->pipe);
2011 mp->pipe = -1;
2012 }
2013 }
2014 else
2015 {
2016 buf[n] = '\0';
2017 mp->read_gstring = g_string_append(mp->read_gstring, buf);
2018 }
2019 }
2020 if (gkrellm_getline_from_gstring(&mp->read_gstring, line, len))
2021 return strlen(line);
2022 if (mp->pipe < 0)
2023 {
2024 if (mp->read_gstring)
2025 g_string_free(mp->read_gstring, TRUE(!(0)));
2026 mp->read_gstring = NULL((void*)0);
2027 return -1;
2028 }
2029 return 0;
2030 }
2031
2032static gboolean
2033mua_is_launched(void)
2034 {
2035 gchar buf[128];
2036 gint n;
2037
2038 if (mail_user_agent.pipe == -1)
2039 return FALSE(0);
2040 while ((n = fgets_pipe(buf, sizeof(buf), &mail_user_agent)) > 0)
2041 ;
2042 return (n < 0) ? FALSE(0) : TRUE(!(0));
2043 }
2044
2045 /* Read mail_fetch pipe and if fetch_check_only_mode, look for output
2046 | of fetchmail -c or flist so I can report mail from these programs.
2047 |
2048 | eg. for MH mail, the nmh program flist -all (from the man page):
2049 | /work/Mail has 5 in sequence unseen (private); out of 46
2050 | inbox+ has 10 in sequence unseen ; out of 153
2051 | junklist has 0 in sequence unseen ; out of 63
2052 |
2053 | For fetchmail, if no remote mail, I get:
2054 | fetchmail: No mail for billw at mail.wt.net
2055 | If remote mail i will get lines like:
2056 | 1 message for billw at mail.wt.net (32743 octets).
2057 | or, as reported by a user, there could be:
2058 | 26 messages (25 seen) for billw at mail.wt.net
2059 | If the remote mail is fetched, I get additional lines like:
2060 | reading message 1 of 1 (32743 octets) .................... flushed
2061 | Note: above 26 messages (25 seen) should show as 1/26 on panel.
2062 |
2063 | And fetchmail can't make up its mind. A user gets this with 5.2.0:
2064 | fetchmail: 5.2.0 querying xx.yy.net (protocol POP3) at Thu, 20 Jan 2000...
2065 | fetchmail: 2 messages for uuu at xx.yy.net (20509 octets).
2066 */
2067
2068 /* Since there is now internal POP3 and IMAP checking, this will not be
2069 | used as much, but there is still flist, using fetchmail for ssl, etc.
2070 | Anyway, here's the code to grok the above mess!
2071 */
2072static gboolean
2073parse_fetch_line(gchar *line, gint *msg, gint *seen)
2074 {
2075 gchar *s, *p, *buf;
2076 gint n, n1, n2;
2077 gint tok_count = 0;
2078 gint state = 0,
2079 seen_flag = FALSE(0),
2080 unseen_flag = FALSE(0);
2081
2082 *msg = 0;
2083 *seen = 0;
2084 n1 = n2 = 0;
2085 buf = g_strdup(line);
2086 s = strtok(buf, " \t()\n");
2087
2088 /* Trap out badly set Fetch/check option.
2089 */
2090 if (!s || !strcmp(s, "reading")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(s) && __builtin_constant_p ("reading") && (
__s1_len = strlen (s), __s2_len = strlen ("reading"), (!((size_t
)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) ||
__s1_len >= 4) && (!((size_t)(const void *)(("reading"
) + 1) - (size_t)(const void *)("reading") == 1) || __s2_len >=
4)) ? __builtin_strcmp (s, "reading") : (__builtin_constant_p
(s) && ((size_t)(const void *)((s) + 1) - (size_t)(const
void *)(s) == 1) && (__s1_len = strlen (s), __s1_len
< 4) ? (__builtin_constant_p ("reading") && ((size_t
)(const void *)(("reading") + 1) - (size_t)(const void *)("reading"
) == 1) ? __builtin_strcmp (s, "reading") : (__extension__ ({
const unsigned char *__s2 = (const unsigned char *) (const char
*) ("reading"); int __result = (((const unsigned char *) (const
char *) (s))[0] - __s2[0]); if (__s1_len > 0 && __result
== 0) { __result = (((const unsigned char *) (const char *) (
s))[1] - __s2[1]); if (__s1_len > 1 && __result ==
0) { __result = (((const unsigned char *) (const char *) (s)
)[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (s))[3]
- __s2[3]); } } __result; }))) : (__builtin_constant_p ("reading"
) && ((size_t)(const void *)(("reading") + 1) - (size_t
)(const void *)("reading") == 1) && (__s2_len = strlen
("reading"), __s2_len < 4) ? (__builtin_constant_p (s) &&
((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s)
== 1) ? __builtin_strcmp (s, "reading") : (- (__extension__ (
{ const unsigned char *__s2 = (const unsigned char *) (const char
*) (s); int __result = (((const unsigned char *) (const char
*) ("reading"))[0] - __s2[0]); if (__s2_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("reading"))[1] - __s2[1]); if (__s2_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("reading"))[2] - __s2[2]); if (__s2_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) ("reading"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp
(s, "reading")))); })
|| !strcmp(s, "skipping")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(s) && __builtin_constant_p ("skipping") && (
__s1_len = strlen (s), __s2_len = strlen ("skipping"), (!((size_t
)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) ||
__s1_len >= 4) && (!((size_t)(const void *)(("skipping"
) + 1) - (size_t)(const void *)("skipping") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (s, "skipping") : (__builtin_constant_p
(s) && ((size_t)(const void *)((s) + 1) - (size_t)(const
void *)(s) == 1) && (__s1_len = strlen (s), __s1_len
< 4) ? (__builtin_constant_p ("skipping") && ((size_t
)(const void *)(("skipping") + 1) - (size_t)(const void *)("skipping"
) == 1) ? __builtin_strcmp (s, "skipping") : (__extension__ (
{ const unsigned char *__s2 = (const unsigned char *) (const char
*) ("skipping"); int __result = (((const unsigned char *) (const
char *) (s))[0] - __s2[0]); if (__s1_len > 0 && __result
== 0) { __result = (((const unsigned char *) (const char *) (
s))[1] - __s2[1]); if (__s1_len > 1 && __result ==
0) { __result = (((const unsigned char *) (const char *) (s)
)[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (s))[3]
- __s2[3]); } } __result; }))) : (__builtin_constant_p ("skipping"
) && ((size_t)(const void *)(("skipping") + 1) - (size_t
)(const void *)("skipping") == 1) && (__s2_len = strlen
("skipping"), __s2_len < 4) ? (__builtin_constant_p (s) &&
((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s)
== 1) ? __builtin_strcmp (s, "skipping") : (- (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) (s); int __result = (((const unsigned char *) (const
char *) ("skipping"))[0] - __s2[0]); if (__s2_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("skipping"))[1] - __s2[1]); if (__s2_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("skipping"))[2] - __s2[2]); if (__s2_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) ("skipping"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp
(s, "skipping")))); })
)
2091 {
2092 g_free(buf);
2093 return FALSE(0);
2094 }
2095
2096 if (_GK.debug_level & DEBUG_MAIL0x10)
2097 g_debug(" parse[");
2098 while (s)
2099 {
2100 if (++tok_count > 3 && state == 0) /* need a int within 3 tokens */
2101 break;
2102 n = strtol(s, &p, 0);
2103 if (*p == ' ' || *p == '\t' || *p == '\0' || *p == '\n')
2104 { /* Have an integer, and not a x.y version number */
2105 if (_GK.debug_level & DEBUG_MAIL0x10)
2106 g_debug("*<%s>,st=%d,", s, state);
2107 if (state == 0)
2108 n1 = n;
2109 else if (state == 1)
2110 n2 = n;
2111 if (_GK.debug_level & DEBUG_MAIL0x10)
2112 g_debug("n1=%d,n2=%d state=%d*", n1, n2, state);
2113 ++state;
2114 }
2115 else if (!strcmp(s, "seen")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(s) && __builtin_constant_p ("seen") && (__s1_len
= strlen (s), __s2_len = strlen ("seen"), (!((size_t)(const void
*)((s) + 1) - (size_t)(const void *)(s) == 1) || __s1_len >=
4) && (!((size_t)(const void *)(("seen") + 1) - (size_t
)(const void *)("seen") == 1) || __s2_len >= 4)) ? __builtin_strcmp
(s, "seen") : (__builtin_constant_p (s) && ((size_t)
(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) &&
(__s1_len = strlen (s), __s1_len < 4) ? (__builtin_constant_p
("seen") && ((size_t)(const void *)(("seen") + 1) - (
size_t)(const void *)("seen") == 1) ? __builtin_strcmp (s, "seen"
) : (__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) ("seen"); int __result = (((const unsigned
char *) (const char *) (s))[0] - __s2[0]); if (__s1_len >
0 && __result == 0) { __result = (((const unsigned char
*) (const char *) (s))[1] - __s2[1]); if (__s1_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (s))[2] - __s2[2]); if (__s1_len > 2 && __result
== 0) __result = (((const unsigned char *) (const char *) (s
))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
"seen") && ((size_t)(const void *)(("seen") + 1) - (size_t
)(const void *)("seen") == 1) && (__s2_len = strlen (
"seen"), __s2_len < 4) ? (__builtin_constant_p (s) &&
((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s)
== 1) ? __builtin_strcmp (s, "seen") : (- (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
(s); int __result = (((const unsigned char *) (const char *)
("seen"))[0] - __s2[0]); if (__s2_len > 0 && __result
== 0) { __result = (((const unsigned char *) (const char *) (
"seen"))[1] - __s2[1]); if (__s2_len > 1 && __result
== 0) { __result = (((const unsigned char *) (const char *) (
"seen"))[2] - __s2[2]); if (__s2_len > 2 && __result
== 0) __result = (((const unsigned char *) (const char *) ("seen"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (s, "seen"
)))); })
|| !strcmp(s, _("seen"))__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(s) && __builtin_constant_p (dcgettext ("gkrellm", "seen"
, 5)) && (__s1_len = strlen (s), __s2_len = strlen (dcgettext
("gkrellm", "seen", 5)), (!((size_t)(const void *)((s) + 1) -
(size_t)(const void *)(s) == 1) || __s1_len >= 4) &&
(!((size_t)(const void *)((dcgettext ("gkrellm", "seen", 5))
+ 1) - (size_t)(const void *)(dcgettext ("gkrellm", "seen", 5
)) == 1) || __s2_len >= 4)) ? __builtin_strcmp (s, dcgettext
("gkrellm", "seen", 5)) : (__builtin_constant_p (s) &&
((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s)
== 1) && (__s1_len = strlen (s), __s1_len < 4) ? (
__builtin_constant_p (dcgettext ("gkrellm", "seen", 5)) &&
((size_t)(const void *)((dcgettext ("gkrellm", "seen", 5)) +
1) - (size_t)(const void *)(dcgettext ("gkrellm", "seen", 5)
) == 1) ? __builtin_strcmp (s, dcgettext ("gkrellm", "seen", 5
)) : (__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) (dcgettext ("gkrellm", "seen", 5)); int
__result = (((const unsigned char *) (const char *) (s))[0] -
__s2[0]); if (__s1_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) (s))[1] - __s2[1]
); if (__s1_len > 1 && __result == 0) { __result =
(((const unsigned char *) (const char *) (s))[2] - __s2[2]);
if (__s1_len > 2 && __result == 0) __result = (((
const unsigned char *) (const char *) (s))[3] - __s2[3]); } }
__result; }))) : (__builtin_constant_p (dcgettext ("gkrellm"
, "seen", 5)) && ((size_t)(const void *)((dcgettext (
"gkrellm", "seen", 5)) + 1) - (size_t)(const void *)(dcgettext
("gkrellm", "seen", 5)) == 1) && (__s2_len = strlen (
dcgettext ("gkrellm", "seen", 5)), __s2_len < 4) ? (__builtin_constant_p
(s) && ((size_t)(const void *)((s) + 1) - (size_t)(const
void *)(s) == 1) ? __builtin_strcmp (s, dcgettext ("gkrellm"
, "seen", 5)) : (- (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) (s); int __result =
(((const unsigned char *) (const char *) (dcgettext ("gkrellm"
, "seen", 5)))[0] - __s2[0]); if (__s2_len > 0 && __result
== 0) { __result = (((const unsigned char *) (const char *) (
dcgettext ("gkrellm", "seen", 5)))[1] - __s2[1]); if (__s2_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) (dcgettext ("gkrellm", "seen", 5)))[2
] - __s2[2]); if (__s2_len > 2 && __result == 0) __result
= (((const unsigned char *) (const char *) (dcgettext ("gkrellm"
, "seen", 5)))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp
(s, dcgettext ("gkrellm", "seen", 5))))); })
)
2116 seen_flag = TRUE(!(0));
2117 else if (!strcmp(s, "unseen")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(s) && __builtin_constant_p ("unseen") && (__s1_len
= strlen (s), __s2_len = strlen ("unseen"), (!((size_t)(const
void *)((s) + 1) - (size_t)(const void *)(s) == 1) || __s1_len
>= 4) && (!((size_t)(const void *)(("unseen") + 1
) - (size_t)(const void *)("unseen") == 1) || __s2_len >= 4
)) ? __builtin_strcmp (s, "unseen") : (__builtin_constant_p (
s) && ((size_t)(const void *)((s) + 1) - (size_t)(const
void *)(s) == 1) && (__s1_len = strlen (s), __s1_len
< 4) ? (__builtin_constant_p ("unseen") && ((size_t
)(const void *)(("unseen") + 1) - (size_t)(const void *)("unseen"
) == 1) ? __builtin_strcmp (s, "unseen") : (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
("unseen"); int __result = (((const unsigned char *) (const char
*) (s))[0] - __s2[0]); if (__s1_len > 0 && __result
== 0) { __result = (((const unsigned char *) (const char *) (
s))[1] - __s2[1]); if (__s1_len > 1 && __result ==
0) { __result = (((const unsigned char *) (const char *) (s)
)[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (s))[3]
- __s2[3]); } } __result; }))) : (__builtin_constant_p ("unseen"
) && ((size_t)(const void *)(("unseen") + 1) - (size_t
)(const void *)("unseen") == 1) && (__s2_len = strlen
("unseen"), __s2_len < 4) ? (__builtin_constant_p (s) &&
((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s)
== 1) ? __builtin_strcmp (s, "unseen") : (- (__extension__ (
{ const unsigned char *__s2 = (const unsigned char *) (const char
*) (s); int __result = (((const unsigned char *) (const char
*) ("unseen"))[0] - __s2[0]); if (__s2_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("unseen"))[1] - __s2[1]); if (__s2_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) ("unseen"))[2] - __s2[2]); if (__s2_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) ("unseen"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp
(s, "unseen")))); })
)
2118 unseen_flag = TRUE(!(0));
2119 s = strtok(NULL((void*)0), " \t()\n");
2120 }
2121 if (state > 1 && seen_flag) /* 26 messages (25 seen) ... */
2122 {
2123 *msg = n1;
2124 *seen = n2;
2125 }
2126 else if (state > 1 && unseen_flag) /* /xxx has 5 in sequence unseen ... */
2127 {
2128 *msg = n2;
2129 *seen = n2 - n1;
2130 }
2131 else if (state > 0) /* 1 message for billw at ... */
2132 *msg = n1; /* or Fetchmail: 1 message for .... */
2133 if (_GK.debug_level & DEBUG_MAIL0x10)
2134 g_debug("]snf=%d sunf=%d msg=%d seen=%d STATE=%d\n",
2135 seen_flag, unseen_flag, *msg, *seen, state);
2136 g_free(buf);
2137 return TRUE(!(0));
2138 }
2139
2140
2141static gint
2142compare_mailboxes(gconstpointer a, gconstpointer b)
2143 {
2144 gchar a_name[128];
2145 gchar b_name[128];
2146
2147 format_remote_mbox_name((Mailbox *)a, a_name, sizeof(a_name));
2148 format_remote_mbox_name((Mailbox *)b, b_name, sizeof(b_name));
2149
2150 return strcmp(a_name, b_name)__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(a_name) && __builtin_constant_p (b_name) &&
(__s1_len = strlen (a_name), __s2_len = strlen (b_name), (!(
(size_t)(const void *)((a_name) + 1) - (size_t)(const void *)
(a_name) == 1) || __s1_len >= 4) && (!((size_t)(const
void *)((b_name) + 1) - (size_t)(const void *)(b_name) == 1)
|| __s2_len >= 4)) ? __builtin_strcmp (a_name, b_name) : (
__builtin_constant_p (a_name) && ((size_t)(const void
*)((a_name) + 1) - (size_t)(const void *)(a_name) == 1) &&
(__s1_len = strlen (a_name), __s1_len < 4) ? (__builtin_constant_p
(b_name) && ((size_t)(const void *)((b_name) + 1) - (
size_t)(const void *)(b_name) == 1) ? __builtin_strcmp (a_name
, b_name) : (__extension__ ({ const unsigned char *__s2 = (const
unsigned char *) (const char *) (b_name); int __result = (((
const unsigned char *) (const char *) (a_name))[0] - __s2[0])
; if (__s1_len > 0 && __result == 0) { __result = (
((const unsigned char *) (const char *) (a_name))[1] - __s2[1
]); if (__s1_len > 1 && __result == 0) { __result =
(((const unsigned char *) (const char *) (a_name))[2] - __s2
[2]); if (__s1_len > 2 && __result == 0) __result =
(((const unsigned char *) (const char *) (a_name))[3] - __s2
[3]); } } __result; }))) : (__builtin_constant_p (b_name) &&
((size_t)(const void *)((b_name) + 1) - (size_t)(const void *
)(b_name) == 1) && (__s2_len = strlen (b_name), __s2_len
< 4) ? (__builtin_constant_p (a_name) && ((size_t
)(const void *)((a_name) + 1) - (size_t)(const void *)(a_name
) == 1) ? __builtin_strcmp (a_name, b_name) : (- (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) (a_name); int __result = (((const unsigned char *) (
const char *) (b_name))[0] - __s2[0]); if (__s2_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (b_name))[1] - __s2[1]); if (__s2_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (b_name))[2] - __s2[2]); if (__s2_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) (b_name))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp
(a_name, b_name)))); })
;
2151 }
2152
2153static void
2154make_fetch_tooltip(gchar *line, gint msg, gint seen)
2155 {
2156 Mailbox *mbox;
2157 MailAccount *account;
2158 GList *old_mbox_pointer;
2159 gchar buf[64], *s;
2160
2161 mbox = g_new0(Mailbox, 1)(Mailbox *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s
= sizeof (Mailbox); gpointer __p; if (__s == 1) __p = g_malloc0
(__n); else if (__builtin_constant_p (__n) && (__s ==
0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =
g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p
; }))
;
2162 account = g_new0(MailAccount, 1)(MailAccount *) (__extension__ ({ gsize __n = (gsize) (1); gsize
__s = sizeof (MailAccount); gpointer __p; if (__s == 1) __p =
g_malloc0 (__n); else if (__builtin_constant_p (__n) &&
(__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s
)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s
); __p; }))
;
2163 mbox->account = account;
2164 account->mboxtype = MBOX_FETCH_TOOLTIP(6);
2165
2166 if ((s = strstr(line, "sequence unseen")) != NULL((void*)0)) /* flist */
2167 {
2168 sscanf(line, "%63s", buf);
2169 account->username = g_strdup(buf);
2170 }
2171 else if ((s = strstr(line, " for ")) != NULL((void*)0)) /* fetchmail */
2172 {
2173 sscanf(s + 5, "%63s", buf);
2174 account->username = g_strdup(buf);
2175 if ((s = strstr(line, " at ")) != NULL((void*)0))
2176 {
2177 sscanf(s + 4, "%63s", buf);
2178 account->server = g_strdup(buf);
2179 }
2180 if ((s = strstr(line, "(folder ")) != NULL((void*)0))
2181 {
2182 sscanf(s + 8, "%63[^)]", buf);
2183 account->imapfolder = g_strdup(buf);
2184 }
2185 }
2186 else
2187 {
2188 free_mailbox(mbox);
2189 return;
2190 }
2191 old_mbox_pointer = g_list_find_custom(mailbox_list, mbox,
2192 (GCompareFunc) compare_mailboxes);
2193 if (old_mbox_pointer)
2194 {
2195 free_mailbox(mbox);
2196 mbox = (Mailbox *) old_mbox_pointer->data;
2197 if (mbox->account->mboxtype == MBOX_FETCH_TOOLTIP(6))
2198 {
2199 mbox->mail_count = msg;
2200 mbox->new_mail_count = msg - seen;
2201 }
2202 }
2203 else
2204 {
2205 mbox->mail_count = msg;
2206 mbox->new_mail_count = msg - seen;
2207 mailbox_list = g_list_insert_sorted(mailbox_list, mbox,
2208 (GCompareFunc)(compare_mailboxes));
2209 }
2210 }
2211
2212 /* Read output lines from the fetch/check program. If fetch_check_only_mode
2213 | is set, parse the lines to try to read message counts so they can be
2214 | reported ("fetchmail -c" or equiv should be configured). However, if
2215 | the mode is not set, then just read lines and waste them because mail
2216 | is presumably being downloaded into local mailboxes.
2217 */
2218static void
2219read_mail_fetch(void)
2220 {
2221 Mailproc *mp = (Mailproc *) mail_fetch->private;
2222 gchar buf[128];
2223 gint n, msg, seen;
2224
2225 while ((n = fgets_pipe(buf, sizeof(buf), mp)) > 0) /* non-blocking */
2226 {
2227 if (_GK.debug_level & DEBUG_MAIL0x10)
2228 g_debug("read_mail_fetch(%d): %s\n", fetch_check_only_mode, buf);
2229 if (fetch_check_only_mode)
2230 {
2231 if (parse_fetch_line(buf, &msg, &seen))
2232 make_fetch_tooltip(buf, msg, seen);
2233 if (msg > 0)
2234 {
2235 mail_fetch->mail_count += msg;
2236 mail_fetch->old_mail_count += seen;
2237 }
2238 }
2239 }
2240
2241 /* When fetch program is done, flag not busy so new counts will be used.
2242 */
2243 if (n < 0)
2244 {
2245 if (fetch_check_only_mode)
2246 {
2247 mail_fetch->new_mail_count =
2248 mail_fetch->mail_count - mail_fetch->old_mail_count;
2249 mbox_set_animation_state(mail_fetch);
2250 }
2251 mail_fetch->busy = FALSE(0);
2252 }
2253 }
2254
2255static void
2256reset_mail_fetch(void)
2257 {
2258 Mailproc *mp = (Mailproc *) mail_fetch->private;
2259
2260 if (mp->pipe >= 0)
2261 {
2262 if (close(mp->pipe) < 0 && errno(*__errno_location ()) == EINTR4)
2263 close(mp->pipe);
2264 }
2265 mp->pipe = -1;
2266 if (mp->read_gstring)
2267 g_string_free(mp->read_gstring, TRUE(!(0)));
2268 mp->read_gstring = NULL((void*)0);
2269 mail_fetch->mail_count = 0;
2270 mail_fetch->new_mail_count = 0;
2271 mail_fetch->old_mail_count = 0;
2272 mail_fetch->need_animation = FALSE(0);
2273 mail_fetch->busy = FALSE(0);
2274 force_mail_check = TRUE(!(0));
2275 }
2276
2277static gboolean
2278run_fetch_program(void)
2279 {
2280 Mailbox *mbox;
2281 Mailproc *mp = (Mailproc *) mail_fetch->private;
2282 GList *list;
2283
2284 if ( !mail_fetch->busy && !mp->read_gstring
2285 && mp->command && *(mp->command) != '\0'
2286 )
2287 {
2288 mail_fetch->busy = TRUE(!(0));
2289 for (list = mailbox_list; list; list = list->next)
2290 {
2291 mbox = (Mailbox *) list->data;
2292 if ( mbox->account->mboxtype == MBOX_FETCH(0x1000)
2293 || mbox->account->mboxtype == MBOX_FETCH_TOOLTIP(6)
2294 )
2295 {
2296 mbox->mail_count = 0;
2297 mbox->new_mail_count = 0;
2298 mbox->old_mail_count = 0;
2299 }
2300 }
2301 pipe_command(mp);
2302 if (mp->pipe >= 0)
2303 return TRUE(!(0));
2304 }
2305 return FALSE(0);
2306 }
2307
2308static gpointer
2309mail_check_thread(void *data)
2310 {
2311 Mailbox *mbox = (Mailbox *) data;
2312 gchar buf[256];
2313 gint external;
2314
2315 buf[0] = '\0';
2316 if (_GK.debug_level & DEBUG_MAIL0x10)
2317 {
2318 format_remote_mbox_name(mbox, buf, sizeof(buf));
2319 g_debug("Start mail_check_thread: %s at %d:%d:%d\n", buf,
2320 gkrellm_get_current_time()->tm_hour,
2321 gkrellm_get_current_time()->tm_min,
2322 gkrellm_get_current_time()->tm_sec);
2323 }
2324 external = mbox->account->mboxtype & MBOX_EXTERNAL0x10;
2325 if ( (*(mbox->check_func))(external ? mbox->data : mbox) == FALSE(0))
2326 {
2327 mbox->mail_count = 0;
2328 mbox->new_mail_count = 0;
2329 mbox->need_animation = FALSE(0);
2330 }
2331 else
2332 mbox_set_animation_state(mbox);
2333
2334 gkrellm_debug(DEBUG_MAIL0x10, "Stop mail_check_thread: %s at %d:%d:%d\n", buf,
2335 gkrellm_get_current_time()->tm_hour,
2336 gkrellm_get_current_time()->tm_min,
2337 gkrellm_get_current_time()->tm_sec);
2338
2339 mbox->busy = FALSE(0);
2340 mbox->thread = NULL((void*)0);
2341 return NULL((void*)0);
2342 }
2343
2344static void
2345update_mail(void)
2346 {
2347 Mailbox *mbox;
2348 GList *list;
2349 gint external, prev_new_mail_count, any_busy;
2350 gint local_check = FALSE(0),
2351 remote_check = FALSE(0),
2352 fetch_check;
2353 static gint second_count,
2354 minute_count,
2355 sound_inhibit;
2356
2357 if (!enable_mail || !mailbox_list)
2358 return;
2359 if (GK.minute_tick && (++minute_count % remote_check_timeout) == 0)
2360 remote_check = TRUE(!(0));
2361 if (GK.second_tick && (++second_count % local_check_timeout) == 0)
2362 local_check = TRUE(!(0));
2363 fetch_check = fetch_check_is_local ? local_check : remote_check;
2364
2365 if (remote_check || local_check)
2366 mua_is_launched(); /* update pipe, avoid lingering zombie */
2367
2368 if ( force_mail_check
2369 || ( GK.second_tick
2370 && !(mute_mode && super_mute_mode)
2371 && !(mua_inhibit_mode && mail_user_agent.pipe >= 0)
2372 )
2373 )
2374 {
2375 prev_new_mail_count = new_mail_count;
2376 total_mail_count = 0;
2377 new_mail_count = 0;
2378 run_animation = FALSE(0);
2379 remote_check |= force_mail_check;
2380 local_check |= force_mail_check;
2381 fetch_check |= force_mail_check;
2382 if (force_mail_check)
2383 minute_count = second_count = 0;
2384 any_busy = FALSE(0);
2385
2386 for (list = mailbox_list; list; list = list->next)
2387 {
2388 mbox = (Mailbox *) list->data;
2389 external = mbox->account->mboxtype & MBOX_EXTERNAL0x10;
2390 switch (mbox->account->mboxtype & MBOX_CHECK_TYPE_MASK0xf000)
2391 {
2392 case MBOX_CHECK_FETCH0x1000:
2393 if (((Mailproc *)(mail_fetch->private))->read_gstring)
2394 read_mail_fetch();
2395 if (fetch_check)
2396 (*mbox->check_func)(mbox);
2397 break;
2398
2399 case MBOX_CHECK_INLINE0x2000: /* Local mailbox or maildir check */
2400 if (local_check)
2401 {
2402 if (mbox->check_func)
2403 (*mbox->check_func)(external ? mbox->data : mbox);
2404 mbox_set_animation_state(mbox);
2405 }
2406 break;
2407 case MBOX_CHECK_THREADED0x4000:
2408 if (remote_check && !mbox->busy && mbox->check_func)
2409 {
2410 mbox->busy = TRUE(!(0));
2411 mbox->thread = g_thread_new("mail_check",
2412 mail_check_thread, mbox);
2413 }
2414 else if ( (_GK.debug_level & DEBUG_MAIL0x10)
2415 && remote_check && mbox->busy
2416 )
2417 g_debug(" %s thread busy\n", mbox->account->server);
2418 break;
2419 default: /* Unknown or pseudo mail box type */
2420 continue;
2421 }
2422 /* If a mailbox check is busy (thread or remote fetch program
2423 | running), use previous counts until the check is done.
2424 */
2425 if (mbox->busy)
2426 {
2427 total_mail_count += mbox->prev_mail_count;
2428 new_mail_count += mbox->prev_new_mail_count;
2429 run_animation |= mbox->prev_need_animation;
2430 any_busy = TRUE(!(0));
2431 }
2432 else
2433 {
2434 total_mail_count += mbox->mail_count;
2435 new_mail_count += mbox->new_mail_count;
2436 if (mbox->new_mail_count && cont_animation_mode)
2437 mbox->need_animation = TRUE(!(0));
2438 run_animation |= mbox->need_animation;
2439 mbox->prev_mail_count = mbox->mail_count;
2440 mbox->prev_new_mail_count = mbox->new_mail_count;
2441 mbox->prev_need_animation = mbox->need_animation;
2442 if (mbox->warn_msg && !mbox->warned)
2443 {
2444 gkrellm_message_dialog(NULL((void*)0), mbox->warn_msg);
2445 mbox->warned = TRUE(!(0));
2446 }
2447 }
2448 }
2449 force_mail_check = FALSE(0);
2450
2451 if ((_GK.debug_level & DEBUG_MAIL0x10) && (local_check || remote_check))
2452 g_debug("Mail check totals: total=%d new=%d anim=%d [%d,%d,%d]\n",
2453 total_mail_count, new_mail_count, run_animation,
2454 local_check, remote_check, fetch_check);
2455
2456 // Update tooltip if mail count changed or no tooltip has been set yet
2457 if ( prev_new_mail_count != new_mail_count
2458#if GTK_CHECK_VERSION(2,12,0)((2) > (2) || ((2) == (2) && (24) > (12)) || ((
2) == (2) && (24) == (12) && (23) >= (0)))
2459 || gtk_widget_get_has_tooltip(mail->drawing_area) == FALSE(0)
2460#else
2461 || tooltip->active_tips_data == NULL((void*)0)
2462#endif
2463 )
2464 {
2465 update_tooltip();
2466 }
2467
2468 /* Run the notify (sound) command if the new mail count goes up,
2469 | and if the various modes permit. Ensure a sound command is
2470 | issued only once per remote check interval by locking it out
2471 | if a new mail count triggers the sound and there are other
2472 | remote threads still busy.
2473 */
2474 if ( !sound_inhibit && !mute_mode
2475 && new_mail_count > prev_new_mail_count
2476 && mail_notify && mail_notify[0] != '\0'
2477 )
2478 {
2479 g_spawn_command_line_async(mail_notify, NULL((void*)0) /* GError */);
2480 if (any_busy)
2481 sound_inhibit = TRUE(!(0));
2482 }
2483 if (!any_busy)
2484 sound_inhibit = FALSE(0);
2485 }
2486
2487 if (mute_mode && (GK.timer_ticks % 15) < 3) /* Asymmetric blink */
2488 draw_mail_text_decal(MUTE_FLAG-1, MUTE_FLAG-1);
2489 else
2490 draw_mail_text_decal(new_mail_count, total_mail_count);
2491
2492 if (run_animation && (animation_mode & ANIMATION_PENGUIN2))
2493 update_krell_animation_frame();
2494 else
2495 anim_frame = 0;
2496
2497 if ((GK.timer_ticks % _GK.decal_mail_delay) == 0)
2498 {
2499 if (run_animation)
2500 {
2501 if (animation_mode & ANIMATION_ENVELOPE1)
2502 {
2503 ++decal_frame;
2504 if (decal_frame >= _GK.decal_mail_frames)
2505 decal_frame = 1;
2506 }
2507 else
2508 decal_frame = 0;
2509 }
2510 else
2511 decal_frame = 1;
2512 }
2513 gkrellm_draw_decal_pixmap(mail, DECAL(mail)((GkrellmDecal *)(((mail)->decal_list)->data)), decal_frame);
2514
2515 /* All the animation frame drawing is done with the general krell code.
2516 */
2517 KRELL(mail)((GkrellmKrell *)(((mail)->krell_list)->data))->previous = 0;
2518 gkrellm_update_krell(mail, KRELL(mail)((GkrellmKrell *)(((mail)->krell_list)->data)), anim_frame);
2519 gkrellm_draw_panel_layers(mail);
2520 }
2521
2522
2523static gint
2524mail_expose_event(GtkWidget *widget, GdkEventExpose *ev)
2525 {
2526 if (widget == mail->drawing_area)
2527 gdk_draw_drawable(widget->window, gkrellm_draw_GC(1), mail->pixmap,
2528 ev->area.x, ev->area.y, ev->area.x, ev->area.y,
2529 ev->area.width, ev->area.height);
2530 return FALSE(0);
2531 }
2532
2533 /* The mua launch button also optionally stops animations and resets
2534 | remote mail counts. So this routine decides if it should be enabled.
2535 */
2536static void
2537set_mua_button_sensitivity(void)
2538 {
2539 if ( *(mail_user_agent.command) || reset_remote_mode
2540 || (animation_mode && !cont_animation_mode)
2541 )
2542 gkrellm_set_button_sensitive(mua_button, TRUE(!(0)));
2543 else
2544 gkrellm_set_button_sensitive(mua_button, FALSE(0));
2545 }
2546
2547
2548 /* Callback for the message count decal button.
2549 */
2550static void
2551cb_mail_button(GkrellmDecalbutton *button)
2552 {
2553 GList *list;
2554 Mailbox *mbox;
2555 GError *err = NULL((void*)0);
2556 gboolean res;
2557
2558 if (reset_remote_mode)
2559 {
2560 for (list = mailbox_list; list; list = list->next)
2561 {
2562 mbox = (Mailbox *) list->data;
2563 if ( (mbox->account->mboxtype & MBOX_CHECK_THREADED0x4000)
2564 || (mbox->account->mboxtype & MBOX_CHECK_FETCH0x1000)
2565 || mbox->account->mboxtype == MBOX_FETCH_TOOLTIP(6)
2566 )
2567 {
2568 GDK_THREADS_ENTER()do { if (gdk_threads_lock) (*gdk_threads_lock) (); } while (0
)
;
2569 mbox->mail_count = 0;
2570 mbox->new_mail_count = 0;
2571 mbox->old_mail_count = 0;
2572 mbox->need_animation = FALSE(0);
2573 GDK_THREADS_LEAVE()do { if (gdk_threads_unlock) (*gdk_threads_unlock) (); } while
(0)
;
2574 }
2575 }
2576 }
2577 if (!cont_animation_mode)
2578 {
2579 for (list = mailbox_list; list; list = list->next)
2580 {
2581 mbox = (Mailbox *) list->data;
2582 mbox->need_animation = FALSE(0);
2583 }
2584 run_animation = FALSE(0);
2585 }
2586
2587 if (enable_multimua)
2588 {
2589 if (mail_user_agent.command && *mail_user_agent.command != '\0')
2590 {
2591 res = g_spawn_command_line_async(mail_user_agent.command, &err);
2592 if (!res && err)
2593 {
2594 gkrellm_message_dialog(NULL((void*)0), err->message);
2595 g_error_free(err);
2596 }
2597 }
2598 }
2599 else if (!mua_is_launched())
2600 {
2601 pipe_command(&mail_user_agent);
2602 }
2603 else
2604 {
2605 check_timeout = 0;
2606 gkrellm_debug(DEBUG_MAIL0x10, "Mail user agent is already running.\n");
2607 }
2608 }
2609
2610 /* Callback for any button clicks on the Mail panel. Must exclude
2611 | button 1 clicks on the message decal button.
2612 */
2613static gint
2614cb_panel_press(GtkWidget *widget, GdkEventButton *ev)
2615 {
2616 GkrellmDecal *d = mail_icon_decal;
2617
2618 if (ev->button == 3)
2619 gkrellm_open_config_window(mon_mail);
2620
2621 /* button 2 anywhere in the panel toggles the mute mode.
2622 */
2623 if (ev->button == 2)
2624 {
2625 mute_mode = !mute_mode;
2626
2627 /* If coming out of mute mode and mail checking was inhibited,
2628 | force a check.
2629 */
2630 if ( ! mute_mode && super_mute_mode
2631 && (! mua_is_launched() || ! mua_inhibit_mode)
2632 )
2633 force_mail_check = TRUE(!(0));
2634 }
2635 /* Button 1 press on the envelope - must exclude the message count button.
2636 */
2637 if (ev->button == 1 && ev->x >= d->x && ev->x < d->x + d->w)
2638 force_mail_check = TRUE(!(0));
2639 return FALSE(0);
2640 }
2641
2642static void
2643dup_account(MailAccount *dst, MailAccount *src)
2644 {
2645 dst->path = g_strdup(src->path);
2646 dst->homedir_path = g_strdup(src->homedir_path);
2647 dst->server = g_strdup(src->server);
2648 dst->username = g_strdup(src->username);
2649 dst->password = g_strdup(src->password);
2650 dst->imapfolder = g_strdup(src->imapfolder);
2651 dst->mboxtype = src->mboxtype;
2652 dst->protocol = src->protocol;
2653 dst->authmech = src->authmech;
2654 dst->port = src->port;
2655 dst->use_ssl = src->use_ssl;
2656 }
2657
2658static gboolean
2659get_local_mboxtype(MailAccount *account)
2660 {
2661 gchar *path;
2662
2663 if (!account->path)
2664 return FALSE(0);
2665 if (*(account->path) == '~')
2666 {
2667 account->homedir_path = account->path;
2668 account->path = g_strdup_printf("%s%s", gkrellm_homedir(),
2669 account->homedir_path + 1);
2670 }
2671 if (g_file_test(account->path, G_FILE_TEST_IS_DIR))
2672 {
2673 path = g_build_path(G_DIR_SEPARATOR_S"/", account->path, "new", NULL((void*)0));
2674 if (g_file_test(path, G_FILE_TEST_IS_DIR))
2675 account->mboxtype = MBOX_MAILDIR(0x2000 | 0x20 | 1);
2676 else
2677 account->mboxtype = MBOX_MH_DIR(0x2000 | 0x20 | 2);
2678 g_free(path);
2679 }
2680 else
2681 account->mboxtype = MBOX_MBOX(0x2000 | 0x20 | 0);
2682 return TRUE(!(0));
2683 }
2684
2685static Mailbox *
2686add_mailbox(MailAccount *account)
2687 {
2688 Mailbox *mbox;
2689
2690 if (!account)
2691 return NULL((void*)0);
2692 mbox = g_new0(Mailbox, 1)(Mailbox *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s
= sizeof (Mailbox); gpointer __p; if (__s == 1) __p = g_malloc0
(__n); else if (__builtin_constant_p (__n) && (__s ==
0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =
g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p
; }))
;
2693 mbox->account = account;
2694 if (account->path)
2695 {
2696 if (*(account->path) == '~')
2697 {
2698 account->homedir_path = account->path;
2699 account->path = g_strdup_printf("%s%s", gkrellm_homedir(),
2700 account->homedir_path + 1);
2701 }
2702 if (account->mboxtype == MBOX_MAILDIR(0x2000 | 0x20 | 1))
2703 mbox->check_func = check_maildir;
2704 else if (account->mboxtype == MBOX_MH_DIR(0x2000 | 0x20 | 2))
2705 {
2706 mbox->check_func = check_mh_dir;
2707 checking_mh_mail = TRUE(!(0));
2708 }
2709 else
2710 mbox->check_func = check_mbox;
2711 }
2712 else if (account->mboxtype == MBOX_REMOTE(0x4000 | 0x20 | 3))
2713 {
2714 switch (account->protocol)
2715 {
2716 case PROTO_POP30:
2717 mbox->check_func = check_pop3;
2718 break;
2719 case PROTO_IMAP1:
2720 mbox->check_func = check_imap;
2721 break;
2722 default:
2723 g_free(mbox);
2724 mbox = NULL((void*)0);
2725 }
2726 }
2727 else
2728 {
2729 g_free(mbox);
2730 mbox = NULL((void*)0);
2731 }
2732 if (mbox)
2733 mailbox_list = g_list_append(mailbox_list, mbox);
2734 return mbox;
2735 }
2736
2737 /* Pre 1.2.7 mailbox config parsing.
2738 */
2739static Mailbox *
2740old_add_mailbox(gchar *arg)
2741 {
2742 Mailbox *mbox;
2743 MailAccount *account;
2744 gchar parms[4][CFG_BUFSIZE512];
2745 gint n;
2746 gchar *p;
2747
2748 account = g_new0(MailAccount, 1)(MailAccount *) (__extension__ ({ gsize __n = (gsize) (1); gsize
__s = sizeof (MailAccount); gpointer __p; if (__s == 1) __p =
g_malloc0 (__n); else if (__builtin_constant_p (__n) &&
(__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s
)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s
); __p; }))
;
2749 n = sscanf(arg, "%s %s %s %s", parms[0], parms[1], parms[2], parms[3]);
2750 if (n == 1)
2751 {
2752 account->path = g_strdup(parms[0]);
2753 get_local_mboxtype(account);
2754 mbox = add_mailbox(account);
2755 return mbox;
2756 }
2757 mbox = g_new0(Mailbox, 1)(Mailbox *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s
= sizeof (Mailbox); gpointer __p; if (__s == 1) __p = g_malloc0
(__n); else if (__builtin_constant_p (__n) && (__s ==
0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =
g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p
; }))
;
2758 mbox->account = account;
2759 switch (n)
2760 {
2761 case 3:
2762 account->mboxtype = MBOX_REMOTE(0x4000 | 0x20 | 3);
2763 if ((p = strchr(parms[0], ':')(__extension__ (__builtin_constant_p (':') && !__builtin_constant_p
(parms[0]) && (':') == '\0' ? (char *) __rawmemchr (
parms[0], ':') : __builtin_strchr (parms[0], ':')))
) != NULL((void*)0))
2764 *p++ = '\0';
2765 account->server = g_strdup(parms[0]);
2766 account->port = (p && *p) ? atoi(p) : atoi(DEFAULT_POP3_PORT"110");
2767 account->protocol = PROTO_POP30;
2768 if ((p = strchr(parms[1], '/')(__extension__ (__builtin_constant_p ('/') && !__builtin_constant_p
(parms[1]) && ('/') == '\0' ? (char *) __rawmemchr (
parms[1], '/') : __builtin_strchr (parms[1], '/')))
) != NULL((void*)0))
2769 {
2770 *p++ = '\0';
2771 if (strcasecmp(p, "user") == 0)
2772 account->authmech = AUTH_USER0;
2773 else if (strcasecmp(p, "apop") == 0)
2774 account->authmech = AUTH_APOP1;
2775 else
2776 {
2777 g_free(account);
2778 g_free(mbox);
2779 return NULL((void*)0);
2780 }
2781 }
2782 else
2783 account->authmech = AUTH_USER0;
2784 account->username = g_strdup(parms[1]);
2785 account->password = g_strdup(parms[2]);
2786 account->use_ssl = SSL_NONE0;
2787 mbox->check_func = check_pop3;
2788 break;
2789
2790 case 4:
2791 account->mboxtype = MBOX_REMOTE(0x4000 | 0x20 | 3);
2792 if ((p = strchr(parms[0], ':')(__extension__ (__builtin_constant_p (':') && !__builtin_constant_p
(parms[0]) && (':') == '\0' ? (char *) __rawmemchr (
parms[0], ':') : __builtin_strchr (parms[0], ':')))
) != NULL((void*)0))
2793 *p++ = '\0';
2794 account->server = g_strdup(parms[0]);
2795 account->port = (p && *p) ? atoi(p) : atoi(DEFAULT_IMAP_PORT"143");
2796 account->imapfolder = g_strdup(parms[1]);
2797 account->username = g_strdup(parms[2]);
2798 account->password = g_strdup(parms[3]);
2799 account->protocol = PROTO_IMAP1;
2800 account->authmech = AUTH_LOGIN0;
2801 account->use_ssl = SSL_NONE0;
2802 mbox->check_func = check_imap;
2803 break;
2804
2805 default: /* Invalid mailbox line */
2806 g_free(account);
2807 g_free(mbox);
2808 return NULL((void*)0);
2809 }
2810 mailbox_list = g_list_append(mailbox_list, mbox);
2811 return mbox;
2812 }
2813
2814static void
2815create_mail(GtkWidget *vbox, gint first_create)
2816 {
2817 GkrellmStyle *style;
2818 GkrellmMargin *m;
2819 GkrellmPanel *p;
2820 MailAccount *account;
2821 Mailproc *mp = (Mailproc*) mail_fetch->private;
2822 gchar *s, buf[64];
2823 gint x, w;
2824 static GkrellmPiximage *krell_penguin_piximage;
2825
2826
2827 if (first_create)
2828 mail = gkrellm_panel_new0();
2829 else
2830 {
2831 gkrellm_destroy_decal_list(mail);
2832 gkrellm_destroy_krell_list(mail);
2833 }
2834 p = mail;
2835
2836 /* Force create user local mailbox if no mailchecking has been configured.
2837 */
2838 if (!mailbox_list->next && local_supported && !*mp->command)
2839 { /* First mailbox is internal fetch */
2840 if ((s = getenv("MAIL")) == NULL((void*)0))
2841 if ((s = getenv("USER")) != NULL((void*)0))
2842 {
2843 if (g_file_test("/var/mail", G_FILE_TEST_IS_DIR))
2844 snprintf(buf, sizeof(buf), "/var/mail/%s", s);
2845 else
2846 snprintf(buf, sizeof(buf), "/var/spool/mail/%s", s);
2847 s = buf;
2848 }
2849 if (s)
2850 {
2851 account = g_new0(MailAccount, 1)(MailAccount *) (__extension__ ({ gsize __n = (gsize) (1); gsize
__s = sizeof (MailAccount); gpointer __p; if (__s == 1) __p =
g_malloc0 (__n); else if (__builtin_constant_p (__n) &&
(__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s
)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s
); __p; }))
;
2852 account->path = g_strdup(s);
2853 account->mboxtype = MBOX_MBOX(0x2000 | 0x20 | 0);
2854 add_mailbox(account);
2855 }
2856 }
2857
2858 style = gkrellm_meter_style(style_id);
2859 m = gkrellm_get_style_margins(style);
2860
2861 if (krell_penguin_piximage)
2862 {
2863 gkrellm_destroy_piximage(krell_penguin_piximage);
2864 krell_penguin_piximage = NULL((void*)0);
2865 }
2866 gkrellm_load_piximage("krell_penguin", NULL((void*)0), &krell_penguin_piximage,
2867 MAIL_STYLE_NAME"mail");
2868 gkrellm_create_krell(p,
2869 krell_penguin_piximage ? krell_penguin_piximage
2870 : gkrellm_krell_meter_piximage(style_id),
2871 style);
2872 KRELL(p)((GkrellmKrell *)(((p)->krell_list)->data))->full_scale = style->krell_depth - 1;
2873
2874 gkrellm_load_piximage("decal_mail", decal_mail_xpm, &decal_mail_piximage,
2875 MAIL_STYLE_NAME"mail");
2876 mail_icon_decal = gkrellm_make_scaled_decal_pixmap(p, decal_mail_piximage,
2877 style, _GK.decal_mail_frames, -1, -1, 0, 0);
2878
2879 /* The new/total mail text needs to be a decal because the text changes
2880 | and must be drawn as a layer in update_layers().
2881 | Calculate x,w override values. Cannot override w after the create.
2882 */
2883 x = m->left;
2884 if (style->label_position >= 50)
2885 x += mail_icon_decal->w;
2886 w = gkrellm_chart_width() - mail_icon_decal->w - m->left - m->right;
2887
2888 mail_text_decal = gkrellm_create_decal_text(p, "0",
2889 gkrellm_meter_textstyle(style_id),
2890 style, x, -1, w); /* -1 means use y default */
2891
2892 gkrellm_panel_configure(p, NULL((void*)0), style);
2893 gkrellm_panel_create(vbox, mon_mail, p);
2894
2895 /* Center the decals with respect to each other.
2896 */
2897 if (mail_icon_decal->h > mail_text_decal->h)
2898 mail_text_decal->y += (mail_icon_decal->h - mail_text_decal->h) / 2;
2899 else
2900 mail_icon_decal->y += (mail_text_decal->h - mail_icon_decal->h) / 2;
2901
2902 mua_button = gkrellm_put_decal_in_meter_button(p, mail_text_decal,
2903 cb_mail_button, NULL((void*)0), NULL((void*)0));
2904 set_mua_button_sensitivity();
2905
2906 if(!enable_mail)
2907 {
2908 gkrellm_panel_hide(p);
2909 gkrellm_spacers_hide(mon_mail);
2910 }
2911 else
2912 gkrellm_spacers_show(mon_mail);
2913
2914 if (first_create)
2915 {
2916 g_signal_connect(G_OBJECT(p->drawing_area), "expose_event",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((p->drawing_area)), (((GType) ((20) <<
(2))))))))), ("expose_event"), (((GCallback) (mail_expose_event
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
2917 G_CALLBACK(mail_expose_event), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((p->drawing_area)), (((GType) ((20) <<
(2))))))))), ("expose_event"), (((GCallback) (mail_expose_event
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
2918 g_signal_connect(G_OBJECT(p->drawing_area),"button_press_event",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((p->drawing_area)), (((GType) ((20) <<
(2))))))))), ("button_press_event"), (((GCallback) (cb_panel_press
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
2919 G_CALLBACK(cb_panel_press), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((p->drawing_area)), (((GType) ((20) <<
(2))))))))), ("button_press_event"), (((GCallback) (cb_panel_press
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
2920#if !GTK_CHECK_VERSION(2,12,0)((2) > (2) || ((2) == (2) && (24) > (12)) || ((
2) == (2) && (24) == (12) && (23) >= (0)))
2921 tooltip = gtk_tooltips_new();
2922#endif
2923 }
2924 }
2925
2926static AuthType *
2927authtype_from_string(gchar *s)
2928 {
2929 gint t;
2930
2931 for (t = 0; auth_strings[t].string != NULL((void*)0); ++t)
2932 if (!strcmp(s, auth_strings[t].string)__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(s) && __builtin_constant_p (auth_strings[t].string)
&& (__s1_len = strlen (s), __s2_len = strlen (auth_strings
[t].string), (!((size_t)(const void *)((s) + 1) - (size_t)(const
void *)(s) == 1) || __s1_len >= 4) && (!((size_t)
(const void *)((auth_strings[t].string) + 1) - (size_t)(const
void *)(auth_strings[t].string) == 1) || __s2_len >= 4)) ?
__builtin_strcmp (s, auth_strings[t].string) : (__builtin_constant_p
(s) && ((size_t)(const void *)((s) + 1) - (size_t)(const
void *)(s) == 1) && (__s1_len = strlen (s), __s1_len
< 4) ? (__builtin_constant_p (auth_strings[t].string) &&
((size_t)(const void *)((auth_strings[t].string) + 1) - (size_t
)(const void *)(auth_strings[t].string) == 1) ? __builtin_strcmp
(s, auth_strings[t].string) : (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (auth_strings
[t].string); int __result = (((const unsigned char *) (const char
*) (s))[0] - __s2[0]); if (__s1_len > 0 && __result
== 0) { __result = (((const unsigned char *) (const char *) (
s))[1] - __s2[1]); if (__s1_len > 1 && __result ==
0) { __result = (((const unsigned char *) (const char *) (s)
)[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (s))[3]
- __s2[3]); } } __result; }))) : (__builtin_constant_p (auth_strings
[t].string) && ((size_t)(const void *)((auth_strings[
t].string) + 1) - (size_t)(const void *)(auth_strings[t].string
) == 1) && (__s2_len = strlen (auth_strings[t].string
), __s2_len < 4) ? (__builtin_constant_p (s) && ((
size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) ==
1) ? __builtin_strcmp (s, auth_strings[t].string) : (- (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) (s); int __result = (((const unsigned char *) (const
char *) (auth_strings[t].string))[0] - __s2[0]); if (__s2_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) (auth_strings[t].string))[1] - __s2[1
]); if (__s2_len > 1 && __result == 0) { __result =
(((const unsigned char *) (const char *) (auth_strings[t].string
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (auth_strings
[t].string))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp
(s, auth_strings[t].string)))); })
)
2933 break;
2934 return &auth_strings[t];
2935 }
2936
2937static gint
2938menu_authtype(gint proto, gint mech)
2939 {
2940 gint t;
2941
2942 for (t = 0; auth_strings[t].string != NULL((void*)0); ++t)
2943 if (auth_strings[t].protocol == proto &&
2944 auth_strings[t].authmech == mech)
2945 break;
2946 return t;
2947 }
2948
2949#define menu_to_proto(type)auth_strings[type].protocol auth_strings[type].protocol
2950#define menu_to_mech(type)auth_strings[type].authmech auth_strings[type].authmech
2951#define auth_string(proto, mech)auth_strings[menu_authtype(proto, mech)].string \
2952 auth_strings[menu_authtype(proto, mech)].string
2953
2954static void
2955save_mail_config(FILE *f)
2956 {
2957 Mailbox *mbox;
2958 MailAccount *account;
2959 Mailproc *mp = (Mailproc*) mail_fetch->private;
2960 GList *list;
2961 gchar *pwd, *qq;
2962
2963 for (list = mailbox_list; list; list = list->next)
2964 {
2965 mbox = (Mailbox *) list->data;
2966 account = mbox->account;
2967 switch (account->mboxtype)
2968 {
2969 case MBOX_MBOX(0x2000 | 0x20 | 0):
2970 case MBOX_MAILDIR(0x2000 | 0x20 | 1):
2971 case MBOX_MH_DIR(0x2000 | 0x20 | 2):
2972 fprintf(f, "mail mailbox-local %s %s\n",
2973 mbox_strings[account->mboxtype & 0xf],
2974 account->homedir_path ?
2975 account->homedir_path : account->path);
2976 break;
2977 case MBOX_REMOTE(0x4000 | 0x20 | 3):
2978 pwd = account->password;
2979 if ((qq = strchr(pwd, '"')(__extension__ (__builtin_constant_p ('"') && !__builtin_constant_p
(pwd) && ('"') == '\0' ? (char *) __rawmemchr (pwd, '"'
) : __builtin_strchr (pwd, '"')))
) != NULL((void*)0))
2980 pwd = "password";
Value stored to 'pwd' is never read
2981 fprintf(f, "mail mailbox-remote %s %s \"%s\" \"%s\" %d",
2982 auth_string(account->protocol,auth_strings[menu_authtype(account->protocol, account->
authmech)].string
2983 account->authmech)auth_strings[menu_authtype(account->protocol, account->
authmech)].string
,
2984 account->server, account->username,
2985 account->password, account->port);
2986 if (account->protocol == PROTO_IMAP1)
2987 fprintf(f, " \"%s\"",
2988 account->imapfolder);
2989 fprintf(f, "\n");
2990 if (qq)
2991 fprintf(f, "mail password %s\n", account->password);
2992#ifdef HAVE_SSL1
2993 fprintf(f, "mail mailbox-remote-use-ssl %d\n",
2994 account->use_ssl);
2995#endif
2996 break;
2997 default:
2998 break;
2999 }
3000 }
3001 fprintf(f, "mail mua %s\n", mail_user_agent.command);
3002 fprintf(f, "mail notify %s\n", mail_notify);
3003 fprintf(f, "mail fetch_command %s\n", mp->command);
3004 fprintf(f, "mail remote_check_timeout %d\n", remote_check_timeout);
3005 fprintf(f, "mail local_check_timeout %d\n", local_check_timeout);
3006 fprintf(f, "mail fetch_check_is_local %d\n", fetch_check_is_local);
3007 fprintf(f, "mail msg_count_mode %d\n", count_mode);
3008 fprintf(f, "mail animation_select_mode %d\n", animation_mode);
3009 fprintf(f, "mail fetch_check_only_mode %d\n", fetch_check_only_mode);
3010 fprintf(f, "mail reset_remote_mode %d\n", reset_remote_mode);
3011 fprintf(f, "mail unseen_is_new %d\n", unseen_is_new);
3012 fprintf(f, "mail enable %d %d %d %d\n", enable_mail, super_mute_mode,
3013 mua_inhibit_mode, enable_multimua);
3014 fprintf(f, "mail animation_continuous %d\n", cont_animation_mode);
3015 fprintf(f, "mail show_tooltip %d\n", show_tooltip);
3016 fprintf(f, "mail mh_seq_ignore %d\n", mh_seq_ignore);
3017 }
3018
3019static void
3020load_mail_config(gchar *arg)
3021 {
3022 static MailAccount *account_prev;
3023 MailAccount *account = NULL((void*)0);
3024 Mailproc *mp = (Mailproc*) mail_fetch->private;
3025 gchar mail_config[32], item[CFG_BUFSIZE512], path[256];
3026 gchar *str, *s;
3027 gint n;
3028 AuthType *authtype;
3029
3030 n = sscanf(arg, "%31s %[^\n]", mail_config, item);
3031 if (n == 2)
3032 {
3033 if ( (_GK.debug_level & DEBUG_MAIL0x10)
3034 && strcmp(mail_config, "password")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("password") &&
(__s1_len = strlen (mail_config), __s2_len = strlen ("password"
), (!((size_t)(const void *)((mail_config) + 1) - (size_t)(const
void *)(mail_config) == 1) || __s1_len >= 4) && (
!((size_t)(const void *)(("password") + 1) - (size_t)(const void
*)("password") == 1) || __s2_len >= 4)) ? __builtin_strcmp
(mail_config, "password") : (__builtin_constant_p (mail_config
) && ((size_t)(const void *)((mail_config) + 1) - (size_t
)(const void *)(mail_config) == 1) && (__s1_len = strlen
(mail_config), __s1_len < 4) ? (__builtin_constant_p ("password"
) && ((size_t)(const void *)(("password") + 1) - (size_t
)(const void *)("password") == 1) ? __builtin_strcmp (mail_config
, "password") : (__extension__ ({ const unsigned char *__s2 =
(const unsigned char *) (const char *) ("password"); int __result
= (((const unsigned char *) (const char *) (mail_config))[0]
- __s2[0]); if (__s1_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) (mail_config))[1]
- __s2[1]); if (__s1_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) (mail_config))[2]
- __s2[2]); if (__s1_len > 2 && __result == 0) __result
= (((const unsigned char *) (const char *) (mail_config))[3]
- __s2[3]); } } __result; }))) : (__builtin_constant_p ("password"
) && ((size_t)(const void *)(("password") + 1) - (size_t
)(const void *)("password") == 1) && (__s2_len = strlen
("password"), __s2_len < 4) ? (__builtin_constant_p (mail_config
) && ((size_t)(const void *)((mail_config) + 1) - (size_t
)(const void *)(mail_config) == 1) ? __builtin_strcmp (mail_config
, "password") : (- (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) (mail_config); int __result
= (((const unsigned char *) (const char *) ("password"))[0] -
__s2[0]); if (__s2_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) ("password"))[1] -
__s2[1]); if (__s2_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) ("password"))[2] -
__s2[2]); if (__s2_len > 2 && __result == 0) __result
= (((const unsigned char *) (const char *) ("password"))[3] -
__s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "password")))); })
3035 && strcmp(mail_config, "mailbox-remote")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("mailbox-remote"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("mailbox-remote"), (!((size_t)(const void *)((mail_config) +
1) - (size_t)(const void *)(mail_config) == 1) || __s1_len >=
4) && (!((size_t)(const void *)(("mailbox-remote") +
1) - (size_t)(const void *)("mailbox-remote") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (mail_config, "mailbox-remote")
: (__builtin_constant_p (mail_config) && ((size_t)(const
void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("mailbox-remote") &&
((size_t)(const void *)(("mailbox-remote") + 1) - (size_t)(const
void *)("mailbox-remote") == 1) ? __builtin_strcmp (mail_config
, "mailbox-remote") : (__extension__ ({ const unsigned char *
__s2 = (const unsigned char *) (const char *) ("mailbox-remote"
); int __result = (((const unsigned char *) (const char *) (mail_config
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (mail_config
))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
"mailbox-remote") && ((size_t)(const void *)(("mailbox-remote"
) + 1) - (size_t)(const void *)("mailbox-remote") == 1) &&
(__s2_len = strlen ("mailbox-remote"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "mailbox-remote") : (- (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
(mail_config); int __result = (((const unsigned char *) (const
char *) ("mailbox-remote"))[0] - __s2[0]); if (__s2_len >
0 && __result == 0) { __result = (((const unsigned char
*) (const char *) ("mailbox-remote"))[1] - __s2[1]); if (__s2_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("mailbox-remote"))[2] - __s2[2]); if
(__s2_len > 2 && __result == 0) __result = (((const
unsigned char *) (const char *) ("mailbox-remote"))[3] - __s2
[3]); } } __result; })))) : __builtin_strcmp (mail_config, "mailbox-remote"
)))); })
/* avoid password */
3036 )
3037 g_debug("%s %s\n", mail_config, item);
3038 if (!strcmp(mail_config, "mailbox")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("mailbox") &&
(__s1_len = strlen (mail_config), __s2_len = strlen ("mailbox"
), (!((size_t)(const void *)((mail_config) + 1) - (size_t)(const
void *)(mail_config) == 1) || __s1_len >= 4) && (
!((size_t)(const void *)(("mailbox") + 1) - (size_t)(const void
*)("mailbox") == 1) || __s2_len >= 4)) ? __builtin_strcmp
(mail_config, "mailbox") : (__builtin_constant_p (mail_config
) && ((size_t)(const void *)((mail_config) + 1) - (size_t
)(const void *)(mail_config) == 1) && (__s1_len = strlen
(mail_config), __s1_len < 4) ? (__builtin_constant_p ("mailbox"
) && ((size_t)(const void *)(("mailbox") + 1) - (size_t
)(const void *)("mailbox") == 1) ? __builtin_strcmp (mail_config
, "mailbox") : (__extension__ ({ const unsigned char *__s2 = (
const unsigned char *) (const char *) ("mailbox"); int __result
= (((const unsigned char *) (const char *) (mail_config))[0]
- __s2[0]); if (__s1_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) (mail_config))[1]
- __s2[1]); if (__s1_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) (mail_config))[2]
- __s2[2]); if (__s1_len > 2 && __result == 0) __result
= (((const unsigned char *) (const char *) (mail_config))[3]
- __s2[3]); } } __result; }))) : (__builtin_constant_p ("mailbox"
) && ((size_t)(const void *)(("mailbox") + 1) - (size_t
)(const void *)("mailbox") == 1) && (__s2_len = strlen
("mailbox"), __s2_len < 4) ? (__builtin_constant_p (mail_config
) && ((size_t)(const void *)((mail_config) + 1) - (size_t
)(const void *)(mail_config) == 1) ? __builtin_strcmp (mail_config
, "mailbox") : (- (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) (mail_config); int __result
= (((const unsigned char *) (const char *) ("mailbox"))[0] -
__s2[0]); if (__s2_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) ("mailbox"))[1] -
__s2[1]); if (__s2_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) ("mailbox"))[2] -
__s2[2]); if (__s2_len > 2 && __result == 0) __result
= (((const unsigned char *) (const char *) ("mailbox"))[3] -
__s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "mailbox")))); })
) /* Old config, pre 1.2.7 */
3039 old_add_mailbox(item);
3040 else if (!strcmp(mail_config, "mailbox-local")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("mailbox-local"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("mailbox-local"), (!((size_t)(const void *)((mail_config) +
1) - (size_t)(const void *)(mail_config) == 1) || __s1_len >=
4) && (!((size_t)(const void *)(("mailbox-local") + 1
) - (size_t)(const void *)("mailbox-local") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (mail_config, "mailbox-local") :
(__builtin_constant_p (mail_config) && ((size_t)(const
void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("mailbox-local") &&
((size_t)(const void *)(("mailbox-local") + 1) - (size_t)(const
void *)("mailbox-local") == 1) ? __builtin_strcmp (mail_config
, "mailbox-local") : (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) ("mailbox-local"); int
__result = (((const unsigned char *) (const char *) (mail_config
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (mail_config
))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
"mailbox-local") && ((size_t)(const void *)(("mailbox-local"
) + 1) - (size_t)(const void *)("mailbox-local") == 1) &&
(__s2_len = strlen ("mailbox-local"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "mailbox-local") : (- (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (mail_config
); int __result = (((const unsigned char *) (const char *) ("mailbox-local"
))[0] - __s2[0]); if (__s2_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("mailbox-local"
))[1] - __s2[1]); if (__s2_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("mailbox-local"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("mailbox-local"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "mailbox-local")))); })
)
3041 {
3042 if (local_supported && sscanf(item, "%*s %255[^\n]", path) == 1)
3043 {
3044 account = g_new0(MailAccount, 1)(MailAccount *) (__extension__ ({ gsize __n = (gsize) (1); gsize
__s = sizeof (MailAccount); gpointer __p; if (__s == 1) __p =
g_malloc0 (__n); else if (__builtin_constant_p (__n) &&
(__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s
)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s
); __p; }))
;
3045 account->path = g_strdup(path);
3046 get_local_mboxtype(account);
3047 add_mailbox(account);
3048 }
3049 }
3050 else if (!strcmp(mail_config, "mailbox-remote")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("mailbox-remote"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("mailbox-remote"), (!((size_t)(const void *)((mail_config) +
1) - (size_t)(const void *)(mail_config) == 1) || __s1_len >=
4) && (!((size_t)(const void *)(("mailbox-remote") +
1) - (size_t)(const void *)("mailbox-remote") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (mail_config, "mailbox-remote")
: (__builtin_constant_p (mail_config) && ((size_t)(const
void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("mailbox-remote") &&
((size_t)(const void *)(("mailbox-remote") + 1) - (size_t)(const
void *)("mailbox-remote") == 1) ? __builtin_strcmp (mail_config
, "mailbox-remote") : (__extension__ ({ const unsigned char *
__s2 = (const unsigned char *) (const char *) ("mailbox-remote"
); int __result = (((const unsigned char *) (const char *) (mail_config
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (mail_config
))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
"mailbox-remote") && ((size_t)(const void *)(("mailbox-remote"
) + 1) - (size_t)(const void *)("mailbox-remote") == 1) &&
(__s2_len = strlen ("mailbox-remote"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "mailbox-remote") : (- (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
(mail_config); int __result = (((const unsigned char *) (const
char *) ("mailbox-remote"))[0] - __s2[0]); if (__s2_len >
0 && __result == 0) { __result = (((const unsigned char
*) (const char *) ("mailbox-remote"))[1] - __s2[1]); if (__s2_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("mailbox-remote"))[2] - __s2[2]); if
(__s2_len > 2 && __result == 0) __result = (((const
unsigned char *) (const char *) ("mailbox-remote"))[3] - __s2
[3]); } } __result; })))) : __builtin_strcmp (mail_config, "mailbox-remote"
)))); })
)
3051 {
3052 account = g_new0(MailAccount, 1)(MailAccount *) (__extension__ ({ gsize __n = (gsize) (1); gsize
__s = sizeof (MailAccount); gpointer __p; if (__s == 1) __p =
g_malloc0 (__n); else if (__builtin_constant_p (__n) &&
(__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s
)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s
); __p; }))
;
3053 account_prev = NULL((void*)0);
3054 account->mboxtype = MBOX_REMOTE(0x4000 | 0x20 | 3);
3055 str = item;
3056 s = gkrellm_dup_token(&str, NULL((void*)0));
3057 authtype = authtype_from_string(s);
3058 account->protocol = authtype->protocol;
3059 account->authmech = authtype->authmech;
3060 g_free(s);
3061 account->server = gkrellm_dup_token(&str, NULL((void*)0));
3062 account->username = gkrellm_dup_token(&str, NULL((void*)0));
3063 account->password = gkrellm_dup_token(&str, NULL((void*)0));
3064 s = gkrellm_dup_token(&str, NULL((void*)0));
3065 account->port = atoi(s);
3066 g_free(s);
3067 account->imapfolder = gkrellm_dup_token(&str, NULL((void*)0));;
3068 if (add_mailbox(account))
3069 account_prev = account; /* XXX */
3070 else
3071 {
3072 free_account(account);
3073 account_prev = NULL((void*)0);
3074 }
3075 }
3076#ifdef HAVE_SSL1
3077 else if (account_prev &&
3078 !strcmp(mail_config, "mailbox-remote-use-ssl")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("mailbox-remote-use-ssl"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("mailbox-remote-use-ssl"), (!((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) || __s1_len
>= 4) && (!((size_t)(const void *)(("mailbox-remote-use-ssl"
) + 1) - (size_t)(const void *)("mailbox-remote-use-ssl") == 1
) || __s2_len >= 4)) ? __builtin_strcmp (mail_config, "mailbox-remote-use-ssl"
) : (__builtin_constant_p (mail_config) && ((size_t)(
const void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("mailbox-remote-use-ssl") &&
((size_t)(const void *)(("mailbox-remote-use-ssl") + 1) - (size_t
)(const void *)("mailbox-remote-use-ssl") == 1) ? __builtin_strcmp
(mail_config, "mailbox-remote-use-ssl") : (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
("mailbox-remote-use-ssl"); int __result = (((const unsigned
char *) (const char *) (mail_config))[0] - __s2[0]); if (__s1_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[1] - __s2[1]); if (__s1_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[2] - __s2[2]); if (__s1_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) (mail_config))[3] - __s2[3]); } } __result
; }))) : (__builtin_constant_p ("mailbox-remote-use-ssl") &&
((size_t)(const void *)(("mailbox-remote-use-ssl") + 1) - (size_t
)(const void *)("mailbox-remote-use-ssl") == 1) && (__s2_len
= strlen ("mailbox-remote-use-ssl"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "mailbox-remote-use-ssl") : (- (__extension__ (
{ const unsigned char *__s2 = (const unsigned char *) (const char
*) (mail_config); int __result = (((const unsigned char *) (
const char *) ("mailbox-remote-use-ssl"))[0] - __s2[0]); if (
__s2_len > 0 && __result == 0) { __result = (((const
unsigned char *) (const char *) ("mailbox-remote-use-ssl"))[
1] - __s2[1]); if (__s2_len > 1 && __result == 0) {
__result = (((const unsigned char *) (const char *) ("mailbox-remote-use-ssl"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("mailbox-remote-use-ssl"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "mailbox-remote-use-ssl")))); })
)
3079 sscanf(item, "%d", &account_prev->use_ssl);
3080#endif
3081 else if (account_prev && !strcmp(mail_config, "password")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("password") &&
(__s1_len = strlen (mail_config), __s2_len = strlen ("password"
), (!((size_t)(const void *)((mail_config) + 1) - (size_t)(const
void *)(mail_config) == 1) || __s1_len >= 4) && (
!((size_t)(const void *)(("password") + 1) - (size_t)(const void
*)("password") == 1) || __s2_len >= 4)) ? __builtin_strcmp
(mail_config, "password") : (__builtin_constant_p (mail_config
) && ((size_t)(const void *)((mail_config) + 1) - (size_t
)(const void *)(mail_config) == 1) && (__s1_len = strlen
(mail_config), __s1_len < 4) ? (__builtin_constant_p ("password"
) && ((size_t)(const void *)(("password") + 1) - (size_t
)(const void *)("password") == 1) ? __builtin_strcmp (mail_config
, "password") : (__extension__ ({ const unsigned char *__s2 =
(const unsigned char *) (const char *) ("password"); int __result
= (((const unsigned char *) (const char *) (mail_config))[0]
- __s2[0]); if (__s1_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) (mail_config))[1]
- __s2[1]); if (__s1_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) (mail_config))[2]
- __s2[2]); if (__s1_len > 2 && __result == 0) __result
= (((const unsigned char *) (const char *) (mail_config))[3]
- __s2[3]); } } __result; }))) : (__builtin_constant_p ("password"
) && ((size_t)(const void *)(("password") + 1) - (size_t
)(const void *)("password") == 1) && (__s2_len = strlen
("password"), __s2_len < 4) ? (__builtin_constant_p (mail_config
) && ((size_t)(const void *)((mail_config) + 1) - (size_t
)(const void *)(mail_config) == 1) ? __builtin_strcmp (mail_config
, "password") : (- (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) (mail_config); int __result
= (((const unsigned char *) (const char *) ("password"))[0] -
__s2[0]); if (__s2_len > 0 && __result == 0) { __result
= (((const unsigned char *) (const char *) ("password"))[1] -
__s2[1]); if (__s2_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) ("password"))[2] -
__s2[2]); if (__s2_len > 2 && __result == 0) __result
= (((const unsigned char *) (const char *) ("password"))[3] -
__s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "password")))); })
)
3082 gkrellm_dup_string(&account_prev->password, item);
3083 else if (strcmp(mail_config, "mua")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("mua") &&
(__s1_len = strlen (mail_config), __s2_len = strlen ("mua"),
(!((size_t)(const void *)((mail_config) + 1) - (size_t)(const
void *)(mail_config) == 1) || __s1_len >= 4) && (
!((size_t)(const void *)(("mua") + 1) - (size_t)(const void *
)("mua") == 1) || __s2_len >= 4)) ? __builtin_strcmp (mail_config
, "mua") : (__builtin_constant_p (mail_config) && ((size_t
)(const void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("mua") && ((size_t)
(const void *)(("mua") + 1) - (size_t)(const void *)("mua") ==
1) ? __builtin_strcmp (mail_config, "mua") : (__extension__ (
{ const unsigned char *__s2 = (const unsigned char *) (const char
*) ("mua"); int __result = (((const unsigned char *) (const char
*) (mail_config))[0] - __s2[0]); if (__s1_len > 0 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (mail_config))[1] - __s2[1]); if (__s1_len > 1 &&
__result == 0) { __result = (((const unsigned char *) (const
char *) (mail_config))[2] - __s2[2]); if (__s1_len > 2 &&
__result == 0) __result = (((const unsigned char *) (const char
*) (mail_config))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p
("mua") && ((size_t)(const void *)(("mua") + 1) - (size_t
)(const void *)("mua") == 1) && (__s2_len = strlen ("mua"
), __s2_len < 4) ? (__builtin_constant_p (mail_config) &&
((size_t)(const void *)((mail_config) + 1) - (size_t)(const void
*)(mail_config) == 1) ? __builtin_strcmp (mail_config, "mua"
) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) (mail_config); int __result = (((const
unsigned char *) (const char *) ("mua"))[0] - __s2[0]); if (
__s2_len > 0 && __result == 0) { __result = (((const
unsigned char *) (const char *) ("mua"))[1] - __s2[1]); if (
__s2_len > 1 && __result == 0) { __result = (((const
unsigned char *) (const char *) ("mua"))[2] - __s2[2]); if (
__s2_len > 2 && __result == 0) __result = (((const
unsigned char *) (const char *) ("mua"))[3] - __s2[3]); } } __result
; })))) : __builtin_strcmp (mail_config, "mua")))); })
== 0)
3084 mail_user_agent.command = g_strdup(item);
3085 else if (strcmp(mail_config, "notify")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("notify") &&
(__s1_len = strlen (mail_config), __s2_len = strlen ("notify"
), (!((size_t)(const void *)((mail_config) + 1) - (size_t)(const
void *)(mail_config) == 1) || __s1_len >= 4) && (
!((size_t)(const void *)(("notify") + 1) - (size_t)(const void
*)("notify") == 1) || __s2_len >= 4)) ? __builtin_strcmp (
mail_config, "notify") : (__builtin_constant_p (mail_config) &&
((size_t)(const void *)((mail_config) + 1) - (size_t)(const void
*)(mail_config) == 1) && (__s1_len = strlen (mail_config
), __s1_len < 4) ? (__builtin_constant_p ("notify") &&
((size_t)(const void *)(("notify") + 1) - (size_t)(const void
*)("notify") == 1) ? __builtin_strcmp (mail_config, "notify"
) : (__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) ("notify"); int __result = (((const unsigned
char *) (const char *) (mail_config))[0] - __s2[0]); if (__s1_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[1] - __s2[1]); if (__s1_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[2] - __s2[2]); if (__s1_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) (mail_config))[3] - __s2[3]); } } __result
; }))) : (__builtin_constant_p ("notify") && ((size_t
)(const void *)(("notify") + 1) - (size_t)(const void *)("notify"
) == 1) && (__s2_len = strlen ("notify"), __s2_len <
4) ? (__builtin_constant_p (mail_config) && ((size_t
)(const void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) ? __builtin_strcmp (mail_config, "notify") : (- (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) (mail_config); int __result = (((const unsigned char
*) (const char *) ("notify"))[0] - __s2[0]); if (__s2_len >
0 && __result == 0) { __result = (((const unsigned char
*) (const char *) ("notify"))[1] - __s2[1]); if (__s2_len >
1 && __result == 0) { __result = (((const unsigned char
*) (const char *) ("notify"))[2] - __s2[2]); if (__s2_len >
2 && __result == 0) __result = (((const unsigned char
*) (const char *) ("notify"))[3] - __s2[3]); } } __result; }
)))) : __builtin_strcmp (mail_config, "notify")))); })
== 0)
3086 mail_notify = g_strdup(item);
3087 else if (strcmp(mail_config, "fetch_command")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("fetch_command"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("fetch_command"), (!((size_t)(const void *)((mail_config) +
1) - (size_t)(const void *)(mail_config) == 1) || __s1_len >=
4) && (!((size_t)(const void *)(("fetch_command") + 1
) - (size_t)(const void *)("fetch_command") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (mail_config, "fetch_command") :
(__builtin_constant_p (mail_config) && ((size_t)(const
void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("fetch_command") &&
((size_t)(const void *)(("fetch_command") + 1) - (size_t)(const
void *)("fetch_command") == 1) ? __builtin_strcmp (mail_config
, "fetch_command") : (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) ("fetch_command"); int
__result = (((const unsigned char *) (const char *) (mail_config
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (mail_config
))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
"fetch_command") && ((size_t)(const void *)(("fetch_command"
) + 1) - (size_t)(const void *)("fetch_command") == 1) &&
(__s2_len = strlen ("fetch_command"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "fetch_command") : (- (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (mail_config
); int __result = (((const unsigned char *) (const char *) ("fetch_command"
))[0] - __s2[0]); if (__s2_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("fetch_command"
))[1] - __s2[1]); if (__s2_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("fetch_command"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("fetch_command"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "fetch_command")))); })
== 0)
3088 mp->command = g_strdup(item);
3089 else if (strcmp(mail_config, "remote_check_timeout")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("remote_check_timeout"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("remote_check_timeout"), (!((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) || __s1_len
>= 4) && (!((size_t)(const void *)(("remote_check_timeout"
) + 1) - (size_t)(const void *)("remote_check_timeout") == 1)
|| __s2_len >= 4)) ? __builtin_strcmp (mail_config, "remote_check_timeout"
) : (__builtin_constant_p (mail_config) && ((size_t)(
const void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("remote_check_timeout") &&
((size_t)(const void *)(("remote_check_timeout") + 1) - (size_t
)(const void *)("remote_check_timeout") == 1) ? __builtin_strcmp
(mail_config, "remote_check_timeout") : (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
("remote_check_timeout"); int __result = (((const unsigned char
*) (const char *) (mail_config))[0] - __s2[0]); if (__s1_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[1] - __s2[1]); if (__s1_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[2] - __s2[2]); if (__s1_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) (mail_config))[3] - __s2[3]); } } __result
; }))) : (__builtin_constant_p ("remote_check_timeout") &&
((size_t)(const void *)(("remote_check_timeout") + 1) - (size_t
)(const void *)("remote_check_timeout") == 1) && (__s2_len
= strlen ("remote_check_timeout"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "remote_check_timeout") : (- (__extension__ ({
const unsigned char *__s2 = (const unsigned char *) (const char
*) (mail_config); int __result = (((const unsigned char *) (
const char *) ("remote_check_timeout"))[0] - __s2[0]); if (__s2_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("remote_check_timeout"))[1] - __s2[1
]); if (__s2_len > 1 && __result == 0) { __result =
(((const unsigned char *) (const char *) ("remote_check_timeout"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("remote_check_timeout"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "remote_check_timeout")))); })
== 0)
3090 sscanf(item, "%d", &remote_check_timeout);
3091 else if (strcmp(mail_config, "fetch_timeout")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("fetch_timeout"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("fetch_timeout"), (!((size_t)(const void *)((mail_config) +
1) - (size_t)(const void *)(mail_config) == 1) || __s1_len >=
4) && (!((size_t)(const void *)(("fetch_timeout") + 1
) - (size_t)(const void *)("fetch_timeout") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (mail_config, "fetch_timeout") :
(__builtin_constant_p (mail_config) && ((size_t)(const
void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("fetch_timeout") &&
((size_t)(const void *)(("fetch_timeout") + 1) - (size_t)(const
void *)("fetch_timeout") == 1) ? __builtin_strcmp (mail_config
, "fetch_timeout") : (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) ("fetch_timeout"); int
__result = (((const unsigned char *) (const char *) (mail_config
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (mail_config
))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
"fetch_timeout") && ((size_t)(const void *)(("fetch_timeout"
) + 1) - (size_t)(const void *)("fetch_timeout") == 1) &&
(__s2_len = strlen ("fetch_timeout"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "fetch_timeout") : (- (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (mail_config
); int __result = (((const unsigned char *) (const char *) ("fetch_timeout"
))[0] - __s2[0]); if (__s2_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("fetch_timeout"
))[1] - __s2[1]); if (__s2_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("fetch_timeout"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("fetch_timeout"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "fetch_timeout")))); })
== 0) /* pre 2.2.5 */
3092 sscanf(item, "%d", &remote_check_timeout);
3093 else if (strcmp(mail_config, "local_check_timeout")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("local_check_timeout"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("local_check_timeout"), (!((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) || __s1_len
>= 4) && (!((size_t)(const void *)(("local_check_timeout"
) + 1) - (size_t)(const void *)("local_check_timeout") == 1) ||
__s2_len >= 4)) ? __builtin_strcmp (mail_config, "local_check_timeout"
) : (__builtin_constant_p (mail_config) && ((size_t)(
const void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("local_check_timeout") &&
((size_t)(const void *)(("local_check_timeout") + 1) - (size_t
)(const void *)("local_check_timeout") == 1) ? __builtin_strcmp
(mail_config, "local_check_timeout") : (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
("local_check_timeout"); int __result = (((const unsigned char
*) (const char *) (mail_config))[0] - __s2[0]); if (__s1_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[1] - __s2[1]); if (__s1_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[2] - __s2[2]); if (__s1_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) (mail_config))[3] - __s2[3]); } } __result
; }))) : (__builtin_constant_p ("local_check_timeout") &&
((size_t)(const void *)(("local_check_timeout") + 1) - (size_t
)(const void *)("local_check_timeout") == 1) && (__s2_len
= strlen ("local_check_timeout"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "local_check_timeout") : (- (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
(mail_config); int __result = (((const unsigned char *) (const
char *) ("local_check_timeout"))[0] - __s2[0]); if (__s2_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("local_check_timeout"))[1] - __s2[1]
); if (__s2_len > 1 && __result == 0) { __result =
(((const unsigned char *) (const char *) ("local_check_timeout"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("local_check_timeout"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "local_check_timeout")))); })
== 0)
3094 sscanf(item, "%d", &local_check_timeout);
3095 else if (strcmp(mail_config, "check_timeout")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("check_timeout"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("check_timeout"), (!((size_t)(const void *)((mail_config) +
1) - (size_t)(const void *)(mail_config) == 1) || __s1_len >=
4) && (!((size_t)(const void *)(("check_timeout") + 1
) - (size_t)(const void *)("check_timeout") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (mail_config, "check_timeout") :
(__builtin_constant_p (mail_config) && ((size_t)(const
void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("check_timeout") &&
((size_t)(const void *)(("check_timeout") + 1) - (size_t)(const
void *)("check_timeout") == 1) ? __builtin_strcmp (mail_config
, "check_timeout") : (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) ("check_timeout"); int
__result = (((const unsigned char *) (const char *) (mail_config
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (mail_config
))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
"check_timeout") && ((size_t)(const void *)(("check_timeout"
) + 1) - (size_t)(const void *)("check_timeout") == 1) &&
(__s2_len = strlen ("check_timeout"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "check_timeout") : (- (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (mail_config
); int __result = (((const unsigned char *) (const char *) ("check_timeout"
))[0] - __s2[0]); if (__s2_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("check_timeout"
))[1] - __s2[1]); if (__s2_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("check_timeout"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("check_timeout"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "check_timeout")))); })
== 0) /* pre 2.2.5 */
3096 sscanf(item, "%d", &local_check_timeout);
3097 else if (strcmp(mail_config, "fetch_check_is_local")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("fetch_check_is_local"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("fetch_check_is_local"), (!((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) || __s1_len
>= 4) && (!((size_t)(const void *)(("fetch_check_is_local"
) + 1) - (size_t)(const void *)("fetch_check_is_local") == 1)
|| __s2_len >= 4)) ? __builtin_strcmp (mail_config, "fetch_check_is_local"
) : (__builtin_constant_p (mail_config) && ((size_t)(
const void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("fetch_check_is_local") &&
((size_t)(const void *)(("fetch_check_is_local") + 1) - (size_t
)(const void *)("fetch_check_is_local") == 1) ? __builtin_strcmp
(mail_config, "fetch_check_is_local") : (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
("fetch_check_is_local"); int __result = (((const unsigned char
*) (const char *) (mail_config))[0] - __s2[0]); if (__s1_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[1] - __s2[1]); if (__s1_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[2] - __s2[2]); if (__s1_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) (mail_config))[3] - __s2[3]); } } __result
; }))) : (__builtin_constant_p ("fetch_check_is_local") &&
((size_t)(const void *)(("fetch_check_is_local") + 1) - (size_t
)(const void *)("fetch_check_is_local") == 1) && (__s2_len
= strlen ("fetch_check_is_local"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "fetch_check_is_local") : (- (__extension__ ({
const unsigned char *__s2 = (const unsigned char *) (const char
*) (mail_config); int __result = (((const unsigned char *) (
const char *) ("fetch_check_is_local"))[0] - __s2[0]); if (__s2_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("fetch_check_is_local"))[1] - __s2[1
]); if (__s2_len > 1 && __result == 0) { __result =
(((const unsigned char *) (const char *) ("fetch_check_is_local"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("fetch_check_is_local"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "fetch_check_is_local")))); })
== 0)
3098 sscanf(item, "%d", &fetch_check_is_local);
3099 else if (strcmp(mail_config, "msg_count_mode")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("msg_count_mode"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("msg_count_mode"), (!((size_t)(const void *)((mail_config) +
1) - (size_t)(const void *)(mail_config) == 1) || __s1_len >=
4) && (!((size_t)(const void *)(("msg_count_mode") +
1) - (size_t)(const void *)("msg_count_mode") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (mail_config, "msg_count_mode")
: (__builtin_constant_p (mail_config) && ((size_t)(const
void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("msg_count_mode") &&
((size_t)(const void *)(("msg_count_mode") + 1) - (size_t)(const
void *)("msg_count_mode") == 1) ? __builtin_strcmp (mail_config
, "msg_count_mode") : (__extension__ ({ const unsigned char *
__s2 = (const unsigned char *) (const char *) ("msg_count_mode"
); int __result = (((const unsigned char *) (const char *) (mail_config
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (mail_config
))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
"msg_count_mode") && ((size_t)(const void *)(("msg_count_mode"
) + 1) - (size_t)(const void *)("msg_count_mode") == 1) &&
(__s2_len = strlen ("msg_count_mode"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "msg_count_mode") : (- (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
(mail_config); int __result = (((const unsigned char *) (const
char *) ("msg_count_mode"))[0] - __s2[0]); if (__s2_len >
0 && __result == 0) { __result = (((const unsigned char
*) (const char *) ("msg_count_mode"))[1] - __s2[1]); if (__s2_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("msg_count_mode"))[2] - __s2[2]); if
(__s2_len > 2 && __result == 0) __result = (((const
unsigned char *) (const char *) ("msg_count_mode"))[3] - __s2
[3]); } } __result; })))) : __builtin_strcmp (mail_config, "msg_count_mode"
)))); })
== 0)
3100 sscanf(item, "%d", &count_mode);
3101 else if (strcmp(mail_config, "animation_select_mode")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("animation_select_mode"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("animation_select_mode"), (!((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) || __s1_len
>= 4) && (!((size_t)(const void *)(("animation_select_mode"
) + 1) - (size_t)(const void *)("animation_select_mode") == 1
) || __s2_len >= 4)) ? __builtin_strcmp (mail_config, "animation_select_mode"
) : (__builtin_constant_p (mail_config) && ((size_t)(
const void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("animation_select_mode") &&
((size_t)(const void *)(("animation_select_mode") + 1) - (size_t
)(const void *)("animation_select_mode") == 1) ? __builtin_strcmp
(mail_config, "animation_select_mode") : (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
("animation_select_mode"); int __result = (((const unsigned char
*) (const char *) (mail_config))[0] - __s2[0]); if (__s1_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[1] - __s2[1]); if (__s1_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[2] - __s2[2]); if (__s1_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) (mail_config))[3] - __s2[3]); } } __result
; }))) : (__builtin_constant_p ("animation_select_mode") &&
((size_t)(const void *)(("animation_select_mode") + 1) - (size_t
)(const void *)("animation_select_mode") == 1) && (__s2_len
= strlen ("animation_select_mode"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "animation_select_mode") : (- (__extension__ (
{ const unsigned char *__s2 = (const unsigned char *) (const char
*) (mail_config); int __result = (((const unsigned char *) (
const char *) ("animation_select_mode"))[0] - __s2[0]); if (__s2_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("animation_select_mode"))[1] - __s2[
1]); if (__s2_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) ("animation_select_mode"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("animation_select_mode"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "animation_select_mode")))); })
== 0)
3102 sscanf(item, "%d", &animation_mode);
3103 else if (strcmp(mail_config, "fetch_check_only_mode")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("fetch_check_only_mode"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("fetch_check_only_mode"), (!((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) || __s1_len
>= 4) && (!((size_t)(const void *)(("fetch_check_only_mode"
) + 1) - (size_t)(const void *)("fetch_check_only_mode") == 1
) || __s2_len >= 4)) ? __builtin_strcmp (mail_config, "fetch_check_only_mode"
) : (__builtin_constant_p (mail_config) && ((size_t)(
const void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("fetch_check_only_mode") &&
((size_t)(const void *)(("fetch_check_only_mode") + 1) - (size_t
)(const void *)("fetch_check_only_mode") == 1) ? __builtin_strcmp
(mail_config, "fetch_check_only_mode") : (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
("fetch_check_only_mode"); int __result = (((const unsigned char
*) (const char *) (mail_config))[0] - __s2[0]); if (__s1_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[1] - __s2[1]); if (__s1_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[2] - __s2[2]); if (__s1_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) (mail_config))[3] - __s2[3]); } } __result
; }))) : (__builtin_constant_p ("fetch_check_only_mode") &&
((size_t)(const void *)(("fetch_check_only_mode") + 1) - (size_t
)(const void *)("fetch_check_only_mode") == 1) && (__s2_len
= strlen ("fetch_check_only_mode"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "fetch_check_only_mode") : (- (__extension__ (
{ const unsigned char *__s2 = (const unsigned char *) (const char
*) (mail_config); int __result = (((const unsigned char *) (
const char *) ("fetch_check_only_mode"))[0] - __s2[0]); if (__s2_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("fetch_check_only_mode"))[1] - __s2[
1]); if (__s2_len > 1 && __result == 0) { __result
= (((const unsigned char *) (const char *) ("fetch_check_only_mode"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("fetch_check_only_mode"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "fetch_check_only_mode")))); })
== 0)
3104 sscanf(item, "%d", &fetch_check_only_mode);
3105 else if (strcmp(mail_config, "reset_remote_mode")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("reset_remote_mode"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("reset_remote_mode"), (!((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) || __s1_len
>= 4) && (!((size_t)(const void *)(("reset_remote_mode"
) + 1) - (size_t)(const void *)("reset_remote_mode") == 1) ||
__s2_len >= 4)) ? __builtin_strcmp (mail_config, "reset_remote_mode"
) : (__builtin_constant_p (mail_config) && ((size_t)(
const void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("reset_remote_mode") &&
((size_t)(const void *)(("reset_remote_mode") + 1) - (size_t
)(const void *)("reset_remote_mode") == 1) ? __builtin_strcmp
(mail_config, "reset_remote_mode") : (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
("reset_remote_mode"); int __result = (((const unsigned char
*) (const char *) (mail_config))[0] - __s2[0]); if (__s1_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[1] - __s2[1]); if (__s1_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[2] - __s2[2]); if (__s1_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) (mail_config))[3] - __s2[3]); } } __result
; }))) : (__builtin_constant_p ("reset_remote_mode") &&
((size_t)(const void *)(("reset_remote_mode") + 1) - (size_t
)(const void *)("reset_remote_mode") == 1) && (__s2_len
= strlen ("reset_remote_mode"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "reset_remote_mode") : (- (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
(mail_config); int __result = (((const unsigned char *) (const
char *) ("reset_remote_mode"))[0] - __s2[0]); if (__s2_len >
0 && __result == 0) { __result = (((const unsigned char
*) (const char *) ("reset_remote_mode"))[1] - __s2[1]); if (
__s2_len > 1 && __result == 0) { __result = (((const
unsigned char *) (const char *) ("reset_remote_mode"))[2] - __s2
[2]); if (__s2_len > 2 && __result == 0) __result =
(((const unsigned char *) (const char *) ("reset_remote_mode"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "reset_remote_mode")))); })
== 0)
3106 sscanf(item, "%d", &reset_remote_mode);
3107 else if (strcmp(mail_config, "unseen_is_new")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("unseen_is_new"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("unseen_is_new"), (!((size_t)(const void *)((mail_config) +
1) - (size_t)(const void *)(mail_config) == 1) || __s1_len >=
4) && (!((size_t)(const void *)(("unseen_is_new") + 1
) - (size_t)(const void *)("unseen_is_new") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (mail_config, "unseen_is_new") :
(__builtin_constant_p (mail_config) && ((size_t)(const
void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("unseen_is_new") &&
((size_t)(const void *)(("unseen_is_new") + 1) - (size_t)(const
void *)("unseen_is_new") == 1) ? __builtin_strcmp (mail_config
, "unseen_is_new") : (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) ("unseen_is_new"); int
__result = (((const unsigned char *) (const char *) (mail_config
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (mail_config
))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
"unseen_is_new") && ((size_t)(const void *)(("unseen_is_new"
) + 1) - (size_t)(const void *)("unseen_is_new") == 1) &&
(__s2_len = strlen ("unseen_is_new"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "unseen_is_new") : (- (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (mail_config
); int __result = (((const unsigned char *) (const char *) ("unseen_is_new"
))[0] - __s2[0]); if (__s2_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("unseen_is_new"
))[1] - __s2[1]); if (__s2_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("unseen_is_new"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("unseen_is_new"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "unseen_is_new")))); })
== 0)
3108 sscanf(item, "%d", &unseen_is_new);
3109 else if (strcmp(mail_config, "enable")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("enable") &&
(__s1_len = strlen (mail_config), __s2_len = strlen ("enable"
), (!((size_t)(const void *)((mail_config) + 1) - (size_t)(const
void *)(mail_config) == 1) || __s1_len >= 4) && (
!((size_t)(const void *)(("enable") + 1) - (size_t)(const void
*)("enable") == 1) || __s2_len >= 4)) ? __builtin_strcmp (
mail_config, "enable") : (__builtin_constant_p (mail_config) &&
((size_t)(const void *)((mail_config) + 1) - (size_t)(const void
*)(mail_config) == 1) && (__s1_len = strlen (mail_config
), __s1_len < 4) ? (__builtin_constant_p ("enable") &&
((size_t)(const void *)(("enable") + 1) - (size_t)(const void
*)("enable") == 1) ? __builtin_strcmp (mail_config, "enable"
) : (__extension__ ({ const unsigned char *__s2 = (const unsigned
char *) (const char *) ("enable"); int __result = (((const unsigned
char *) (const char *) (mail_config))[0] - __s2[0]); if (__s1_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[1] - __s2[1]); if (__s1_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[2] - __s2[2]); if (__s1_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) (mail_config))[3] - __s2[3]); } } __result
; }))) : (__builtin_constant_p ("enable") && ((size_t
)(const void *)(("enable") + 1) - (size_t)(const void *)("enable"
) == 1) && (__s2_len = strlen ("enable"), __s2_len <
4) ? (__builtin_constant_p (mail_config) && ((size_t
)(const void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) ? __builtin_strcmp (mail_config, "enable") : (- (__extension__
({ const unsigned char *__s2 = (const unsigned char *) (const
char *) (mail_config); int __result = (((const unsigned char
*) (const char *) ("enable"))[0] - __s2[0]); if (__s2_len >
0 && __result == 0) { __result = (((const unsigned char
*) (const char *) ("enable"))[1] - __s2[1]); if (__s2_len >
1 && __result == 0) { __result = (((const unsigned char
*) (const char *) ("enable"))[2] - __s2[2]); if (__s2_len >
2 && __result == 0) __result = (((const unsigned char
*) (const char *) ("enable"))[3] - __s2[3]); } } __result; }
)))) : __builtin_strcmp (mail_config, "enable")))); })
== 0)
3110 sscanf(item, "%d %d %d %d", &enable_mail, &super_mute_mode,
3111 &mua_inhibit_mode, &enable_multimua);
3112 else if (strcmp(mail_config, "animation_continuous")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("animation_continuous"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("animation_continuous"), (!((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) || __s1_len
>= 4) && (!((size_t)(const void *)(("animation_continuous"
) + 1) - (size_t)(const void *)("animation_continuous") == 1)
|| __s2_len >= 4)) ? __builtin_strcmp (mail_config, "animation_continuous"
) : (__builtin_constant_p (mail_config) && ((size_t)(
const void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("animation_continuous") &&
((size_t)(const void *)(("animation_continuous") + 1) - (size_t
)(const void *)("animation_continuous") == 1) ? __builtin_strcmp
(mail_config, "animation_continuous") : (__extension__ ({ const
unsigned char *__s2 = (const unsigned char *) (const char *)
("animation_continuous"); int __result = (((const unsigned char
*) (const char *) (mail_config))[0] - __s2[0]); if (__s1_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[1] - __s2[1]); if (__s1_len
> 1 && __result == 0) { __result = (((const unsigned
char *) (const char *) (mail_config))[2] - __s2[2]); if (__s1_len
> 2 && __result == 0) __result = (((const unsigned
char *) (const char *) (mail_config))[3] - __s2[3]); } } __result
; }))) : (__builtin_constant_p ("animation_continuous") &&
((size_t)(const void *)(("animation_continuous") + 1) - (size_t
)(const void *)("animation_continuous") == 1) && (__s2_len
= strlen ("animation_continuous"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "animation_continuous") : (- (__extension__ ({
const unsigned char *__s2 = (const unsigned char *) (const char
*) (mail_config); int __result = (((const unsigned char *) (
const char *) ("animation_continuous"))[0] - __s2[0]); if (__s2_len
> 0 && __result == 0) { __result = (((const unsigned
char *) (const char *) ("animation_continuous"))[1] - __s2[1
]); if (__s2_len > 1 && __result == 0) { __result =
(((const unsigned char *) (const char *) ("animation_continuous"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("animation_continuous"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "animation_continuous")))); })
== 0)
3113 sscanf(item, "%d", &cont_animation_mode);
3114 else if (strcmp(mail_config, "show_tooltip")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("show_tooltip"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("show_tooltip"), (!((size_t)(const void *)((mail_config) + 1
) - (size_t)(const void *)(mail_config) == 1) || __s1_len >=
4) && (!((size_t)(const void *)(("show_tooltip") + 1
) - (size_t)(const void *)("show_tooltip") == 1) || __s2_len >=
4)) ? __builtin_strcmp (mail_config, "show_tooltip") : (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) &&
(__s1_len = strlen (mail_config), __s1_len < 4) ? (__builtin_constant_p
("show_tooltip") && ((size_t)(const void *)(("show_tooltip"
) + 1) - (size_t)(const void *)("show_tooltip") == 1) ? __builtin_strcmp
(mail_config, "show_tooltip") : (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) ("show_tooltip"
); int __result = (((const unsigned char *) (const char *) (mail_config
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (mail_config
))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
"show_tooltip") && ((size_t)(const void *)(("show_tooltip"
) + 1) - (size_t)(const void *)("show_tooltip") == 1) &&
(__s2_len = strlen ("show_tooltip"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "show_tooltip") : (- (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (mail_config
); int __result = (((const unsigned char *) (const char *) ("show_tooltip"
))[0] - __s2[0]); if (__s2_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("show_tooltip"
))[1] - __s2[1]); if (__s2_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("show_tooltip"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("show_tooltip"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "show_tooltip")))); })
== 0)
3115 sscanf(item, "%d", &show_tooltip);
3116 else if (strcmp(mail_config, "mh_seq_ignore")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p
(mail_config) && __builtin_constant_p ("mh_seq_ignore"
) && (__s1_len = strlen (mail_config), __s2_len = strlen
("mh_seq_ignore"), (!((size_t)(const void *)((mail_config) +
1) - (size_t)(const void *)(mail_config) == 1) || __s1_len >=
4) && (!((size_t)(const void *)(("mh_seq_ignore") + 1
) - (size_t)(const void *)("mh_seq_ignore") == 1) || __s2_len
>= 4)) ? __builtin_strcmp (mail_config, "mh_seq_ignore") :
(__builtin_constant_p (mail_config) && ((size_t)(const
void *)((mail_config) + 1) - (size_t)(const void *)(mail_config
) == 1) && (__s1_len = strlen (mail_config), __s1_len
< 4) ? (__builtin_constant_p ("mh_seq_ignore") &&
((size_t)(const void *)(("mh_seq_ignore") + 1) - (size_t)(const
void *)("mh_seq_ignore") == 1) ? __builtin_strcmp (mail_config
, "mh_seq_ignore") : (__extension__ ({ const unsigned char *__s2
= (const unsigned char *) (const char *) ("mh_seq_ignore"); int
__result = (((const unsigned char *) (const char *) (mail_config
))[0] - __s2[0]); if (__s1_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[1] - __s2[1]); if (__s1_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) (mail_config
))[2] - __s2[2]); if (__s1_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) (mail_config
))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
"mh_seq_ignore") && ((size_t)(const void *)(("mh_seq_ignore"
) + 1) - (size_t)(const void *)("mh_seq_ignore") == 1) &&
(__s2_len = strlen ("mh_seq_ignore"), __s2_len < 4) ? (__builtin_constant_p
(mail_config) && ((size_t)(const void *)((mail_config
) + 1) - (size_t)(const void *)(mail_config) == 1) ? __builtin_strcmp
(mail_config, "mh_seq_ignore") : (- (__extension__ ({ const unsigned
char *__s2 = (const unsigned char *) (const char *) (mail_config
); int __result = (((const unsigned char *) (const char *) ("mh_seq_ignore"
))[0] - __s2[0]); if (__s2_len > 0 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("mh_seq_ignore"
))[1] - __s2[1]); if (__s2_len > 1 && __result == 0
) { __result = (((const unsigned char *) (const char *) ("mh_seq_ignore"
))[2] - __s2[2]); if (__s2_len > 2 && __result == 0
) __result = (((const unsigned char *) (const char *) ("mh_seq_ignore"
))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (mail_config
, "mh_seq_ignore")))); })
== 0)
3117 sscanf(item, "%d", &mh_seq_ignore);
3118 }
3119 }
3120
3121
3122/* ---------------------------------------------------------------------*/
3123
3124enum
3125 {
3126 PROTOCOL_COLUMN,
3127#ifdef HAVE_SSL1
3128 SSL_COLUMN,
3129#endif
3130 MAILBOX_COLUMN,
3131 ACCOUNT_COLUMN,
3132 N_COLUMNS
3133 };
3134
3135static GtkTreeView *treeview;
3136static GtkTreeRowReference *row_reference;
3137static GtkTreeSelection *selection;
3138
3139static GtkWidget *account_notebook;
3140static GtkWidget *mbox_path_entry;
3141static GtkWidget *server_entry,
3142 *user_entry,
3143 *password_entry,
3144 *imapfolder_entry,
3145 *port_entry,
3146#ifdef HAVE_SSL1
3147 *ssl_combo_box,
3148#endif
3149 *port_button;
3150
3151static GtkWidget *local_button,
3152 *remote_button,
3153 *delete_button,
3154 *new_apply_button,
3155 *remote_combo_box;
3156
3157static GtkWidget *mail_user_agent_entry;
3158static GtkWidget *enable_multimua_button;
3159static GtkWidget *mail_fetch_entry;
3160static GtkWidget *mail_notify_entry;
3161static GtkWidget *enable_cont_anim_button;
3162static GtkWidget *super_mute_button;
3163static GtkWidget *count_mode_button[3];
3164static GtkWidget *anim_button[4];
3165static GtkWidget *check_only_button;
3166static GtkWidget *reset_remote_button;
3167static GtkWidget *unseen_is_new_button;
3168static GtkWidget *mua_inhibit_button;
3169static GtkWidget *show_tooltip_button;
3170static GtkWidget *mh_seq_ignore_button;
3171
3172static GList *config_mailbox_list;
3173
3174static gint optmenu_auth_protocol;
3175static gint optmenu_use_ssl; /* Always SSL_NONE if !HAVE_SSL */
3176
3177static gboolean selection_in_progress;
3178
3179static gchar *
3180x_out(gchar *s)
3181 {
3182 gchar *p;
3183 static gchar xbuf[32];
3184
3185 strncpy(xbuf, s, sizeof(xbuf))__builtin_strncpy (xbuf, s, sizeof(xbuf));
3186 xbuf[31] = '\0';
3187 if ((p = strchr(xbuf, '_')(__extension__ (__builtin_constant_p ('_') && !__builtin_constant_p
(xbuf) && ('_') == '\0' ? (char *) __rawmemchr (xbuf
, '_') : __builtin_strchr (xbuf, '_')))
) != NULL((void*)0))
3188 *p = ' ';
3189 return xbuf;
3190 }
3191
3192static gchar *
3193default_port_of_proto(gint protocol, gint use_ssl)
3194 {
3195 gchar *port = NULL((void*)0);
3196
3197 switch (protocol)
3198 {
3199 case PROTO_POP30:
3200 if (use_ssl == SSL_TRANSPORT1)
3201 port = DEFAULT_POP3S_PORT"995";
3202 else
3203 port = DEFAULT_POP3_PORT"110";
3204 break;
3205 case PROTO_IMAP1:
3206 if (use_ssl == SSL_TRANSPORT1)
3207 port = DEFAULT_IMAPS_PORT"993";
3208 else
3209 port = DEFAULT_IMAP_PORT"143";
3210 break;
3211 }
3212 return port;
3213 }
3214
3215static void
3216set_list_store_model_data(GtkListStore *store, GtkTreeIter *iter,
3217 MailAccount *account)
3218 {
3219 gchar *protocol, *mailbox, *default_port = NULL((void*)0), abuf[32], pbuf[32];
3220 gchar *s;
3221#ifdef HAVE_SSL1
3222 gchar *use_ssl;
3223#endif
3224
3225 if (account->mboxtype == MBOX_REMOTE(0x4000 | 0x20 | 3))
3226 {
3227 default_port = default_port_of_proto(account->protocol,
3228 account->use_ssl);
3229 snprintf(abuf, sizeof(abuf), "%s",
3230 auth_string(account->protocol, account->authmech)auth_strings[menu_authtype(account->protocol, account->
authmech)].string
);
3231 mailbox = g_strdup(account->server);
3232 if (account->port != atoi(default_port))
3233 {
3234 snprintf(pbuf, sizeof(pbuf), ":%d", account->port);
3235 s = g_strconcat(mailbox, pbuf, NULL((void*)0));
3236 g_free(mailbox);
3237 mailbox = s;
3238 }
3239 s = g_strconcat(mailbox, " ", account->username, NULL((void*)0));
3240 g_free(mailbox);
3241 mailbox = s;
3242 if (account->protocol == PROTO_IMAP1)
3243 {
3244 s = g_strconcat(mailbox, " ", account->imapfolder,
3245 NULL((void*)0));
3246 g_free(mailbox);
3247 mailbox = s;
3248 }
3249 }
3250 else
3251 {
3252 snprintf(abuf, sizeof(abuf), "%s", mbox_strings[account->mboxtype & 0xf]);
3253 mailbox = g_strdup_printf("%s", account->homedir_path ?
3254 account->homedir_path : account->path);
3255 }
3256 protocol = x_out(abuf);
3257#ifdef HAVE_SSL1
3258 switch (account->use_ssl)
3259 {
3260 case SSL_TRANSPORT1:
3261 use_ssl = "SSL";
3262 break;
3263 case SSL_STARTTLS2:
3264 use_ssl = "STARTTLS";
3265 break;
3266 default:
3267 use_ssl = "";
3268 break;
3269 }
3270#endif
3271
3272 gtk_list_store_set(store, iter,
3273 PROTOCOL_COLUMN, protocol,
3274#ifdef HAVE_SSL1
3275 SSL_COLUMN, use_ssl,
3276#endif
3277 MAILBOX_COLUMN, mailbox,
3278 ACCOUNT_COLUMN, account,
3279 -1);
3280 g_free(mailbox);
3281 }
3282
3283static GtkTreeModel *
3284create_model(void)
3285 {
3286 GtkListStore *store;
3287 GtkTreeIter iter;
3288 GList *list;
3289 MailAccount *account;
3290
3291 store = gtk_list_store_new(N_COLUMNS,
3292 G_TYPE_STRING((GType) ((16) << (2))),
3293 G_TYPE_STRING((GType) ((16) << (2))),
3294#ifdef HAVE_SSL1
3295 G_TYPE_STRING((GType) ((16) << (2))),
3296#endif
3297 G_TYPE_POINTER((GType) ((17) << (2))));
3298
3299 for (list = config_mailbox_list; list; list = list->next)
3300 {
3301 account = (MailAccount *) list->data;
3302 gtk_list_store_append(store, &iter);
3303 set_list_store_model_data(store, &iter, account);
3304 }
3305 return GTK_TREE_MODEL(store)((((GtkTreeModel*) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((gtk_tree_model_get_type ()))))))
;
3306 }
3307
3308static void
3309change_row_reference(GtkTreeModel *model, GtkTreePath *path)
3310 {
3311 gtk_tree_row_reference_free(row_reference);
3312 if (model && path)
3313 row_reference = gtk_tree_row_reference_new(model, path);
3314 else
3315 row_reference = NULL((void*)0);
3316 }
3317
3318static void
3319reset_entries(void)
3320 {
3321 if (selection_in_progress)
3322 return;
3323 if (mbox_path_entry)
3324 gtk_entry_set_text(GTK_ENTRY(mbox_path_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(mbox_path_entry)), ((gtk_entry_get_type ()))))))
, "");
3325
3326 gtk_entry_set_text(GTK_ENTRY(server_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(server_entry)), ((gtk_entry_get_type ()))))))
, "");
3327 gtk_entry_set_text(GTK_ENTRY(user_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(user_entry)), ((gtk_entry_get_type ()))))))
, "");
3328 gtk_entry_set_text(GTK_ENTRY(password_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(password_entry)), ((gtk_entry_get_type ()))))))
, "");
3329 gtk_entry_set_text(GTK_ENTRY(imapfolder_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(imapfolder_entry)), ((gtk_entry_get_type ()))))))
, "");
3330 gtk_widget_set_sensitive(imapfolder_entry, FALSE(0));
3331 gtk_combo_box_set_active(GTK_COMBO_BOX(remote_combo_box)((((GtkComboBox*) g_type_check_instance_cast ((GTypeInstance*
) ((remote_combo_box)), ((gtk_combo_box_get_type ()))))))
, 0);
3332 optmenu_auth_protocol = 0;
3333#ifdef HAVE_SSL1
3334 gtk_combo_box_set_active(GTK_COMBO_BOX(ssl_combo_box)((((GtkComboBox*) g_type_check_instance_cast ((GTypeInstance*
) ((ssl_combo_box)), ((gtk_combo_box_get_type ()))))))
, 0);
3335#endif
3336 optmenu_use_ssl = SSL_NONE0;
3337
3338 gtk_entry_set_text(GTK_ENTRY(port_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(port_entry)), ((gtk_entry_get_type ()))))))
, DEFAULT_POP3_PORT"110");
3339 gtk_widget_set_sensitive(port_entry, FALSE(0));
3340 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(port_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((port_button)), ((gtk_toggle_button_get_type ()))))))
, FALSE(0));
3341 change_row_reference(NULL((void*)0), NULL((void*)0));
3342 gtk_tree_selection_unselect_all(selection);
3343 }
3344
3345static void
3346cb_mailbox_group(GtkWidget *widget, gpointer data)
3347 {
3348 gint group;
3349
3350 group = GPOINTER_TO_INT(data)((gint) (glong) (data));
3351 gtk_notebook_set_current_page(GTK_NOTEBOOK(account_notebook)((((GtkNotebook*) g_type_check_instance_cast ((GTypeInstance*
) ((account_notebook)), ((gtk_notebook_get_type ()))))))
, group);
3352 reset_entries();
3353 }
3354
3355static gboolean
3356default_port_entry(void)
3357 {
3358 gboolean active;
3359 gchar* default_port = NULL((void*)0);
3360
3361 active = GTK_TOGGLE_BUTTON(port_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((port_button)), ((gtk_toggle_button_get_type ()))))))
->active;
3362 if (!active)
3363 {
3364 default_port = default_port_of_proto(
3365 menu_to_proto(optmenu_auth_protocol)auth_strings[optmenu_auth_protocol].protocol,
3366 optmenu_use_ssl);
3367 gtk_entry_set_text(GTK_ENTRY(port_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(port_entry)), ((gtk_entry_get_type ()))))))
, default_port);
3368 }
3369 return active;
3370 }
3371
3372#ifdef HAVE_SSL1
3373static void
3374cb_ssl_selected(GtkComboBox *widget)
3375 {
3376 optmenu_use_ssl = gtk_combo_box_get_active(widget);
3377 default_port_entry();
3378 }
3379#endif
3380
3381static void
3382cb_specify_port(GtkWidget *widget, gpointer data)
3383 {
3384 gtk_widget_set_sensitive(port_entry, default_port_entry());
3385 }
3386
3387static void
3388cb_protocol_selected(GtkComboBox *widget)
3389 {
3390 optmenu_auth_protocol = gtk_combo_box_get_active(widget);
3391 switch (menu_to_proto(optmenu_auth_protocol)auth_strings[optmenu_auth_protocol].protocol)
3392 {
3393 case PROTO_POP30:
3394 gtk_entry_set_text(GTK_ENTRY(imapfolder_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(imapfolder_entry)), ((gtk_entry_get_type ()))))))
, "");
3395 gtk_widget_set_sensitive(imapfolder_entry, FALSE(0));
3396 break;
3397 case PROTO_IMAP1:
3398 gtk_entry_set_text(GTK_ENTRY(imapfolder_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(imapfolder_entry)), ((gtk_entry_get_type ()))))))
,
3399 "inbox");
3400 gtk_widget_set_sensitive(imapfolder_entry, TRUE(!(0)));
3401 break;
3402 }
3403 default_port_entry();
3404 }
3405
3406static void
3407cb_tree_selection_changed(GtkTreeSelection *selection, gpointer data)
3408 {
3409 GtkTreeIter iter;
3410 GtkTreeModel *model;
3411 GtkTreePath *path;
3412 MailAccount *account;
3413 gchar buf[32];
3414 gint default_port = 0;
3415 gboolean active;
3416
3417 if (!gtk_tree_selection_get_selected(selection, &model, &iter))
3418 {
3419 reset_entries();
3420 gtk_button_set_label(GTK_BUTTON(new_apply_button)((((GtkButton*) g_type_check_instance_cast ((GTypeInstance*) (
(new_apply_button)), ((gtk_button_get_type ()))))))
, GTK_STOCK_NEW"gtk-new");
3421 gtk_widget_set_sensitive(delete_button, FALSE(0));
3422 return;
3423 }
3424 path = gtk_tree_model_get_path(model, &iter);
3425 change_row_reference(model, path);
3426 gtk_tree_path_free(path);
3427
3428 gtk_button_set_label(GTK_BUTTON(new_apply_button)((((GtkButton*) g_type_check_instance_cast ((GTypeInstance*) (
(new_apply_button)), ((gtk_button_get_type ()))))))
, GTK_STOCK_APPLY"gtk-apply");
3429 gtk_widget_set_sensitive(delete_button, TRUE(!(0)));
3430
3431 gtk_tree_model_get(model, &iter, ACCOUNT_COLUMN, &account, -1);
3432
3433 /* Below toggle of group button causes a callback -> reset_entries(),
3434 | and I want to lock that out.
3435 */
3436 selection_in_progress = TRUE(!(0));
3437 if (account->mboxtype == MBOX_REMOTE(0x4000 | 0x20 | 3))
3438 {
3439 if (remote_button)
3440 gtk_toggle_button_set_active(
3441 GTK_TOGGLE_BUTTON(remote_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((remote_button)), ((gtk_toggle_button_get_type ()))))))
, TRUE(!(0)));
3442 gtk_entry_set_text(GTK_ENTRY(server_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(server_entry)), ((gtk_entry_get_type ()))))))
, account->server);
3443 gtk_entry_set_text(GTK_ENTRY(user_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(user_entry)), ((gtk_entry_get_type ()))))))
, account->username);
3444 gtk_entry_set_text(GTK_ENTRY(password_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(password_entry)), ((gtk_entry_get_type ()))))))
, account->password);
3445 optmenu_auth_protocol = menu_authtype(account->protocol,
3446 account->authmech);
3447 optmenu_use_ssl = account->use_ssl;
3448 switch (account->protocol)
3449 {
3450 case PROTO_POP30:
3451 gtk_entry_set_text(GTK_ENTRY(imapfolder_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(imapfolder_entry)), ((gtk_entry_get_type ()))))))
, "");
3452 gtk_widget_set_sensitive(imapfolder_entry, FALSE(0));
3453 break;
3454 case PROTO_IMAP1:
3455 gtk_entry_set_text(GTK_ENTRY(imapfolder_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(imapfolder_entry)), ((gtk_entry_get_type ()))))))
,
3456 account->imapfolder);
3457 gtk_widget_set_sensitive(imapfolder_entry, TRUE(!(0)));
3458 break;
3459 }
3460 default_port = atoi(default_port_of_proto(account->protocol,
3461 account->use_ssl));
3462 gtk_combo_box_set_active(GTK_COMBO_BOX(remote_combo_box)((((GtkComboBox*) g_type_check_instance_cast ((GTypeInstance*
) ((remote_combo_box)), ((gtk_combo_box_get_type ()))))))
,
3463 optmenu_auth_protocol);
3464#ifdef HAVE_SSL1
3465 gtk_combo_box_set_active(GTK_COMBO_BOX(ssl_combo_box)((((GtkComboBox*) g_type_check_instance_cast ((GTypeInstance*
) ((ssl_combo_box)), ((gtk_combo_box_get_type ()))))))
,
3466 optmenu_use_ssl);
3467#endif
3468 if (account->port < 1)
3469 account->port = default_port;
3470 active = (account->port == default_port) ? FALSE(0) : TRUE(!(0));
3471 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(port_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((port_button)), ((gtk_toggle_button_get_type ()))))))
, active);
3472 snprintf(buf, sizeof(buf), "%d", account->port);
3473 gtk_entry_set_text(GTK_ENTRY(port_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(port_entry)), ((gtk_entry_get_type ()))))))
, buf);
3474 }
3475 else if (local_supported)
3476 {
3477 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(local_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((local_button)), ((gtk_toggle_button_get_type ()))))))
, TRUE(!(0)));
3478 gtk_entry_set_text(GTK_ENTRY(mbox_path_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(mbox_path_entry)), ((gtk_entry_get_type ()))))))
, account->homedir_path ?
3479 account->homedir_path : account->path);
3480 }
3481 selection_in_progress = FALSE(0);
3482 }
3483
3484
3485static gboolean
3486dup_entry(gchar **buf, GtkWidget **entry)
3487 {
3488 gchar *s;
3489
3490 s = gkrellm_gtk_entry_get_text(entry);
3491 if (*s)
3492 {
3493 *buf = g_strdup(s);
3494 return TRUE(!(0));
3495 }
3496 *buf = NULL((void*)0);
3497 return FALSE(0);
3498 }
3499
3500static void
3501sync_mail_list(void)
3502 {
3503 Mailbox *mbox;
3504 MailAccount *account, *new_account;
3505 GList *list;
3506
3507 /* Destroy MBOX_INTERNAL type mailboxes from the mailbox_list, then
3508 | recreate them from the config list. Skip over the first FETCH mbox.
3509 */
3510 for (list = mailbox_list->next; list; )
3511 {
3512 mbox = (Mailbox *) list->data;
3513 if (mbox->account->mboxtype & MBOX_INTERNAL0x20)
3514 {
3515 list = g_list_delete_link(list, list);
3516 free_mailbox(mbox);
3517 }
3518 else
3519 list = list->next;
3520 }
3521 checking_mh_mail = FALSE(0);
3522 for (list = config_mailbox_list; list; list = list->next)
3523 {
3524 account = (MailAccount *) list->data;
3525 new_account = g_new0(MailAccount, 1)(MailAccount *) (__extension__ ({ gsize __n = (gsize) (1); gsize
__s = sizeof (MailAccount); gpointer __p; if (__s == 1) __p =
g_malloc0 (__n); else if (__builtin_constant_p (__n) &&
(__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s
)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s
); __p; }))
;
3526 dup_account(new_account, account);
3527 add_mailbox(new_account);
3528 }
3529 force_mail_check = TRUE(!(0));
3530 }
3531
3532static void
3533mailbox_enter_cb(void)
3534 {
3535 GtkTreeModel *model;
3536 GtkTreePath *path;
3537 GtkTreeIter iter;
3538 GList *list;
3539 MailAccount *new_account, *account;
3540 gboolean remote, valid;
3541 gint default_port = 0;
3542
3543 new_account = g_new0(MailAccount, 1)(MailAccount *) (__extension__ ({ gsize __n = (gsize) (1); gsize
__s = sizeof (MailAccount); gpointer __p; if (__s == 1) __p =
g_malloc0 (__n); else if (__builtin_constant_p (__n) &&
(__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s
)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s
); __p; }))
;
3544 valid = FALSE(0);
3545 remote = remote_button ? GTK_TOGGLE_BUTTON(remote_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((remote_button)), ((gtk_toggle_button_get_type ()))))))
->active : TRUE(!(0));
3546 if (remote)
3547 {
3548 if ( dup_entry(&new_account->server, &server_entry)
3549 && dup_entry(&new_account->username, &user_entry)
3550 && dup_entry(&new_account->password, &password_entry)
3551 )
3552 valid = TRUE(!(0));
3553 if (GTK_TOGGLE_BUTTON(port_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((port_button)), ((gtk_toggle_button_get_type ()))))))
->active)
3554 new_account->port = atoi(gkrellm_gtk_entry_get_text(&port_entry));
3555 new_account->mboxtype = MBOX_REMOTE(0x4000 | 0x20 | 3);
3556 new_account->protocol = menu_to_proto(optmenu_auth_protocol)auth_strings[optmenu_auth_protocol].protocol;
3557 new_account->authmech = menu_to_mech(optmenu_auth_protocol)auth_strings[optmenu_auth_protocol].authmech;
3558 new_account->use_ssl = optmenu_use_ssl;
3559 if (new_account->protocol == PROTO_IMAP1 && valid)
3560 valid = dup_entry(&new_account->imapfolder,
3561 &imapfolder_entry);
3562 default_port = atoi(default_port_of_proto(
3563 new_account->protocol,
3564 new_account->use_ssl));
3565 if (new_account->port == 0)
3566 new_account->port = default_port;
3567 }
3568 else if (mbox_path_entry)
3569 {
3570 valid = dup_entry(&new_account->path, &mbox_path_entry);
3571 get_local_mboxtype(new_account);
3572 }
3573
3574 if (!valid)
3575 {
3576 gkrellm_config_message_dialog(_("GKrellM Config Error")dcgettext ("gkrellm", "GKrellM Config Error", 5),
3577 _("Incomplete mailbox entries")dcgettext ("gkrellm", "Incomplete mailbox entries", 5));
3578 free_account(new_account);
3579 return;
3580 }
3581
3582 model = gtk_tree_view_get_model(treeview);
3583 if (row_reference)
3584 {
3585 path = gtk_tree_row_reference_get_path(row_reference);
3586 gtk_tree_model_get_iter(model, &iter, path);
3587 gtk_tree_model_get(model, &iter, ACCOUNT_COLUMN, &account, -1);
3588 list = g_list_find(config_mailbox_list, account);
3589 free_account(account);
3590 if (list)
3591 list->data = (gpointer) new_account;
3592 }
3593 else
3594 {
3595 config_mailbox_list = g_list_append(config_mailbox_list, new_account);
3596 gtk_list_store_append(GTK_LIST_STORE(model)((((GtkListStore*) g_type_check_instance_cast ((GTypeInstance
*) ((model)), ((gtk_list_store_get_type ()))))))
, &iter);
3597 path = gtk_tree_model_get_path(model, &iter);
3598 gtk_tree_view_scroll_to_cell(treeview, path, NULL((void*)0), TRUE(!(0)), 0.5, 0.5);
3599 }
3600 set_list_store_model_data(GTK_LIST_STORE(model)((((GtkListStore*) g_type_check_instance_cast ((GTypeInstance
*) ((model)), ((gtk_list_store_get_type ()))))))
, &iter, new_account);
3601
3602 reset_entries();
3603 sync_mail_list();
3604 }
3605
3606
3607static void
3608mailbox_delete_cb(GtkWidget *widget, gpointer *data)
3609 {
3610 GtkTreeModel *model;
3611 GtkTreePath *path;
3612 GtkTreeIter iter;
3613 MailAccount *account;
3614
3615 if (!row_reference)
3616 return;
3617 model = gtk_tree_view_get_model(treeview);
3618 path = gtk_tree_row_reference_get_path(row_reference);
3619 gtk_tree_model_get_iter(model, &iter, path);
3620
3621 gtk_tree_model_get(model, &iter, ACCOUNT_COLUMN, &account, -1);
3622 config_mailbox_list = g_list_remove(config_mailbox_list, account);
3623 free_account(account);
3624
3625 gtk_list_store_remove(GTK_LIST_STORE(model)((((GtkListStore*) g_type_check_instance_cast ((GTypeInstance
*) ((model)), ((gtk_list_store_get_type ()))))))
, &iter);
3626
3627 reset_entries();
3628 sync_mail_list();
3629 }
3630
3631static void
3632cb_animation_mode(GtkWidget *button, gpointer data)
3633 {
3634 gint i = GPOINTER_TO_INT(data)((gint) (glong) (data));
3635
3636 if (GTK_TOGGLE_BUTTON(button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_toggle_button_get_type ()))))))
->active)
3637 animation_mode = i;
3638 }
3639
3640static void
3641cb_count_mode(GtkWidget *button, gpointer data)
3642 {
3643 gint i = GPOINTER_TO_INT(data)((gint) (glong) (data));
3644
3645 if (GTK_TOGGLE_BUTTON(button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_toggle_button_get_type ()))))))
->active)
3646 count_mode = i;
3647 mail_text_decal->value = -1; /* Force a redraw */
3648 force_mail_check = TRUE(!(0));
3649 }
3650
3651static void
3652toggle_button_cb(GtkToggleButton *button, gint *flag)
3653 {
3654// *flag = gtk_toggle_button_get_active(button);
3655 *flag = button->active;
3656 }
3657
3658static void
3659multi_toggle_button_cb(GtkWidget *button, gpointer data)
3660 {
3661 gint i;
3662
3663 cont_animation_mode = GTK_TOGGLE_BUTTON(enable_cont_anim_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((enable_cont_anim_button)), ((gtk_toggle_button_get_type (
)))))))
->active;
3664 if (check_only_button)
3665 fetch_check_only_mode = GTK_TOGGLE_BUTTON(check_only_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((check_only_button)), ((gtk_toggle_button_get_type ()))))
))
->active;
3666 reset_remote_mode = GTK_TOGGLE_BUTTON(reset_remote_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((reset_remote_button)), ((gtk_toggle_button_get_type ()))
))))
->active;
3667
3668 i = GTK_TOGGLE_BUTTON(unseen_is_new_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((unseen_is_new_button)), ((gtk_toggle_button_get_type ())
)))))
->active;
3669 if (unseen_is_new != i)
3670 force_mail_check = TRUE(!(0));
3671 unseen_is_new = i;
3672
3673 super_mute_mode = GTK_TOGGLE_BUTTON(super_mute_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((super_mute_button)), ((gtk_toggle_button_get_type ()))))
))
->active;
3674
3675 mail_text_decal->value = -1; /* Force a redraw */
3676 mua_inhibit_mode = GTK_TOGGLE_BUTTON(mua_inhibit_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((mua_inhibit_button)), ((gtk_toggle_button_get_type ())))
)))
->active;
3677
3678 enable_multimua = GTK_TOGGLE_BUTTON(enable_multimua_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((enable_multimua_button)), ((gtk_toggle_button_get_type (
)))))))
->active;
3679 show_tooltip = GTK_TOGGLE_BUTTON(show_tooltip_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((show_tooltip_button)), ((gtk_toggle_button_get_type ()))
))))
->active;
3680
3681 if (mh_seq_ignore_button)
3682 mh_seq_ignore = GTK_TOGGLE_BUTTON(mh_seq_ignore_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((mh_seq_ignore_button)), ((gtk_toggle_button_get_type ())
)))))
->active;
3683 update_tooltip();
3684 }
3685
3686static void
3687cb_enable(GtkWidget *button, gpointer data)
3688 {
3689 enable_mail = GTK_TOGGLE_BUTTON(button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_toggle_button_get_type ()))))))
->active;
3690 if (enable_mail)
3691 {
3692 gkrellm_panel_show(mail);
3693 gkrellm_spacers_show(mon_mail);
3694 }
3695 else
3696 {
3697 gkrellm_panel_hide(mail);
3698 gkrellm_spacers_hide(mon_mail);
3699 }
3700 }
3701
3702static void
3703cb_mua(GtkWidget *widget, gpointer data)
3704 {
3705 gkrellm_dup_string(&mail_user_agent.command,
3706 gkrellm_gtk_entry_get_text(&mail_user_agent_entry));
3707 set_mua_button_sensitivity();
3708 }
3709
3710static void
3711remote_check_timeout_cb(GtkWidget *widget, GtkSpinButton *spin)
3712 {
3713 remote_check_timeout = gtk_spin_button_get_value_as_int(spin);
3714 }
3715
3716static void
3717local_check_timeout_cb(GtkWidget *widget, GtkSpinButton *spin)
3718 {
3719 local_check_timeout = gtk_spin_button_get_value_as_int(spin);
3720 }
3721
3722
3723 /* Go to some extra trouble here to avoid incomplete entries being used for
3724 | fetch or notify commands which can trigger in the middle of entering the
3725 | command. My UI instant apply behavior is that whatever is typed into the
3726 | entry will be used and to be consistent with other entries I don't wan't
3727 | to require an "enter" to "activate". So, save "changed" values and apply
3728 | them when config is closed if user never hit the Enter key. (Is there
3729 | a way for Gtk to auto activate?)
3730 */
3731static gchar *pending_fetch,
3732 *pending_notify;
3733
3734static void
3735cb_mail_fetch(GtkWidget *widget, gpointer data)
3736 {
3737 Mailproc *mp = (Mailproc *) mail_fetch->private;
3738 gboolean activate_sig = GPOINTER_TO_INT(data)((gint) (glong) (data));
3739 gchar *s = gkrellm_gtk_entry_get_text(&mail_fetch_entry);
3740
3741 if (activate_sig)
3742 {
3743 if (gkrellm_dup_string(&mp->command, s))
3744 reset_mail_fetch();
3745 g_free(pending_fetch);
3746 pending_fetch = NULL((void*)0);
3747 }
3748 else /* "changed" sig, entry is pending on "activate" or config close */
3749 gkrellm_dup_string(&pending_fetch, s);
3750 }
3751
3752static void
3753cb_mail_notify(GtkWidget *widget, gpointer data)
3754 {
3755 gboolean activate_sig = GPOINTER_TO_INT(data)((gint) (glong) (data));
3756 gchar *s = gkrellm_gtk_entry_get_text(&mail_notify_entry);
3757
3758 if (activate_sig)
3759 {
3760 gkrellm_dup_string(&mail_notify, s);
3761 g_free(pending_notify);
3762 pending_notify = NULL((void*)0);
3763 }
3764 else /* "changed" sig, entry is pending on "activate" or config close */
3765 gkrellm_dup_string(&pending_notify, s);
3766 }
3767
3768static void
3769config_destroyed(void)
3770 {
3771 GList *list;
3772 MailAccount *account;
3773 Mailproc *mp = (Mailproc *) mail_fetch->private;
3774
3775 if (pending_fetch && gkrellm_dup_string(&mp->command, pending_fetch))
3776 reset_mail_fetch();
3777 g_free(pending_fetch);
3778 pending_fetch = NULL((void*)0);
3779
3780 if (pending_notify)
3781 gkrellm_dup_string(&mail_notify, pending_notify);
3782 g_free(pending_notify);
3783 pending_notify = NULL((void*)0);
3784
3785 for (list = config_mailbox_list; list; list = list->next)
3786 {
3787 account = (MailAccount *) list->data;
3788 free_account(account);
3789 }
3790 g_list_free(config_mailbox_list);
3791 config_mailbox_list = NULL((void*)0);
3792 }
3793
3794static void
3795copy_mailbox_accounts(void)
3796 {
3797 GList *list;
3798 MailAccount *account;
3799 Mailbox *mbox;
3800
3801 for (list = mailbox_list; list; list = list->next)
3802 {
3803 mbox = (Mailbox *) list->data;
3804 if (! (mbox->account->mboxtype & MBOX_INTERNAL0x20))
3805 continue;
3806 account = g_new0(MailAccount, 1)(MailAccount *) (__extension__ ({ gsize __n = (gsize) (1); gsize
__s = sizeof (MailAccount); gpointer __p; if (__s == 1) __p =
g_malloc0 (__n); else if (__builtin_constant_p (__n) &&
(__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s
)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s
); __p; }))
;
3807 dup_account(account, mbox->account);
3808 config_mailbox_list = g_list_append(config_mailbox_list, account);
3809 }
3810 }
3811
3812static gchar *mail_info_text0[] =
3813{
3814N_("<h>Mailboxes\n")("<h>Mailboxes\n"),
3815
3816N_("Mailboxes to monitor can be local or remote mailbox types.\n")("Mailboxes to monitor can be local or remote mailbox types.\n"
)
,
3817N_("For local mailboxes, the path name may be a mbox file or it may be\n"("For local mailboxes, the path name may be a mbox file or it may be\n"
"a Maildir or MH mail style directory.\n")
3818"a Maildir or MH mail style directory.\n")("For local mailboxes, the path name may be a mbox file or it may be\n"
"a Maildir or MH mail style directory.\n")
,
3819"\n"
3820};
3821
3822static gchar *mail_info_text1[] =
3823{
3824N_("<h>Setup\n")("<h>Setup\n"),
3825N_("<b>Mail reading program\n")("<b>Mail reading program\n"),
3826N_("If you enter a mail reading program (your mail user agent or MUA)\n"("If you enter a mail reading program (your mail user agent or MUA)\n"
"it can be launched by clicking on the mail monitor message count button.\n"
)
3827"it can be launched by clicking on the mail monitor message count button.\n")("If you enter a mail reading program (your mail user agent or MUA)\n"
"it can be launched by clicking on the mail monitor message count button.\n"
)
,
3828"\n",
3829N_("<b>Sound notify program\n")("<b>Sound notify program\n"),
3830N_("If you enter a notify (sound) command, it will be run when new mail\n"("If you enter a notify (sound) command, it will be run when new mail\n"
"is detected.\n")
3831"is detected.\n")("If you enter a notify (sound) command, it will be run when new mail\n"
"is detected.\n")
,
3832"\n"
3833};
3834
3835static gchar *mail_info_text2[] =
3836{
3837N_("<b>fetch/check Program\n")("<b>fetch/check Program\n"),
3838N_("If you want to download remote mail or check for remote mail without\n"("If you want to download remote mail or check for remote mail without\n"
"using the builtin POP3 or IMAP mail checking which is set up in the\n"
)
3839"using the builtin POP3 or IMAP mail checking which is set up in the\n")("If you want to download remote mail or check for remote mail without\n"
"using the builtin POP3 or IMAP mail checking which is set up in the\n"
)
,
3840N_("<i>Mailboxes")("<i>Mailboxes"),
3841N_(" tab, then do this by entering a mail fetch/check command.\n"(" tab, then do this by entering a mail fetch/check command.\n"
"For example, fetchmail can be run periodically to download mail\n"
"messages from a remote server to your local mailboxes where GKrellM\n"
"can count them.\n\n""Or, GKrellM can read the output and report the results from some mail\n"
"checking programs which count remote or local messages. If you enter\n"
"a command like this that checks mail without downloading, then you\n"
"must tell GKrellM this is the expected behaviour by selecting in the\n"
"Options tab:\n")
3842"For example, fetchmail can be run periodically to download mail\n"(" tab, then do this by entering a mail fetch/check command.\n"
"For example, fetchmail can be run periodically to download mail\n"
"messages from a remote server to your local mailboxes where GKrellM\n"
"can count them.\n\n""Or, GKrellM can read the output and report the results from some mail\n"
"checking programs which count remote or local messages. If you enter\n"
"a command like this that checks mail without downloading, then you\n"
"must tell GKrellM this is the expected behaviour by selecting in the\n"
"Options tab:\n")
3843"messages from a remote server to your local mailboxes where GKrellM\n"(" tab, then do this by entering a mail fetch/check command.\n"
"For example, fetchmail can be run periodically to download mail\n"
"messages from a remote server to your local mailboxes where GKrellM\n"
"can count them.\n\n""Or, GKrellM can read the output and report the results from some mail\n"
"checking programs which count remote or local messages. If you enter\n"
"a command like this that checks mail without downloading, then you\n"
"must tell GKrellM this is the expected behaviour by selecting in the\n"
"Options tab:\n")
3844"can count them.\n\n"(" tab, then do this by entering a mail fetch/check command.\n"
"For example, fetchmail can be run periodically to download mail\n"
"messages from a remote server to your local mailboxes where GKrellM\n"
"can count them.\n\n""Or, GKrellM can read the output and report the results from some mail\n"
"checking programs which count remote or local messages. If you enter\n"
"a command like this that checks mail without downloading, then you\n"
"must tell GKrellM this is the expected behaviour by selecting in the\n"
"Options tab:\n")
3845
3846"Or, GKrellM can read the output and report the results from some mail\n"(" tab, then do this by entering a mail fetch/check command.\n"
"For example, fetchmail can be run periodically to download mail\n"
"messages from a remote server to your local mailboxes where GKrellM\n"
"can count them.\n\n""Or, GKrellM can read the output and report the results from some mail\n"
"checking programs which count remote or local messages. If you enter\n"
"a command like this that checks mail without downloading, then you\n"
"must tell GKrellM this is the expected behaviour by selecting in the\n"
"Options tab:\n")
3847"checking programs which count remote or local messages. If you enter\n"(" tab, then do this by entering a mail fetch/check command.\n"
"For example, fetchmail can be run periodically to download mail\n"
"messages from a remote server to your local mailboxes where GKrellM\n"
"can count them.\n\n""Or, GKrellM can read the output and report the results from some mail\n"
"checking programs which count remote or local messages. If you enter\n"
"a command like this that checks mail without downloading, then you\n"
"must tell GKrellM this is the expected behaviour by selecting in the\n"
"Options tab:\n")
3848"a command like this that checks mail without downloading, then you\n"(" tab, then do this by entering a mail fetch/check command.\n"
"For example, fetchmail can be run periodically to download mail\n"
"messages from a remote server to your local mailboxes where GKrellM\n"
"can count them.\n\n""Or, GKrellM can read the output and report the results from some mail\n"
"checking programs which count remote or local messages. If you enter\n"
"a command like this that checks mail without downloading, then you\n"
"must tell GKrellM this is the expected behaviour by selecting in the\n"
"Options tab:\n")
3849"must tell GKrellM this is the expected behaviour by selecting in the\n"(" tab, then do this by entering a mail fetch/check command.\n"
"For example, fetchmail can be run periodically to download mail\n"
"messages from a remote server to your local mailboxes where GKrellM\n"
"can count them.\n\n""Or, GKrellM can read the output and report the results from some mail\n"
"checking programs which count remote or local messages. If you enter\n"
"a command like this that checks mail without downloading, then you\n"
"must tell GKrellM this is the expected behaviour by selecting in the\n"
"Options tab:\n")
3850"Options tab:\n")(" tab, then do this by entering a mail fetch/check command.\n"
"For example, fetchmail can be run periodically to download mail\n"
"messages from a remote server to your local mailboxes where GKrellM\n"
"can count them.\n\n""Or, GKrellM can read the output and report the results from some mail\n"
"checking programs which count remote or local messages. If you enter\n"
"a command like this that checks mail without downloading, then you\n"
"must tell GKrellM this is the expected behaviour by selecting in the\n"
"Options tab:\n")
,
3851N_("<i>\tFetch/check program checks messages only\n")("<i>\tFetch/check program checks messages only\n"),
3852N_("For checking messages on a remote server, GKrellM can read the\n"("For checking messages on a remote server, GKrellM can read the\n"
"output of the program ")
3853"output of the program ")("For checking messages on a remote server, GKrellM can read the\n"
"output of the program ")
,
3854N_("<i>fetchmail -c")("<i>fetchmail -c"),
3855N_(" (you must append the -c).\n")(" (you must append the -c).\n"),
3856N_("But, do not combine these methods for the same mailbox! If you enter a\n"("But, do not combine these methods for the same mailbox! If you enter a\n"
"POP3 mailbox in the ")
3857"POP3 mailbox in the ")("But, do not combine these methods for the same mailbox! If you enter a\n"
"POP3 mailbox in the ")
,
3858N_("<i>Mailboxes")("<i>Mailboxes"),
3859N_(" tab, then don't check it again with fetchmail.\n")(" tab, then don't check it again with fetchmail.\n")
3860};
3861
3862static gchar *mail_info_text3[] =
3863{
3864N_("<h>\nMouse Button Actions:\n")("<h>\nMouse Button Actions:\n"),
3865N_("<b>\tLeft ")("<b>\tLeft "),
3866N_("click the mail count button to launch the mail reading program.\n")("click the mail count button to launch the mail reading program.\n"
)
,
3867N_("\t\tIf options permit, also stop animations and reset remote counts.\n")("\t\tIf options permit, also stop animations and reset remote counts.\n"
)
,
3868N_("<b>\tLeft ")("<b>\tLeft "),
3869N_("click the envelope decal to force a mail check regardless of\n"("click the envelope decal to force a mail check regardless of\n"
"\t\tany mute mode or inhibit mail checking option settings.\n"
)
3870"\t\tany mute mode or inhibit mail checking option settings.\n")("click the envelope decal to force a mail check regardless of\n"
"\t\tany mute mode or inhibit mail checking option settings.\n"
)
,
3871N_("<b>\tMiddle ")("<b>\tMiddle "),
3872N_("click the mail panel to toggle a mute mode which inhibits\n"("click the mail panel to toggle a mute mode which inhibits\n"
"\t\tthe sound notify program and optionally inhibits all mail\n"
"\t\tchecking.\n")
3873 "\t\tthe sound notify program and optionally inhibits all mail\n"("click the mail panel to toggle a mute mode which inhibits\n"
"\t\tthe sound notify program and optionally inhibits all mail\n"
"\t\tchecking.\n")
3874 "\t\tchecking.\n")("click the mail panel to toggle a mute mode which inhibits\n"
"\t\tthe sound notify program and optionally inhibits all mail\n"
"\t\tchecking.\n")
,
3875};
3876
3877
3878static void
3879create_mail_tab(GtkWidget *tab_vbox)
3880 {
3881 GtkWidget *tabs;
3882 GtkWidget *table;
3883 GtkWidget *vbox, *vbox1, *hbox, *hbox1;
3884 GtkWidget *label;
3885 GtkWidget *button;
3886 GtkWidget *scrolled;
3887 GtkWidget *text;
3888 GtkTreeModel *model;
3889 GtkCellRenderer *renderer;
3890 GSList *group;
3891 gint i;
3892
3893 row_reference = NULL((void*)0);
3894 mh_seq_ignore_button = NULL((void*)0);
3895
3896 copy_mailbox_accounts();
3897 tabs = gtk_notebook_new();
3898 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tabs)((((GtkNotebook*) g_type_check_instance_cast ((GTypeInstance*
) ((tabs)), ((gtk_notebook_get_type ()))))))
, GTK_POS_TOP);
3899 gtk_box_pack_start(GTK_BOX(tab_vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((tab_vbox
)), ((gtk_box_get_type ()))))))
, tabs, TRUE(!(0)), TRUE(!(0)), 0);
3900 g_signal_connect(G_OBJECT(tabs),"destroy",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((tabs)), (((GType) ((20) << (2)))))
)))), ("destroy"), (((GCallback) (config_destroyed))), (((void
*)0)), ((void*)0), (GConnectFlags) 0)
3901 G_CALLBACK(config_destroyed), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((tabs)), (((GType) ((20) << (2)))))
)))), ("destroy"), (((GCallback) (config_destroyed))), (((void
*)0)), ((void*)0), (GConnectFlags) 0)
;
3902
3903/* --Setup tab */
3904 vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Setup")dcgettext ("gkrellm", "Setup", 5));
3905
3906 gkrellm_gtk_check_button_connected(vbox, NULL((void*)0),
3907 enable_mail, FALSE(0), FALSE(0), 10,
3908 cb_enable, NULL((void*)0),
3909 _("Enable Mailcheck")dcgettext ("gkrellm", "Enable Mailcheck", 5));
3910
3911 vbox1 = gkrellm_gtk_framed_vbox_end(vbox, NULL((void*)0), 4, FALSE(0), 0, 2);
3912 table = gtk_table_new(7, 2, FALSE(0) /*non-homogeneous*/);
3913 gtk_table_set_col_spacings(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, 2);
3914 gtk_table_set_row_spacings(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, 3);
3915 gtk_box_pack_start(GTK_BOX(vbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox1
)), ((gtk_box_get_type ()))))))
, table, FALSE(0), FALSE(0), 2);
3916
3917 hbox = gtk_hbox_new(TRUE(!(0)), 0);
3918 /* Attach left right top bottom */
3919 gtk_table_attach(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, hbox, 0, 1, 0, 1,
3920 GTK_SHRINK, GTK_SHRINK, 0, 0);
3921 label = gtk_label_new(_("Mail reading program:")dcgettext ("gkrellm", "Mail reading program:", 5));
3922 gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) ((
label)), ((gtk_misc_get_type ()))))))
, 1.0, 0.5);
3923 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 4);
3924 mail_user_agent_entry = gtk_entry_new();
3925 gtk_entry_set_max_length(GTK_ENTRY(mail_user_agent_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(mail_user_agent_entry)), ((gtk_entry_get_type ()))))))
, 255);
3926 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, mail_user_agent_entry,
3927 1, 2, 0, 1);
3928 gtk_entry_set_text(GTK_ENTRY(mail_user_agent_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(mail_user_agent_entry)), ((gtk_entry_get_type ()))))))
,
3929 mail_user_agent.command);
3930 g_signal_connect(G_OBJECT(mail_user_agent_entry), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((mail_user_agent_entry)), (((GType) ((20)
<< (2))))))))), ("changed"), (((GCallback) (cb_mua))),
(((void*)0)), ((void*)0), (GConnectFlags) 0)
3931 G_CALLBACK(cb_mua), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((mail_user_agent_entry)), (((GType) ((20)
<< (2))))))))), ("changed"), (((GCallback) (cb_mua))),
(((void*)0)), ((void*)0), (GConnectFlags) 0)
;
3932
3933 hbox = gtk_hbox_new(TRUE(!(0)), 0);
3934 gtk_table_attach(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, hbox, 0, 1, 1, 2,
3935 GTK_SHRINK, GTK_SHRINK, 0, 0);
3936 label = gtk_label_new(_("Notify (sound) program:")dcgettext ("gkrellm", "Notify (sound) program:", 5));
3937 gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) ((
label)), ((gtk_misc_get_type ()))))))
, 1.0, 0.5);
3938 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 4);
3939 mail_notify_entry = gtk_entry_new();
3940 gtk_entry_set_max_length(GTK_ENTRY(mail_notify_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(mail_notify_entry)), ((gtk_entry_get_type ()))))))
, 255);
3941 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, mail_notify_entry, 1, 2, 1, 2);
3942 gtk_entry_set_text(GTK_ENTRY(mail_notify_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(mail_notify_entry)), ((gtk_entry_get_type ()))))))
, mail_notify);
3943 g_signal_connect(G_OBJECT(mail_notify_entry), "activate",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((mail_notify_entry)), (((GType) ((20) <<
(2))))))))), ("activate"), (((GCallback) (cb_mail_notify))),
(((gpointer) (glong) (1))), ((void*)0), (GConnectFlags) 0)
3944 G_CALLBACK(cb_mail_notify), GINT_TO_POINTER(1))g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((mail_notify_entry)), (((GType) ((20) <<
(2))))))))), ("activate"), (((GCallback) (cb_mail_notify))),
(((gpointer) (glong) (1))), ((void*)0), (GConnectFlags) 0)
;
3945 g_signal_connect(G_OBJECT(mail_notify_entry), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((mail_notify_entry)), (((GType) ((20) <<
(2))))))))), ("changed"), (((GCallback) (cb_mail_notify))), (
((gpointer) (glong) (0))), ((void*)0), (GConnectFlags) 0)
3946 G_CALLBACK(cb_mail_notify), GINT_TO_POINTER(0))g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((mail_notify_entry)), (((GType) ((20) <<
(2))))))))), ("changed"), (((GCallback) (cb_mail_notify))), (
((gpointer) (glong) (0))), ((void*)0), (GConnectFlags) 0)
;
3947
3948 if (local_supported)
3949 {
3950 hbox = gtk_hbox_new(TRUE(!(0)), 0);
3951 gtk_table_attach(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, hbox, 0, 1, 2, 3,
3952 GTK_SHRINK, GTK_SHRINK, 0, 0);
3953 label = gtk_label_new(_("Mail fetch/check program:")dcgettext ("gkrellm", "Mail fetch/check program:", 5));
3954 gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) ((
label)), ((gtk_misc_get_type ()))))))
, 1.0, 0.5);
3955 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 4);
3956 mail_fetch_entry = gtk_entry_new();
3957 gtk_entry_set_max_length(GTK_ENTRY(mail_fetch_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(mail_fetch_entry)), ((gtk_entry_get_type ()))))))
, 255);
3958 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, mail_fetch_entry,
3959 1, 2, 2, 3);
3960 gtk_entry_set_text(GTK_ENTRY(mail_fetch_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(mail_fetch_entry)), ((gtk_entry_get_type ()))))))
,
3961 ((Mailproc *)mail_fetch->private)->command);
3962 g_signal_connect(G_OBJECT(mail_fetch_entry), "activate",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((mail_fetch_entry)), (((GType) ((20) <<
(2))))))))), ("activate"), (((GCallback) (cb_mail_fetch))), (
((gpointer) (glong) (1))), ((void*)0), (GConnectFlags) 0)
3963 G_CALLBACK(cb_mail_fetch), GINT_TO_POINTER(1))g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((mail_fetch_entry)), (((GType) ((20) <<
(2))))))))), ("activate"), (((GCallback) (cb_mail_fetch))), (
((gpointer) (glong) (1))), ((void*)0), (GConnectFlags) 0)
;
3964 g_signal_connect(G_OBJECT(mail_fetch_entry), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((mail_fetch_entry)), (((GType) ((20) <<
(2))))))))), ("changed"), (((GCallback) (cb_mail_fetch))), (
((gpointer) (glong) (0))), ((void*)0), (GConnectFlags) 0)
3965 G_CALLBACK(cb_mail_fetch), GINT_TO_POINTER(0))g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((mail_fetch_entry)), (((GType) ((20) <<
(2))))))))), ("changed"), (((GCallback) (cb_mail_fetch))), (
((gpointer) (glong) (0))), ((void*)0), (GConnectFlags) 0)
;
3966
3967 hbox = gtk_hbox_new(FALSE(0), 0);
3968 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, hbox, 1, 2, 3, 4);
3969 gkrellm_gtk_check_button_connected(hbox, NULL((void*)0), fetch_check_is_local,
3970 FALSE(0), FALSE(0), 3,
3971 toggle_button_cb, &fetch_check_is_local,
3972 _("Run fetch/check program at local interval")dcgettext ("gkrellm", "Run fetch/check program at local interval"
, 5)
);
3973
3974 label = gtk_label_new(" ");
3975 gtk_table_attach(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, label, 0, 1, 4, 5,
3976 GTK_SHRINK, GTK_SHRINK, 0, 0);
3977
3978
3979 hbox = gtk_hbox_new(TRUE(!(0)), 0);
3980 gtk_table_attach(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, hbox, 0, 1, 5, 6,
3981 GTK_SHRINK, GTK_SHRINK, 0, 0);
3982 label = gtk_label_new(_("Check local mailboxes every")dcgettext ("gkrellm", "Check local mailboxes every", 5));
3983 gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) ((
label)), ((gtk_misc_get_type ()))))))
, 1.0, 0.5);
3984 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 4);
3985 hbox = gtk_hbox_new(FALSE(0), 0);
3986 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, hbox, 1, 2, 5, 6);
3987 gkrellm_gtk_spin_button(hbox, NULL((void*)0),
3988 (gfloat) local_check_timeout, 2.0, 100.0, 1.0, 5.0, 0, 60,
3989 local_check_timeout_cb, NULL((void*)0), FALSE(0), _("seconds")dcgettext ("gkrellm", "seconds", 5));
3990 }
3991 hbox = gtk_hbox_new(FALSE(0), 0);
3992 gtk_table_attach(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, hbox, 0, 1, 6, 7,
3993 GTK_SHRINK, GTK_SHRINK, 0, 0);
3994 if (local_supported)
3995 label = gtk_label_new(_("Do remote checks every")dcgettext ("gkrellm", "Do remote checks every", 5));
3996 else
3997 label = gtk_label_new(_("Check mail every")dcgettext ("gkrellm", "Check mail every", 5));
3998 gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) ((
label)), ((gtk_misc_get_type ()))))))
, 1.0, 0.5);
3999 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 4);
4000 hbox = gtk_hbox_new(FALSE(0), 0);
4001 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, hbox, 1, 2, 6, 7);
4002 gkrellm_gtk_spin_button(hbox, NULL((void*)0),
4003 (gfloat) remote_check_timeout, 1.0, 60.0, 1.0, 5.0, 0, 60,
4004 remote_check_timeout_cb, NULL((void*)0), FALSE(0), _("minutes")dcgettext ("gkrellm", "minutes", 5));
4005
4006/* --Mailboxes tab */
4007 vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Mailboxes")dcgettext ("gkrellm", "Mailboxes", 5));
4008// vbox1 = gkrellm_gtk_framed_vbox(vbox, NULL, 3, FALSE, 0, 3);
4009 vbox1 = gtk_vbox_new(FALSE(0), 0);
4010 gtk_container_add(GTK_CONTAINER(vbox)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((gtk_container_get_type ()))))))
, vbox1);
4011
4012 account_notebook = gtk_notebook_new();
4013 gtk_box_pack_start(GTK_BOX(vbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox1
)), ((gtk_box_get_type ()))))))
, account_notebook, FALSE(0), FALSE(0), 2);
4014 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(account_notebook)((((GtkNotebook*) g_type_check_instance_cast ((GTypeInstance*
) ((account_notebook)), ((gtk_notebook_get_type ()))))))
, FALSE(0));
4015
4016 /* Local mailbox account entry */
4017 if (local_supported)
4018 {
4019 vbox1 = gtk_vbox_new(FALSE(0), 0);
4020 gtk_notebook_append_page(GTK_NOTEBOOK(account_notebook)((((GtkNotebook*) g_type_check_instance_cast ((GTypeInstance*
) ((account_notebook)), ((gtk_notebook_get_type ()))))))
, vbox1, NULL((void*)0));
4021 hbox = gtk_hbox_new(FALSE(0), 2);
4022 gtk_box_pack_start(GTK_BOX(vbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox1
)), ((gtk_box_get_type ()))))))
, hbox, FALSE(0), FALSE(0), 0);
4023 label = gtk_label_new(_("Path name:")dcgettext ("gkrellm", "Path name:", 5));
4024 gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) ((
label)), ((gtk_misc_get_type ()))))))
, 1.0, 0.5);
4025 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, label, FALSE(0), FALSE(0), 0);
4026 mbox_path_entry = gtk_entry_new();
4027 gtk_entry_set_max_length(GTK_ENTRY(mbox_path_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(mbox_path_entry)), ((gtk_entry_get_type ()))))))
, 255);
4028 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, mbox_path_entry, TRUE(!(0)), TRUE(!(0)), 2);
4029 gtk_entry_set_text(GTK_ENTRY(mbox_path_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(mbox_path_entry)), ((gtk_entry_get_type ()))))))
, "");
4030 g_signal_connect (G_OBJECT (mbox_path_entry), "activate",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((mbox_path_entry)), (((GType) ((20) <<
(2))))))))), ("activate"), (((GCallback) (mailbox_enter_cb))
), (((void*)0)), ((void*)0), (GConnectFlags) 0)
4031 G_CALLBACK(mailbox_enter_cb), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((mbox_path_entry)), (((GType) ((20) <<
(2))))))))), ("activate"), (((GCallback) (mailbox_enter_cb))
), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
4032 }
4033
4034 /* Remote mailbox account entry */
4035 table = gtk_table_new(4 /* rows */, 4, FALSE(0) /*non-homogeneous*/);
4036 gtk_table_set_row_spacings(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, 2);
4037 gtk_table_set_col_spacings(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, 6);
4038 gtk_table_set_col_spacing(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, 1, 16);
4039 gtk_notebook_append_page(GTK_NOTEBOOK(account_notebook)((((GtkNotebook*) g_type_check_instance_cast ((GTypeInstance*
) ((account_notebook)), ((gtk_notebook_get_type ()))))))
, table, NULL((void*)0));
4040
4041 label = gtk_label_new(_("Server")dcgettext ("gkrellm", "Server", 5));
4042 gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) ((
label)), ((gtk_misc_get_type ()))))))
, 1.0, 0.5);
4043 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, label, 0, 1, 0, 1);
4044 server_entry = gtk_entry_new();
4045 gtk_entry_set_max_length(GTK_ENTRY(server_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(server_entry)), ((gtk_entry_get_type ()))))))
, 255);
4046 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, server_entry, 1, 2, 0, 1);
4047
4048 label = gtk_label_new(_("User name")dcgettext ("gkrellm", "User name", 5));
4049 gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) ((
label)), ((gtk_misc_get_type ()))))))
, 1.0, 0.5);
4050 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, label, 0, 1, 1, 2);
4051 user_entry = gtk_entry_new();
4052 gtk_entry_set_max_length(GTK_ENTRY(user_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(user_entry)), ((gtk_entry_get_type ()))))))
, 255);
4053 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, user_entry, 1, 2, 1, 2);
4054
4055 label = gtk_label_new(_("Password")dcgettext ("gkrellm", "Password", 5));
4056 gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) ((
label)), ((gtk_misc_get_type ()))))))
, 1.0, 0.5);
4057 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, label, 0, 1, 2, 3);
4058 password_entry = gtk_entry_new();
4059 gtk_entry_set_max_length(GTK_ENTRY(password_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(password_entry)), ((gtk_entry_get_type ()))))))
, 255);
4060 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, password_entry, 1, 2, 2, 3);
4061 gtk_entry_set_visibility(GTK_ENTRY(password_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(password_entry)), ((gtk_entry_get_type ()))))))
, FALSE(0));
4062
4063 label = gtk_label_new(_("Protocol")dcgettext ("gkrellm", "Protocol", 5));
4064 gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) ((
label)), ((gtk_misc_get_type ()))))))
, 1.0, 0.5);
4065 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, label, 2, 3, 0, 1);
4066
4067 remote_combo_box = gtk_combo_box_new_text();
4068 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, remote_combo_box, 3, 4, 0,1);
4069 for (i = 0; auth_strings[i].string != NULL((void*)0); ++i)
4070 gtk_combo_box_append_text(GTK_COMBO_BOX(remote_combo_box)((((GtkComboBox*) g_type_check_instance_cast ((GTypeInstance*
) ((remote_combo_box)), ((gtk_combo_box_get_type ()))))))
, auth_strings[i].string);
4071 g_signal_connect(G_OBJECT(remote_combo_box), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((remote_combo_box)), (((GType) ((20) <<
(2))))))))), ("changed"), (((GCallback) (cb_protocol_selected
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
4072 G_CALLBACK(cb_protocol_selected), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((remote_combo_box)), (((GType) ((20) <<
(2))))))))), ("changed"), (((GCallback) (cb_protocol_selected
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
4073
4074 i = 1;
4075
4076#ifdef HAVE_SSL1
4077 label = gtk_label_new(_("Use SSL")dcgettext ("gkrellm", "Use SSL", 5));
4078 gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) ((
label)), ((gtk_misc_get_type ()))))))
, 1.0, 0.5);
4079 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, label, 2, 3, i, i+1);
4080
4081 ssl_combo_box = gtk_combo_box_new_text();
4082 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, ssl_combo_box, 3, 4, i, i+1);
4083 ++i;
4084 gtk_combo_box_append_text(GTK_COMBO_BOX(ssl_combo_box)((((GtkComboBox*) g_type_check_instance_cast ((GTypeInstance*
) ((ssl_combo_box)), ((gtk_combo_box_get_type ()))))))
, _("No")dcgettext ("gkrellm", "No", 5));
4085 gtk_combo_box_append_text(GTK_COMBO_BOX(ssl_combo_box)((((GtkComboBox*) g_type_check_instance_cast ((GTypeInstance*
) ((ssl_combo_box)), ((gtk_combo_box_get_type ()))))))
, "SSL");
4086 gtk_combo_box_append_text(GTK_COMBO_BOX(ssl_combo_box)((((GtkComboBox*) g_type_check_instance_cast ((GTypeInstance*
) ((ssl_combo_box)), ((gtk_combo_box_get_type ()))))))
, "STARTTLS");
4087 g_signal_connect(G_OBJECT(ssl_combo_box), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((ssl_combo_box)), (((GType) ((20) <<
(2))))))))), ("changed"), (((GCallback) (cb_ssl_selected))),
(((void*)0)), ((void*)0), (GConnectFlags) 0)
4088 G_CALLBACK(cb_ssl_selected), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((ssl_combo_box)), (((GType) ((20) <<
(2))))))))), ("changed"), (((GCallback) (cb_ssl_selected))),
(((void*)0)), ((void*)0), (GConnectFlags) 0)
;
4089#endif
4090
4091
4092 label = gtk_label_new(_("IMAP folder")dcgettext ("gkrellm", "IMAP folder", 5));
4093 gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) ((
label)), ((gtk_misc_get_type ()))))))
, 1.0, 0.5);
4094 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, label, 2, 3, i, i+1);
4095 imapfolder_entry = gtk_entry_new();
4096 gtk_entry_set_max_length(GTK_ENTRY(imapfolder_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(imapfolder_entry)), ((gtk_entry_get_type ()))))))
, 255);
4097 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, imapfolder_entry,
4098 3, 4, i, i+1);
4099 ++i;
4100 gkrellm_gtk_check_button_connected(NULL((void*)0), &port_button,
4101 FALSE(0), FALSE(0), FALSE(0), 0, cb_specify_port, NULL((void*)0),
4102 _("Specify port")dcgettext ("gkrellm", "Specify port", 5));
4103 hbox = gtk_hbox_new(TRUE(!(0)), 0);
4104 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, hbox, 2, 3, i, i+1);
4105 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, port_button, FALSE(0), FALSE(0), 0);
4106 port_entry = gtk_entry_new();
4107 gtk_entry_set_max_length(GTK_ENTRY(port_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(port_entry)), ((gtk_entry_get_type ()))))))
, 255);
4108 gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) (
(table)), ((gtk_table_get_type ()))))))
, port_entry, 3, 4, i, i+1);
4109 gtk_widget_set_sensitive(port_entry, FALSE(0));
4110
4111 hbox1 = gtk_hbox_new(FALSE(0), 0);
4112 gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox
)), ((gtk_box_get_type ()))))))
, hbox1, FALSE(0), FALSE(0), 0);
4113 hbox = gtk_hbutton_box_new();
4114 gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox)((((GtkButtonBox*) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((gtk_button_box_get_type ()))))))
, GTK_BUTTONBOX_END);
4115 gtk_box_set_spacing(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, 5);
4116 gtk_box_pack_end(GTK_BOX(hbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox1
)), ((gtk_box_get_type ()))))))
, hbox, FALSE(0), FALSE(0), 0);
4117
4118 if (local_supported)
4119 {
4120 local_button = gtk_radio_button_new_with_label(NULL((void*)0),
4121 _("Local mailbox")dcgettext ("gkrellm", "Local mailbox", 5));
4122 gtk_box_pack_start(GTK_BOX(hbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox1
)), ((gtk_box_get_type ()))))))
, local_button, FALSE(0), FALSE(0), 5);
4123 g_signal_connect(G_OBJECT(local_button), "clicked",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((local_button)), (((GType) ((20) <<
(2))))))))), ("clicked"), (((GCallback) (cb_mailbox_group)))
, (((gpointer) (glong) (0))), ((void*)0), (GConnectFlags) 0)
4124 G_CALLBACK(cb_mailbox_group), GINT_TO_POINTER(0))g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((local_button)), (((GType) ((20) <<
(2))))))))), ("clicked"), (((GCallback) (cb_mailbox_group)))
, (((gpointer) (glong) (0))), ((void*)0), (GConnectFlags) 0)
;
4125
4126 remote_button = gtk_radio_button_new_with_label_from_widget(
4127 GTK_RADIO_BUTTON(local_button)((((GtkRadioButton*) g_type_check_instance_cast ((GTypeInstance
*) ((local_button)), ((gtk_radio_button_get_type ()))))))
, _("Remote mailbox")dcgettext ("gkrellm", "Remote mailbox", 5));
4128 gtk_box_pack_start(GTK_BOX(hbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox1
)), ((gtk_box_get_type ()))))))
, remote_button, FALSE(0), FALSE(0), 0);
4129 g_signal_connect(G_OBJECT(remote_button), "clicked",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((remote_button)), (((GType) ((20) <<
(2))))))))), ("clicked"), (((GCallback) (cb_mailbox_group)))
, (((gpointer) (glong) (1))), ((void*)0), (GConnectFlags) 0)
4130 G_CALLBACK(cb_mailbox_group), GINT_TO_POINTER(1))g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((remote_button)), (((GType) ((20) <<
(2))))))))), ("clicked"), (((GCallback) (cb_mailbox_group)))
, (((gpointer) (glong) (1))), ((void*)0), (GConnectFlags) 0)
;
4131 }
4132 else
4133 default_port_entry();
4134
4135 gkrellm_gtk_button_connected(hbox, &delete_button, FALSE(0), FALSE(0), 5,
4136 mailbox_delete_cb, NULL((void*)0), GTK_STOCK_DELETE"gtk-delete");
4137 gtk_widget_set_sensitive(delete_button, FALSE(0));
4138
4139 gkrellm_gtk_button_connected(hbox, &new_apply_button, FALSE(0), FALSE(0), 5,
4140 mailbox_enter_cb, NULL((void*)0), GTK_STOCK_NEW"gtk-new");
4141
4142 vbox1 = gkrellm_gtk_framed_vbox(vbox, NULL((void*)0), 6, TRUE(!(0)), 0, 3);
4143 scrolled = gtk_scrolled_window_new(NULL((void*)0), NULL((void*)0));
4144 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled)((((GtkScrolledWindow*) g_type_check_instance_cast ((GTypeInstance
*) ((scrolled)), ((gtk_scrolled_window_get_type ()))))))
,
4145 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
4146 gtk_box_pack_start(GTK_BOX(vbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox1
)), ((gtk_box_get_type ()))))))
, scrolled, TRUE(!(0)), TRUE(!(0)), 0);
4147
4148 model = create_model();
4149 treeview = GTK_TREE_VIEW(gtk_tree_view_new_with_model(model))((((GtkTreeView*) g_type_check_instance_cast ((GTypeInstance*
) ((gtk_tree_view_new_with_model(model))), ((gtk_tree_view_get_type
()))))))
;
4150 g_object_unref(G_OBJECT(model)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
model)), (((GType) ((20) << (2))))))))
);
4151 gtk_tree_view_set_rules_hint(treeview, TRUE(!(0)));
4152 renderer = gtk_cell_renderer_text_new();
4153 gtk_tree_view_insert_column_with_attributes(treeview, -1, _("Protocol")dcgettext ("gkrellm", "Protocol", 5),
4154 renderer,
4155 "text", PROTOCOL_COLUMN, NULL((void*)0));
4156#ifdef HAVE_SSL1
4157 renderer = gtk_cell_renderer_text_new();
4158 gtk_tree_view_insert_column_with_attributes(treeview, -1, "SSL",
4159 renderer,
4160 "text", SSL_COLUMN, NULL((void*)0));
4161#endif
4162 renderer = gtk_cell_renderer_text_new();
4163 gtk_tree_view_insert_column_with_attributes(treeview, -1, _("Mailbox")dcgettext ("gkrellm", "Mailbox", 5),
4164 renderer,
4165 "text", MAILBOX_COLUMN, NULL((void*)0));
4166
4167 gtk_container_add(GTK_CONTAINER(scrolled)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((scrolled)), ((gtk_container_get_type ()))))))
, GTK_WIDGET(treeview)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(treeview)), ((gtk_widget_get_type ()))))))
);
4168 selection = gtk_tree_view_get_selection(treeview);
4169 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
4170 g_signal_connect(G_OBJECT(selection), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((selection)), (((GType) ((20) << (2
))))))))), ("changed"), (((GCallback) (cb_tree_selection_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
4171 G_CALLBACK(cb_tree_selection_changed), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((selection)), (((GType) ((20) << (2
))))))))), ("changed"), (((GCallback) (cb_tree_selection_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
4172
4173/* --Animation tab */
4174 vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Animation")dcgettext ("gkrellm", "Animation", 5));
4175
4176 vbox1 = gkrellm_gtk_category_vbox(vbox,
4177 _("Animation Select")dcgettext ("gkrellm", "Animation Select", 5),
4178 4, 0, TRUE(!(0)));
4179 hbox = gtk_hbox_new(FALSE(0), 0);
4180 gtk_box_pack_start(GTK_BOX(vbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox1
)), ((gtk_box_get_type ()))))))
, hbox, FALSE(0), FALSE(0), 0);
4181
4182 anim_button[0] = gtk_radio_button_new_with_label(NULL((void*)0), _("None")dcgettext ("gkrellm", "None", 5));
4183 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, anim_button[0], TRUE(!(0)), TRUE(!(0)), 0);
4184 anim_button[1] = gtk_radio_button_new_with_label_from_widget(
4185 GTK_RADIO_BUTTON(anim_button[0])((((GtkRadioButton*) g_type_check_instance_cast ((GTypeInstance
*) ((anim_button[0])), ((gtk_radio_button_get_type ()))))))
, _("Envelope")dcgettext ("gkrellm", "Envelope", 5));
4186 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, anim_button[1], TRUE(!(0)), TRUE(!(0)), 0);
4187 anim_button[2] = gtk_radio_button_new_with_label_from_widget(
4188 GTK_RADIO_BUTTON(anim_button[1])((((GtkRadioButton*) g_type_check_instance_cast ((GTypeInstance
*) ((anim_button[1])), ((gtk_radio_button_get_type ()))))))
,
4189#ifdef BSD
4190 _("Daemon")dcgettext ("gkrellm", "Daemon", 5));
4191#else
4192 _("Penguin")dcgettext ("gkrellm", "Penguin", 5));
4193#endif
4194 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, anim_button[2], TRUE(!(0)), TRUE(!(0)), 0);
4195 anim_button[3] = gtk_radio_button_new_with_label_from_widget(
4196 GTK_RADIO_BUTTON(anim_button[2])((((GtkRadioButton*) g_type_check_instance_cast ((GTypeInstance
*) ((anim_button[2])), ((gtk_radio_button_get_type ()))))))
, _("Both")dcgettext ("gkrellm", "Both", 5));
4197 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, anim_button[3], TRUE(!(0)), TRUE(!(0)), 0);
4198
4199 button = anim_button[animation_mode];
4200 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_toggle_button_get_type ()))))))
, TRUE(!(0)));
4201
4202 for (i = 0; i < 4; ++i)
4203 g_signal_connect(G_OBJECT(anim_button[i]), "toggled",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((anim_button[i])), (((GType) ((20) <<
(2))))))))), ("toggled"), (((GCallback) (cb_animation_mode))
), (((gpointer) (glong) (i))), ((void*)0), (GConnectFlags) 0)
4204 G_CALLBACK(cb_animation_mode), GINT_TO_POINTER(i))g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((anim_button[i])), (((GType) ((20) <<
(2))))))))), ("toggled"), (((GCallback) (cb_animation_mode))
), (((gpointer) (glong) (i))), ((void*)0), (GConnectFlags) 0)
;
4205
4206 gkrellm_gtk_check_button_connected(vbox, &enable_cont_anim_button,
4207 cont_animation_mode, FALSE(0), FALSE(0), 10,
4208 multi_toggle_button_cb, NULL((void*)0),
4209 _("Run animation continuously as long as there is a new mail count")dcgettext ("gkrellm", "Run animation continuously as long as there is a new mail count"
, 5)
);
4210
4211
4212/* --Options tab */
4213 vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Options")dcgettext ("gkrellm", "Options", 5));
4214
4215 vbox1 = gkrellm_gtk_category_vbox(vbox,
4216 _("Message Counting")dcgettext ("gkrellm", "Message Counting", 5),
4217 4, 0, TRUE(!(0)));
4218 hbox = gtk_hbox_new (FALSE(0), 0);
4219 gtk_box_pack_start(GTK_BOX(vbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox1
)), ((gtk_box_get_type ()))))))
, hbox, FALSE(0), FALSE(0), 0);
4220
4221 button = gtk_radio_button_new_with_label(NULL((void*)0), _("new/total")dcgettext ("gkrellm", "new/total", 5));
4222 gtk_box_pack_start(GTK_BOX (hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
4223 group = gtk_radio_button_get_group(GTK_RADIO_BUTTON (button)((((GtkRadioButton*) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_radio_button_get_type ()))))))
);
4224 count_mode_button[0] = button;
4225 button = gtk_radio_button_new_with_label(group, _("new")dcgettext ("gkrellm", "new", 5));
4226 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
4227 group = gtk_radio_button_get_group(GTK_RADIO_BUTTON (button)((((GtkRadioButton*) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_radio_button_get_type ()))))))
);
4228 count_mode_button[1] = button;
4229 button = gtk_radio_button_new_with_label(group, _("do not count")dcgettext ("gkrellm", "do not count", 5));
4230 gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox
)), ((gtk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
4231 count_mode_button[2] = button;
4232 button = count_mode_button[count_mode];
4233 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((gtk_toggle_button_get_type ()))))))
, TRUE(!(0)));
4234 for (i = 0; i < 3; ++i)
4235 g_signal_connect(G_OBJECT(count_mode_button[i]), "toggled",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((count_mode_button[i])), (((GType) ((20) <<
(2))))))))), ("toggled"), (((GCallback) (cb_count_mode))), (
((gpointer) (glong) (i))), ((void*)0), (GConnectFlags) 0)
4236 G_CALLBACK(cb_count_mode), GINT_TO_POINTER(i))g_signal_connect_data ((((((GObject*) g_type_check_instance_cast
((GTypeInstance*) ((count_mode_button[i])), (((GType) ((20) <<
(2))))))))), ("toggled"), (((GCallback) (cb_count_mode))), (
((gpointer) (glong) (i))), ((void*)0), (GConnectFlags) 0)
;
4237
4238 if (local_supported)
4239 gkrellm_gtk_check_button_connected(vbox, &check_only_button,
4240 fetch_check_only_mode, TRUE(!(0)), TRUE(!(0)), 0,
4241 multi_toggle_button_cb, NULL((void*)0),
4242 _("Fetch/check program checks messages only (see Mail Info tab)")dcgettext ("gkrellm", "Fetch/check program checks messages only (see Mail Info tab)"
, 5)
);
4243
4244 gkrellm_gtk_check_button_connected(vbox, &reset_remote_button,
4245 reset_remote_mode, TRUE(!(0)), TRUE(!(0)), 0,
4246 multi_toggle_button_cb, NULL((void*)0),
4247 _("Reset remote message counts when message count button is pressed.")dcgettext ("gkrellm", "Reset remote message counts when message count button is pressed."
, 5)
);
4248
4249 gkrellm_gtk_check_button_connected(vbox, &unseen_is_new_button,
4250 unseen_is_new, TRUE(!(0)), TRUE(!(0)), 0,
4251 multi_toggle_button_cb, NULL((void*)0),
4252 _("Count accessed but unseen mail as new (if this status is available)")dcgettext ("gkrellm", "Count accessed but unseen mail as new (if this status is available)"
, 5)
);
4253
4254 gkrellm_gtk_check_button_connected(vbox, &super_mute_button,
4255 super_mute_mode, TRUE(!(0)), TRUE(!(0)), 0,
4256 multi_toggle_button_cb, NULL((void*)0),
4257 _("Mute mode inhibits all mail checking, not just notify (sound) program")dcgettext ("gkrellm", "Mute mode inhibits all mail checking, not just notify (sound) program"
, 5)
);
4258
4259 gkrellm_gtk_check_button_connected(vbox, &mua_inhibit_button,
4260 mua_inhibit_mode, TRUE(!(0)), TRUE(!(0)), 0,
4261 multi_toggle_button_cb, NULL((void*)0),
4262 _("Inhibit all mail checking while the mail reader is running")dcgettext ("gkrellm", "Inhibit all mail checking while the mail reader is running"
, 5)
);
4263
4264 gkrellm_gtk_check_button_connected(vbox, &enable_multimua_button,
4265 enable_multimua, TRUE(!(0)), TRUE(!(0)), 0,
4266 multi_toggle_button_cb, NULL((void*)0),
4267 _("Allow multiple launches of the mail reader program")dcgettext ("gkrellm", "Allow multiple launches of the mail reader program"
, 5)
);
4268
4269 gkrellm_gtk_check_button_connected(vbox, &show_tooltip_button,
4270 show_tooltip, TRUE(!(0)), TRUE(!(0)), 0,
4271 multi_toggle_button_cb, NULL((void*)0),
4272 _("List mailboxes containing new mail in a tooltip")dcgettext ("gkrellm", "List mailboxes containing new mail in a tooltip"
, 5)
);
4273
4274 if (checking_mh_mail && have_mh_sequences)
4275 gkrellm_gtk_check_button_connected(vbox, &mh_seq_ignore_button,
4276 mh_seq_ignore, TRUE(!(0)), TRUE(!(0)), 0,
4277 multi_toggle_button_cb, NULL((void*)0),
4278 _("Ignore .mh_sequences when checking MH mail.")dcgettext ("gkrellm", "Ignore .mh_sequences when checking MH mail."
, 5)
);
4279
4280/* --Info tab */
4281 vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Info")dcgettext ("gkrellm", "Info", 5));
4282 text = gkrellm_gtk_scrolled_text_view(vbox, NULL((void*)0),
4283 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
4284 if (local_supported)
4285 for (i = 0; i < sizeof(mail_info_text0)/sizeof(gchar *); ++i)
4286 gkrellm_gtk_text_view_append(text, _(mail_info_text0[i])dcgettext ("gkrellm", mail_info_text0[i], 5));
4287 for (i = 0; i < sizeof(mail_info_text1)/sizeof(gchar *); ++i)
4288 gkrellm_gtk_text_view_append(text, _(mail_info_text1[i])dcgettext ("gkrellm", mail_info_text1[i], 5));
4289 if (local_supported)
4290 for (i = 0; i < sizeof(mail_info_text2)/sizeof(gchar *); ++i)
4291 gkrellm_gtk_text_view_append(text, _(mail_info_text2[i])dcgettext ("gkrellm", mail_info_text2[i], 5));
4292 for (i = 0; i < sizeof(mail_info_text3)/sizeof(gchar *); ++i)
4293 gkrellm_gtk_text_view_append(text, _(mail_info_text3[i])dcgettext ("gkrellm", mail_info_text3[i], 5));
4294 }
4295
4296
4297
4298
4299static GkrellmMonitor monitor_mail =
4300 {
4301 N_("Mail")("Mail"), /* Name, for config tab. */
4302 MON_MAIL7, /* Id, 0 if a plugin */
4303 create_mail, /* The create function */
4304 update_mail, /* The update function */
4305 create_mail_tab, /* The config tab create function */
4306 NULL((void*)0), /* Instant apply */
4307
4308 save_mail_config, /* Save user conifg */
4309 load_mail_config, /* Load user config */
4310 "mail", /* config keyword */
4311
4312 NULL((void*)0), /* Undef 2 */
4313 NULL((void*)0), /* Undef 1 */
4314 NULL((void*)0), /* Undef 0 */
4315
4316 0, /* insert_before_id - place plugin before this mon */
4317
4318 NULL((void*)0), /* Handle if a plugin, filled in by GKrellM */
4319 NULL((void*)0) /* path if a plugin, filled in by GKrellM */
4320 };
4321
4322GkrellmMonitor *
4323gkrellm_init_mail_monitor(void)
4324 {
4325#ifdef HAVE_SSL1
4326#ifndef HAVE_GNUTLS
4327 int i, num_locks = CRYPTO_num_locks();
4328#endif
4329#endif
4330
4331 monitor_mail.name = _(monitor_mail.name)dcgettext ("gkrellm", monitor_mail.name, 5);
4332 enable_mail = TRUE(!(0));
4333 show_tooltip = TRUE(!(0));
4334#if defined(WIN32)
4335 // Defaulting to TRUE makes sense on windows as most MUAs will raise their
4336 // window if they're started a second time (i.e. clicking the button in
4337 // gkrellm will raise an existing mail-window)
4338 enable_multimua = TRUE(!(0));
4339#else
4340 enable_multimua = FALSE(0);
4341#endif
4342 cont_animation_mode = FALSE(0);
4343 super_mute_mode = FALSE(0);
4344 mua_inhibit_mode = FALSE(0);
4345 _GK.decal_mail_frames = 18;
4346 _GK.decal_mail_delay = 1;
4347
4348#ifdef HAVE_GNUTLS
4349#if GNUTLS_VERSION_NUMBER <= 0x020b00
4350 /* gcrypt mutex setup, only needed for GnuTLS < 2.12 */
4351 gcry_control (GCRYCTL_SET_THREAD_CBS, &gk_gcry_threads_glib);
4352#endif
4353 gnutls_global_init();
4354 SSL_load_error_strings();
4355 SSL_library_init();
4356#else
4357#ifdef HAVE_SSL1
4358 SSL_load_error_strings();
4359 SSL_library_init();
4360 ssl_locks = g_new(GMutex *, num_locks)(GMutex * *) (__extension__ ({ gsize __n = (gsize) (num_locks
); gsize __s = sizeof (GMutex *); gpointer __p; if (__s == 1)
__p = g_malloc (__n); else if (__builtin_constant_p (__n) &&
(__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s
)) __p = g_malloc (__n * __s); else __p = g_malloc_n (__n, __s
); __p; }))
;
4361 for (i = 0; i < num_locks; i++)
4362 ssl_locks[i] = g_mutex_new();
4363 CRYPTO_set_locking_callback(ssl_locking_cb);
4364#endif
4365#endif
4366
4367 mail_fetch = g_new0(Mailbox, 1)(Mailbox *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s
= sizeof (Mailbox); gpointer __p; if (__s == 1) __p = g_malloc0
(__n); else if (__builtin_constant_p (__n) && (__s ==
0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =
g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p
; }))
;
4368 mail_fetch->account = g_new0(MailAccount, 1)(MailAccount *) (__extension__ ({ gsize __n = (gsize) (1); gsize
__s = sizeof (MailAccount); gpointer __p; if (__s == 1) __p =
g_malloc0 (__n); else if (__builtin_constant_p (__n) &&
(__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s
)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s
); __p; }))
;
4369 mail_fetch->private = g_new0(Mailproc, 1)(Mailproc *) (__extension__ ({ gsize __n = (gsize) (1); gsize
__s = sizeof (Mailproc); gpointer __p; if (__s == 1) __p = g_malloc0
(__n); else if (__builtin_constant_p (__n) && (__s ==
0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =
g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p
; }))
;
4370 mail_fetch->account->mboxtype = MBOX_FETCH(0x1000);
4371 mail_fetch->check_func = run_fetch_program;
4372 mailbox_list = g_list_append(mailbox_list, mail_fetch);
4373
4374 ((Mailproc *)(mail_fetch->private))->command = g_strdup("");
4375 ((Mailproc *)(mail_fetch->private))->pipe = -1;
4376 mail_user_agent.command = g_strdup("");
4377 mail_user_agent.pipe = -1;
4378 mail_notify = g_strdup("");
4379
4380 style_id = gkrellm_add_meter_style(&monitor_mail, MAIL_STYLE_NAME"mail");
4381 force_mail_check = TRUE(!(0)); /* Do a check at startup */
4382
4383 mon_mail = &monitor_mail;
4384 return &monitor_mail;
4385 }
4386
4387
4388 /* ====================== Exported Mail Functions =====================*/
4389
4390gboolean
4391gkrellm_get_mail_mute_mode(void)
4392 {
4393 return mute_mode;
4394 }
4395
4396 /* ====================================================================*/
4397 /* Functions to allow for external mailboxes, as in plugins which want
4398 | to check for alternate mailbox types but have the mail counts reported
4399 | by the builtin mailbox monitor. A plugin outline would be:
4400 |
4401 | typedef struct
4402 | {
4403 | gpointer mbox_ptr;
4404 | ... local plugin stuff ...
4405 | } PluginMbox;
4406 |
4407 | PluginMbox pmbox;
4408 |
4409 | void create_plugin_mbox(GtkWidget *vbox, gint first_create)
4410 | { //See plugin programmers reference for general structure
4411 | ...
4412 | pmbox.mbox_ptr = gkrellm_add_external_mbox(pmbox_check, TRUE, &pmbox);
4413 | gkrellm_set_external_mbox_tooltip(pmbox.mbox_ptr, "mbox_name_stuff");
4414 | ...
4415 | }
4416 |
4417 | gint pmbox_check(PluginMbox *pmb)
4418 | { //Collect info from the mail box
4419 | gkrellm_set_external_mbox_counts(pmb->mbox_ptr, total_mail, new_mail);
4420 | }
4421 */
4422
4423 /* External mailbox counts won't show in the tooltip unless you call this.
4424 | If a plugin wants only to use the sound/animation feature and not show
4425 | up in a tooltip, then do not make this call.
4426 */
4427void
4428gkrellm_set_external_mbox_tooltip(gpointer mbox_ptr, gchar *string)
4429 {
4430 Mailbox *mbox = (Mailbox *) mbox_ptr;
4431
4432 gkrellm_dup_string(&mbox->account->path, string);
4433 }
4434
4435 /* Set total and new message counts for an external mailbox so the counts
4436 | can appear in a tooltip (must also call above routine), and so the
4437 | animation/sound can be triggered. Since sound and animation is triggered
4438 | synchronously with remote and local checks, a plugin should
4439 | call this routine from within a check_func that is setup in the
4440 | gkrellm_add_external_mbox() routine.
4441 */
4442void
4443gkrellm_set_external_mbox_counts(gpointer mbox_ptr, gint total, gint new)
4444 {
4445 Mailbox *mbox = (Mailbox *) mbox_ptr;
4446
4447 mbox->mail_count = total;
4448 mbox->new_mail_count = new;
4449 }
4450
4451 /* A plugin can have a check_func() called at the mail monitors local
4452 | check interval (threaded is FALSE) or at the remote check interval
4453 | (threaded is TRUE). Additionally, if threaded is TRUE, the check_func
4454 | will be called as a thread. The data pointer is a pointer to a plugin
4455 | defined structure which specifies a plugins unique mailbox. This data
4456 | pointer will be passed as the argument to check_func(data) when it
4457 | is called at the update intervals. gkrellm_add_external_mbox() returns
4458 | the internal Mailbox * which should be treated simply as a gpointer
4459 | in the plugin and it must be used as the first argument to the above
4460 | gkrellm_set_external_tooltip() and gkrellm_set_external_counts().
4461 */
4462gpointer
4463gkrellm_add_external_mbox(gboolean (*check_func)(), gboolean threaded,
4464 gpointer data)
4465 {
4466 Mailbox *mbox;
4467
4468 mbox = g_new0(Mailbox, 1)(Mailbox *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s
= sizeof (Mailbox); gpointer __p; if (__s == 1) __p = g_malloc0
(__n); else if (__builtin_constant_p (__n) && (__s ==
0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =
g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p
; }))
;
4469 mbox->account = g_new0(MailAccount, 1)(MailAccount *) (__extension__ ({ gsize __n = (gsize) (1); gsize
__s = sizeof (MailAccount); gpointer __p; if (__s == 1) __p =
g_malloc0 (__n); else if (__builtin_constant_p (__n) &&
(__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s
)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s
); __p; }))
;
4470 mbox->account->mboxtype = threaded ? MBOX_REMOTE_PLUGIN(0x4000 | 0x10) :MBOX_LOCAL_PLUGIN(0x2000 | 0x10);
4471 mbox->check_func = check_func;
4472 mbox->data = data;
4473 mailbox_list = g_list_append(mailbox_list, mbox);
4474 return (gpointer) mbox;
4475 }
4476
4477void
4478gkrellm_destroy_external_mbox(gpointer mbox_ptr)
4479 {
4480 GList *tmp;
4481
4482 if ((tmp = g_list_find(mailbox_list, mbox_ptr)) == NULL((void*)0))
4483 return;
4484 mailbox_list = g_list_remove_link(mailbox_list, tmp);
4485 g_list_free(tmp);
4486 free_mailbox(mbox_ptr);
4487 }
4488
4489 /* =======================================================================*/
4490