#include "summaryview.h"
#include "log.h"
#include "timing.h"
+#include "inc.h"
static gint procmsg_send_message_queue_full(const gchar *file, gboolean keep_session, gchar **errstr);
START_TIMING("procmsg_get_thread_tree");
root = g_node_new(NULL);
msgid_table = g_hash_table_new(g_str_hash, g_str_equal);
- subject_relation = g_relation_new(2);
- g_relation_index(subject_relation, 0, g_str_hash, g_str_equal);
+
+ if (prefs_common.thread_by_subject) {
+ subject_relation = g_relation_new(2);
+ g_relation_index(subject_relation, 0, g_str_hash, g_str_equal);
+ }
for (; mlist != NULL; mlist = mlist->next) {
msginfo = (MsgInfo *)mlist->data;
END_TIMING();
}
- g_relation_destroy(subject_relation);
+ if (prefs_common.thread_by_subject)
+ g_relation_destroy(subject_relation);
+
g_hash_table_destroy(msgid_table);
END_TIMING();
return root;
return TRUE;
}
+static gboolean send_queue_lock = FALSE;
/*!
*\brief Send messages in queue
*
GSList *list, *elem;
GSList *sorted_list = NULL;
GNode *node, *next;
- static gboolean send_queue_lock = FALSE;
if (send_queue_lock) {
log_error(_("Already trying to send\n"));
if (*errstr) g_free(*errstr);
*errstr = g_strdup_printf(_("Already trying to send."));
}
+ toolbar_main_set_sensitive(mainwindow_get_mainwindow());
return -1;
}
send_queue_lock = TRUE;
+ inc_lock();
if (!queue)
queue = folder_get_default_queue();
- g_return_val_if_fail(queue != NULL, -1);
+
+ if (queue == NULL) {
+ send_queue_lock = FALSE;
+ inc_unlock();
+ return -1;
+ }
+
+ toolbar_main_set_sensitive(mainwindow_get_mainwindow());
folder_item_scan(queue);
list = folder_item_get_msg_list(queue);
}
}
send_queue_lock = FALSE;
+ inc_unlock();
+ toolbar_main_set_sensitive(mainwindow_get_mainwindow());
+
return (err != 0 ? -err : sent);
}
+gboolean procmsg_is_sending(void)
+{
+ return send_queue_lock;
+}
+
/*!
*\brief Determine if a queue folder is empty
*
g_warning("can't save message\n");
return -1;
}
- return 0;
}
msginfo = folder_item_get_msginfo(outbox, num); /* refcnt++ */
tmp_msginfo = procmsg_msginfo_get_full_info(msginfo); /* refcnt++ */
if (tmp_msginfo && (msginfo->dispositionnotificationto ||
msginfo->returnreceiptto)) {
procmsg_msginfo_set_flags(msginfo, MSG_RETRCPT_SENT, 0);
- procmsg_msginfo_free(msginfo); /* refcnt-- */
}
+ procmsg_msginfo_free(tmp_msginfo); /* refcnt-- */
}
return 0;
gint procmsg_send_message_queue(const gchar *file, gchar **errstr)
{
- return procmsg_send_message_queue_full(file, FALSE, errstr);
+ gint result = procmsg_send_message_queue_full(file, FALSE, errstr);
+ toolbar_main_set_sensitive(mainwindow_get_mainwindow());
+ return result;
}
static void update_folder_msg_counts(FolderItem *item, MsgInfo *msginfo, MsgPermFlags old_flags)
* \return TRUE if the message was moved and MsgInfo is now invalid,
* FALSE otherwise
*/
-gboolean procmsg_msginfo_filter(MsgInfo *msginfo)
+gboolean procmsg_msginfo_filter(MsgInfo *msginfo, PrefsAccount* ac_prefs)
{
MailFilteringData mail_filtering_data;
/* filter if enabled in prefs or move to inbox if not */
if((filtering_rules != NULL) &&
- filter_message_by_msginfo(filtering_rules, msginfo)) {
+ filter_message_by_msginfo(filtering_rules, msginfo, ac_prefs)) {
return TRUE;
}
FolderItem *item = spam_folder_item ? folder_find_item_from_identifier(spam_folder_item) : NULL;
return item ? item : folder_get_default_trash();
}
+
+static void item_has_queued_mails(FolderItem *item, gpointer data)
+{
+ gboolean *result = (gboolean *)data;
+ if (*result == TRUE)
+ return;
+ if (folder_has_parent_of_type(item, F_QUEUE) && item->total_msgs > 0)
+ *result = TRUE;
+}
+
+gboolean procmsg_have_queued_mails_fast (void)
+{
+ gboolean result = FALSE;
+ folder_func_to_all_folders(item_has_queued_mails, &result);
+ return result;
+}