if (!attr || !attr->name || !attr->value) continue;
if (!strcmp(attr->name, "type")) {
- if (!strcasecmp(attr->value, "normal"))
+ if (!g_ascii_strcasecmp(attr->value, "normal"))
item->stype = F_NORMAL;
- else if (!strcasecmp(attr->value, "inbox"))
+ else if (!g_ascii_strcasecmp(attr->value, "inbox"))
item->stype = F_INBOX;
- else if (!strcasecmp(attr->value, "outbox"))
+ else if (!g_ascii_strcasecmp(attr->value, "outbox"))
item->stype = F_OUTBOX;
- else if (!strcasecmp(attr->value, "draft"))
+ else if (!g_ascii_strcasecmp(attr->value, "draft"))
item->stype = F_DRAFT;
- else if (!strcasecmp(attr->value, "queue"))
+ else if (!g_ascii_strcasecmp(attr->value, "queue"))
item->stype = F_QUEUE;
- else if (!strcasecmp(attr->value, "trash"))
+ else if (!g_ascii_strcasecmp(attr->value, "trash"))
item->stype = F_TRASH;
} else if (!strcmp(attr->name, "name")) {
if (item->name != NULL)
if (status->str) {
id = folder_item_get_identifier(item);
- g_string_sprintfa(status->str, "%5d %5d %5d %s\n",
+ g_string_append_printf(status->str, "%5d %5d %5d %s\n",
item->new_msgs, item->unread_msgs,
item->total_msgs, id);
g_free(id);
gchar *id;
id = folder_item_get_identifier(item);
- g_string_sprintfa(str, "%5d %5d %5d %s\n",
+ g_string_append_printf(str, "%5d %5d %5d %s\n",
item->new_msgs, item->unread_msgs,
item->total_msgs, id);
g_free(id);
}
if (full)
- g_string_sprintfa(str, "%5d %5d %5d\n", new, unread, total);
+ g_string_append_printf(str, "%5d %5d %5d\n", new, unread, total);
else
- g_string_sprintfa(str, "%d %d %d\n", new, unread, total);
+ g_string_append_printf(str, "%d %d %d\n", new, unread, total);
ret = str->str;
g_string_free(str, FALSE);
classlist = folder_get_class_list();
for (; classlist != NULL; classlist = g_slist_next(classlist)) {
FolderClass *class = (FolderClass *) classlist->data;
- if (g_strcasecmp(class->idstr, str) == 0)
+ if (g_ascii_strcasecmp(class->idstr, str) == 0)
return class;
}
return msginfo;
}
+static gint syncronize_flags(FolderItem *item, MsgInfoList *msglist)
+{
+ GRelation *relation;
+ gint ret = 0;
+ GSList *cur;
+
+ if(msglist == NULL)
+ return 0;
+ if(item->folder->klass->get_flags == NULL)
+ return 0;
+
+ relation = g_relation_new(2);
+ g_relation_index(relation, 0, g_direct_hash, g_direct_equal);
+ if ((ret = item->folder->klass->get_flags(
+ item->folder, item, msglist, relation)) == 0) {
+ GTuples *tuples;
+ MsgInfo *msginfo;
+ MsgPermFlags permflags;
+ gboolean skip;
+
+ for (cur = msglist; cur != NULL; cur = g_slist_next(cur)) {
+ msginfo = (MsgInfo *) cur->data;
+
+ tuples = g_relation_select(relation, msginfo, 0);
+ skip = tuples->len < 1;
+ if (!skip)
+ permflags = GPOINTER_TO_INT(g_tuples_index(tuples, 0, 1));
+ g_tuples_destroy(tuples);
+ if (skip)
+ continue;
+
+ if (msginfo->flags.perm_flags != permflags) {
+ procmsg_msginfo_set_flags(msginfo,
+ permflags & ~msginfo->flags.perm_flags, 0);
+ procmsg_msginfo_unset_flags(msginfo,
+ ~permflags & msginfo->flags.perm_flags, 0);
+ }
+ }
+ }
+ g_relation_destroy(relation);
+
+ return ret;
+}
+
gint folder_item_scan_full(FolderItem *item, gboolean filtering)
{
Folder *folder;
g_slist_free(new_list);
}
+ syncronize_flags(item, exists_list);
+
folder_item_update_freeze();
if (newmsg_list != NULL) {
GSList *elem;
return 0;
}
-gint folder_item_syncronize_flags(FolderItem *item)
-{
- MsgInfoList *msglist = NULL;
- GSList *cur;
- GRelation *relation;
- gint ret = 0;
-
- g_return_val_if_fail(item != NULL, -1);
- g_return_val_if_fail(item->folder != NULL, -1);
- g_return_val_if_fail(item->folder->klass != NULL, -1);
- if(item->folder->klass->get_flags == NULL)
- return 0;
-
- if (item->cache == NULL)
- folder_item_read_cache(item);
-
- msglist = msgcache_get_msg_list(item->cache);
-
- relation = g_relation_new(2);
- g_relation_index(relation, 0, g_direct_hash, g_direct_equal);
- if ((ret = item->folder->klass->get_flags(
- item->folder, item, msglist, relation)) == 0) {
- GTuples *tuples;
- MsgInfo *msginfo;
- MsgPermFlags permflags;
- gboolean skip;
-
- for (cur = msglist; cur != NULL; cur = g_slist_next(cur)) {
- msginfo = (MsgInfo *) cur->data;
-
- tuples = g_relation_select(relation, msginfo, 0);
- skip = tuples->len < 1;
- if (!skip)
- permflags = GPOINTER_TO_INT(g_tuples_index(tuples, 0, 1));
- g_tuples_destroy(tuples);
- if (skip)
- continue;
-
- if (msginfo->flags.perm_flags != permflags) {
- procmsg_msginfo_set_flags(msginfo,
- permflags & ~msginfo->flags.perm_flags, 0);
- procmsg_msginfo_unset_flags(msginfo,
- ~permflags & msginfo->flags.perm_flags, 0);
- }
- }
- }
- g_relation_destroy(relation);
-
- for (cur = msglist; cur != NULL; cur = g_slist_next(cur))
- procmsg_msginfo_free((MsgInfo *) cur->data);
-
- return ret;
-}
-
gint folder_item_scan(FolderItem *item)
{
return folder_item_scan_full(item, TRUE);
*memusage += msgcache_get_memory_usage(item->cache);
}
+gint folder_item_syncronize_flags(FolderItem *item)
+{
+ MsgInfoList *msglist = NULL;
+ GSList *cur;
+ gint ret = 0;
+
+ g_return_val_if_fail(item != NULL, -1);
+ g_return_val_if_fail(item->folder != NULL, -1);
+ g_return_val_if_fail(item->folder->klass != NULL, -1);
+
+ if (item->cache == NULL)
+ folder_item_read_cache(item);
+
+ msglist = msgcache_get_msg_list(item->cache);
+
+ ret = syncronize_flags(item, msglist);
+
+ for (cur = msglist; cur != NULL; cur = g_slist_next(cur))
+ procmsg_msginfo_free((MsgInfo *) cur->data);
+
+ return ret;
+}
+
gint folder_cache_time_compare_func(gconstpointer a, gconstpointer b)
{
FolderItem *fa = (FolderItem *)a;