diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ChangeLog.ja | 8 | ||||
-rw-r--r-- | src/main.c | 7 | ||||
-rw-r--r-- | src/mainwindow.c | 7 | ||||
-rw-r--r-- | src/procmsg.c | 76 | ||||
-rw-r--r-- | src/procmsg.h | 3 | ||||
-rw-r--r-- | src/send_message.c | 78 | ||||
-rw-r--r-- | src/send_message.h | 5 |
8 files changed, 107 insertions, 85 deletions
@@ -1,3 +1,11 @@ +2005-09-05 + + * src/main.c + src/procmsg.[ch] + src/send_message.[ch] + src/mainwindow.c: moved procmsg.c::procmsg_send_queue() to + send_message.c::send_message_queue_all(). + 2005-09-02 * src/html.c diff --git a/ChangeLog.ja b/ChangeLog.ja index 010f027a..6335ad2b 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,11 @@ +2005-09-05 + + * src/main.c + src/procmsg.[ch] + src/send_message.[ch] + src/mainwindow.c: procmsg.c::procmsg_send_queue() を + send_message.c::send_message_queue_all() に移動。 + 2005-09-02 * src/html.c @@ -62,6 +62,7 @@ #include "account_dialog.h" #include "procmsg.h" #include "filter.h" +#include "send_message.h" #include "inc.h" #include "import.h" #include "manage_window.h" @@ -907,9 +908,9 @@ static void send_queue(void) if (folder->queue) { gint ret; - ret = procmsg_send_queue(folder->queue, - prefs_common.savemsg, - prefs_common.filter_sent); + ret = send_message_queue_all(folder->queue, + prefs_common.savemsg, + prefs_common.filter_sent); statusbar_pop_all(); if (ret > 0) folder_item_scan(folder->queue); diff --git a/src/mainwindow.c b/src/mainwindow.c index 169ae208..92c79be0 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -61,6 +61,7 @@ #include "inc.h" #include "compose.h" #include "procmsg.h" +#include "send_message.h" #include "import.h" #include "export.h" #include "prefs_common.h" @@ -2869,9 +2870,9 @@ static void send_queue_cb(MainWindow *mainwin, guint action, GtkWidget *widget) if (folder->queue) { gint ret; - ret = procmsg_send_queue(folder->queue, - prefs_common.savemsg, - prefs_common.filter_sent); + ret = send_message_queue_all(folder->queue, + prefs_common.savemsg, + prefs_common.filter_sent); statusbar_pop_all(); if (ret > 0) folder_item_scan(folder->queue); diff --git a/src/procmsg.c b/src/procmsg.c index 9766d874..560c0478 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -28,7 +28,6 @@ #include "procmsg.h" #include "procheader.h" #include "account.h" -#include "send_message.h" #include "procmime.h" #include "prefs_common.h" #include "prefs_filter.h" @@ -1239,81 +1238,6 @@ void procmsg_empty_all_trash(void) } } -gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs, - gboolean filter_msgs) -{ - gint ret = 0; - GSList *mlist = NULL; - GSList *cur; - - if (!queue) - queue = folder_get_default_queue(); - g_return_val_if_fail(queue != NULL, -1); - - mlist = folder_item_get_msg_list(queue, FALSE); - mlist = procmsg_sort_msg_list(mlist, SORT_BY_NUMBER, SORT_ASCENDING); - - for (cur = mlist; cur != NULL; cur = cur->next) { - gchar *file; - MsgInfo *msginfo = (MsgInfo *)cur->data; - QueueInfo *qinfo; - gchar tmp[MAXPATHLEN + 1]; - - file = procmsg_get_message_file(msginfo); - if (!file) - continue; - - qinfo = send_get_queue_info(file); - if (!qinfo || send_message_queue(qinfo) < 0) { - g_warning("Sending queued message %d failed.\n", - msginfo->msgnum); - send_queue_info_free(qinfo); - g_free(file); - continue; - } - - g_snprintf(tmp, sizeof(tmp), "%s%ctmpmsg.out.%08x", - get_rc_dir(), G_DIR_SEPARATOR, g_random_int()); - - if (send_get_queue_contents(qinfo, tmp) == 0) { - if (save_msgs) { - FolderItem *outbox; - outbox = account_get_special_folder - (qinfo->ac, F_OUTBOX); - procmsg_save_to_outbox(outbox, tmp); - } - if (filter_msgs) { - FilterInfo *fltinfo; - - fltinfo = filter_info_new(); - fltinfo->account = qinfo->ac; - fltinfo->flags.perm_flags = 0; - fltinfo->flags.tmp_flags = MSG_RECEIVED; - - filter_apply(prefs_common.fltlist, tmp, - fltinfo); - - filter_info_free(fltinfo); - } - g_unlink(tmp); - } - - send_queue_info_free(qinfo); - g_free(file); - - folder_item_remove_msg(queue, msginfo); - ret++; - } - - procmsg_msg_list_free(mlist); - - procmsg_clear_cache(queue); - queue->cache_dirty = FALSE; - queue->mtime = 0; - - return ret; -} - gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file) { gint num; diff --git a/src/procmsg.h b/src/procmsg.h index 55b803a0..4aa389b2 100644 --- a/src/procmsg.h +++ b/src/procmsg.h @@ -270,9 +270,6 @@ void procmsg_get_filter_keyword (MsgInfo *msginfo, void procmsg_empty_trash (FolderItem *trash); void procmsg_empty_all_trash (void); -gint procmsg_send_queue (FolderItem *queue, - gboolean save_msgs, - gboolean filter_msgs); gint procmsg_save_to_outbox (FolderItem *outbox, const gchar *file); void procmsg_print_message (MsgInfo *msginfo, diff --git a/src/send_message.c b/src/send_message.c index 87072818..0579c619 100644 --- a/src/send_message.c +++ b/src/send_message.c @@ -44,6 +44,9 @@ #include "prefs_account.h" #include "procheader.h" #include "account.h" +#include "folder.h" +#include "procmsg.h" +#include "filter.h" #include "progressdialog.h" #include "statusbar.h" #include "inputdialog.h" @@ -304,6 +307,81 @@ gint send_message_queue(QueueInfo *qinfo) return val; } +gint send_message_queue_all(FolderItem *queue, gboolean save_msgs, + gboolean filter_msgs) +{ + gint ret = 0; + GSList *mlist = NULL; + GSList *cur; + + if (!queue) + queue = folder_get_default_queue(); + g_return_val_if_fail(queue != NULL, -1); + + mlist = folder_item_get_msg_list(queue, FALSE); + mlist = procmsg_sort_msg_list(mlist, SORT_BY_NUMBER, SORT_ASCENDING); + + for (cur = mlist; cur != NULL; cur = cur->next) { + gchar *file; + MsgInfo *msginfo = (MsgInfo *)cur->data; + QueueInfo *qinfo; + gchar tmp[MAXPATHLEN + 1]; + + file = procmsg_get_message_file(msginfo); + if (!file) + continue; + + qinfo = send_get_queue_info(file); + if (!qinfo || send_message_queue(qinfo) < 0) { + g_warning("Sending queued message %d failed.\n", + msginfo->msgnum); + send_queue_info_free(qinfo); + g_free(file); + continue; + } + + g_snprintf(tmp, sizeof(tmp), "%s%ctmpmsg.out.%08x", + get_rc_dir(), G_DIR_SEPARATOR, g_random_int()); + + if (send_get_queue_contents(qinfo, tmp) == 0) { + if (save_msgs) { + FolderItem *outbox; + outbox = account_get_special_folder + (qinfo->ac, F_OUTBOX); + procmsg_save_to_outbox(outbox, tmp); + } + if (filter_msgs) { + FilterInfo *fltinfo; + + fltinfo = filter_info_new(); + fltinfo->account = qinfo->ac; + fltinfo->flags.perm_flags = 0; + fltinfo->flags.tmp_flags = MSG_RECEIVED; + + filter_apply(prefs_common.fltlist, tmp, + fltinfo); + + filter_info_free(fltinfo); + } + g_unlink(tmp); + } + + send_queue_info_free(qinfo); + g_free(file); + + folder_item_remove_msg(queue, msginfo); + ret++; + } + + procmsg_msg_list_free(mlist); + + procmsg_clear_cache(queue); + queue->cache_dirty = FALSE; + queue->mtime = 0; + + return ret; +} + static gint send_message_local(const gchar *command, FILE *fp) { gchar **argv; diff --git a/src/send_message.h b/src/send_message.h index 83a9c994..29e7eb53 100644 --- a/src/send_message.h +++ b/src/send_message.h @@ -26,6 +26,7 @@ typedef struct _QueueInfo QueueInfo; #include "prefs_account.h" +#include "folder.h" struct _QueueInfo { @@ -39,10 +40,14 @@ struct _QueueInfo gint send_message (const gchar *file, PrefsAccount *ac_prefs, GSList *to_list); + QueueInfo *send_get_queue_info (const gchar *file); gint send_get_queue_contents (QueueInfo *qinfo, const gchar *dest); void send_queue_info_free (QueueInfo *qinfo); gint send_message_queue (QueueInfo *qinfo); +gint send_message_queue_all (FolderItem *queue, + gboolean save_msgs, + gboolean filter_msgs); #endif /* __SEND_H__ */ |