Jeremy Andrews
Shawn Houston
Alessandro Maestri
+ Neill Miller
+2002-02-21
+
+ * src/prefs_account.[ch]: added receive size limit option.
+ * src/pop.c: skip messages larger than the limit size.
+ LOOKUP_NEXT_MSG(): new macro.
+ * src/compose.c: compose_attach_append(): check whether the file
+ is readable.
+
+2002-02-21
+
+ * src/rfc2015.c: commented out dump_mimeinfo() and dump_part().
+ changed g_message()'s to debug_print() and g_warning().
+ rfc2015_decrypt_message(): fixed a bug that duplicated message
+ parts when decryption was failed/cancelled. And made some code
+ cleanup.
+ * src/passphrase.c: made the dialog transient.
+ * src/prefs.c: prefs_config_parse_one_line(): removed debug_print().
+
+2002-02-20
+
+ * src/messageview.c
+ src/procmsg.[ch]: fixed a bug that failed to parse multipart
+ messages if GPGME was enabled.
+ * src/rfc2015.c: commented out copy_gpgmedata_to_temp() which
+ is not used.
+ * src/prefs_account.c: prefs_account_privacy_create(): modified
+ the vertical spacing.
+
+2002-02-19
+
+ * src/menu.[ch]: menu_set_sensitive_all(): new.
+ menu_set_insensitive_all(): made it a wrapper for
+ menu_set_sensitive_all().
+ * src/prefs_account.c:
+ prefs_account_open()
+ prefs_account_protocol_set_optmenu(): made the protocol type
+ unchangeable after creating an account.
+ * src/compose.c: compose_attach_parts(): traverse MIME tree to
+ extract all attathed files from nested multipart MIME message.
+
+2002-02-19
+
+ * src/procmsg.[ch]: procmsg_get_mark_sum(): added arguments to
+ obtain minimum/maximum number, and to specify first number
+ limit.
+ * src/folderview.c
+ src/inc.c: enabled new message checking on news folder.
+ * src/news.c: news_scan_group(): implemented. Guess new/unread
+ message number from the response of GROUP command and the mark
+ data.
+ news_select_group(): return the total/first/last number.
+ * src/prefs_account.c: prefs_account_receive_create(): modified
+ the text of the 'Get all' check button.
+
+2002-02-18
+
+ * src/account.c: made 'Get all' checkbox available for IMAP4 and
+ NNTP accounts.
+ * src/inc.c: corrected the argument of folderview_check_new().
+ * src/prefs_account.c: modification for the "`Get all' checks for
+ new mail on this account" checkbox.
+
+2002-02-18
+
+ * src/folderview.[ch]:
+ folderview_rescan_tree(), folderview_rescan_all(): renamed from
+ folderview_update_tree() and folderview_update_all().
+ folderview_update_all_node(): removed.
+ folderview_check_new(): new. If the argument is NULL, it checks
+ all local folders. If the arguments is specified, it checks
+ the (local and remote) folder.
+ * src/inc.c:
+ inc_account_mail()
+ inc_all_account_mail(): check also IMAP4 account.
+
+2002-02-18
+
+ * src/folderview.c:
+ folderview_rename_folder_cb()
+ folderview_delete_folder_cb(): modify the filter rules when folder
+ is renamed/deleted.
+ * src/prefs_filter.[ch]:
+ prefs_filter_rename_path(): new. It renames the destination paths
+ in the filter list.
+ prefs_filter_delete_path(): new. It deletes the filter rules if
+ the destination paths matched.
+ * thanks to Neill Miller for above.
+
+2002-02-17
+
+ * src/compose.c: inherit attached files when forwarding or reediting
+ (rewrote the code in claws branch).
+ compose_attach_parts(): new. It extracts and attaches the files
+ in the given message.
+ compose_attach_append(): chnaged the types of arguments.
+ * src/messageview.c: messageview_show(): moved the GPG decryption
+ code to procmsg.c.
+ * src/procmsg.[ch]: procmsg_open_message_decrypted(): new.
+
2002-02-16
* version 0.7.2
+2002-02-21 [paul] 0.7.2claws3
+
+ * sync with sylpheed 0.7.2cvs11
+ see ChangeLog entries 2002-02-17, 2002-02-18, 2002-02-19,
+ 2002-02-20 and 2002-02-21
+
2002-02-20 [melvin] 0.7.2claws2
* src/prefs_actions.c
+2002-02-21
+
+ * src/prefs_account.[ch]: ¼õ¿®¥µ¥¤¥ºÀ©¸Â¤Î¥ª¥×¥·¥ç¥ó¤òÄɲá£
+ * src/pop.c: À©¸Â¥µ¥¤¥º¤è¤êÂ礤¤¥á¥Ã¥»¡¼¥¸¤ò¥¹¥¥Ã¥×¡£
+ LOOKUP_NEXT_MSG(): ¿·µ¬¥Þ¥¯¥í¡£
+ * src/compose.c: compose_attach_append(): ¥Õ¥¡¥¤¥ë¤¬ÆÉ¤ß¹þ¤ß²Äǽ
+ ¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¡£
+
+2002-02-21
+
+ * src/rfc2015.c: dump_mimeinfo() ¤È dump_part() ¤ò¥³¥á¥ó¥È¥¢¥¦¥È¡£
+ g_message() ¤ò debug_print() ¤È g_warning() ¤ËÊѹ¹¡£
+ rfc2015_decrypt_message(): Éü¹æ²½¤Ë¼ºÇÔ¤·¤¿¤¢¤ë¤¤¤Ï¥¥ã¥ó¥»¥ë¤·¤¿
+ ¾ì¹ç¤Ë¥á¥Ã¥»¡¼¥¸¥Ñ¡¼¥È¤òÊ£À½¤·¤Æ¤¤¤¿¥Ð¥°¤ò½¤Àµ¡£¥³¡¼¥É¤ÎÀ°Íý¡£
+ * src/passphrase.c: ¥À¥¤¥¢¥í¥°¤ò transient ¤Ë¤·¤¿¡£
+ * src/prefs.c: prefs_config_parse_one_line(): debug_print() ¤òºï½ü¡£
+
+2002-02-20
+
+ * src/messageview.c
+ src/procmsg.[ch]: GPGME ¤¬Í¸ú¤Ê¾ì¹ç¥Þ¥ë¥Á¥Ñ¡¼¥È¥á¥Ã¥»¡¼¥¸¤Î
+ ²òÀϤ˼ºÇÔ¤¹¤ë¥Ð¥°¤ò½¤Àµ¡£
+ * src/rfc2015.c: »ÈÍѤµ¤ì¤Æ¤¤¤Ê¤¤ copy_gpgmedata_to_temp() ¤ò
+ ¥³¥á¥ó¥È¥¢¥¦¥È¡£
+ * src/prefs_account.c: prefs_account_privacy_create(): ½ÄÊý¸þ¤Î
+ ´Ö³Ö¤ò½¤Àµ¡£
+
+2002-02-19
+
+ * src/menu.[ch]: menu_set_sensitive_all(): ¿·µ¬¡£
+ menu_set_insensitive_all(): menu_set_sensitive_all() ¤Î¥é¥Ã¥Ñ¡¼
+ ¤Ë¤·¤¿¡£
+ * src/prefs_account.c:
+ prefs_account_open()
+ prefs_account_protocol_set_optmenu(): ¥¢¥«¥¦¥ó¥ÈºîÀ®¸å¥×¥í¥È¥³¥ë
+ ¤Î¥¿¥¤¥×¤òÊѹ¹ÉԲĤˤ·¤¿¡£
+ * src/compose.c: compose_attach_parts(): MIME ¥Ä¥ê¡¼¤ò¥È¥é¥Ð¡¼¥¹
+ ¤·¤Æ¥Í¥¹¥È¤µ¤ì¤¿¥Þ¥ë¥Á¥Ñ¡¼¥È MIME ¥á¥Ã¥»¡¼¥¸¤«¤éÁ´¤Æ¤ÎźÉÕ¤µ¤ì¤¿
+ ¥Õ¥¡¥¤¥ë¤òŸ³«¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+2002-02-19
+
+ * src/procmsg.[ch]: procmsg_get_mark_sum(): ºÇ¾®/ºÇÂç¤ÎÈÖ¹æ¤òÆÀ¤ë
+ °ú¿ô¤ÈÀèÆ¬¤ÎÈÖ¹æ¤ÎÀ©¸Â¤ò»ØÄꤹ¤ë°ú¿ô¤òÄɲá£
+ * src/folderview.c
+ src/inc.c: ¥Ë¥å¡¼¥¹¥Õ¥©¥ë¥À¤Î¥á¥Ã¥»¡¼¥¸¥Á¥§¥Ã¥¯¤ò͸ú¤Ë¤·¤¿¡£
+ * src/news.c: news_scan_group(): ¼ÂÁõ¡£¿·Ãå/̤ÆÉ¥á¥Ã¥»¡¼¥¸¿ô¤ò
+ GROUP ¥³¥Þ¥ó¥É¤Î±þÅú¤È¥Þ¡¼¥¯¥Ç¡¼¥¿¤«¤é¿ä¬¡£
+ news_select_group(): ¹ç·×/ºÇ½é/ºÇ¸å¤ÎÈÖ¹æ¤òÊÖ¤¹¤è¤¦¤Ë¤·¤¿¡£
+ * src/prefs_account.c: prefs_account_receive_create(): ¡ÖÁ´¼õ¿®¡×
+ ¥Á¥§¥Ã¥¯¥Ü¥¿¥ó¤Î¥Æ¥¥¹¥È¤ò½¤Àµ¡£
+
+2002-02-18
+
+ * src/account.c: ¡ÖÁ´¼õ¿®¡×¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ò IMAP4 ¤È NNTP ¤Ç
+ ÍøÍѲÄǽ¤Ë¤·¤¿¡£
+ * src/inc.c: folderview_check_new() ¤Î°ú¿ô¤ò½¤Àµ¡£
+ * src/prefs_account.c: "¡ÖÁ´¼õ¿®¡×¤Ç¤³¤Î¥¢¥«¥¦¥ó¥È¤Î¿·Ãå¥á¡¼¥ë¤ò
+ ¥Á¥§¥Ã¥¯¤¹¤ë" ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤Î½¤Àµ¡£
+
+2002-02-18
+
+ * src/folderview.[ch]:
+ folderview_rescan_tree(), folderview_rescan_all():
+ folderview_update_tree() ¤È folderview_update_all() ¤ò̾¾ÎÊѹ¹¡£
+ folderview_update_all_node(): ºï½ü¡£
+ folderview_check_new(): ¿·µ¬¡£°ú¿ô¤¬ NULL ¤Î¾ì¹ç¡¢Á´¤Æ¤Î¥í¡¼¥«¥ë
+ ¥Õ¥©¥ë¥À¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£°ú¿ô¤¬»ØÄꤵ¤ì¤Æ¤¤¤ì¤Ð¡¢¤½¤Î(¥í¡¼¥«¥ë¤È
+ ¥ê¥â¡¼¥È)¥Õ¥©¥ë¥À¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+ * src/inc.c:
+ inc_account_mail()
+ inc_all_account_mail(): IMAP4 ¥¢¥«¥¦¥ó¥È¤â¥Á¥§¥Ã¥¯¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+2002-02-18
+
+ * src/folderview.c:
+ folderview_rename_folder_cb()
+ folderview_delete_folder_cb(): ¥Õ¥©¥ë¥À¤ò²þ̾/ºï½ü¤·¤¿¤È¤¤Ë
+ ¥Õ¥£¥ë¥¿¥ë¡¼¥ë¤ò½¤Àµ¡£
+ * src/prefs_filter.[ch]:
+ prefs_filter_rename_path(): ¿·µ¬¡£¥Õ¥£¥ë¥¿¥ê¥¹¥ÈÃæ¤Î¿¶¤êʬ¤±Àè
+ ¤Î¥Ñ¥¹¤ò²þ̾¤¹¤ë¡£
+ prefs_filter_delete_path(): ¿·µ¬¡£¿¶¤êʬ¤±Àè¤Î¥Ñ¥¹¤¬¥Þ¥Ã¥Á¤¹¤ì¤Ð
+ ¥Õ¥£¥ë¥¿¥ë¡¼¥ë¤òºï½ü¤¹¤ë¡£
+ * ¾åµ¤Ë¤Ä¤¤¤Æ Neill Miller ¤µ¤ó thanks¡£
+
+2002-02-17
+
+ * src/compose.c: žÁ÷¤Þ¤¿¤ÏºÆÊÔ½¸»þ¤ËźÉÕ¥Õ¥¡¥¤¥ë¤ò¼õ¤±·Ñ¤°¤è¤¦¤Ë
+ ¤·¤¿(claws ¥Ö¥é¥ó¥Á¤Î¥³¡¼¥É¤ò½ñ¤Ä¾¤·¤¿)¡£
+ compose_attach_parts(): ¿·µ¬¡£Í¿¤¨¤é¤ì¤¿¥á¥Ã¥»¡¼¥¸Ãæ¤Î¥Õ¥¡¥¤¥ë
+ ¤òŸ³«¤·¤ÆÅºÉÕ¤¹¤ë¡£
+ compose_attach_append(): °ú¿ô¤Î·¿¤òÊѹ¹¡£
+ * src/messageview.c: messageview_show(): GPG Éü¹æ¤Î¥³¡¼¥É¤ò
+ procmsg.c ¤Ë°Üư¡£
+ * src/procmsg.[ch]: procmsg_open_message_decrypted(): ¿·µ¬¡£
+
2002-02-16
* version 0.7.2
MICRO_VERSION=2
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws2
+EXTRA_VERSION=claws3
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
ac_prefs->folder && strcmp(ac_name, ac_prefs->account_name) != 0) {
folder_set_name(FOLDER(ac_prefs->folder),
ac_prefs->account_name);
- folderview_update_all();
+ folderview_rescan_all();
}
account_clist_set();
ac_prefs = gtk_clist_get_row_data(clist, row);
if (ac_prefs->folder) {
folder_destroy(FOLDER(ac_prefs->folder));
- folderview_update_all();
+ folderview_rescan_all();
}
account_destroy(ac_prefs);
account_clist_set();
PrefsAccount *ac;
ac = gtk_clist_get_row_data(clist, row);
- if (ac->protocol == A_POP3 || ac->protocol == A_APOP) {
+ if (ac->protocol == A_POP3 || ac->protocol == A_APOP ||
+ ac->protocol == A_IMAP4 || ac->protocol == A_NNTP) {
ac->recv_at_getall ^= TRUE;
account_clist_set_row(ac, row);
}
gtk_clist_set_text(clist, row, COL_SERVER, text[COL_SERVER]);
}
- has_getallbox = (ac_prefs->protocol == A_POP3 ||
- ac_prefs->protocol == A_APOP);
+ has_getallbox = (ac_prefs->protocol == A_POP3 ||
+ ac_prefs->protocol == A_APOP ||
+ ac_prefs->protocol == A_IMAP4 ||
+ ac_prefs->protocol == A_NNTP);
getall = has_getallbox && ac_prefs->recv_at_getall;
if (ac_prefs->is_default)
const gchar *file);
static void compose_attach_append (Compose *compose,
const gchar *file,
- ContentType cnttype);
-static void compose_attach_append_with_type(Compose *compose,
- const gchar *file,
- const gchar *type,
- ContentType cnttype);
+ const gchar *type,
+ const gchar *content_type);
+static void compose_attach_parts (Compose *compose,
+ MsgInfo *msginfo);
static void compose_wrap_line (Compose *compose);
static void compose_wrap_line_all (Compose *compose);
static void compose_set_title (Compose *compose);
Compose *compose);
#endif
-static void compose_attach_parts (Compose *compose,
- MsgInfo *msginfo);
-
static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
gboolean to_all,
gboolean ignore_replyto,
return filename;
}
-static void compose_attach_parts(Compose *compose, MsgInfo *msginfo)
-{
- FILE *fp;
- gchar *file;
- MimeInfo *mimeinfo;
- MsgInfo *tmpmsginfo;
- gchar *p;
- gchar *boundary;
- gint boundary_len = 0;
- gchar buf[BUFFSIZE];
- glong fpos, prev_fpos;
- gint npart;
- gchar *source;
- gchar *filename;
-
- g_return_if_fail(msginfo != NULL);
-
-#if USE_GPGME
- for (;;) {
- if ((fp = procmsg_open_message(msginfo)) == NULL) return;
- mimeinfo = procmime_scan_mime_header(fp, MIME_TEXT);
- if (!mimeinfo) break;
-
- if (!MSG_IS_ENCRYPTED(msginfo->flags) &&
- rfc2015_is_encrypted(mimeinfo)) {
- MSG_SET_TMP_FLAGS(msginfo->flags, MSG_ENCRYPTED);
- }
- if (MSG_IS_ENCRYPTED(msginfo->flags) &&
- !msginfo->plaintext_file &&
- !msginfo->decryption_failed) {
- rfc2015_decrypt_message(msginfo, mimeinfo, fp);
- if (msginfo->plaintext_file &&
- !msginfo->decryption_failed) {
- fclose(fp);
- continue;
- }
- }
-
- break;
- }
-#else /* !USE_GPGME */
- if ((fp = procmsg_open_message(msginfo)) == NULL) return;
- mimeinfo = procmime_scan_mime_header(fp, MIME_TEXT);
-#endif /* USE_GPGME */
-
- fclose(fp);
- if (!mimeinfo) return;
- if (mimeinfo->mime_type == MIME_TEXT)
- return;
-
- if ((fp = procmsg_open_message(msginfo)) == NULL) return;
-
- g_return_if_fail(mimeinfo != NULL);
- g_return_if_fail(mimeinfo->mime_type != MIME_TEXT);
-
- if (mimeinfo->mime_type == MIME_MULTIPART) {
- g_return_if_fail(mimeinfo->boundary != NULL);
- g_return_if_fail(mimeinfo->sub == NULL);
- }
- g_return_if_fail(fp != NULL);
-
- boundary = mimeinfo->boundary;
-
- if (boundary) {
- boundary_len = strlen(boundary);
-
- /* look for first boundary */
- while ((p = fgets(buf, sizeof(buf), fp)) != NULL)
- if (IS_BOUNDARY(buf, boundary, boundary_len)) break;
- if (!p) {
- fclose(fp);
- return;
- }
- }
-
- if ((fpos = ftell(fp)) < 0) {
- perror("ftell");
- fclose(fp);
- return;
- }
-
- for (npart = 0;; npart++) {
- MimeInfo *partinfo;
- gboolean eom = FALSE;
-
- prev_fpos = fpos;
-
- partinfo = procmime_scan_mime_header(fp, MIME_TEXT);
- if (!partinfo) break;
-
- if (npart != 0)
- procmime_mimeinfo_insert(mimeinfo, partinfo);
- else
- procmime_mimeinfo_free(partinfo);
-
- /* look for next boundary */
- buf[0] = '\0';
- while ((p = fgets(buf, sizeof(buf), fp)) != NULL) {
- if (IS_BOUNDARY(buf, boundary, boundary_len)) {
- if (buf[2 + boundary_len] == '-' &&
- buf[2 + boundary_len + 1] == '-')
- eom = TRUE;
- break;
- }
- }
- if (p == NULL)
- eom = TRUE; /* broken MIME message */
- fpos = ftell(fp);
-
- partinfo->size = fpos - prev_fpos - strlen(buf);
-
- if (eom) break;
- }
-
- source = procmsg_get_message_file_path(msginfo);
-
- g_return_if_fail(mimeinfo != NULL);
-
- if (!mimeinfo->main && mimeinfo->parent)
- {
- filename = mime_extract_file(source, mimeinfo);
-
- compose_attach_append_with_type(compose, filename,
- mimeinfo->content_type,
- mimeinfo->mime_type);
-
- g_free(filename);
- }
-
- if (mimeinfo->sub && mimeinfo->sub->children)
- {
- filename = mime_extract_file(source, mimeinfo->sub);
-
- compose_attach_append_with_type(compose, filename,
- mimeinfo->content_type,
- mimeinfo->sub->mime_type);
-
- g_free(filename);
- }
-
- if (mimeinfo->children) {
- MimeInfo *child;
-
- child = mimeinfo->children;
- while (child) {
- filename = mime_extract_file(source, child);
-
- compose_attach_append_with_type(compose, filename,
- child->content_type,
- child->mime_type);
-
- g_free(filename);
-
- child = child->next;
- }
- }
-
- fclose(fp);
-
- procmime_mimeinfo_free_all(mimeinfo);
-}
#define INSERT_FW_HEADER(var, hdr) \
text = GTK_STEXT(compose->text);
gtk_stext_freeze(text);
- if (as_attach) {
- gchar *msgfile;
- msgfile = procmsg_get_message_file_path(msginfo);
- if (!is_file_exist(msgfile))
- g_warning(_("%s: file not exist\n"), msgfile);
- else
- compose_attach_append(compose, msgfile,
- MIME_MESSAGE_RFC822);
+ if (as_attach) {
+ gchar *msgfile;
- g_free(msgfile);
- } else {
- gchar *qmark;
- gchar *quote_str;
+ msgfile = procmsg_get_message_file_path(msginfo);
+ if (!is_file_exist(msgfile))
+ g_warning(_("%s: file not exist\n"), msgfile);
+ else
+ compose_attach_append(compose, msgfile, msgfile,
+ "message/rfc822");
- if (prefs_common.fw_quotemark && *prefs_common.fw_quotemark)
- qmark = prefs_common.fw_quotemark;
- else
- qmark = "> ";
+ g_free(msgfile);
+ } else {
+ gchar *qmark;
+ gchar *quote_str;
- quote_str = compose_quote_fmt(compose, msginfo,
- prefs_common.fw_quotefmt, qmark,
- body);
- compose_attach_parts(compose, msginfo);
- }
+ if (prefs_common.fw_quotemark &&
+ *prefs_common.fw_quotemark)
+ qmark = prefs_common.fw_quotemark;
+ else
+ qmark = "> ";
+
+ quote_str = compose_quote_fmt(compose, msginfo,
+ prefs_common.fw_quotefmt,
+ qmark, body);
+ compose_attach_parts(compose, msginfo);
+ }
if (prefs_common.auto_sig)
compose_insert_sig(compose);
if (!is_file_exist(msgfile))
g_warning(_("%s: file not exist\n"), msgfile);
else
- compose_attach_append(compose, msgfile,
- MIME_MESSAGE_RFC822);
+ compose_attach_append(compose, msgfile, msgfile,
+ "message/rfc822");
g_free(msgfile);
}
fclose(fp);
}
-static void compose_attach_info(Compose * compose, AttachInfo * ainfo,
- ContentType cnttype)
-{
- gchar *text[N_ATTACH_COLS];
- gint row;
-
- text[COL_MIMETYPE] = ainfo->content_type;
- text[COL_SIZE] = to_human_readable(ainfo->size);
- text[COL_NAME] = ainfo->name;
-
- row = gtk_clist_append(GTK_CLIST(compose->attach_clist), text);
- gtk_clist_set_row_data(GTK_CLIST(compose->attach_clist), row, ainfo);
-
- if (cnttype != MIME_MESSAGE_RFC822)
- compose_changed_cb(NULL, compose);
-}
-
-static void compose_attach_append_with_type(Compose *compose,
- const gchar *file,
- const gchar *type,
- ContentType cnttype)
+static void compose_attach_append(Compose *compose, const gchar *file,
+ const gchar *filename,
+ const gchar *content_type)
{
AttachInfo *ainfo;
+ gchar *text[N_ATTACH_COLS];
+ FILE *fp;
off_t size;
+ gint row;
if (!is_file_exist(file)) {
g_warning(_("File %s doesn't exist\n"), file);
return;
}
if (size == 0) {
- alertpanel_notice(_("File %s is empty\n"), file);
+ alertpanel_notice(_("File %s is empty."), file);
return;
}
+ if ((fp = fopen(file, "r")) == NULL) {
+ alertpanel_error(_("Can't read %s."), file);
+ return;
+ }
+ fclose(fp);
+
#if 0 /* NEW COMPOSE GUI */
if (!compose->use_attach) {
GtkItemFactory *ifactory;
ifactory = gtk_item_factory_from_widget(compose->menubar);
menuitem = gtk_item_factory_get_item(ifactory,
- "/Message/Attach");
+ "/View/Attachment");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
TRUE);
}
ainfo = g_new0(AttachInfo, 1);
ainfo->file = g_strdup(file);
- if (cnttype == MIME_MESSAGE_RFC822) {
- ainfo->encoding = ENC_7BIT;
- ainfo->name = g_strdup_printf(_("Message: %s"),
- g_basename(file));
+ if (content_type) {
+ ainfo->content_type = g_strdup(content_type);
+ if (!strcasecmp(content_type, "message/rfc822")) {
+ ainfo->encoding = ENC_7BIT;
+ ainfo->name = g_strdup_printf
+ (_("Message: %s"),
+ g_basename(filename ? filename : file));
+ } else {
+ ainfo->encoding = ENC_BASE64;
+ ainfo->name = g_strdup
+ (g_basename(filename ? filename : file));
+ }
} else {
+ ainfo->content_type = procmime_get_mime_type(file);
+ if (!ainfo->content_type)
+ ainfo->content_type =
+ g_strdup("application/octet-stream");
ainfo->encoding = ENC_BASE64;
- ainfo->name = g_strdup(g_basename(file));
+ ainfo->name = g_strdup(g_basename(filename ? filename : file));
}
-
- ainfo->content_type = g_strdup(type);
ainfo->size = size;
- compose_attach_info(compose, ainfo, cnttype);
+ text[COL_MIMETYPE] = ainfo->content_type;
+ text[COL_SIZE] = to_human_readable(size);
+ text[COL_NAME] = ainfo->name;
+
+ row = gtk_clist_append(GTK_CLIST(compose->attach_clist), text);
+ gtk_clist_set_row_data(GTK_CLIST(compose->attach_clist), row, ainfo);
}
-static void compose_attach_append(Compose *compose, const gchar *file,
- ContentType cnttype)
+#define IS_FIRST_PART_TEXT(info) \
+ ((info->mime_type == MIME_TEXT || info->mime_type == MIME_TEXT_HTML || \
+ info->mime_type == MIME_TEXT_ENRICHED) || \
+ (info->mime_type == MIME_MULTIPART && info->content_type && \
+ !strcasecmp(info->content_type, "multipart/alternative") && \
+ (info->children && \
+ (info->children->mime_type == MIME_TEXT || \
+ info->children->mime_type == MIME_TEXT_HTML || \
+ info->children->mime_type == MIME_TEXT_ENRICHED))))
+
+static void compose_attach_parts(Compose *compose, MsgInfo *msginfo)
{
- AttachInfo *ainfo;
- gchar *text[N_ATTACH_COLS];
- off_t size;
- gint row;
+ MimeInfo *mimeinfo;
+ MimeInfo *child;
+ gchar *infile;
+ gchar *outfile;
- if (!is_file_exist(file)) {
- g_warning(_("File %s doesn't exist\n"), file);
- return;
- }
- if ((size = get_file_size(file)) < 0) {
- g_warning(_("Can't get file size of %s\n"), file);
- return;
- }
- if (size == 0) {
- alertpanel_notice(_("File %s is empty\n"), file);
+ mimeinfo = procmime_scan_message(msginfo);
+ if (!mimeinfo) return;
+
+ /* skip first text (presumably message body) */
+ child = mimeinfo->children;
+ if (!child || IS_FIRST_PART_TEXT(mimeinfo)) {
+ procmime_mimeinfo_free_all(mimeinfo);
return;
}
-#if 0 /* NEW COMPOSE GUI */
- if (!compose->use_attach) {
- GtkItemFactory *ifactory;
- GtkWidget *menuitem;
+ if (IS_FIRST_PART_TEXT(child))
+ child = child->next;
- ifactory = gtk_item_factory_from_widget(compose->menubar);
- menuitem = gtk_item_factory_get_item(ifactory,
- "/View/Attachment");
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
- TRUE);
- }
-#endif
- ainfo = g_new0(AttachInfo, 1);
- ainfo->file = g_strdup(file);
+ infile = procmsg_get_message_file_path(msginfo);
- if (cnttype == MIME_MESSAGE_RFC822) {
- ainfo->content_type = g_strdup("message/rfc822");
- ainfo->encoding = ENC_7BIT;
- ainfo->name = g_strdup_printf(_("Message: %s"),
- g_basename(file));
- } else {
- ainfo->content_type = procmime_get_mime_type(file);
- if (!ainfo->content_type)
- ainfo->content_type =
- g_strdup("application/octet-stream");
- ainfo->encoding = ENC_BASE64;
- ainfo->name = g_strdup(g_basename(file));
+ while (child != NULL) {
+ if (child->children || child->mime_type == MIME_MULTIPART) {
+ child = procmime_mimeinfo_next(child);
+ continue;
+ }
+
+ outfile = procmime_get_tmp_file_name(child);
+ if (procmime_get_part(outfile, infile, child) < 0)
+ g_warning(_("Can't get the part of multipart message."));
+ else
+ compose_attach_append
+ (compose, outfile,
+ child->filename ? child->filename : child->name,
+ child->content_type);
+
+ child = child->next;
}
- ainfo->size = size;
- compose_attach_info(compose, ainfo, cnttype);
+ g_free(infile);
+ procmime_mimeinfo_free_all(mimeinfo);
}
+#undef IS_FIRST_PART_TEXT
+
#define GET_CHAR(pos, buf, len) \
{ \
if (text->use_wchar) \
for ( tmp = file_list; tmp; tmp = tmp->next) {
gchar *file = (gchar *) tmp->data;
- compose_attach_append(compose, file, MIME_UNKNOWN);
+ compose_attach_append(compose, file, file, NULL);
+ compose_changed_cb(NULL, compose);
g_free(file);
}
g_list_free(file_list);
list = uri_list_extract_filenames((const gchar *)data->data);
for (tmp = list; tmp != NULL; tmp = tmp->next)
- compose_attach_append(compose, (const gchar *)tmp->data,
- MIME_UNKNOWN);
+ compose_attach_append
+ (compose, (const gchar *)tmp->data,
+ (const gchar *)tmp->data, NULL);
+ if (list) compose_changed_cb(NULL, compose);
list_free_strings(list);
g_list_free(list);
}
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto & The Sylpheed Claws Team
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto & The Sylpheed Claws Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto & The Sylpheed Claws Team
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto & The Sylpheed Claws Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "gtkutils.h"
#include "prefs_common.h"
#include "prefs_account.h"
+#include "prefs_filter.h"
#include "account.h"
#include "folder.h"
#include "inc.h"
return window;
}
-void folderview_update_tree(Folder *folder)
+void folderview_rescan_tree(Folder *folder)
{
GtkWidget *window;
inc_unlock();
}
-void folderview_update_all(void)
+void folderview_rescan_all(void)
{
GList *list;
GtkWidget *window;
inc_unlock();
}
-void folderview_update_all_node(void)
+void folderview_check_new(Folder *folder)
{
GList *list;
FolderItem *item;
for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
item = gtk_ctree_node_get_row_data(ctree, node);
- if (!item || !FOLDER_IS_LOCAL(item->folder) ||
- !item->path)
- continue;
+ if (!item || !item->path || !item->folder) continue;
+ if (folder && folder != item->folder) continue;
+ if (!folder && !FOLDER_IS_LOCAL(item->folder)) continue;
+
folderview_scan_tree_func(item->folder, item, NULL);
folder_item_scan(item);
folderview_update_node(folderview, node);
g_return_if_fail(item->folder != NULL);
if (action == 0)
- folderview_update_all_node();
+ folderview_check_new(item->folder);
else
- folderview_update_tree(item->folder);
+ folderview_rescan_tree(item->folder);
}
static void folderview_new_folder_cb(FolderView *folderview, guint action,
FolderItem *item;
gchar *new_folder;
gchar *message;
+ gchar *old_path;
+ gchar *new_path;
if (!folderview->selected) return;
return;
}
+ Xstrdup_a(old_path, item->path, {g_free(new_folder); return;});
+
if (item->folder->rename_folder(item->folder, item, new_folder) < 0) {
g_free(new_folder);
return;
}
+
+ if (strchr(item->path, G_DIR_SEPARATOR) != NULL) {
+ gchar *dirname;
+ dirname = g_dirname(item->path);
+ new_path = g_strconcat(dirname, G_DIR_SEPARATOR_S, new_folder, NULL);
+ g_free(dirname);
+ } else
+ new_path = g_strdup(new_folder);
+
g_free(new_folder);
+ prefs_filter_rename_path(old_path, new_path);
+ g_free(new_path);
+
gtk_clist_freeze(GTK_CLIST(ctree));
folderview_update_node(folderview, folderview->selected);
FolderItem *item;
gchar *message;
AlertValue avalue;
+ gchar *old_path;
if (!folderview->selected) return;
g_free(message);
if (avalue != G_ALERTDEFAULT) return;
+ Xstrdup_a(old_path, item->path, return);
+
if (item->folder->remove_folder(item->folder, item) < 0) {
alertpanel_error(_("Can't remove the folder `%s'."),
item->path);
return;
}
+ prefs_filter_delete_path(old_path);
+
if (folderview->opened == folderview->selected ||
gtk_ctree_is_ancestor(ctree,
folderview->selected,
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
void folderview_select_next_unread (FolderView *folderview);
void folderview_update_msg_num (FolderView *folderview,
GtkCTreeNode *row);
-void folderview_update_tree (Folder *folder);
-void folderview_update_all (void);
-void folderview_update_all_node (void);
+void folderview_rescan_tree (Folder *folder);
+void folderview_rescan_all (void);
+void folderview_check_new (Folder *folder);
void folderview_update_item (FolderItem *item,
gboolean update_summary);
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static void inc_finished(MainWindow *mainwin, gboolean new_messages)
{
FolderItem *item;
-
+
if (prefs_common.scan_all_after_inc)
- folderview_update_all_node();
+ folderview_check_new(NULL);
if (!new_messages && !prefs_common.scan_all_after_inc) return;
IncSession *session;
gchar *text[3];
+ if (account->protocol == A_IMAP4 || account->protocol == A_NNTP) {
+ folderview_check_new(FOLDER(account->folder));
+ return 1;
+ }
+
session = inc_session_new(account);
if (!session) return 0;
return;
}
+ /* check IMAP4 folders */
for (; list != NULL; list = list->next) {
+ PrefsAccount *account = list->data;
+ if ((account->protocol == A_IMAP4 ||
+ account->protocol == A_NNTP) && account->recv_at_getall)
+ folderview_check_new(FOLDER(account->folder));
+ }
+
+ /* check POP3 accounts */
+ for (list = account_get_list(); list != NULL; list = list->next) {
IncSession *session;
PrefsAccount *account = list->data;
GtkWidget *widget)
{
summary_show(mainwin->summaryview, NULL, FALSE);
- folderview_update_all();
+ folderview_rescan_all();
}
static void new_folder_cb(MainWindow *mainwin, guint action,
gtk_widget_set_sensitive(widget, sensitive);
}
-void menu_set_insensitive_all(GtkMenuShell *menu_shell)
+void menu_set_sensitive_all(GtkMenuShell *menu_shell, gboolean sensitive)
{
GList *cur;
for (cur = menu_shell->children; cur != NULL; cur = cur->next)
- gtk_widget_set_sensitive(GTK_WIDGET(cur->data), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(cur->data), sensitive);
}
void menu_set_toggle(GtkItemFactory *ifactory, const gchar *path,
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
GINT_TO_POINTER(data)); \
}
+#define menu_set_insensitive_all(menu_shell) \
+ menu_set_sensitive_all(menu_shell, FALSE);
+
GtkWidget *menubar_create (GtkWidget *window,
GtkItemFactoryEntry *entries,
guint n_entries,
void menu_set_sensitive (GtkItemFactory *ifactory,
const gchar *path,
gboolean sensitive);
-void menu_set_insensitive_all (GtkMenuShell *menu_shell);
+void menu_set_sensitive_all (GtkMenuShell *menu_shell,
+ gboolean sensitive);
+
void menu_set_toggle (GtkItemFactory *ifactory,
const gchar *path,
gboolean active);
g_return_if_fail(msginfo != NULL);
#if USE_GPGME
- for (;;) {
- if ((fp = procmsg_open_message(msginfo)) == NULL) return;
- mimeinfo = procmime_scan_mime_header(fp, MIME_TEXT);
- if (!mimeinfo) break;
-
- if (!MSG_IS_ENCRYPTED(msginfo->flags) &&
- rfc2015_is_encrypted(mimeinfo)) {
- MSG_SET_TMP_FLAGS(msginfo->flags, MSG_ENCRYPTED);
- }
- if (!MSG_IS_ENCRYPTED(msginfo->flags) &&
- pgptext_is_encrypted(mimeinfo, msginfo)) {
- MSG_SET_TMP_FLAGS(msginfo->flags, MSG_ENCRYPTED);
- /* To avoid trouble with the rfc2015 stuff we go for encryption
- * right here. */
- if (MSG_IS_ENCRYPTED(msginfo->flags) &&
- !msginfo->plaintext_file &&
- !msginfo->decryption_failed) {
- /* This is an encrypted message but it has not yet
- * been decrypted and there was no unsuccessful
- * decryption attempt */
- pgptext_decrypt_message(msginfo, mimeinfo, fp);
- if (msginfo->plaintext_file &&
- !msginfo->decryption_failed) {
- fclose(fp);
- continue;
- }
- }
- }
-
- if (MSG_IS_ENCRYPTED(msginfo->flags) &&
- !msginfo->plaintext_file &&
- !msginfo->decryption_failed) {
- /* This is an encrypted message but it has not yet
- * been decrypted and there was no unsuccessful
- * decryption attempt */
- rfc2015_decrypt_message(msginfo, mimeinfo, fp);
- if (msginfo->plaintext_file &&
- !msginfo->decryption_failed) {
- fclose(fp);
- continue;
- }
- }
-
- break;
- }
+ if ((fp = procmsg_open_message_decrypted(msginfo, &mimeinfo)) == NULL)
+ return;
#else /* !USE_GPGME */
if ((fp = procmsg_open_message(msginfo)) == NULL) return;
- mimeinfo = procmime_scan_mime_header(fp, MIME_TEXT);
+ mimeinfo = procmime_scan_mime_header(fp);
#endif /* USE_GPGME */
fclose(fp);
if (!mimeinfo) return;
if (n_msg == 0)
item->new = item->unread = item->total = 0;
else {
- gint new, unread, total;
+ gint new, unread, total, min, max;
- procmsg_get_mark_sum(".", &new, &unread, &total);
+ procmsg_get_mark_sum(".", &new, &unread, &total, &min, &max, 0);
if (n_msg > total) {
new += n_msg - total;
unread += n_msg - total;
closedir(dp);
if (item->path) {
- gint new, unread, total;
+ gint new, unread, total, min, max;
- procmsg_get_mark_sum(item->path, &new, &unread, &total);
+ procmsg_get_mark_sum(item->path, &new, &unread, &total,
+ &min, &max, 0);
if (n_msg > total) {
new += n_msg - total;
unread += n_msg - total;
gchar *filename);
static gint news_select_group (NNTPSession *session,
- const gchar *group);
+ const gchar *group,
+ gint *num,
+ gint *first,
+ gint *last);
static GSList *news_get_uncached_articles(NNTPSession *session,
FolderItem *item,
gint cache_last,
return NULL;
}
- ok = news_select_group(session, item->path);
+ ok = news_select_group(session, item->path, NULL, NULL, NULL);
statusbar_pop_all();
if (ok != NN_SUCCESS) {
g_warning(_("can't select group %s\n"), item->path);
void news_scan_group(Folder *folder, FolderItem *item)
{
+ NNTPSession *session;
+ gint num = 0, first = 0, last = 0;
+ gint new = 0, unread = 0, total = 0;
+ gint min = 0, max = 0;
+ gchar *path;
+ gint ok;
+
+ g_return_if_fail(folder != NULL);
+ g_return_if_fail(item != NULL);
+
+ session = news_session_get(folder);
+ if (!session) return;
+
+ ok = news_select_group(session, item->path, &num, &first, &last);
+ if (ok != NN_SUCCESS) {
+ log_warning(_("can't set group: %s\n"), item->path);
+ return;
+ }
+
+ if (num == 0) {
+ item->new = item->unread = item->total = item->last_num = 0;
+ return;
+ }
+
+ path = folder_item_get_path(item);
+ if (path && is_dir_exist(path)) {
+ procmsg_get_mark_sum(path, &new, &unread, &total, &min, &max,
+ first);
+ }
+ g_free(path);
+
+ if (first < min) {
+ new = unread = total = num;
+ } else if (max < first) {
+ new = unread = total = num;
+ } else if (last > max) {
+ new += last - max;
+ unread += last - max;
+ if (new > num) new = num;
+ if (unread > num) unread = num;
+ }
+ item->new = new;
+ item->unread = unread;
+ item->total = num;
+ item->last_num = last;
}
static NewsGroupInfo *news_group_info_new(const gchar *name,
* news_select_group:
* @session: Active NNTP session.
* @group: Newsgroup name.
+ * @num: Estimated number of articles.
+ * @first: First article number.
+ * @last: Last article number.
*
* Select newsgroup @group with the GROUP command if it is not already
- * selected in @session.
+ * selected in @session, or article numbers need to be returned.
*
* Return value: NNTP result code.
**/
-static gint news_select_group(NNTPSession *session, const gchar *group)
+static gint news_select_group(NNTPSession *session, const gchar *group,
+ gint *num, gint *first, gint *last)
{
gint ok;
- gint num, first, last;
-
- if (session->group && g_strcasecmp(session->group, group) == 0)
- return NN_SUCCESS;
+ gint num_, first_, last_;
+
+ if (!num || !first || !last) {
+ if (session->group && g_strcasecmp(session->group, group) == 0)
+ return NN_SUCCESS;
+ num = &num_;
+ first = &first_;
+ last = &last_;
+ }
g_free(session->group);
session->group = NULL;
- ok = nntp_group(session->nntp_sock, group, &num, &first, &last);
+ ok = nntp_group(session->nntp_sock, group, num, first, last);
if (ok == NN_SUCCESS)
session->group = g_strdup(group);
g_return_val_if_fail(item->folder != NULL, NULL);
g_return_val_if_fail(item->folder->type == F_NEWS, NULL);
- g_free(session->group);
- session->group = NULL;
-
- ok = nntp_group(session->nntp_sock, item->path,
- &num, &first, &last);
+ ok = news_select_group(session, item->path, &num, &first, &last);
if (ok != NN_SUCCESS) {
log_warning(_("can't set group: %s\n"), item->path);
return NULL;
}
- session->group = g_strdup(item->path);
/* calculate getting overview range */
if (first > last) {
#include "intl.h"
#include "passphrase.h"
+#include "manage_window.h"
static int grab_all = 0;
GTK_SIGNAL_FUNC(passphrase_deleted), NULL);
gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
GTK_SIGNAL_FUNC(passphrase_key_pressed), NULL);
+ gtk_signal_connect(GTK_OBJECT(window), "focus_in_event",
+ GTK_SIGNAL_FUNC(manage_window_focus_in), NULL);
+ gtk_signal_connect(GTK_OBJECT(window), "focus_out_event",
+ GTK_SIGNAL_FUNC(manage_window_focus_out), NULL);
+ manage_window_set_transient(GTK_WINDOW(window));
vbox = gtk_vbox_new(FALSE, 8);
gtk_container_add(GTK_CONTAINER(window), vbox);
if (desc) {
- GtkWidget *label = create_description (desc);
+ GtkWidget *label;
+ label = create_description (desc);
gtk_box_pack_start (GTK_BOX(vbox), label, TRUE, TRUE, 0);
}
gdk_flush();
}
+ manage_window_focus_out(window, NULL, NULL);
+
if (pass_ack) {
the_passphrase = gtk_entry_get_text(GTK_ENTRY(pass_entry));
if (the_passphrase) /* Hmmm: Do we really need this? */
static GtkWidget *
create_description (const gchar *desc)
{
- const gchar *cmd=NULL, *uid=NULL, *info=NULL;
+ const gchar *cmd = NULL, *uid = NULL, *info = NULL;
gchar *buf;
GtkWidget *label;
return 0;
if ((fp = procmsg_open_message(msginfo)) == NULL) return;
- mimeinfo = procmime_scan_mime_header(fp, MIME_TEXT);
+ mimeinfo = procmime_scan_mime_header(fp);
fclose(fp);
if (!mimeinfo) return;
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "inc.h"
#include "recv.h"
+#define LOOKUP_NEXT_MSG() \
+ for (;;) { \
+ gint size = state->sizes[state->cur_msg]; \
+ \
+ if (size == 0 || \
+ (state->ac_prefs->enable_size_limit && \
+ state->ac_prefs->size_limit > 0 && \
+ size > state->ac_prefs->size_limit * 1024)) { \
+ log_print(_("Skipping message %d\n"), state->cur_msg); \
+ if (size > 0) { \
+ state->cur_total_bytes += size; \
+ state->cur_total_num++; \
+ if (state->new_id_list) { \
+ state->id_list = g_slist_append(state->id_list, state->new_id_list->data); \
+ state->new_id_list = g_slist_remove(state->new_id_list, state->new_id_list->data); \
+ } \
+ } \
+ if (state->cur_msg == state->count) \
+ return POP3_LOGOUT_SEND; \
+ else \
+ state->cur_msg++; \
+ } else \
+ break; \
+ }
+
static gint pop3_ok(SockInfo *sock, gchar *argbuf);
static void pop3_gen_send(SockInfo *sock, const gchar *format, ...);
static gint pop3_gen_recv(SockInfo *sock, gchar *buf, gint size);
state->cur_total_bytes += size;
}
- while (state->sizes[state->cur_msg] == 0) {
- if (state->cur_msg == state->count)
- return POP3_LOGOUT_SEND;
- else
- state->cur_msg++;
- }
-
+ LOOKUP_NEXT_MSG();
return POP3_RETR_SEND;
}
if (state->cur_msg < state->count) {
state->cur_msg++;
- while (state->sizes[state->cur_msg] == 0) {
- if (state->cur_msg == state->count)
- return POP3_LOGOUT_SEND;
- else
- state->cur_msg++;
- }
+ LOOKUP_NEXT_MSG();
return POP3_RETR_SEND;
} else
return POP3_LOGOUT_SEND;
if ((ok = pop3_ok(sock, NULL)) == PS_SUCCESS) {
if (state->cur_msg < state->count) {
state->cur_msg++;
- while (state->sizes[state->cur_msg] == 0) {
- if (state->cur_msg == state->count)
- return POP3_LOGOUT_SEND;
- else
- state->cur_msg++;
- }
+ LOOKUP_NEXT_MSG();
return POP3_RETR_SEND;
} else
return POP3_LOGOUT_SEND;
if (buf[name_len] != '=')
continue;
value = buf + name_len + 1;
+ /* debug_print("%s = %s\n", param[i].name, value); */
switch (param[i].type) {
case P_STRING:
GtkWidget *pop3_frame;
GtkWidget *rmmail_chkbtn;
GtkWidget *getall_chkbtn;
- GtkWidget *recvatgetall_chkbtn;
+ GtkWidget *size_limit_chkbtn;
+ GtkWidget *size_limit_entry;
GtkWidget *filter_on_recv_chkbtn;
GtkWidget *inbox_label;
GtkWidget *inbox_entry;
GtkWidget *imap_frame;
GtkWidget *imapdir_entry;
+
+ GtkWidget *recvatgetall_chkbtn;
} receive;
static struct Send {
&receive.getall_chkbtn,
prefs_set_data_from_toggle, prefs_set_toggle},
- {"receive_at_get_all", "TRUE", &tmp_ac_prefs.recv_at_getall, P_BOOL,
- &receive.recvatgetall_chkbtn,
+ {"enable_size_limit", "FALSE", &tmp_ac_prefs.enable_size_limit, P_BOOL,
+ &receive.size_limit_chkbtn,
prefs_set_data_from_toggle, prefs_set_toggle},
+ {"size_limit", "1024", &tmp_ac_prefs.size_limit, P_INT,
+ &receive.size_limit_entry,
+ prefs_set_data_from_entry, prefs_set_entry},
{"filter_on_receive", "TRUE", &tmp_ac_prefs.filter_on_recv, P_BOOL,
&receive.filter_on_recv_chkbtn,
{"imap_directory", NULL, &tmp_ac_prefs.imap_dir, P_STRING,
&receive.imapdir_entry, prefs_set_data_from_entry, prefs_set_entry},
+ {"receive_at_get_all", "TRUE", &tmp_ac_prefs.recv_at_getall, P_BOOL,
+ &receive.recvatgetall_chkbtn,
+ prefs_set_data_from_toggle, prefs_set_toggle},
+
/* Send */
{"add_date", "TRUE", &tmp_ac_prefs.add_date, P_BOOL,
&send.date_chkbtn,
gtk_entry_set_text(GTK_ENTRY(basic.org_entry),
def_ac->organization ? def_ac->organization : "");
}
+ menu_set_sensitive_all
+ (GTK_MENU_SHELL
+ (gtk_option_menu_get_menu
+ (GTK_OPTION_MENU
+ (basic.protocol_optmenu))),
+ TRUE);
gtk_window_set_title(GTK_WINDOW(dialog.window),
_("Preferences for new account"));
gtk_widget_hide(dialog.apply_btn);
GtkWidget *vbox2;
GtkWidget *rmmail_chkbtn;
GtkWidget *getall_chkbtn;
- GtkWidget *recvatgetall_chkbtn;
+ GtkWidget *hbox1;
+ GtkWidget *size_limit_chkbtn;
+ GtkWidget *size_limit_entry;
+ GtkWidget *label;
GtkWidget *filter_on_recv_chkbtn;
GtkWidget *vbox3;
- GtkWidget *hbox1;
GtkWidget *inbox_label;
GtkWidget *inbox_entry;
GtkWidget *inbox_btn;
- GtkWidget *label;
GtkWidget *frame2;
GtkWidget *imapdir_label;
GtkWidget *imapdir_entry;
+ GtkWidget *recvatgetall_chkbtn;
vbox1 = gtk_vbox_new (FALSE, VSPACING);
gtk_widget_show (vbox1);
_("Remove messages on server when received"));
PACK_CHECK_BUTTON (vbox2, getall_chkbtn,
_("Download all messages on server"));
- PACK_CHECK_BUTTON
- (vbox2, recvatgetall_chkbtn,
- _("`Get all' checks for new mail on this account"));
+
+ hbox1 = gtk_hbox_new (FALSE, 8);
+ gtk_widget_show (hbox1);
+ gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
+
+ PACK_CHECK_BUTTON (hbox1, size_limit_chkbtn, _("Receive size limit"));
+
+ size_limit_entry = gtk_entry_new ();
+ gtk_widget_show (size_limit_entry);
+ gtk_widget_set_usize (size_limit_entry, 64, -1);
+ gtk_box_pack_start (GTK_BOX (hbox1), size_limit_entry, FALSE, FALSE, 0);
+
+ label = gtk_label_new ("KB");
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
+
+ SET_TOGGLE_SENSITIVITY (size_limit_chkbtn, size_limit_entry);
+
PACK_CHECK_BUTTON (vbox2, filter_on_recv_chkbtn,
_("Filter messages on receiving"));
gtk_widget_show (imapdir_entry);
gtk_box_pack_start (GTK_BOX (hbox1), imapdir_entry, TRUE, TRUE, 0);
+ PACK_CHECK_BUTTON
+ (vbox1, recvatgetall_chkbtn,
+ _("`Get all' checks for new messages on this account"));
+
receive.pop3_frame = frame1;
receive.rmmail_chkbtn = rmmail_chkbtn;
receive.getall_chkbtn = getall_chkbtn;
- receive.recvatgetall_chkbtn = recvatgetall_chkbtn;
+ receive.size_limit_chkbtn = size_limit_chkbtn;
+ receive.size_limit_entry = size_limit_entry;
receive.filter_on_recv_chkbtn = filter_on_recv_chkbtn;
receive.inbox_label = inbox_label;
receive.inbox_entry = inbox_entry;
receive.imap_frame = frame2;
receive.imapdir_entry = imapdir_entry;
+
+ receive.recvatgetall_chkbtn = recvatgetall_chkbtn;
}
static void prefs_account_send_create(void)
GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
GtkWidget *menu;
GtkWidget *menuitem;
+ GList *children;
+ gint list_order[] = {
+ 0, /* A_POP3 */
+ 1, /* A_APOP */
+ -1, /* A_RPOP */
+ 2, /* A_IMAP4 */
+ 3, /* A_NNTP */
+ 4 /* A_LOCAL */
+ };
protocol = *((RecvProtocol *)pparam->data);
+ if (protocol < 0 || protocol > A_LOCAL) return;
+ if (list_order[protocol] < 0) return;
+ gtk_option_menu_set_history(optmenu, list_order[protocol]);
- switch (protocol) {
- case A_POP3:
- gtk_option_menu_set_history(optmenu, 0);
- break;
- case A_APOP:
- gtk_option_menu_set_history(optmenu, 1);
- break;
- case A_IMAP4:
- gtk_option_menu_set_history(optmenu, 2);
- break;
- case A_NNTP:
- gtk_option_menu_set_history(optmenu, 3);
- break;
- case A_LOCAL:
- gtk_option_menu_set_history(optmenu, 4);
- break;
- /*
- case A_LOCAL_CMD:
- gtk_option_menu_set_history(optmenu, 5);
- break;
- */
- default:
- break;
+ menu = gtk_option_menu_get_menu(optmenu);
+ menu_set_insensitive_all(GTK_MENU_SHELL(menu));
+
+#define SET_NTH_SENSITIVE(proto) \
+{ \
+ menuitem = g_list_nth_data(children, list_order[proto]); \
+ if (menuitem) \
+ gtk_widget_set_sensitive(menuitem, TRUE); \
+}
+
+ children = GTK_MENU_SHELL(menu)->children;
+ SET_NTH_SENSITIVE(protocol);
+ if (protocol == A_POP3) {
+ SET_NTH_SENSITIVE(A_APOP);
+ } else if (protocol == A_APOP) {
+ SET_NTH_SENSITIVE(A_POP3);
}
- menu = gtk_option_menu_get_menu(optmenu);
+#undef SET_NTH_SENSITIVE
+
menuitem = gtk_menu_get_active(GTK_MENU(menu));
gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
}
(GTK_TOGGLE_BUTTON(basic.nntpauth_chkbtn), NULL);
gtk_widget_set_sensitive(receive.pop3_frame, FALSE);
gtk_widget_set_sensitive(receive.imap_frame, FALSE);
+ gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
#if USE_SSL
gtk_widget_set_sensitive(ssl.receive_frame, FALSE);
gtk_widget_set_sensitive(ssl.pop_chkbtn, FALSE);
gtk_widget_set_sensitive(basic.pass_entry, TRUE);
gtk_widget_set_sensitive(receive.pop3_frame, FALSE);
gtk_widget_set_sensitive(receive.imap_frame, FALSE);
+ gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, FALSE);
prefs_account_mailcmd_toggled
(GTK_TOGGLE_BUTTON(basic.mailcmd_chkbtn), NULL);
gtk_widget_set_sensitive(basic.pass_entry, TRUE);
gtk_widget_set_sensitive(receive.pop3_frame, FALSE);
gtk_widget_set_sensitive(receive.imap_frame, TRUE);
+ gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
gtk_widget_set_sensitive(basic.smtpserv_entry, TRUE);
gtk_widget_set_sensitive(basic.smtpserv_label, TRUE);
gtk_widget_set_sensitive(basic.pass_entry, TRUE);
gtk_widget_set_sensitive(receive.pop3_frame, TRUE);
gtk_widget_set_sensitive(receive.imap_frame, FALSE);
+ gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
gtk_widget_set_sensitive(basic.smtpserv_entry, TRUE);
gtk_widget_set_sensitive(basic.smtpserv_label, TRUE);
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
gboolean rmmail;
gboolean getall;
gboolean recv_at_getall;
+ gboolean enable_size_limit;
+ gint size_limit;
gboolean filter_on_recv;
gchar *inbox;
gchar *imap_dir;
/* Send */
- gboolean add_date;
- gboolean gen_msgid;
- gboolean add_customhdr;
+ gboolean add_date;
+ gboolean gen_msgid;
+ gboolean add_customhdr;
gboolean use_smtp_auth;
gchar *smtp_userid;
gchar *smtp_passwd;
}
}
+void prefs_filter_rename_path(const gchar *old_path, const gchar *new_path)
+{
+ GSList *cur;
+ gchar *base;
+ gchar *dest_path;
+ gint oldpathlen;
+
+ for (cur = prefs_common.fltlist; cur != NULL; cur = cur->next) {
+ Filter *flt = (Filter *)cur->data;
+
+ oldpathlen = strlen(old_path);
+ if (!strncmp(old_path, (gchar *)flt->dest, oldpathlen)) {
+ base = (gchar *)flt->dest + oldpathlen;
+ while (*base == G_DIR_SEPARATOR) base++;
+ if (*base == '\0')
+ dest_path = g_strdup(new_path);
+ else
+ dest_path = g_strconcat(new_path,
+ G_DIR_SEPARATOR_S,
+ base, NULL);
+ g_free(flt->dest);
+ flt->dest = dest_path;
+ }
+ }
+
+ prefs_filter_write_config();
+}
+
+void prefs_filter_delete_path(const gchar *path)
+{
+ GSList *cur;
+ GSList *next;
+ gint len;
+
+ for (cur = prefs_common.fltlist; cur != NULL; cur = next) {
+ Filter *flt = (Filter *)cur->data;
+ next = cur->next;
+
+ len = strlen(path);
+ if (!strncmp(path, flt->dest, len)) {
+ filter_free(flt);
+ prefs_common.fltlist =
+ g_slist_remove(prefs_common.fltlist, flt);
+ }
+ }
+
+ prefs_filter_write_config();
+}
+
static void prefs_filter_set_dialog(const gchar *header, const gchar *key)
{
GtkCList *clist = GTK_CLIST(filter.cond_clist);
void prefs_filter_open (const gchar *header,
const gchar *key);
+void prefs_filter_rename_path (const gchar *old_path,
+ const gchar *new_path);
+void prefs_filter_delete_path (const gchar *path);
+
#endif /* __PREFS_FILTER_H__ */
g_return_val_if_fail(msginfo != NULL, NULL);
if ((fp = procmsg_open_message(msginfo)) == NULL) return NULL;
- mimeinfo = procmime_scan_mime_header(fp, MIME_TEXT);
+ mimeinfo = procmime_scan_mime_header(fp);
if (mimeinfo) {
if (mimeinfo->mime_type != MIME_MULTIPART) {
gchar buf[BUFFSIZE];
glong fpos, prev_fpos;
gint npart;
- ContentType default_type;
g_return_if_fail(mimeinfo != NULL);
g_return_if_fail(mimeinfo->mime_type != MIME_TEXT);
return;
}
- /* Sets default subpart type for multipart/digest */
- if (!strncasecmp(mimeinfo->content_type, "multipart/digest", 16))
- default_type = MIME_MESSAGE_RFC822;
- else
- default_type = MIME_TEXT;
for (npart = 0;; npart++) {
MimeInfo *partinfo;
prev_fpos = fpos;
- partinfo = procmime_scan_mime_header(fp, default_type);
+ partinfo = procmime_scan_mime_header(fp);
if (!partinfo) break;
procmime_mimeinfo_insert(mimeinfo, partinfo);
} else if (partinfo->mime_type == MIME_MESSAGE_RFC822) {
MimeInfo *sub;
- partinfo->sub = sub = procmime_scan_mime_header
- (fp, MIME_TEXT);
+ partinfo->sub = sub = procmime_scan_mime_header(fp);
if (!sub) break;
sub->level = partinfo->level + 1;
- sub->parent = partinfo;
+ sub->parent = partinfo->parent;
sub->main = partinfo;
if (sub->mime_type == MIME_MULTIPART) {
H_SUBJECT = 4
};
-MimeInfo *procmime_scan_mime_header(FILE *fp, ContentType default_type)
+MimeInfo *procmime_scan_mime_header(FILE *fp)
{
static HeaderEntry hentry[] = {{"Content-Transfer-Encoding:",
NULL, FALSE},
g_return_val_if_fail(fp != NULL, NULL);
mimeinfo = procmime_mimeinfo_new();
- /* Needed for multipart/digest */
- mimeinfo->mime_type = default_type;
+ mimeinfo->mime_type = MIME_TEXT;
mimeinfo->encoding_type = ENC_7BIT;
mimeinfo->fpos = ftell(fp);
mimeinfo->mime_type = procmime_scan_mime_type(type);
}
- if (!mimeinfo->content_type) {
- if (mimeinfo->mime_type == MIME_MESSAGE_RFC822) {
- mimeinfo->content_type = g_strdup("message/rfc822");
- } else {
+ if (!mimeinfo->content_type)
mimeinfo->content_type = g_strdup("text/plain");
- }
- }
return mimeinfo;
}
const gchar *content_description);
void procmime_scan_subject (MimeInfo *mimeinfo,
const gchar *subject);
-MimeInfo *procmime_scan_mime_header (FILE *fp,
- ContentType default_type);
+MimeInfo *procmime_scan_mime_header (FILE *fp);
FILE *procmime_decode_content (FILE *outfp,
FILE *infp,
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifndef __PROCMSG_H__
#define __PROCMSG_H__
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <glib.h>
#include <stdio.h>
#include <time.h>
typedef struct _MsgFlags MsgFlags;
#include "folder.h"
+#include "procmime.h"
typedef enum
{
void procmsg_get_mark_sum (const gchar *folder,
gint *new,
gint *unread,
- gint *total);
+ gint *total,
+ gint *min,
+ gint *max,
+ gint first);
FILE *procmsg_open_mark_file (const gchar *folder,
gboolean append);
gchar *procmsg_get_message_file_path (MsgInfo *msginfo);
gchar *procmsg_get_message_file (MsgInfo *msginfo);
FILE *procmsg_open_message (MsgInfo *msginfo);
+#if USE_GPGME
+FILE *procmsg_open_message_decrypted (MsgInfo *msginfo,
+ MimeInfo **mimeinfo);
+#endif
gboolean procmsg_msg_exist (MsgInfo *msginfo);
void procmsg_empty_trash (void);
static char *create_boundary (void);
+#if 0
static void dump_mimeinfo (const char *text, MimeInfo *x)
{
debug_print ("MimeInfo[%s] %p level=%d\n",
debug_print ("dump_part: read error\n");
debug_print ("--- end dump_part ----\n");
}
+#endif
void
rfc2015_disable_all (void)
}
gpgmegtk_set_passphrase_grab (prefs_common.passphrase_grab);
- debug_print ("requesting passphrase for `%s': ", desc );
+ debug_print ("%% requesting passphrase for `%s': ", desc );
pass = gpgmegtk_passphrase_mbox (desc);
if (!pass) {
- debug_print ("cancel passphrase entry\n");
+ debug_print ("%% cancel passphrase entry");
gpgme_cancel (ctx);
}
else
- debug_print ("sending passphrase\n");
+ debug_print ("%% sending passphrase");
return pass;
}
* Copy a gpgme data object to a temporary file and
* return this filename
*/
+#if 0
static char *
copy_gpgmedata_to_temp (GpgmeData data, guint *length)
{
return tmp;
}
+#endif
static GpgmeData
pgp_decrypt (MimeInfo *partinfo, FILE *fp)
plain = NULL;
}
else
- debug_print ("decryption succeeded\n");
+ debug_print ("** decryption succeeded");
gpgme_release (ctx);
return plain;
if (g_strcasecmp (mimeinfo->content_type, "multipart/signed"))
return NULL;
- debug_print ("multipart/signed encountered\n");
+ debug_print ("** multipart/signed encountered");
/* check that we have at least 2 parts of the correct type */
for (partinfo = mimeinfo->children;
}
+#define DECRYPTION_ABORT() \
+{ \
+ procmime_mimeinfo_free_all(tmpinfo); \
+ msginfo->decryption_failed = 1; \
+ return; \
+}
+
void rfc2015_decrypt_message (MsgInfo *msginfo, MimeInfo *mimeinfo, FILE *fp)
{
static int id;
- MimeInfo *partinfo;
- int n, found;
- int ver_okay=0;
+ MimeInfo *tmpinfo, *partinfo;
+ int ver_ok = 0;
char *fname;
GpgmeData plain;
FILE *dstfp;
char buf[BUFFSIZE];
GpgmeError err;
+ g_return_if_fail (msginfo != NULL);
+ g_return_if_fail (mimeinfo != NULL);
+ g_return_if_fail (fp != NULL);
g_return_if_fail (mimeinfo->mime_type == MIME_MULTIPART);
- debug_print ("multipart/encrypted encountered\n");
+ debug_print ("** decrypting multipart/encrypted message");
/* skip headers */
if (fseek(fp, mimeinfo->fpos, SEEK_SET) < 0)
perror("fseek");
- while (fgets(buf, sizeof(buf), fp) != NULL)
- if (buf[0] == '\r' || buf[0] == '\n') break;
-
- procmime_scan_multipart_message(mimeinfo, fp);
+ tmpinfo = procmime_scan_mime_header(fp);
+ if (!tmpinfo || tmpinfo->mime_type != MIME_MULTIPART) {
+ DECRYPTION_ABORT();
+ }
+
+ procmime_scan_multipart_message(tmpinfo, fp);
/* check that we have the 2 parts */
- n = found = 0;
- for (partinfo = mimeinfo->children; partinfo; partinfo = partinfo->next) {
- if (++n == 1 && !g_strcasecmp (partinfo->content_type,
- "application/pgp-encrypted")) {
- /* Fixme: check that the version is 1 */
- ver_okay = 1;
- }
- else if (n == 2 && !g_strcasecmp (partinfo->content_type,
- "application/octet-stream")) {
- if (partinfo->next)
- debug_print ("oops: pgp_encrypted with more than 2 parts\n");
- break;
- }
+ partinfo = tmpinfo->children;
+ if (!partinfo || !partinfo->next) {
+ DECRYPTION_ABORT();
}
-
- if (!ver_okay || !partinfo) {
- msginfo->decryption_failed = 1;
- /* fixme: remove the stuff, that the above procmime_scan_multiparts()
- * has appended to mimeino */
- return;
+ if (!g_strcasecmp (partinfo->content_type, "application/pgp-encrypted")) {
+ /* Fixme: check that the version is 1 */
+ ver_ok = 1;
+ }
+ partinfo = partinfo->next;
+ if (ver_ok &&
+ !g_strcasecmp (partinfo->content_type, "application/octet-stream")) {
+ if (partinfo->next)
+ g_warning ("oops: pgp_encrypted with more than 2 parts");
+ }
+ else {
+ DECRYPTION_ABORT();
}
- debug_print ("yep, it is pgp encrypted\n");
+ debug_print ("** yep, it is pgp encrypted");
plain = pgp_decrypt (partinfo, fp);
if (!plain) {
- msginfo->decryption_failed = 1;
- return;
+ DECRYPTION_ABORT();
}
-
+
fname = g_strdup_printf("%s%cplaintext.%08x",
get_mime_tmp_dir(), G_DIR_SEPARATOR, ++id);
if ((dstfp = fopen(fname, "w")) == NULL) {
FILE_OP_ERROR(fname, "fopen");
g_free(fname);
- msginfo->decryption_failed = 1;
- return;
+ DECRYPTION_ABORT();
}
/* write the orginal header to the new file */
- if (fseek(fp, mimeinfo->fpos, SEEK_SET) < 0)
+ if (fseek(fp, tmpinfo->fpos, SEEK_SET) < 0)
perror("fseek");
while (fgets(buf, sizeof(buf), fp)) {
}
fclose (dstfp);
+ procmime_mimeinfo_free_all(tmpinfo);
msginfo->plaintext_file = fname;
msginfo->decryption_failed = 0;
}
+#undef DECRYPTION_ABORT
-/*
+
+/*
* plain contains an entire mime object.
* Encrypt it and return an GpgmeData object with the encrypted version of
* the file or NULL in case of error.
cipher = NULL;
}
else {
- debug_print ("encryption succeeded\n");
+ debug_print ("** encryption succeeded");
}
gpgme_release (ctx);
/* write them to the temp data and add the rest of the message */
for (i = 0; !err && i < clineidx; i++) {
- debug_print ("%s:%d: cline=`%s'\n", __FILE__ ,__LINE__, clines[i]);
+ debug_print ("%% %s:%d: cline=`%s'", __FILE__ ,__LINE__, clines[i]);
err = gpgme_data_write (plain, clines[i], strlen (clines[i]));
}
if (!err)