+2002-05-09
+
+ * src/folderview.c: folderview_check_new(): skip unselectable folders.
+ * src/summaryview.c: added 'Create filter rule' to the context menu.
+
+2002-05-08
+
+ * src/imap.[ch]: supported namespace for others/shared folders
+ (in progress).
+ imap_parse_namespace(): parse also others/shared namespace.
+ imap_find_namespace(): search also others/shared namespace.
+ * src/utils.[ch]:
+ strchr_parenthesis_close(): return pointer to closing parenthesis.
+ strsplit_parenthesis(): split parenthetic list into array of
+ strings.
+
2002-05-08
* src/procheader.c: procheader_date_parse(): fixed a bug that didn't
+2002-05-09 [paul] 0.7.5claws14
+
+ * sync with 0.7.5cvs14
+ see ChangeLog 2002-05-08 and 2002-05-09
+
2002-05-08 [paul] 0.7.5claws13
* sync with 0.7.5cvs11
+2002-05-09
+
+ * src/folderview.c: folderview_check_new(): ÁªÂò¤Ç¤¤Ê¤¤¥Õ¥©¥ë¥À¤ò
+ ¥¹¥¥Ã¥×¡£
+ * src/summaryview.c: ¥³¥ó¥Æ¥¥¹¥È¥á¥Ë¥å¡¼¤Ë¡Ö¿¶¤êʬ¤±¥ë¡¼¥ë¤òºîÀ®¡×
+ ¤òÄɲá£
+
+2002-05-08
+
+ * src/imap.[ch]: others/shared ¥Õ¥©¥ë¥À¤Î namespace ¤ËÂбþ(ºî¶ÈÃæ)¡£
+ imap_parse_namespace(): others/shared namespace ¤â¥Ñ¡¼¥¹¡£
+ imap_find_namespace(): others/shared namespace ¤â¸¡º÷¡£
+ * src/utils.[ch]:
+ strchr_parenthesis_close(): ÊĤ¸³ç¸Ì¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
+ strsplit_parenthesis(): ³ç¸Ì¤Î¥ê¥¹¥È¤òʸ»úÎó¤ÎÇÛÎó¤Ëʬ³ä¡£
+
2002-05-08
* src/procheader.c: procheader_date_parse(): "Mon,6 May 2002 20:31:12
MICRO_VERSION=5
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws13
+EXTRA_VERSION=claws14
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
item = gtk_ctree_node_get_row_data(ctree, node);
if (!item || !item->path || !item->folder) continue;
+ if (item->no_select) continue;
if (folder && folder != item->folder) continue;
if (!folder && !FOLDER_IS_LOCAL(item->folder)) continue;
session = imap_session_get(folder);
if (!session) return;
- if (imapfolder->namespace && imapfolder->namespace->data)
- namespace = (IMAPNameSpace *)imapfolder->namespace->data;
+ if (imapfolder->ns_personal && imapfolder->ns_personal->data)
+ namespace = (IMAPNameSpace *)imapfolder->ns_personal->data;
if (folder->account->imap_dir && *folder->account->imap_dir) {
gchar *imap_dir;
return sock;
}
-#define THROW goto catch
-
-static void imap_parse_namespace(IMAPSession *session, IMAPFolder *folder)
+static GList *imap_parse_namespace_str(gchar *str)
{
- gchar *ns_str;
+ gchar *p = str;
gchar *name;
gchar *separator;
- gchar *p;
IMAPNameSpace *namespace;
GList *ns_list = NULL;
- g_return_if_fail(session != NULL);
- g_return_if_fail(folder != NULL);
-
- if (folder->namespace != NULL) return;
-
- if (imap_cmd_namespace(SESSION(session)->sock, &ns_str)
- != IMAP_SUCCESS) {
- log_warning(_("can't get namespace\n"));
- return;
- }
-
- /* get the first element */
- extract_one_parenthesis_with_skip_quote(ns_str, '"', '(', ')');
- g_strstrip(ns_str);
- p = ns_str;
-
while (*p != '\0') {
/* parse ("#foo" "/") */
while (*p && *p != '(') p++;
- if (*p == '\0') THROW;
+ if (*p == '\0') break;
p++;
while (*p && *p != '"') p++;
- if (*p == '\0') THROW;
+ if (*p == '\0') break;
p++;
name = p;
while (*p && *p != '"') p++;
- if (*p == '\0') THROW;
+ if (*p == '\0') break;
*p = '\0';
p++;
while (*p && isspace(*p)) p++;
- if (*p == '\0') THROW;
+ if (*p == '\0') break;
if (strncmp(p, "NIL", 3) == 0)
separator = NULL;
else if (*p == '"') {
p++;
separator = p;
while (*p && *p != '"') p++;
- if (*p == '\0') THROW;
+ if (*p == '\0') break;
*p = '\0';
p++;
- } else THROW;
+ } else break;
while (*p && *p != ')') p++;
- if (*p == '\0') THROW;
+ if (*p == '\0') break;
p++;
namespace = g_new(IMAPNameSpace, 1);
namespace->name = g_strdup(name);
namespace->separator = separator ? separator[0] : '\0';
ns_list = g_list_append(ns_list, namespace);
- IMAP_FOLDER(folder)->namespace = ns_list;
}
-catch:
- g_free(ns_str);
- return;
+ return ns_list;
}
-#undef THROW
+static void imap_parse_namespace(IMAPSession *session, IMAPFolder *folder)
+{
+ gchar *ns_str;
+ gchar **str_array;
-static IMAPNameSpace *imap_find_namespace(IMAPFolder *folder,
- const gchar *path)
+ g_return_if_fail(session != NULL);
+ g_return_if_fail(folder != NULL);
+
+ if (folder->ns_personal != NULL ||
+ folder->ns_others != NULL ||
+ folder->ns_shared != NULL)
+ return;
+
+ if (imap_cmd_namespace(SESSION(session)->sock, &ns_str)
+ != IMAP_SUCCESS) {
+ log_warning(_("can't get namespace\n"));
+ return;
+ }
+
+ str_array = strsplit_parenthesis(ns_str, '(', ')', 3);
+ if (str_array[0])
+ folder->ns_personal = imap_parse_namespace_str(str_array[0]);
+ if (str_array[0] && str_array[1])
+ folder->ns_others = imap_parse_namespace_str(str_array[1]);
+ if (str_array[0] && str_array[1] && str_array[2])
+ folder->ns_shared = imap_parse_namespace_str(str_array[2]);
+ g_strfreev(str_array);
+ return;
+}
+
+static IMAPNameSpace *imap_find_namespace_from_list(GList *ns_list,
+ const gchar *path)
{
IMAPNameSpace *namespace = NULL;
- GList *ns_list;
gchar *name;
- g_return_val_if_fail(folder != NULL, NULL);
g_return_val_if_fail(path != NULL, NULL);
- ns_list = folder->namespace;
-
for (; ns_list != NULL; ns_list = ns_list->next) {
IMAPNameSpace *tmp_ns = ns_list->data;
return namespace;
}
+static IMAPNameSpace *imap_find_namespace(IMAPFolder *folder,
+ const gchar *path)
+{
+ IMAPNameSpace *namespace;
+
+ namespace = imap_find_namespace_from_list(folder->ns_personal, path);
+ if (namespace) return namespace;
+ namespace = imap_find_namespace_from_list(folder->ns_others, path);
+ if (namespace) return namespace;
+ namespace = imap_find_namespace_from_list(folder->ns_shared, path);
+ if (namespace) return namespace;
+
+ return NULL;
+}
+
static gchar *imap_get_real_path(IMAPFolder *folder, const gchar *path)
{
gchar *real_path;
{
RemoteFolder rfolder;
- GList *namespace; /* list of IMAPNameSpace */
+ /* list of IMAPNameSpace */
+ GList *ns_personal;
+ GList *ns_others;
+ GList *ns_shared;
};
struct _IMAPSession
static void summary_add_address_cb (SummaryView *summaryview,
guint action,
GtkWidget *widget);
+static void summary_create_filter_cb (SummaryView *summaryview,
+ guint action,
+ GtkWidget *widget);
static void summary_mark_clicked (GtkWidget *button,
SummaryView *summaryview);
{N_("/---"), NULL, NULL, 0, "<Separator>"},
{N_("/Add sender to address boo_k"),
NULL, summary_add_address_cb, 0, NULL},
+ {N_("/Create f_ilter rule"), NULL, NULL, 0, "<Branch>"},
+ {N_("/Create f_ilter rule/_Automatically"),
+ NULL, summary_create_filter_cb, FILTER_BY_AUTO, NULL},
+ {N_("/Create f_ilter rule/by _From"),
+ NULL, summary_create_filter_cb, FILTER_BY_FROM, NULL},
+ {N_("/Create f_ilter rule/by _To"),
+ NULL, summary_create_filter_cb, FILTER_BY_TO, NULL},
+ {N_("/Create f_ilter rule/by _Subject"),
+ NULL, summary_create_filter_cb, FILTER_BY_SUBJECT, NULL},
{N_("/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_View"), NULL, NULL, 0, "<Branch>"},
{N_("/_View/Open in new _window"),
menu_set_sensitive(ifactory, "/Bounce", TRUE);
menu_set_sensitive(ifactory, "/Add sender to address book", sens);
+ menu_set_sensitive(ifactory, "/Create filter rule", sens);
menu_set_sensitive(ifactory, "/View", sens);
menu_set_sensitive(ifactory, "/View/Open in new window", sens);
summary_add_address(summaryview);
}
+static void summary_create_filter_cb(SummaryView *summaryview,
+ guint action, GtkWidget *widget)
+{
+ summary_filter_open(summaryview, (PrefsFilterType)action);
+}
+
static void summary_mark_clicked(GtkWidget *button, SummaryView *summaryview)
{
summary_sort(summaryview, SORT_BY_MARK);
return NULL;
}
-/* this fuction was taken from gstrfuncs.c in glib. */
+gchar *strchr_parenthesis_close(const gchar *str, gchar op, gchar cl)
+{
+ const gchar *p;
+ gchar quote_chr = '"';
+ gint in_brace;
+ gboolean in_quote = FALSE;
+
+ p = str;
+
+ if ((p = strchr_with_skip_quote(p, quote_chr, op))) {
+ p++;
+ in_brace = 1;
+ while (*p) {
+ if (*p == op && !in_quote)
+ in_brace++;
+ else if (*p == cl && !in_quote)
+ in_brace--;
+ else if (*p == quote_chr)
+ in_quote ^= TRUE;
+
+ if (in_brace == 0)
+ return (gchar *)p;
+
+ p++;
+ }
+ }
+
+ return NULL;
+}
+
+gchar **strsplit_parenthesis(const gchar *str, gchar op, gchar cl,
+ gint max_tokens)
+{
+ GSList *string_list = NULL, *slist;
+ gchar **str_array;
+ const gchar *s_op, *s_cl;
+ guint i, n = 1;
+
+ g_return_val_if_fail(str != NULL, NULL);
+
+ if (max_tokens < 1)
+ max_tokens = G_MAXINT;
+
+ s_op = strchr_with_skip_quote(str, '"', op);
+ if (!s_op) return NULL;
+ str = s_op;
+ s_cl = strchr_parenthesis_close(str, op, cl);
+ if (s_cl) {
+ do {
+ guint len;
+ gchar *new_string;
+
+ str++;
+ len = s_cl - str;
+ new_string = g_new(gchar, len + 1);
+ strncpy(new_string, str, len);
+ new_string[len] = 0;
+ string_list = g_slist_prepend(string_list, new_string);
+ n++;
+ str = s_cl + 1;
+
+ while (*str && isspace(*str)) str++;
+ if (*str != op) {
+ string_list = g_slist_prepend(string_list,
+ g_strdup(""));
+ n++;
+ s_op = strchr_with_skip_quote(str, '"', op);
+ if (!--max_tokens || !s_op) break;
+ str = s_op;
+ } else
+ s_op = str;
+ s_cl = strchr_parenthesis_close(str, op, cl);
+ } while (--max_tokens && s_cl);
+ }
+
+ str_array = g_new(gchar*, n);
+
+ i = n - 1;
+
+ str_array[i--] = NULL;
+ for (slist = string_list; slist; slist = slist->next)
+ str_array[i--] = slist->data;
+
+ g_slist_free(string_list);
+
+ return str_array;
+}
+
gchar **strsplit_with_quote(const gchar *str, const gchar *delim,
gint max_tokens)
{
const gchar *quote_chars);
gchar *strstr_with_skip_quote (const gchar *haystack,
const gchar *needle);
+gchar *strchr_parenthesis_close (const gchar *str,
+ gchar op,
+ gchar cl);
+
+gchar **strsplit_parenthesis (const gchar *str,
+ gchar op,
+ gchar cl,
+ gint max_tokens);
gchar **strsplit_with_quote (const gchar *str,
const gchar *delim,
gint max_tokens);