#include "procheader.h"
#include "matcher.h"
#include "filtering.h"
-#include "prefs.h"
+#include "prefs_gtk.h"
#include "compose.h"
#define PREFSBUFSIZE 1024
action = g_new0(FilteringAction, 1);
+ /* NOTE:
+ * if type is MATCHACTION_CHANGE_SCORE, account_id = (-1, 0, 1) and
+ * labelcolor = the score value change
+ */
+
action->type = type;
action->account_id = account_id;
if (destination) {
}
return TRUE;
+ case MATCHACTION_CHANGE_SCORE:
+ /* NOTE:
+ * action->account_id is 0 if just assignment, -1 if decrement
+ * and 1 if increment by action->labelcolor
+ * action->labelcolor has the score value change
+ */
+ info->score = action->account_id == 1 ? info->score + action->labelcolor
+ : action->account_id == -1 ? info->score - action->labelcolor
+ : action->labelcolor;
+ return TRUE;
+
default:
break;
}
gchar buf[50];
if (FALSE == (result = filteringaction_apply(filtering->action, info))) {
- g_warning(_("action %s could not be applied"),
+ g_warning("action %s could not be applied",
filteringaction_to_string(buf, sizeof buf, filtering->action));
}
return result;
gboolean applied;
if (info == NULL) {
- g_warning(_("msginfo is not set"));
+ g_warning("msginfo is not set");
return;
}
FolderItem *item = folder_get_default_processing();
if (item == NULL) {
- g_warning(_("folderitem not set"));
+ g_warning("folderitem not set");
return;
}
filename = folder_item_fetch_msg(item, msgnum);
if (filename == NULL) {
- g_warning(_("filename is not set"));
+ g_warning("filename is not set");
return;
}
g_free(filename);
if (msginfo == NULL) {
- g_warning(_("could not get info for %s"), filename);
+ g_warning("could not get info for %s", filename);
return;
}
gchar *filteringaction_to_string(gchar *dest, gint destlen, FilteringAction *action)
{
- gchar *command_str;
+ const gchar *command_str;
command_str = get_matchparser_tab_str(action->type);
case MATCHACTION_COLOR:
g_snprintf(dest, destlen, "%s %d", command_str, action->labelcolor);
return dest;
- case MATCHACTION_DELETE_ON_SERVER:
- g_snprintf(dest, destlen, "%s", command_str);
- return dest;
default:
return NULL;
}