sync with sylpheed 0.4.99cvs9
authorPaul Mangan <paul@claws-mail.org>
Wed, 13 Jun 2001 11:23:49 +0000 (11:23 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 13 Jun 2001 11:23:49 +0000 (11:23 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/imap.c
src/summaryview.c
src/utils.c
src/utils.h

index 053bc4f..7c22510 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-06-13
+
+       * src/imap.c: imap_parse_namespace(), imap_cmd_namespace(): new.
+
+2001-06-11
+
+       * src/summaryview.c: summary_show(): fixed a glitch in folder view.
+
 2001-06-08
 
        * src/imap.[ch]: added imap_add_msg(), and imap_append_message(),
index c58894d..491606c 100644 (file)
@@ -1,3 +1,9 @@
+2001-06-13 [paul]
+
+        0.4.99claws9
+
+        * sync with sylpheed 0.4.99cvs9
+
 2001-06-13 [hoa]
 
        * src/compose.c
index 68fb942..c800bba 100644 (file)
@@ -1,3 +1,11 @@
+2001-06-13
+
+       * src/imap.c: imap_parse_namespace(), imap_cmd_namespace(): ¿·µ¬¡£
+
+2001-06-11
+
+       * src/summaryview.c: summary_show(): ¥Õ¥©¥ë¥À¥Ó¥å¡¼¤ÎÉÔ¶ñ¹ç¤ò½¤Àµ¡£
+
 2001-06-08
 
        * src/imap.[ch]: ¥Õ¥¡¥¤¥ë¤ò IMAP4 ¥Õ¥©¥ë¥À¤ËÄɲ乤ë
index 299105e..d8b09ef 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=4
 MICRO_VERSION=99
 INTERFACE_AGE=99
 BINARY_AGE=99
-EXTRA_VERSION=claws8
+EXTRA_VERSION=claws9
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 1cc3540..7be5806 100644 (file)
@@ -76,6 +76,9 @@ static gint imap_set_article_flags    (IMAPSession    *session,
                                         IMAPFlags       flag,
                                         gboolean        is_set);
 
+static void imap_parse_namespace       (IMAPSession    *session,
+                                        Folder         *folder);
+
 static gchar *imap_parse_atom          (SockInfo *sock,
                                         gchar    *src,
                                         gchar    *dest,
@@ -100,6 +103,8 @@ static gint imap_cmd_login  (SockInfo       *sock,
                                 const gchar    *pass);
 static gint imap_cmd_logout    (SockInfo       *sock);
 static gint imap_cmd_noop      (SockInfo       *sock);
+static gint imap_cmd_namespace (SockInfo       *sock,
+                                gchar         **ns_str);
 static gint imap_cmd_select    (SockInfo       *sock,
                                 const gchar    *folder,
                                 gint           *exists,
@@ -769,6 +774,75 @@ static SockInfo *imap_open(const gchar *server, gushort port, gchar *buf)
        return sock;
 }
 
+#define THROW goto catch
+
+static void imap_parse_namespace(IMAPSession *session, Folder *folder)
+{
+       gchar *ns_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);
+       g_return_if_fail(folder->type == F_IMAP);
+
+       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') {
+               while (*p && *p != '(') p++;
+               if (*p == '\0') THROW;
+               p++;
+
+               while (*p && *p != '"') p++;
+               if (*p == '\0') THROW;
+               p++;
+               name = p;
+
+               while (*p && *p != '"') p++;
+               if (*p == '\0') THROW;
+               *p = '\0';
+               p++;
+
+               while (*p && *p != '"') p++;
+               if (*p == '\0') THROW;
+               p++;
+               separator = p;
+
+               while (*p && *p != '"') p++;
+               if (*p == '\0') THROW;
+               *p = '\0';
+               p++;
+
+               while (*p && *p != ')') p++;
+               if (*p == '\0') THROW;
+               p++;
+
+               namespace = g_new(IMAPNameSpace, 1);
+               namespace->name = g_strdup(name);
+               namespace->separator = separator[0];
+               ns_list = g_list_append(ns_list, namespace);
+               IMAP_FOLDER(folder)->namespace = ns_list;
+       }
+
+catch:
+       g_free(ns_str);
+       return;
+}
+
+#undef THROW
+
 static gchar *imap_parse_atom(SockInfo *sock, gchar *src, gchar *dest,
                              gchar *orig_buf)
 {
@@ -1079,6 +1153,7 @@ static gint imap_set_article_flags(IMAPSession *session,
 }
 
 
+/* low-level IMAP4rev1 commands */
 
 static gint imap_cmd_login(SockInfo *sock,
                           const gchar *user, const gchar *pass)
@@ -1105,6 +1180,33 @@ static gint imap_cmd_noop(SockInfo *sock)
        return imap_cmd_ok(sock, NULL);
 }
 
+#define THROW(err) { ok = err; goto catch; }
+
+static gint imap_cmd_namespace(SockInfo *sock, gchar **ns_str)
+{
+       gint ok;
+       GPtrArray *argbuf;
+       gchar *str;
+
+       argbuf = g_ptr_array_new();
+
+       imap_cmd_gen_send(sock, "NAMESPACE");
+       if ((ok = imap_cmd_ok(sock, argbuf)) != IMAP_SUCCESS) THROW(ok);
+
+       str = search_array_contain_str(argbuf, "NAMESPACE");
+       if (!str) THROW(IMAP_ERROR);
+
+       *ns_str = g_strdup(str);
+
+catch:
+       ptr_array_free_strings(argbuf);
+       g_ptr_array_free(argbuf, TRUE);
+
+       return ok;
+}
+
+#undef THROW
+
 static gint imap_cmd_select(SockInfo *sock, const gchar *folder,
                            gint *exists, gint *recent, gint *unseen,
                            gulong *uid)
@@ -1231,6 +1333,7 @@ static gint imap_cmd_append(SockInfo *sock, const gchar *destfolder,
 
        g_return_val_if_fail(file != NULL, IMAP_ERROR);
 
+       size = get_file_size(file);
        imap_cmd_gen_send(sock, "APPEND %s {%d}", destfolder, size);
        ok = imap_cmd_ok(sock, NULL);
        if (ok != IMAP_SUCCESS) {
index 4c104bc..e53e595 100644 (file)
@@ -646,6 +646,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
        gchar *buf;
        gboolean is_refresh;
        guint prev_msgnum = 0;
+       GtkCTreeNode *selected_node = summaryview->folderview->selected;
        GSList *cur;
        gint sort_mode;
        gint sort_type;
@@ -676,7 +677,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
        } else
                summary_write_cache(summaryview);
 
-       summaryview->folderview->opened = summaryview->folderview->selected;
+       summaryview->folderview->opened = selected_node;
 
        gtk_clist_freeze(GTK_CLIST(ctree));
 
index 7bd281a..e30a5b0 100644 (file)
@@ -558,6 +558,35 @@ void extract_parenthesis(gchar *str, gchar op, gchar cl)
        *destp = '\0';
 }
 
+void extract_one_parenthesis_with_skip_quote(gchar *str, gchar quote_chr,
+                                            gchar op, gchar cl)
+{
+       register gchar *srcp, *destp;
+       gint in_brace;
+       gboolean in_quote = FALSE;
+
+       srcp = destp = str;
+
+       if ((srcp = strchr_with_skip_quote(destp, quote_chr, op))) {
+               memmove(destp, srcp + 1, strlen(srcp));
+               in_brace = 1;
+               while(*destp) {
+                       if (*destp == op && !in_quote)
+                               in_brace++;
+                       else if (*destp == cl && !in_quote)
+                               in_brace--;
+                       else if (*destp == quote_chr)
+                               in_quote ^= TRUE;
+
+                       if (in_brace == 0)
+                               break;
+
+                       destp++;
+               }
+       }
+       *destp = '\0';
+}
+
 void extract_parenthesis_with_skip_quote(gchar *str, gchar quote_chr,
                                         gchar op, gchar cl)
 {
@@ -567,7 +596,7 @@ void extract_parenthesis_with_skip_quote(gchar *str, gchar quote_chr,
 
        srcp = destp = str;
 
-       while ((srcp = strchr_with_skip_quote(destp, '"', op))) {
+       while ((srcp = strchr_with_skip_quote(destp, quote_chr, op))) {
                if (destp > str)
                        *destp++ = ' ';
                memmove(destp, srcp + 1, strlen(srcp));
index eff7076..a7de67f 100644 (file)
@@ -196,10 +196,16 @@ void eliminate_parenthesis                (gchar          *str,
 void extract_parenthesis               (gchar          *str,
                                         gchar           op,
                                         gchar           cl);
-void extract_parenthesis_with_skip_quote(gchar         *str,
-                                        gchar           quote_chr,
-                                        gchar           op,
-                                        gchar           cl);
+
+void extract_one_parenthesis_with_skip_quote   (gchar          *str,
+                                                gchar           quote_chr,
+                                                gchar           op,
+                                                gchar           cl);
+void extract_parenthesis_with_skip_quote       (gchar          *str,
+                                                gchar           quote_chr,
+                                                gchar           op,
+                                                gchar           cl);
+
 void eliminate_quote                   (gchar          *str,
                                         gchar           quote_chr);
 void extract_quote                     (gchar          *str,