GtkCTreeNode *row,
FolderItem *to_folder);
-static void summary_execute_move (SummaryView *summaryview);
+static gint summary_execute_move (SummaryView *summaryview);
static void summary_execute_move_func (GtkCTree *ctree,
GtkCTreeNode *node,
gpointer data);
/* STATUSBAR_POP(summaryview->mainwin); */
is_refresh = (item == summaryview->folder_item) ? TRUE : FALSE;
+
if (is_refresh) {
selected_msgnum = summary_get_msgnum(summaryview,
summaryview->selected);
if (MSG_IS_UNREAD(msginfo->flags) &&
!MSG_IS_IGNORE_THREAD(msginfo->flags))
not_killed = g_slist_prepend(not_killed, msginfo);
+ else if (is_refresh &&
+ (msginfo->msgnum == selected_msgnum ||
+ msginfo->msgnum == displayed_msgnum))
+ not_killed = g_slist_prepend(not_killed, msginfo);
else
procmsg_msginfo_free(msginfo);
}
static gchar buf[BUFFSIZE];
gint *col_pos = summaryview->col_pos;
FolderType ftype = F_UNKNOWN;
+ gchar *from_text = NULL, *to_text = NULL;
+ gboolean should_swap = FALSE;
text[col_pos[S_COL_MARK]] = NULL;
text[col_pos[S_COL_STATUS]] = NULL;
else
text[col_pos[S_COL_DATE]] = _("(No Date)");
+ if (ftype != F_NEWS && prefs_common.swap_from && msginfo->from && msginfo->to) {
+ gchar *addr = NULL;
+
+ addr = g_strdup(msginfo->from);
+
+ if (addr) {
+ extract_address(addr);
+ if (account_find_from_address(addr)) {
+ should_swap = TRUE;
+ }
+ g_free(addr);
+ }
+ }
+
if (!prefs_common.use_addr_book) {
- text[col_pos[S_COL_FROM]] = msginfo->fromname ?
- msginfo->fromname :
- _("(No From)");
+ from_text = msginfo->fromname ?
+ msginfo->fromname :
+ _("(No From)");
} else {
- gchar *tmp = summary_complete_address(msginfo->fromname);
- text[col_pos[S_COL_FROM]] = tmp ? tmp : (msginfo->fromname ?
- msginfo->fromname:
- _("(No From)"));
+ gchar *tmp = summary_complete_address(msginfo->from);
+ from_text = tmp ? tmp : (msginfo->fromname ?
+ msginfo->fromname:
+ _("(No From)"));
+ }
+
+ to_text = msginfo->to ? msginfo->to :
+ (msginfo->cc ? msginfo->cc :
+ (msginfo->newsgroups ? msginfo->newsgroups : _("(No Recipient)")
+ )
+ );
+
+ if (!should_swap) {
+ text[col_pos[S_COL_FROM]] = from_text;
+ text[col_pos[S_COL_TO]] = to_text;
+ } else {
+ gchar *tmp = NULL;
+ tmp = g_strconcat("-->", to_text, NULL);
+ text[col_pos[S_COL_FROM]] = tmp;
+ tmp = g_strconcat("<--", from_text, NULL);
+ text[col_pos[S_COL_TO]] = tmp;
}
- text[col_pos[S_COL_TO]] = msginfo->to ? msginfo->to :
- _("(No Recipient)");
if (msginfo->folder && msginfo->folder->folder)
ftype = msginfo->folder->folder->klass->type;
summaryview->copied--;
procmsg_msginfo_set_to_folder(msginfo, NULL);
- procmsg_msginfo_unset_flags(msginfo, MSG_DELETED, MSG_MOVE | MSG_COPY);
- procmsg_msginfo_set_flags(msginfo, MSG_MARKED, 0);
+ procmsg_msginfo_change_flags(msginfo, MSG_MARKED, 0, MSG_DELETED, MSG_MOVE | MSG_COPY);
summary_set_row_marks(summaryview, row);
debug_print("Message %s/%d is marked\n", msginfo->folder->path, msginfo->msgnum);
}
changed = TRUE;
}
procmsg_msginfo_set_to_folder(msginfo, NULL);
- procmsg_msginfo_unset_flags(msginfo, MSG_DELETED, MSG_MOVE | MSG_COPY);
- procmsg_msginfo_set_flags(msginfo, MSG_LOCKED, 0);
+ procmsg_msginfo_change_flags(msginfo, MSG_LOCKED, 0, MSG_DELETED, MSG_MOVE | MSG_COPY);
+
summary_set_row_marks(summaryview, row);
debug_print("Message %d is locked\n", msginfo->msgnum);
}
summaryview->copied--;
procmsg_msginfo_set_to_folder(msginfo, NULL);
- procmsg_msginfo_unset_flags(msginfo, MSG_MARKED, MSG_MOVE | MSG_COPY);
- procmsg_msginfo_set_flags(msginfo, MSG_DELETED, 0);
+ procmsg_msginfo_change_flags(msginfo, MSG_DELETED, 0, MSG_MARKED, MSG_MOVE | MSG_COPY);
summaryview->deleted++;
if (!prefs_common.immediate_exec &&
if (MSG_IS_COPY(msginfo->flags)) {
summaryview->copied--;
}
- procmsg_msginfo_unset_flags(msginfo, MSG_MARKED | MSG_DELETED, MSG_COPY);
if (!MSG_IS_MOVE(msginfo->flags)) {
- procmsg_msginfo_set_flags(msginfo, 0, MSG_MOVE);
+ procmsg_msginfo_change_flags(msginfo, 0, MSG_MOVE, MSG_MARKED | MSG_DELETED, MSG_COPY);
summaryview->moved++;
+ } else {
+ procmsg_msginfo_unset_flags(msginfo, MSG_MARKED | MSG_DELETED, MSG_COPY);
}
+
if (!prefs_common.immediate_exec) {
summary_set_row_marks(summaryview, row);
}
if (MSG_IS_MOVE(msginfo->flags)) {
summaryview->moved--;
}
- procmsg_msginfo_unset_flags(msginfo, MSG_MARKED | MSG_DELETED, MSG_MOVE);
+
if (!MSG_IS_COPY(msginfo->flags)) {
- procmsg_msginfo_set_flags(msginfo, 0, MSG_COPY);
+ procmsg_msginfo_change_flags(msginfo, 0, MSG_COPY, MSG_MARKED | MSG_DELETED, MSG_MOVE);
summaryview->copied++;
+ } else {
+ procmsg_msginfo_unset_flags(msginfo, MSG_MARKED | MSG_DELETED, MSG_MOVE);
}
if (!prefs_common.immediate_exec) {
summary_set_row_marks(summaryview, row);
GtkCList *clist = GTK_CLIST(summaryview->ctree);
GtkCTreeNode *node, *next;
GtkCTreeNode *new_selected = NULL;
+ gint move_val = -1;
if (!summaryview->folder_item) return FALSE;
summary_unthread_for_exec(summaryview);
folder_item_update_freeze();
- summary_execute_move(summaryview);
+ move_val = summary_execute_move(summaryview);
summary_execute_copy(summaryview);
summary_execute_delete(summaryview);
gtk_ctree_node_moveto(ctree, summaryview->selected, -1, 0.5, 0);
summary_unlock(summaryview);
+
+ if (move_val < 0)
+ summary_show(summaryview, summaryview->folder_item);
return TRUE;
}
-static void summary_execute_move(SummaryView *summaryview)
+static gint summary_execute_move(SummaryView *summaryview)
{
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
GSList *cur;
-
+ gint val = -1;
/* search moving messages and execute */
gtk_ctree_pre_recursive(ctree, NULL, summary_execute_move_func,
summaryview);
if (summaryview->mlist) {
- procmsg_move_messages(summaryview->mlist);
+ val = procmsg_move_messages(summaryview->mlist);
for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next)
procmsg_msginfo_free((MsgInfo *)cur->data);
g_slist_free(summaryview->mlist);
summaryview->mlist = NULL;
}
+ return val;
}
static void summary_execute_move_func(GtkCTree *ctree, GtkCTreeNode *node,
msginfo = gtk_ctree_node_get_row_data(ctree, row);
- procmsg_msginfo_unset_flags(msginfo, MSG_CLABEL_FLAG_MASK, 0);
- procmsg_msginfo_set_flags(msginfo, MSG_COLORLABEL_TO_FLAGS(labelcolor), 0);
+ procmsg_msginfo_change_flags(msginfo, MSG_COLORLABEL_TO_FLAGS(labelcolor), 0,
+ MSG_CLABEL_FLAG_MASK, 0);
}
void summary_set_colorlabel(SummaryView *summaryview, guint labelcolor,
if (mff->account->mark_crosspost_read) {
line = g_string_sized_new(128);
- g_string_sprintf(line, "%s:%d", msginfo->folder->path, msginfo->msgnum);
+ g_string_printf(line, "%s:%d", msginfo->folder->path, msginfo->msgnum);
debug_print("nfcp: checking <%s>", line->str);
if (mff->newsart &&
g_hash_table_lookup_extended(mff->newsart, line->str, &key, &value)) {
debug_print(" <%s>", (gchar *)value);
if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
- procmsg_msginfo_unset_flags(msginfo, MSG_NEW | MSG_UNREAD, 0);
- procmsg_msginfo_set_flags(msginfo, mff->account->crosspost_col, 0);
+ procmsg_msginfo_change_flags(msginfo,
+ mff->account->crosspost_col, 0, MSG_NEW | MSG_UNREAD, 0);
}
g_hash_table_remove(mff->newsart, key);
g_free(key);
if (MSG_IS_UNREAD(msginfo->flags) && procmsg_msg_has_marked_parent(msginfo))
summaryview->unreadmarked--;
- procmsg_msginfo_unset_flags(msginfo, MSG_NEW | MSG_UNREAD, 0);
- procmsg_msginfo_set_flags(msginfo, MSG_IGNORE_THREAD, 0);
+ procmsg_msginfo_change_flags(msginfo, MSG_IGNORE_THREAD, 0, MSG_NEW | MSG_UNREAD, 0);
summary_set_row_marks(summaryview, row);
debug_print("Message %d is marked as ignore thread\n",