* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
#include "defs.h"
#include <glib.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/stat.h>
+#include <regex.h>
#include "intl.h"
#include "main.h"
#include "compose.h"
#include "utils.h"
#include "gtkutils.h"
+#include "stock_pixmap.h"
#include "filesel.h"
#include "manage_window.h"
#include "alertpanel.h"
#include "folder.h"
#include "colorlabel.h"
#include "inc.h"
+#include "imap.h"
#include "addressbook.h"
#include "addr_compl.h"
#include "scoring.h"
#include "prefs_folder_item.h"
#include "filtering.h"
-
-#include "pixmaps/dir-open.xpm"
-#include "pixmaps/mark.xpm"
-#include "pixmaps/deleted.xpm"
-#include "pixmaps/new.xpm"
-#include "pixmaps/unread.xpm"
-#include "pixmaps/replied.xpm"
-#include "pixmaps/forwarded.xpm"
-#include "pixmaps/clip.xpm"
-#include "pixmaps/ignorethread.xpm"
-#include "pixmaps/locked.xpm"
+#include "string_match.h"
#define STATUSBAR_PUSH(mainwin, str) \
{ \
#define SUMMARY_COL_MARK_WIDTH 10
#define SUMMARY_COL_UNREAD_WIDTH 13
#define SUMMARY_COL_LOCKED_WIDTH 13
-#define SUMMARY_COL_MIME_WIDTH 10
+#define SUMMARY_COL_MIME_WIDTH 11
static GdkFont *boldfont;
static GdkFont *smallfont;
static GtkStyle *small_marked_style;
static GtkStyle *small_deleted_style;
-static GdkPixmap *folderxpm;
-static GdkBitmap *folderxpmmask;
-
static GdkPixmap *markxpm;
static GdkBitmap *markxpmmask;
static GdkPixmap *deletedxpm;
static GdkPixmap *clipxpm;
static GdkBitmap *clipxpmmask;
+static GdkPixmap *keyxpm;
+static GdkBitmap *keyxpmmask;
+static GdkPixmap *clipkeyxpm;
+static GdkBitmap *clipkeyxpmmask;
static void summary_free_msginfo_func (GtkCTree *ctree,
GtkCTreeNode *node,
static void summary_toggle_view (SummaryView *summaryview);
static void summary_set_row_marks (SummaryView *summaryview,
GtkCTreeNode *row);
+static void summaryview_subject_filter_init (PrefsFolderItem *prefs);
/* message handling */
static void summary_mark_row (SummaryView *summaryview,
GtkCTreeNode *node,
gpointer data);
+void summary_simplify_subject(SummaryView *summaryview, gchar * rexp,
+ GSList * mlist);
+
void summary_processing(SummaryView *summaryview, GSList * mlist);
static void summary_filter_func (GtkCTree *ctree,
GtkCTreeNode *node,
GtkStyle *style;
GtkWidget *pixmap;
- PIXMAP_CREATE(summaryview->ctree, markxpm, markxpmmask, mark_xpm);
- PIXMAP_CREATE(summaryview->ctree, deletedxpm, deletedxpmmask,
- deleted_xpm);
- PIXMAP_CREATE(summaryview->ctree, newxpm, newxpmmask, new_xpm);
- PIXMAP_CREATE(summaryview->ctree, unreadxpm, unreadxpmmask, unread_xpm);
- PIXMAP_CREATE(summaryview->ctree, repliedxpm, repliedxpmmask,
- replied_xpm);
- PIXMAP_CREATE(summaryview->ctree, forwardedxpm, forwardedxpmmask,
- forwarded_xpm);
- PIXMAP_CREATE(summaryview->ctree, ignorethreadxpm, ignorethreadxpmmask,
- ignorethread_xpm);
- PIXMAP_CREATE(summaryview->ctree, lockedxpm, lockedxpmmask, locked_xpm);
- PIXMAP_CREATE(summaryview->ctree, clipxpm, clipxpmmask, clip_xpm);
- PIXMAP_CREATE(summaryview->hbox, folderxpm, folderxpmmask,
- dir_open_xpm);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_MARK,
+ &markxpm, &markxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_DELETED,
+ &deletedxpm, &deletedxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_NEW,
+ &newxpm, &newxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_UNREAD,
+ &unreadxpm, &unreadxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_REPLIED,
+ &repliedxpm, &repliedxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_FORWARDED,
+ &forwardedxpm, &forwardedxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_CLIP,
+ &clipxpm, &clipxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_LOCKED,
+ &lockedxpm, &lockedxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_IGNORETHREAD,
+ &ignorethreadxpm, &ignorethreadxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_CLIP_KEY,
+ &clipkeyxpm, &clipkeyxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_KEY,
+ &keyxpm, &keyxpmmask);
if (!small_style) {
small_style = gtk_style_copy
gtk_widget_set_style(summaryview->statlabel_select, style);
gtk_widget_set_style(summaryview->statlabel_msgs, style);
- pixmap = gtk_pixmap_new(folderxpm, folderxpmmask);
+ pixmap = stock_pixmap_widget(summaryview->hbox, STOCK_PIXMAP_DIR_OPEN);
gtk_box_pack_start(GTK_BOX(summaryview->hbox), pixmap, FALSE, FALSE, 4);
gtk_box_reorder_child(GTK_BOX(summaryview->hbox), pixmap, 0);
gtk_widget_show(pixmap);
return FALSE;
}
folder_update_op_count();
- }
-
- summary_write_cache(summaryview);
+ } else
+ summary_write_cache(summaryview);
summaryview->folderview->opened = selected_node;
SORT_BY_FROM,
SORT_BY_DATE,
SORT_BY_SIZE,
- SORT_BY_NUMBER
+ SORT_BY_NUMBER,
+ SORT_BY_SCORE,
+ SORT_BY_LOCKED
};
for (pos = 0; pos < N_SUMMARY_COLS; pos++) {
type = summaryview->col_state[pos].type;
- single_char = (type == S_COL_MIME ||
- type == S_COL_MARK || type == S_COL_UNREAD);
+ /* CLAWS: mime and unread are single char headers */
+ single_char = (type == S_COL_MIME || type == S_COL_UNREAD);
justify = (type == S_COL_NUMBER || type == S_COL_SIZE)
? GTK_JUSTIFY_RIGHT : GTK_JUSTIFY_LEFT;
else
title = col_label[type];
break;
+ /* CLAWS: dummies for mark and locked headers */
+ case S_COL_MARK:
+ case S_COL_LOCKED:
+ title = "";
+ break;
default:
title = gettext(col_label[type]);
}
continue;
}
- hbox = gtk_hbox_new(FALSE, 4);
- label = gtk_label_new(title);
+ /* CLAWS: changed so that locked and mark headers
+ * show a pixmap instead of single character */
+ hbox = gtk_hbox_new(FALSE, 4);
+
+ if (type == S_COL_LOCKED)
+ label = gtk_pixmap_new(lockedxpm, lockedxpmmask);
+ else if (type == S_COL_MARK)
+ label = gtk_pixmap_new(markxpm, markxpmmask);
+ else
+ label = gtk_label_new(title);
+
if (justify == GTK_JUSTIFY_RIGHT)
gtk_box_pack_end(GTK_BOX(hbox), label,
FALSE, FALSE, 0);
summaryview->important_score =
summaryview->folder_item->prefs->important_score;
}
+
+ summaryview_subject_filter_init(summaryview->folder_item->prefs);
if (summaryview->folder_item->threaded) {
GNode *root, *gnode;
static gchar *from_name = NULL;
static gchar col_number[11];
static gchar col_score[11];
+ static gchar buf[BUFFSIZE];
+ PrefsFolderItem *prefs = summaryview->folder_item->prefs;
gint *col_pos = summaryview->col_pos;
text[col_pos[S_COL_MARK]] = NULL;
}
}
- text[col_pos[S_COL_SUBJECT]] = msginfo->subject ? msginfo->subject :
- _("(No Subject)");
+ if (prefs->enable_simplify_subject
+ && prefs->simplify_subject_preg != NULL )
+ text[col_pos[S_COL_SUBJECT]] = msginfo->subject ?
+ string_remove_match(buf, BUFFSIZE, msginfo->subject,
+ prefs->simplify_subject_preg) :
+
+ _("(No Subject)");
+ else
+ text[col_pos[S_COL_SUBJECT]] = msginfo->subject ? msginfo->subject :
+ _("(No Subject)");
}
#define CHANGE_FLAGS(msginfo) \
{
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
MsgInfo *msginfo;
+ MsgFlags flags;
gchar *filename;
if (!new_window && summaryview->displayed == row) return;
summaryview->newmsgs--;
if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
summaryview->unread--;
+ if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags) ||
+ MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
+ MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
+ if (MSG_IS_IMAP(msginfo->flags))
+ imap_msg_unset_perm_flags(msginfo, MSG_NEW | MSG_UNREAD);
+ summary_set_row_marks(summaryview, row);
+ gtk_clist_thaw(GTK_CLIST(ctree));
+ summary_status_show(summaryview);
+ }
+
+ flags = msginfo->flags;
if (new_window) {
MessageView *msgview;
gtkut_ctree_node_move_if_on_the_edge(ctree, row);
}
- if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
+ if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags) ||
+ (MSG_IS_MIME(msginfo->flags) - MSG_IS_MIME(flags) != 0)) {
MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
CHANGE_FLAGS(msginfo);
summary_set_row_marks(summaryview, row);
gtk_ctree_node_set_text(ctree, row, col_pos[S_COL_LOCKED], NULL);
}
- if (MSG_IS_MIME(flags)) {
+ if (MSG_IS_MIME(flags) && MSG_IS_ENCRYPTED(flags)) {
+ gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
+ clipkeyxpm, clipkeyxpmmask);
+ } else if (MSG_IS_ENCRYPTED(flags)) {
+ gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
+ keyxpm, keyxpmmask);
+ } else if (MSG_IS_MIME(flags)) {
gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
clipxpm, clipxpmmask);
} else {
MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_DELETED);
MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE | MSG_COPY);
MSG_SET_PERM_FLAGS(msginfo->flags, MSG_MARKED);
+ if (MSG_IS_IMAP(msginfo->flags))
+ imap_msg_set_perm_flags(msginfo, MSG_MARKED);
CHANGE_FLAGS(msginfo);
summary_set_row_marks(summaryview, row);
- imap_do_mark(msginfo);
debug_print(_("Message %s/%d is marked\n"), msginfo->folder->path, msginfo->msgnum);
}
MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_DELETED);
MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE | MSG_COPY);
MSG_SET_PERM_FLAGS(msginfo->flags, MSG_LOCKED);
+ if (MSG_IS_IMAP(msginfo->flags))
+ imap_msg_set_perm_flags(msginfo, MSG_LOCKED);
CHANGE_FLAGS(msginfo);
summary_set_row_marks(summaryview, row);
debug_print(_("Message %d is locked\n"), msginfo->msgnum);
if (MSG_IS_NEW(msginfo->flags) ||
MSG_IS_UNREAD(msginfo->flags)) {
MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
+ if (MSG_IS_IMAP(msginfo->flags))
+ imap_msg_unset_perm_flags(msginfo, MSG_NEW | MSG_UNREAD);
CHANGE_FLAGS(msginfo);
summary_set_row_marks(summaryview, row);
debug_print(_("Message %d is marked as read\n"),
summaryview->deleted--;
}
MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_REPLIED | MSG_FORWARDED);
+ if (MSG_IS_IMAP(msginfo->flags))
+ imap_msg_unset_perm_flags(msginfo, MSG_REPLIED);
if (!MSG_IS_UNREAD(msginfo->flags)) {
MSG_SET_PERM_FLAGS(msginfo->flags, MSG_UNREAD);
+ if (MSG_IS_IMAP(msginfo->flags))
+ imap_msg_set_perm_flags(msginfo, MSG_UNREAD);
summaryview->unread++;
debug_print(_("Message %d is marked as unread\n"),
msginfo->msgnum);
}
msginfo->to_folder = NULL;
MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED);
+ if (MSG_IS_IMAP(msginfo->flags))
+ imap_msg_unset_perm_flags(msginfo, MSG_MARKED);
MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE | MSG_COPY);
MSG_SET_PERM_FLAGS(msginfo->flags, MSG_DELETED);
CHANGE_FLAGS(msginfo);
}
msginfo->to_folder = NULL;
MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED | MSG_DELETED);
+ if (MSG_IS_IMAP(msginfo->flags))
+ imap_msg_unset_perm_flags(msginfo, MSG_MARKED);
MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE | MSG_COPY);
CHANGE_FLAGS(msginfo);
summary_set_row_marks(summaryview, row);
- imap_do_unmark(msginfo);
debug_print(_("Message %s/%d is unmarked\n"),
msginfo->folder->path, msginfo->msgnum);
}
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
GList *cur;
- for (cur = GTK_CLIST(ctree)->selection; cur != NULL;
- cur = cur->next)
+ for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next)
summary_unmark_row(summaryview, GTK_CTREE_NODE(cur->data));
summary_status_show(summaryview);
msginfo->to_folder->op_count--;
}
MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED | MSG_DELETED);
+ if (MSG_IS_IMAP(msginfo->flags))
+ imap_msg_unset_perm_flags(msginfo, MSG_MARKED);
MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_COPY);
if (!MSG_IS_MOVE(msginfo->flags)) {
MSG_SET_TMP_FLAGS(msginfo->flags, MSG_MOVE);
msginfo->to_folder->op_count--;
}
MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED | MSG_DELETED);
+ if (MSG_IS_IMAP(msginfo->flags))
+ imap_msg_unset_perm_flags(msginfo, MSG_MARKED);
MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE);
if (!MSG_IS_COPY(msginfo->flags)) {
MSG_SET_TMP_FLAGS(msginfo->flags, MSG_COPY);
GtkWidget *scrolledwin = summaryview->scrolledwin;
GtkWidget *pixmap;
FolderItem *item;
+ guint selected_msgnum = summary_get_msgnum(summaryview, summaryview->selected);
+ guint displayed_msgnum = summary_get_msgnum(summaryview, summaryview->displayed);
+
item = summaryview->folder_item;
+
+ summary_lock(summaryview);
+ summary_write_cache(summaryview);
+ summary_unlock(summaryview);
+
summary_clear_all(summaryview);
gtk_widget_destroy(summaryview->ctree);
gtk_widget_show(ctree);
summary_show(summaryview, item, FALSE);
+
+ summary_select_by_msgnum(summaryview, selected_msgnum);
+ summaryview->displayed = summary_find_msg_by_msgnum(summaryview, displayed_msgnum);
+ if (!summaryview->displayed)
+ messageview_clear(summaryview->messageview);
+ else
+ summary_redisplay_msg(summaryview);
}
case S_COL_MARK:
if (MSG_IS_MARKED(msginfo->flags)) {
MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED);
+ if (MSG_IS_IMAP(msginfo->flags))
+ imap_msg_unset_perm_flags(msginfo, MSG_MARKED);
CHANGE_FLAGS(msginfo);
summary_set_row_marks(summaryview, row);
} else
list = gtk_target_list_new(summary_drag_types, 1);
context = gtk_drag_begin(widget, list,
- GDK_ACTION_MOVE, button, event);
+ GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_DEFAULT, button, event);
gtk_drag_set_icon_default(context);
}
gtk_object_set_data(GTK_OBJECT(widget), "dont_toggle",
GINT_TO_POINTER(0));
}
+static void summaryview_subject_filter_init(PrefsFolderItem *prefs)
+{
+ int err;
+ gchar buf[BUFFSIZE];
+ if (prefs->enable_simplify_subject) {
+ if (prefs->simplify_subject_regexp &&
+ *prefs->simplify_subject_regexp != 0x00) {
+
+ if (!prefs->simplify_subject_preg)
+ prefs->simplify_subject_preg = g_new(regex_t, 1);
+ else
+ regfree(prefs->simplify_subject_preg);
+
+ err = string_match_precompile(prefs->simplify_subject_regexp,
+ prefs->simplify_subject_preg, REG_EXTENDED);
+ if (err) {
+ regerror(err, prefs->simplify_subject_preg, buf, BUFFSIZE);
+ alertpanel_error(_("Regular expression (regexp) error:\n%s"), buf);
+ g_free(prefs->simplify_subject_preg);
+ prefs->simplify_subject_preg = NULL;
+ }
+ } else {
+ if (prefs->simplify_subject_preg) {
+ regfree(prefs->simplify_subject_preg);
+ g_free(prefs->simplify_subject_preg);
+ prefs->simplify_subject_preg = NULL;
+ }
+ }
+ }
+}
+
+
/*
* End of Source.
*/