/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto and 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
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
static char *string_getline(char *buf, size_t len, char **str)
{
- if (!**str)
+ if (!*str || !**str)
return NULL;
for (; **str && len > 1; --len)
FILE *fp;
GSList *hlist;
- if ((fp = fopen(file, "rb")) == NULL) {
+ if ((fp = g_fopen(file, "rb")) == NULL) {
FILE_OP_ERROR(file, "fopen");
return NULL;
}
if (!S_ISREG(s.st_mode))
return NULL;
- if ((fp = fopen(file, "rb")) == NULL) {
+ if ((fp = g_fopen(file, "rb")) == NULL) {
FILE_OP_ERROR(file, "fopen");
return NULL;
}
H_FROM_SPACE = 13,
H_SC_PLANNED_DOWNLOAD = 14,
H_SC_MESSAGE_SIZE = 15,
- H_X_FACE = 16,
- H_DISPOSITION_NOTIFICATION_TO = 17,
- H_RETURN_RECEIPT_TO = 18,
- H_SC_PARTIALLY_RETRIEVED = 19,
- H_SC_ACCOUNT_SERVER = 20,
- H_SC_ACCOUNT_LOGIN = 21,
+ H_FACE = 16,
+ H_X_FACE = 17,
+ H_DISPOSITION_NOTIFICATION_TO = 18,
+ H_RETURN_RECEIPT_TO = 19,
+ H_SC_PARTIALLY_RETRIEVED = 20,
+ H_SC_ACCOUNT_SERVER = 21,
+ H_SC_ACCOUNT_LOGIN = 22,
};
static HeaderEntry hentry_full[] = {{"Date:", NULL, FALSE},
{"From ", NULL, FALSE},
{"SC-Marked-For-Download:", NULL, FALSE},
{"SC-Message-Size:", NULL, FALSE},
+ {"Face:", NULL, FALSE},
{"X-Face:", NULL, FALSE},
{"Disposition-Notification-To:", NULL, FALSE},
{"Return-Receipt-To:", NULL, FALSE},
{
MsgInfo *msginfo;
gchar buf[BUFFSIZE];
- gchar *reference = NULL;
gchar *p, *tmp;
gchar *hp;
HeaderEntry *hentry;
if (msginfo->from) break;
msginfo->from = conv_unmime_header(hp, NULL);
msginfo->fromname = procheader_get_fromname(msginfo->from);
+ replace_returns(msginfo->from);
+ replace_returns(msginfo->fromname);
break;
case H_TO:
tmp = conv_unmime_header(hp, NULL);
case H_SUBJECT:
if (msginfo->subject) break;
msginfo->subject = conv_unmime_header(hp, NULL);
+ replace_returns(msginfo->subject);
break;
case H_MSG_ID:
if (msginfo->msgid) break;
msginfo->msgid = g_strdup(hp);
break;
case H_REFERENCES:
+ msginfo->references =
+ references_list_prepend(msginfo->references,
+ hp);
+ break;
case H_IN_REPLY_TO:
- if (!reference) {
- msginfo->references = g_strdup(hp);
- eliminate_parenthesis(hp, '(', ')');
- if ((p = strrchr(hp, '<')) != NULL &&
- strchr(p + 1, '>') != NULL) {
- extract_parenthesis(p, '<', '>');
- remove_space(p);
- if (*p != '\0')
- reference = g_strdup(p);
- }
+ if (msginfo->inreplyto) break;
+
+ eliminate_parenthesis(hp, '(', ')');
+ if ((p = strrchr(hp, '<')) != NULL &&
+ strchr(p + 1, '>') != NULL) {
+ extract_parenthesis(p, '<', '>');
+ remove_space(p);
+ if (*p != '\0')
+ msginfo->inreplyto = g_strdup(p);
}
break;
case H_CONTENT_TYPE:
MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_NEW|MSG_UNREAD);
break;
#endif
+ case H_FACE:
+ if (msginfo->face) break;
+ msginfo->face = g_strdup(hp);
+ break;
case H_X_FACE:
if (msginfo->xface) break;
msginfo->xface = g_strdup(hp);
break;
}
}
- msginfo->inreplyto = reference;
+
+ if (!msginfo->inreplyto && msginfo->references)
+ msginfo->inreplyto =
+ g_strdup((gchar *)msginfo->references->data);
return msginfo;
}
if (procheader_scan_date_string(src, weekday, &day, month, &year,
&hh, &mm, &ss, zone) < 0) {
- g_warning("Invalid date: %s\n", src);
if (dest && len > 0)
strncpy2(dest, src, len);
return 0;
break;
}
}
- if (*p == '\0')
- g_warning("Invalid month: %s\n", month);
t.tm_sec = ss;
t.tm_min = mm;
g_return_val_if_fail(msginfo != NULL, -1);
file = procmsg_get_message_file_path(msginfo);
- if ((fp = fopen(file, "rb")) == NULL) {
+ if ((fp = g_fopen(file, "rb")) == NULL) {
FILE_OP_ERROR(file, "fopen");
g_free(file);
return -1;
val = procheader_get_one_field(buf,len, fp, hentry);
if (fclose(fp) == EOF) {
FILE_OP_ERROR(file, "fclose");
- unlink(file);
+ g_unlink(file);
g_free(file);
return -1;
}