+2011-07-05 [mones] 3.7.9cvs32
+
+ * src/imap.c
+ * src/common/tags.c
+ * src/common/tags.h
+ * src/etpan/imap-thread.c
+ Make constants for reserved tags and use them
+ Removed also duplicate comparison while at it
+
2011-07-05 [paul] 3.7.9cvs31
* src/compose.c
( cvs diff -u -r 1.1.2.83 -r 1.1.2.84 src/wizard.c; ) > 3.7.9cvs29.patchset
( cvs diff -u -r 1.115.2.238 -r 1.115.2.239 src/main.c; ) > 3.7.9cvs30.patchset
( cvs diff -u -r 1.382.2.576 -r 1.382.2.577 src/compose.c; ) > 3.7.9cvs31.patchset
+( cvs diff -u -r 1.179.2.255 -r 1.179.2.256 src/imap.c; cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/common/tags.c; cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/common/tags.h; cvs diff -u -r 1.1.4.113 -r 1.1.4.114 src/etpan/imap-thread.c; ) > 3.7.9cvs32.patchset
MICRO_VERSION=9
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=31
+EXTRA_VERSION=32
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
#include "defs.h"
#include "utils.h"
+#include "tags.h"
static GHashTable *tags_table = NULL;
static GHashTable *tags_reverse_table = NULL;
continue;
g_strstrip(tag_name);
*(sep) = '\0';
- if (strcmp(tag_name, "NonJunk") &&
- strcmp(tag_name, "NotJunk") &&
- strcmp(tag_name, "NoJunk") &&
- strcmp(tag_name, "$Forwarded") &&
- strcmp(tag_name, "Junk")) {
+ if (IS_NOT_RESERVED_TAG(tag_name)) {
id = atoi(tmp);
g_hash_table_insert(tags_table,
GINT_TO_POINTER(id), g_strdup(tag_name));
if (g_hash_table_lookup(tags_reverse_table, tag))
return -1;
- if (strcmp(tag, "NonJunk") &&
- strcmp(tag, "NotJunk") &&
- strcmp(tag, "NoJunk") &&
- strcmp(tag, "$Forwarded") &&
- strcmp(tag, "Junk")) {
+ if (IS_NOT_RESERVED_TAG(tag)) {
tag_max_id++;
g_hash_table_insert(tags_table, GINT_TO_POINTER(tag_max_id),
g_strdup(tag));
{
gchar *old_tag = g_hash_table_lookup(tags_table, GINT_TO_POINTER(id));
- if (strcmp(tag, "NonJunk") &&
- strcmp(tag, "NotJunk") &&
- strcmp(tag, "NoJunk") &&
- strcmp(tag, "$Forwarded") &&
- strcmp(tag, "Junk")) {
+ if (IS_NOT_RESERVED_TAG(tag)) {
if (old_tag) {
prefs_filtering_rename_tag(old_tag, tag);
g_hash_table_remove(tags_reverse_table, old_tag);
#include <glib.h>
+/* Reserved tags */
+#define RTAG_NON_JUNK "NonJunk"
+#define RTAG_NOT_JUNK "NotJunk"
+#define RTAG_NO_JUNK "NoJunk"
+#define RTAG_JUNK "Junk"
+#define RTAG_FORWARDED "$Forwarded"
+
+#define IS_NOT_RESERVED_TAG(tag) \
+ (strcmp((tag), "NonJunk") && \
+ strcmp((tag), "NotJunk") && \
+ strcmp((tag), "NoJunk") && \
+ strcmp((tag), "Junk") && \
+ strcmp((tag), "$Forwarded"))
+
void tags_read_tags(void);
void tags_write_tags(void);
gint tags_add_tag(const gchar *tag);
#include "ssl_certificate.h"
#include "socket.h"
#include "remotefolder.h"
+#include "tags.h"
#define DISABLE_LOG_DURING_LOGIN
c_flag = IMAP_FLAG_SEEN;
break;
case MAILIMAP_FLAG_KEYWORD:
- if (!strcasecmp(flag->fl_flag->fl_data.fl_keyword, "$Forwarded"))
+ if (!strcasecmp(flag->fl_flag->fl_data.fl_keyword, RTAG_FORWARDED))
c_flag = IMAP_FLAG_FORWARDED;
- if (!strcasecmp(flag->fl_flag->fl_data.fl_keyword, "Junk"))
+ if (!strcasecmp(flag->fl_flag->fl_data.fl_keyword, RTAG_JUNK))
c_flag = IMAP_FLAG_SPAM;
- if (!strcasecmp(flag->fl_flag->fl_data.fl_keyword, "NonJunk") ||
- !strcasecmp(flag->fl_flag->fl_data.fl_keyword, "NoJunk") ||
- !strcasecmp(flag->fl_flag->fl_data.fl_keyword, "NotJunk"))
+ if (!strcasecmp(flag->fl_flag->fl_data.fl_keyword, RTAG_NON_JUNK) ||
+ !strcasecmp(flag->fl_flag->fl_data.fl_keyword, RTAG_NO_JUNK) ||
+ !strcasecmp(flag->fl_flag->fl_data.fl_keyword, RTAG_NOT_JUNK))
c_flag = IMAP_FLAG_HAM;
break;
default:
case IMAP_SEARCH_TYPE_FORWARDED:
search_type_key = mailimap_search_key_new(MAILIMAP_SEARCH_KEY_KEYWORD,
NULL, NULL, NULL, NULL, NULL,
- strdup("$Forwarded"), NULL, NULL, NULL, NULL,
+ strdup(RTAG_FORWARDED), NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, 0,
NULL, NULL, NULL, NULL, NULL,
NULL, 0, NULL, NULL, NULL);
case IMAP_SEARCH_TYPE_SPAM:
search_type_key = mailimap_search_key_new(MAILIMAP_SEARCH_KEY_KEYWORD,
NULL, NULL, NULL, NULL, NULL,
- strdup("Junk"), NULL, NULL, NULL, NULL,
+ strdup(RTAG_JUNK), NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, 0,
NULL, NULL, NULL, NULL, NULL,
NULL, 0, NULL, NULL, NULL);
flags &= ~MSG_NEW;
break;
case MAILIMAP_FLAG_KEYWORD:
- if (!strcasecmp(flag_fetch->fl_flag->fl_data.fl_keyword, "$Forwarded"))
+ if (!strcasecmp(flag_fetch->fl_flag->fl_data.fl_keyword, RTAG_FORWARDED))
flags |= MSG_FORWARDED;
- else if (!strcasecmp(flag_fetch->fl_flag->fl_data.fl_keyword, "Junk"))
+ else if (!strcasecmp(flag_fetch->fl_flag->fl_data.fl_keyword, RTAG_JUNK))
flags |= MSG_SPAM;
- else if (!strcasecmp(flag_fetch->fl_flag->fl_data.fl_keyword, "NonJunk") ||
- !strcasecmp(flag_fetch->fl_flag->fl_data.fl_keyword, "NoJunk") ||
- !strcasecmp(flag_fetch->fl_flag->fl_data.fl_keyword, "NotJunk"))
+ else if (!strcasecmp(flag_fetch->fl_flag->fl_data.fl_keyword, RTAG_NON_JUNK) ||
+ !strcasecmp(flag_fetch->fl_flag->fl_data.fl_keyword, RTAG_NO_JUNK) ||
+ !strcasecmp(flag_fetch->fl_flag->fl_data.fl_keyword, RTAG_NOT_JUNK))
flags &= ~MSG_SPAM;
else if (s_tags)
tags = g_slist_prepend(tags, g_strdup(flag_fetch->fl_flag->fl_data.fl_keyword));
for (cur = tags_set; cur; cur = cur->next) {
gint cur_tag = GPOINTER_TO_INT(cur->data);
const gchar *str = tags_get_tag(cur_tag);
- if (strcmp(str, "$Forwarded") && strcmp(str, "Junk") && strcmp(str, "NonJunk") && strcmp(str, "NotJunk") && strcmp(str, "NoJunk") && strcmp(str, "Junk") )
+ if (IS_NOT_RESERVED_TAG(str))
list_set = g_slist_prepend(list_set, g_strdup(str));
}
if (list_set) {
for (cur = tags_unset; cur; cur = cur->next) {
gint cur_tag = GPOINTER_TO_INT(cur->data);
const gchar *str = tags_get_tag(cur_tag);
- if (strcmp(str, "$Forwarded") && strcmp(str, "Junk") && strcmp(str, "NonJunk") && strcmp(str, "NotJunk") && strcmp(str, "NoJunk") && strcmp(str, "Junk") )
+ if (IS_NOT_RESERVED_TAG(str))
list_unset = g_slist_prepend(list_unset, g_strdup(str));
}
if (list_unset) {
mailimap_flag_new_draft());
if (IMAP_IS_FORWARDED(flags) && flag_ok(item, IMAP_FLAG_FORWARDED))
mailimap_flag_list_add(flag_list,
- mailimap_flag_new_flag_keyword(strdup("$Forwarded")));
+ mailimap_flag_new_flag_keyword(strdup(RTAG_FORWARDED)));
if (IMAP_IS_SPAM(flags) && flag_ok(item, IMAP_FLAG_SPAM))
mailimap_flag_list_add(flag_list,
- mailimap_flag_new_flag_keyword(strdup("Junk")));
+ mailimap_flag_new_flag_keyword(strdup(RTAG_JUNK)));
else if (IMAP_IS_HAM(flags) && flag_ok(item, IMAP_FLAG_HAM))
mailimap_flag_list_add(flag_list,
- mailimap_flag_new_flag_keyword(strdup("NonJunk")));
+ mailimap_flag_new_flag_keyword(strdup(RTAG_NON_JUNK)));
for (; cur; cur = cur->next) {
gchar *enc_str =