/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2002 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2003 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 GHashTable *procmsg_read_mark_file (const gchar *folder);
void procmsg_msginfo_write_flags (MsgInfo *msginfo);
-static void procmsg_update_unread_children (MsgInfo *info, gboolean newly_marked);
GHashTable *procmsg_msg_hash_table_create(GSList *mlist)
{
}
if (MSG_IS_ENCRYPTED(msginfo->flags) &&
- !msginfo->plaintext_file &&
- !msginfo->decryption_failed) {
+ (!msginfo->plaintext_file || msginfo->decryption_failed)) {
rfc2015_decrypt_message(msginfo, mimeinfo_, fp);
if (msginfo->plaintext_file &&
!msginfo->decryption_failed) {
if (msginfo->refcnt > 0)
return;
+ debug_print("freeing msginfo %d is %s\n", msginfo->msgnum, msginfo->folder ? msginfo->folder->path : "(nil)");
+
if (msginfo->to_folder) {
msginfo->to_folder->op_count--;
folder_item_update(msginfo->to_folder, F_ITEM_UPDATE_MSGCNT);
Q_NEWS_ACCOUNT_ID = 5,
Q_SAVE_COPY_FOLDER = 6,
Q_REPLY_MESSAGE_ID = 7,
+ Q_FWD_MESSAGE_ID = 8
};
gint procmsg_send_message_queue(const gchar *file)
{"NAID:", NULL, FALSE},
{"SCF:", NULL, FALSE},
{"RMID:", NULL, FALSE},
+ {"FMID:", NULL, FALSE},
{NULL, NULL, FALSE}};
FILE *fp;
gint filepos;
GSList *newsgroup_list = NULL;
gchar *savecopyfolder = NULL;
gchar *replymessageid = NULL;
+ gchar *fwdmessageid = NULL;
gchar buf[BUFFSIZE];
gint hnum;
PrefsAccount *mailac = NULL, *newsac = NULL;
case Q_REPLY_MESSAGE_ID:
if (!replymessageid) replymessageid = g_strdup(p);
break;
+ case Q_FWD_MESSAGE_ID:
+ if (!fwdmessageid) fwdmessageid = g_strdup(p);
+ break;
}
}
filepos = ftell(fp);
}
if (mailval < 0) {
if (!local)
- alertpanel_error(
+ alertpanel_error_log(
_("Error occurred while sending the message to `%s'."),
mailac ? mailac->smtp_server : smtpserver);
else
- alertpanel_error(
+ alertpanel_error_log(
_("Error occurred while sending the message with command `%s'."),
(mailac && mailac->use_mail_command &&
mailac->mail_command && (*mailac->mail_command)) ?
procmsg_save_to_outbox(outbox, file, TRUE);
}
- if (replymessageid != NULL) {
+ if (replymessageid != NULL || fwdmessageid != NULL) {
gchar **tokens;
FolderItem *item;
- tokens = g_strsplit(replymessageid, "\x7f", 0);
+ if (replymessageid != NULL)
+ tokens = g_strsplit(replymessageid, "\x7f", 0);
+ else
+ tokens = g_strsplit(fwdmessageid, "\x7f", 0);
item = folder_find_item_from_identifier(tokens[0]);
if (item != NULL) {
MsgInfo *msginfo;
}
if (msginfo != NULL) {
- procmsg_msginfo_unset_flags(msginfo, MSG_FORWARDED, 0);
- procmsg_msginfo_set_flags(msginfo, MSG_REPLIED, 0);
-
+ if (replymessageid != NULL) {
+ procmsg_msginfo_unset_flags(msginfo, MSG_FORWARDED, 0);
+ procmsg_msginfo_set_flags(msginfo, MSG_REPLIED, 0);
+ }
+ else {
+ procmsg_msginfo_unset_flags(msginfo, MSG_REPLIED, 0);
+ procmsg_msginfo_set_flags(msginfo, MSG_FORWARDED, 0);
+ }
procmsg_msginfo_free(msginfo);
}
}
g_free(savecopyfolder);
g_free(replymessageid);
+ g_free(fwdmessageid);
return (newsval != 0 ? newsval : mailval);
}
}
-GSList *procmsg_find_children (MsgInfo *info)
+GSList *procmsg_find_children_func(MsgInfo *info,
+ GSList *children, GSList *all)
{
- GSList *children = NULL;
- GSList *all, *cur;
-
- g_return_val_if_fail(info!=NULL, NULL);
+ GSList *cur;
+
+ g_return_val_if_fail(info!=NULL, children);
if (info->msgid == NULL)
- return NULL;
- all = folder_item_get_msg_list(info->folder);
+ return children;
+
for (cur = all; cur != NULL; cur = g_slist_next(cur)) {
MsgInfo *tmp = (MsgInfo *)cur->data;
if (tmp->inreplyto && !strcmp(tmp->inreplyto, info->msgid)) {
- GSList *grand_children;
- children = g_slist_prepend(children, tmp);
- grand_children = procmsg_find_children(tmp);
- children = slist_concat_unique(children, grand_children);
- g_slist_free(grand_children);
+ /* Check if message is already in the list */
+ if ((children == NULL) ||
+ (g_slist_index(children, tmp) == -1)) {
+ children = g_slist_prepend(children,
+ procmsg_msginfo_new_ref(tmp));
+ children = procmsg_find_children_func(tmp,
+ children,
+ all);
+ }
}
- if (tmp && tmp != info)
- procmsg_msginfo_free(tmp);
}
-
return children;
}
-static void procmsg_update_unread_children(MsgInfo *info, gboolean newly_marked)
+GSList *procmsg_find_children (MsgInfo *info)
+{
+ GSList *children;
+ GSList *all, *cur;
+
+ g_return_val_if_fail(info!=NULL, NULL);
+ all = folder_item_get_msg_list(info->folder);
+ children = procmsg_find_children_func(info, NULL, all);
+ if (children != NULL) {
+ for (cur = all; cur != NULL; cur = g_slist_next(cur)) {
+ /* this will not free the used pointers
+ created with procmsg_msginfo_new_ref */
+ procmsg_msginfo_free((MsgInfo *)cur->data);
+ }
+ }
+ g_slist_free(all);
+
+ return children;
+}
+
+void procmsg_update_unread_children(MsgInfo *info, gboolean newly_marked)
{
GSList *children = procmsg_find_children(info);
GSList *cur;
}
procmsg_msginfo_free(tmp);
}
+ g_slist_free(children);
}
/**