From 0186236e2aa71f63feb606edd7eb1683ac61e5e5 Mon Sep 17 00:00:00 2001 From: Paul Mangan Date: Fri, 14 Dec 2001 09:32:45 +0000 Subject: [PATCH] sync with sylpheed 0.6.5cvs27 --- ChangeLog | 21 +++++ ChangeLog.claws | 5 ++ ChangeLog.jp | 21 +++++ INSTALL | 9 ++ INSTALL.jp | 9 ++ NEWS | 14 +++ configure.in | 2 +- src/compose.c | 13 ++- src/imap.c | 224 +++++++++++++++++++++++++--------------------- src/imap.h | 8 +- src/summaryview.c | 35 +++++++- src/utils.h | 11 ++- 12 files changed, 254 insertions(+), 118 deletions(-) diff --git a/ChangeLog b/ChangeLog index 877bf3b7c..0c3f2be03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2001-12-14 + + * src/utils.h: added the macro Xstrcat_a() that concatenates + two strings and return alloca'd string. + * src/imap.c: imap_scan_tree_recursive(): fixed a bug that didn't + handle folder name which includes some spaces correctly + (based on the patch from Willem van Engen (thanks!)). + * src/compose.c: compose_wrap_line_all(): fixed the crash when + wrapping long lines if linewrap quotation is disabled and + a word spanning more than one line. + +2001-12-14 + + * applied the Tobias' patch with modification (thanks!). + * src/imap.[ch]: + imap_msg_set_perm_flags() + imap_msg_unset_perm_flags(): new. They set permanent flags to + a IMAP message. + * src/compose.c + src/summaryview.c: set flags on IMAP server when flags are changed. + 2001-12-11 * src/gtkutils.[ch]: gtkut_container_remove(): new. It's a wrapper diff --git a/ChangeLog.claws b/ChangeLog.claws index e8df63625..ca3c57c6d 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,8 @@ +2001-12-14 [paul] 0.6.5claws86 + + * sync with sylpheed 0.6.5cvs27 + see ChangeLog entries 2001-12-14 + 2001-12-14 [carsten] 0.6.5claws85 * src/mainwindow.c following a suggestion of Melvin the rcoabm pops up diff --git a/ChangeLog.jp b/ChangeLog.jp index 59fb9e33f..26748cf01 100644 --- a/ChangeLog.jp +++ b/ChangeLog.jp @@ -1,3 +1,24 @@ +2001-12-14 + + * src/utils.h: 2¤Ä¤Îʸ»úÎó¤ò·ë¹ç¤·¤Æ alloca ºÑ¤Îʸ»úÎó¤òÊÖ¤¹¥Þ¥¯¥í + Xstrcat_a() ¤òÄɲᣠ+ * src/imap.c: imap_scan_tree_recursive(): ¥¹¥Ú¡¼¥¹¤ò´Þ¤à¥Õ¥©¥ë¥À̾ + ¤òÀµ¤·¤¯°·¤¨¤Ê¤¤¥Ð¥°¤ò½¤Àµ(Willem van Engen ¤µ¤ó¤Î¥Ñ¥Ã¥Á¤Ë´ð¤Å¤¤ + ¤Æ¤¤¤Þ¤¹(thanks!))¡£ + * src/compose.c: compose_wrap_line_all(): °úÍÑÉô¤Î¼«Æ°²þ¹Ô¤¬Ìµ¸ú + ¤Ç¡¢Ã±¸ì¤¬1¹Ô°Ê¾å¤ËÅϤäƤ¤¤ë¾ì¹ç¤Ë¥¯¥é¥Ã¥·¥å¤¹¤ë¤Î¤ò½¤Àµ¡£ + +2001-12-14 + + * Tobias ¤µ¤ó¤Î¥Ñ¥Ã¥Á¤ò½¤Àµ¤·¤ÆŬÍÑ(thanks!)¡£ + * src/imap.[ch]: + imap_msg_set_perm_flags() + imap_msg_unset_perm_flags(): ¿·µ¬¡£ IMAP ¥á¥Ã¥»¡¼¥¸¤Ë±Ê³¥Õ¥é¥°¤ò + ¥»¥Ã¥È¤¹¤ë¡£ + * src/compose.c + src/summaryview.c: ¥Õ¥é¥°¤¬Êѹ¹¤µ¤ì¤¿¤é IMAP ¥µ¡¼¥Ð¾å¤Î¥Õ¥é¥°¤â + Êѹ¹¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£ + 2001-12-11 * src/gtkutils.[ch]: gtkut_container_remove(): ¿·µ¬¡£ Gtk{Text,Entry} diff --git a/INSTALL b/INSTALL index 0f2e8c38b..94386d515 100644 --- a/INSTALL +++ b/INSTALL @@ -30,6 +30,7 @@ o RedHat Linux 6.1 + Helix GNOME (glibc 2.1.x) o RedHat Linux 6.2 / 6.2J (glibc 2.1.x) o RedHat Linux 7.0 / 7.0J o RedHat Linux 7.1 +o RedHat Linux 7.2 o LinuxPPC2000 + Yukikaze(Japanization kit) o Linux2000G (Intel / PPC) o HOLON Linux 2.0 (Intel / PPC) @@ -39,6 +40,8 @@ o LinuxPPC Q4 2000 (glibc 2.1.x) o Linux MLD4 o Linux MLD5 o Plamo Linux 2.0 +o Plamo Linux 2.1 +o Slackware 7.0 o Slackware 7.1 o Slackware 8.0 o Linux Mandrake 7.0 @@ -51,6 +54,7 @@ o SuSE Linux 6.4 o SuSE Linux 7.0 o SuSE Linux 7.1 o SuSE Linux 7.2 +o SuSE Linux 7.3 o OpenLinux 2.3 (glibc 2.1.1 -> 2.1.3) o Caldera OpenDesktop 2.4 o Caldera Workstation 3.1 @@ -58,16 +62,19 @@ o Conectiva Linux 4.0 o Conectiva Linux 5.0 o Vector Linux 1.5 o Yellow Dog Linux 2.0 (glibc 2.2.1) +o Yellow Dog Linux 2.1 (PowerPC) o FreeBSD 3.2-RELEASE o FreeBSD 3.4-RELEASE o FreeBSD 4.0-RELEASE o FreeBSD 4.1-RELEASE o FreeBSD 4.2-RELEASE o FreeBSD 4.3-RELEASE +o FreeBSD 4.4-RELEASE o FreeBSD 5.0-CURRENT o NetBSD 1.4.2 o NetBSD 1.5 + XPG4DL o NetBSD 1.5.1 +o NetBSD 1.5.2 o OpenBSD 2.7 o OpenBSD 2.8 (i386) o OpenBSD 2.9 @@ -80,6 +87,8 @@ o Solaris 8 o IRIX 6.3 o IRIX 6.5 6.5.8m o HP-UX 10.20 +o HP-UX 11.0 +o HP-UX 11i o Tru64 Unix 5.0 (OSF1 V5.0) o SCO UnixWare 7 o Mac OS X (Darwin 1.3) + Xtools (has locale problem) diff --git a/INSTALL.jp b/INSTALL.jp index 7686a7910..889e0870b 100644 --- a/INSTALL.jp +++ b/INSTALL.jp @@ -29,6 +29,7 @@ o RedHat Linux 6.1 + Helix GNOME (glibc 2.1.x) o RedHat Linux 6.2 / 6.2J (glibc 2.1.x) o RedHat Linux 7.0 / 7.0J o RedHat Linux 7.1 +o RedHat Linux 7.2 o LinuxPPC2000 + ÀãÉ÷(ÆüËܸ첽 kit) o Linux2000G (Intel / PPC) o HOLON Linux 2.0 (Intel / PPC) @@ -38,6 +39,8 @@ o LinuxPPC Q4 2000 (glibc 2.1.x) o Linux MLD4 o Linux MLD5 o Plamo Linux 2.0 +o Plamo Linux 2.1 +o Slackware 7.0 o Slackware 7.1 o Slackware 8.0 o Linux Mandrake 7.0 @@ -50,6 +53,7 @@ o SuSE Linux 6.4 o SuSE Linux 7.0 o SuSE Linux 7.1 o SuSE Linux 7.2 +o SuSE Linux 7.3 o OpenLinux 2.3 (glibc 2.1.1 -> 2.1.3) o Caldera OpenDesktop 2.4 o Caldera Workstation 3.1 @@ -57,16 +61,19 @@ o Conectiva Linux 4.0 o Conectiva Linux 5.0 o Vector Linux 1.5 o Yellow Dog Linux 2.0 (glibc 2.2.1) +o Yellow Dog Linux 2.1 (PowerPC) o FreeBSD 3.2-RELEASE o FreeBSD 3.4-RELEASE o FreeBSD 4.0-RELEASE o FreeBSD 4.1-RELEASE o FreeBSD 4.2-RELEASE o FreeBSD 4.3-RELEASE +o FreeBSD 4.4-RELEASE o FreeBSD 5.0-CURRENT o NetBSD 1.4.2 o NetBSD 1.5 + XPG4DL o NetBSD 1.5.1 +o NetBSD 1.5.2 o OpenBSD 2.7 o OpenBSD 2.8 (i386) o OpenBSD 2.9 @@ -79,6 +86,8 @@ o Solaris 8 o IRIX 6.3 o IRIX 6.5 6.5.8m o HP-UX 10.20 +o HP-UX 11.0 +o HP-UX 11i o Tru64 Unix 5.0 (OSF1 V5.0) o SCO UnixWare 7 o Mac OS X (Darwin 1.3) + Xtools (locale ¤ËÌäÂꤢ¤ê) diff --git a/NEWS b/NEWS index ed86e5890..05d0c94ce 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,19 @@ Changes of Sylpheed +* 0.6.6 + + * The newsgroup subscription dialog has been enhanced. + * Template function has been improved. + * New wrapping function for composition window has been implemented. + * Mailto URL has been supported on the --compose option. + * The --status option that displays current message count was added. + * Workaround for RFC-incompliant Date header has been made. + * Check connection between IMAP or NNTP server only if access time + limit is expired. + * Thai encodings have been supported. + * Copy and paste problems have been fixed. + * Some other bugs have been fixed. + * 0.6.5 * The template function has been implemented. diff --git a/configure.in b/configure.in index 8b52c59d6..6acee4264 100644 --- a/configure.in +++ b/configure.in @@ -8,7 +8,7 @@ MINOR_VERSION=6 MICRO_VERSION=5 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws85 +EXTRA_VERSION=claws86 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl diff --git a/src/compose.c b/src/compose.c index c8ebea65e..bead615cb 100644 --- a/src/compose.c +++ b/src/compose.c @@ -78,6 +78,7 @@ #include "procmsg.h" #include "menu.h" #include "send.h" +#include "imap.h" #include "news.h" #include "customheader.h" #include "prefs_common.h" @@ -706,8 +707,8 @@ static void compose_generic_reply(MsgInfo *msginfo, gboolean quote, MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_FORWARDED); MSG_SET_PERM_FLAGS(msginfo->flags, MSG_REPLIED); - imap_do_reply(msginfo); - + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_set_perm_flags(msginfo, MSG_REPLIED); CHANGE_FLAGS(msginfo); compose = compose_create(account, COMPOSE_REPLY); @@ -1023,6 +1024,8 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo, MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_REPLIED); MSG_SET_PERM_FLAGS(msginfo->flags, MSG_FORWARDED); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_unset_perm_flags(msginfo, MSG_REPLIED); CHANGE_FLAGS(msginfo); compose = compose_create(account, COMPOSE_FORWARD); @@ -2179,11 +2182,13 @@ static void compose_wrap_line_all(Compose *compose) for (; cur_pos < tlen; cur_pos++) { /* mark position of new line - needed for quotation wrap */ if (is_new_line) { - if (linewrap_quote && is_new_line) { + if (linewrap_quote) { qlen = gtkut_text_str_compare (text, cur_pos, tlen, qfmt); + is_new_line = FALSE; if (qlen) - i_len = get_indent_length(text, cur_pos, tlen); + i_len = get_indent_length + (text, cur_pos, tlen); else i_len = 0; } diff --git a/src/imap.c b/src/imap.c index 604bce77f..f9907f8e4 100644 --- a/src/imap.c +++ b/src/imap.c @@ -51,6 +51,21 @@ #define IMAPS_PORT 993 #endif +#define QUOTE_IF_REQUIRED(out, str) \ +{ \ + if (*str != '"' && strchr(str, ' ')) { \ + gchar *__tmp; \ + gint len; \ + \ + len = strlen(str) + 3; \ + Xalloca(__tmp, len, return IMAP_ERROR); \ + g_snprintf(__tmp, len, "\"%s\"", str); \ + out = __tmp; \ + } else { \ + Xstrdup_a(out, str, return IMAP_ERROR); \ + } \ +} + static GList *session_list = NULL; static gint imap_cmd_count = 0; @@ -59,7 +74,7 @@ static IMAPSession *imap_session_get (Folder *folder); static gchar *imap_query_password (const gchar *server, const gchar *user); -static void imap_scan_tree_recursive (IMAPSession *session, +static gint imap_scan_tree_recursive (IMAPSession *session, FolderItem *item, IMAPNameSpace *namespace); static GSList *imap_parse_list (IMAPSession *session, @@ -592,51 +607,6 @@ static gint imap_do_copy(Folder *folder, FolderItem *dest, MsgInfo *msginfo, return ok; } -gint imap_do_mark (MsgInfo *msginfo) -{ - Folder *folder = msginfo->folder->folder; - IMAPSession *session; - - g_return_val_if_fail(folder != NULL, -1); - g_return_val_if_fail(folder->type == F_IMAP, -1); - g_return_val_if_fail(msginfo != NULL, -1); - - session = imap_session_get(folder); - if (!session) return -1; - debug_print(_("imap_do_mark(): Message %s/%d is marked . %d\n"), msginfo->folder->path, msginfo->msgnum, folder->type); - imap_set_message_flags(session, msginfo->msgnum, msginfo->msgnum, IMAP_FLAG_FLAGGED, TRUE); -} - -gint imap_do_unmark (MsgInfo *msginfo) -{ - Folder *folder = msginfo->folder->folder; - IMAPSession *session; - - g_return_val_if_fail(folder != NULL, -1); - g_return_val_if_fail(folder->type == F_IMAP, -1); - g_return_val_if_fail(msginfo != NULL, -1); - - session = imap_session_get(folder); - if (!session) return -1; - debug_print(_("imap_do_unmark(): Message %s/%d is unmarked . %d\n"), msginfo->folder->path, msginfo->msgnum, folder->type); - imap_set_message_flags(session, msginfo->msgnum, msginfo->msgnum, IMAP_FLAG_FLAGGED, FALSE); -} - -gint imap_do_reply (MsgInfo *msginfo) -{ - Folder *folder = msginfo->folder->folder; - IMAPSession *session; - - g_return_val_if_fail(folder != NULL, -1); - g_return_val_if_fail(folder->type == F_IMAP, -1); - g_return_val_if_fail(msginfo != NULL, -1); - - session = imap_session_get(folder); - if (!session) return -1; - debug_print(_("imap_do_reply(): Message %s/%d is replied . %d\n"), msginfo->folder->path, msginfo->msgnum, folder->type); - imap_set_message_flags(session, msginfo->msgnum, msginfo->msgnum, IMAP_FLAG_ANSWERED, TRUE); -} - static gint imap_do_copy_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist, gboolean remove_source) @@ -753,31 +723,6 @@ gint imap_remove_msg(Folder *folder, FolderItem *item, gint uid) return IMAP_SUCCESS; } -#define RETURN_VAL_IF_QUOTE_REQUIRED_FAIL(out, str) \ -{ \ - if (*str != '"' && strchr(str, ' ')) { \ - gint len; \ - len = strlen(str) + 3; \ - Xalloca(out, len, return IMAP_ERROR); \ - g_snprintf(out, len, "\"%s\"", str); \ - } else { \ - Xstrdup_a(out, str, return IMAP_ERROR); \ - } \ -} - -#define RETURN_IF_QUOTE_REQUIRED_FAIL(out, str) \ -{ \ - if (*str != '"' && strchr(str, ' ')) { \ - gint len; \ - len = strlen(str) + 3; \ - Xalloca(out, len, return); \ - g_snprintf(out, len, "\"%s\"", str); \ - } else { \ - Xstrdup_a(out, str, return); \ - } \ -} - - gint imap_remove_all_msg(Folder *folder, FolderItem *item) { gint exists, recent, unseen; @@ -891,48 +836,53 @@ void imap_scan_tree(Folder *folder) imap_create_trash(folder); } -static void imap_scan_tree_recursive(IMAPSession *session, - FolderItem *item, +static gint imap_scan_tree_recursive(IMAPSession *session, FolderItem *item, IMAPNameSpace *namespace) { IMAPFolder *imapfolder; FolderItem *new_item; GSList *item_list, *cur; - gchar *real_path, *wildcard_path, *wildcard_path_; + gchar *real_path; + gchar *wildcard_path; + gchar separator = '/'; + gchar wildcard[3]; - g_return_if_fail(item != NULL); - g_return_if_fail(item->folder != NULL); - g_return_if_fail(item->no_sub == FALSE); + g_return_val_if_fail(item != NULL, -1); + g_return_val_if_fail(item->folder != NULL, -1); + g_return_val_if_fail(item->no_sub == FALSE, -1); imapfolder = IMAP_FOLDER(item->folder); + if (namespace && namespace->separator) + separator = namespace->separator; + if (item->folder->ui_func) item->folder->ui_func(item->folder, item, item->folder->ui_func_data); if (item->path) { + wildcard[0] = separator; + wildcard[1] = '%'; + wildcard[2] = '\0'; real_path = imap_get_real_path(imapfolder, item->path); - Xstrconcat_a(wildcard_path, real_path,"/%", return); - RETURN_IF_QUOTE_REQUIRED_FAIL(wildcard_path_, wildcard_path); - imap_cmd_gen_send(SESSION(session)->sock, "LIST \"\" %s", - wildcard_path_, - namespace && namespace->separator - ? namespace->separator : '/'); - g_free(wildcard_path); } else { + wildcard[0] = '%'; + wildcard[1] = '\0'; real_path = g_strdup(namespace && namespace->name ? namespace->name : ""); - Xstrconcat_a(wildcard_path, real_path, "%", return); - RETURN_IF_QUOTE_REQUIRED_FAIL(wildcard_path_, wildcard_path); - imap_cmd_gen_send(SESSION(session)->sock, "LIST \"\" %s", - wildcard_path_); - g_free(wildcard_path); } - strtailchomp(real_path, namespace && namespace->separator - ? namespace->separator : '/'); + Xstrcat_a(wildcard_path, real_path, wildcard, + {g_free(real_path); return IMAP_ERROR;}); + QUOTE_IF_REQUIRED(wildcard_path, wildcard_path); + imap_cmd_gen_send(SESSION(session)->sock, "LIST \"\" %s", + wildcard_path); + + strtailchomp(real_path, separator); item_list = imap_parse_list(session, real_path); + g_free(real_path); + for (cur = item_list; cur != NULL; cur = cur->next) { new_item = cur->data; if (!strcmp(new_item->path, "INBOX")) { @@ -955,6 +905,8 @@ static void imap_scan_tree_recursive(IMAPSession *session, if (new_item->no_sub == FALSE) imap_scan_tree_recursive(session, new_item, namespace); } + + return IMAP_SUCCESS; } static GSList *imap_parse_list(IMAPSession *session, const gchar *path) @@ -1658,6 +1610,8 @@ static MsgFlags imap_parse_flags(const gchar *flag_str) MSG_SET_PERM_FLAGS(flags, MSG_DELETED); } else if (g_strncasecmp(p, "Flagged", 7) == 0) { MSG_SET_PERM_FLAGS(flags, MSG_MARKED); + } else if (g_strncasecmp(p, "Answered", 8) == 0) { + MSG_SET_PERM_FLAGS(flags, MSG_REPLIED); } } @@ -1816,6 +1770,72 @@ static MsgInfo *imap_parse_envelope(SockInfo *sock, GString *line_str) return msginfo; } +gint imap_msg_set_perm_flags(MsgInfo *msginfo, MsgPermFlags flags) +{ + Folder *folder; + IMAPSession *session; + IMAPFlags iflags = 0; + gint ok = IMAP_SUCCESS; + + g_return_val_if_fail(msginfo != NULL, -1); + g_return_val_if_fail(MSG_IS_IMAP(msginfo->flags), -1); + g_return_val_if_fail(msginfo->folder != NULL, -1); + g_return_val_if_fail(msginfo->folder->folder != NULL, -1); + + folder = msginfo->folder->folder; + g_return_val_if_fail(folder->type == F_IMAP, -1); + + session = imap_session_get(folder); + if (!session) return -1; + + if (flags & MSG_MARKED) iflags |= IMAP_FLAG_FLAGGED; + if (flags & MSG_REPLIED) iflags |= IMAP_FLAG_ANSWERED; + if (iflags) { + ok = imap_set_message_flags(session, msginfo->msgnum, + msginfo->msgnum, iflags, TRUE); + if (ok != IMAP_SUCCESS) return ok; + } + + if (flags & MSG_UNREAD) + ok = imap_set_message_flags(session, msginfo->msgnum, + msginfo->msgnum, IMAP_FLAG_SEEN, + FALSE); + return ok; +} + +gint imap_msg_unset_perm_flags(MsgInfo *msginfo, MsgPermFlags flags) +{ + Folder *folder; + IMAPSession *session; + IMAPFlags iflags = 0; + gint ok = IMAP_SUCCESS; + + g_return_val_if_fail(msginfo != NULL, -1); + g_return_val_if_fail(MSG_IS_IMAP(msginfo->flags), -1); + g_return_val_if_fail(msginfo->folder != NULL, -1); + g_return_val_if_fail(msginfo->folder->folder != NULL, -1); + + folder = msginfo->folder->folder; + g_return_val_if_fail(folder->type == F_IMAP, -1); + + session = imap_session_get(folder); + if (!session) return -1; + + if (flags & MSG_MARKED) iflags |= IMAP_FLAG_FLAGGED; + if (flags & MSG_REPLIED) iflags |= IMAP_FLAG_ANSWERED; + if (iflags) { + ok = imap_set_message_flags(session, msginfo->msgnum, + msginfo->msgnum, iflags, FALSE); + if (ok != IMAP_SUCCESS) return ok; + } + + if (flags & MSG_UNREAD) + ok = imap_set_message_flags(session, msginfo->msgnum, + msginfo->msgnum, IMAP_FLAG_SEEN, + TRUE); + return ok; +} + static gint imap_set_message_flags(IMAPSession *session, guint32 first_uid, guint32 last_uid, @@ -1911,7 +1931,7 @@ static gint imap_status(IMAPSession *session, IMAPFolder *folder, argbuf = g_ptr_array_new(); real_path = imap_get_real_path(folder, path); - RETURN_VAL_IF_QUOTE_REQUIRED_FAIL(real_path_, real_path); + QUOTE_IF_REQUIRED(real_path_, real_path); imap_cmd_gen_send(SESSION(session)->sock, "STATUS %s " "(MESSAGES RECENT UNSEEN UIDVALIDITY)", real_path_); @@ -1964,8 +1984,8 @@ static gint imap_cmd_login(SockInfo *sock, gchar *user_, *pass_; gint ok; - RETURN_VAL_IF_QUOTE_REQUIRED_FAIL(user_, user); - RETURN_VAL_IF_QUOTE_REQUIRED_FAIL(pass_, pass); + QUOTE_IF_REQUIRED(user_, user); + QUOTE_IF_REQUIRED(pass_, pass); imap_cmd_gen_send(sock, "LOGIN %s %s", user_, pass_); ok = imap_cmd_ok(sock, NULL); @@ -2022,8 +2042,8 @@ static gint imap_cmd_list(SockInfo *sock, const gchar *ref, if (!ref) ref = "\"\""; if (!mailbox) mailbox = "\"\""; - RETURN_VAL_IF_QUOTE_REQUIRED_FAIL(ref_, ref); - RETURN_VAL_IF_QUOTE_REQUIRED_FAIL(mailbox_, mailbox); + QUOTE_IF_REQUIRED(ref_, ref); + QUOTE_IF_REQUIRED(mailbox_, mailbox); imap_cmd_gen_send(sock, "LIST %s %s", ref_, mailbox_); return imap_cmd_ok(sock, argbuf); @@ -2050,7 +2070,7 @@ static gint imap_cmd_do_select(SockInfo *sock, const gchar *folder, else select_cmd = "SELECT"; - RETURN_VAL_IF_QUOTE_REQUIRED_FAIL(folder_, folder); + QUOTE_IF_REQUIRED(folder_, folder); imap_cmd_gen_send(sock, "%s %s", select_cmd, folder_); if ((ok = imap_cmd_ok(sock, argbuf)) != IMAP_SUCCESS) THROW; @@ -2117,7 +2137,7 @@ static gint imap_cmd_create(SockInfo *sock, const gchar *folder) { gchar *folder_; - RETURN_VAL_IF_QUOTE_REQUIRED_FAIL(folder_, folder); + QUOTE_IF_REQUIRED(folder_, folder); imap_cmd_gen_send(sock, "CREATE %s", folder_); return imap_cmd_ok(sock, NULL); @@ -2127,7 +2147,7 @@ static gint imap_cmd_delete(SockInfo *sock, const gchar *folder) { gchar *folder_; - RETURN_VAL_IF_QUOTE_REQUIRED_FAIL(folder_, folder); + QUOTE_IF_REQUIRED(folder_, folder); imap_cmd_gen_send(sock, "DELETE %s", folder_); return imap_cmd_ok(sock, NULL); @@ -2179,12 +2199,12 @@ static gint imap_cmd_append(SockInfo *sock, const gchar *destfolder, { gint ok; gint size; - gchar *destfolder_; + gchar *destfolder_; g_return_val_if_fail(file != NULL, IMAP_ERROR); size = get_file_size(file); - RETURN_VAL_IF_QUOTE_REQUIRED_FAIL(destfolder_, destfolder); + QUOTE_IF_REQUIRED(destfolder_, destfolder); imap_cmd_gen_send(sock, "APPEND %s {%d}", destfolder_, size); ok = imap_cmd_ok(sock, NULL); if (ok != IMAP_SUCCESS) { @@ -2202,7 +2222,7 @@ static gint imap_cmd_copy(SockInfo *sock, guint32 uid, const gchar *destfolder) g_return_val_if_fail(destfolder != NULL, IMAP_ERROR); - RETURN_VAL_IF_QUOTE_REQUIRED_FAIL(destfolder_, destfolder); + QUOTE_IF_REQUIRED(destfolder_, destfolder); imap_cmd_gen_send(sock, "UID COPY %d %s", uid, destfolder_); ok = imap_cmd_ok(sock, NULL); diff --git a/src/imap.h b/src/imap.h index 3b95b44af..4d350422e 100644 --- a/src/imap.h +++ b/src/imap.h @@ -29,6 +29,7 @@ #include "folder.h" #include "session.h" +#include "procmsg.h" typedef struct _IMAPSession IMAPSession; typedef struct _IMAPNameSpace IMAPNameSpace; @@ -133,8 +134,9 @@ FolderItem *imap_create_folder (Folder *folder, gint imap_remove_folder (Folder *folder, FolderItem *item); -gint imap_do_mark (MsgInfo *msginfo); -gint imap_do_unmark (MsgInfo *msginfo); -gint imap_do_reply (MsgInfo *msginfo); +gint imap_msg_set_perm_flags (MsgInfo *msginfo, + MsgPermFlags flags); +gint imap_msg_unset_perm_flags (MsgInfo *msginfo, + MsgPermFlags flags); #endif /* __IMAP_H__ */ diff --git a/src/summaryview.c b/src/summaryview.c index 9f0076f20..c6bdead9f 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -74,6 +74,7 @@ #include "folder.h" #include "colorlabel.h" #include "inc.h" +#include "imap.h" #include "addressbook.h" #include "addr_compl.h" #include "scoring.h" @@ -2267,6 +2268,15 @@ static void summary_display_msg(SummaryView *summaryview, GtkCTreeNode *row, summaryview->newmsgs--; if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) summaryview->unread--; + if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags) || + MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) { + MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_unset_perm_flags(msginfo, MSG_NEW | MSG_UNREAD); + summary_set_row_marks(summaryview, row); + gtk_clist_thaw(GTK_CLIST(ctree)); + summary_status_show(summaryview); + } if (new_window) { MessageView *msgview; @@ -2598,9 +2608,10 @@ static void summary_mark_row(SummaryView *summaryview, GtkCTreeNode *row) MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_DELETED); MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE | MSG_COPY); MSG_SET_PERM_FLAGS(msginfo->flags, MSG_MARKED); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_set_perm_flags(msginfo, MSG_MARKED); CHANGE_FLAGS(msginfo); summary_set_row_marks(summaryview, row); - imap_do_mark(msginfo); debug_print(_("Message %s/%d is marked\n"), msginfo->folder->path, msginfo->msgnum); } @@ -2631,6 +2642,8 @@ static void summary_lock_row(SummaryView *summaryview, GtkCTreeNode *row) MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_DELETED); MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE | MSG_COPY); MSG_SET_PERM_FLAGS(msginfo->flags, MSG_LOCKED); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_set_perm_flags(msginfo, MSG_LOCKED); CHANGE_FLAGS(msginfo); summary_set_row_marks(summaryview, row); debug_print(_("Message %d is locked\n"), msginfo->msgnum); @@ -2662,6 +2675,8 @@ static void summary_mark_row_as_read(SummaryView *summaryview, if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) { MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_unset_perm_flags(msginfo, MSG_NEW | MSG_UNREAD); CHANGE_FLAGS(msginfo); summary_set_row_marks(summaryview, row); debug_print(_("Message %d is marked as read\n"), @@ -2714,8 +2729,12 @@ static void summary_mark_row_as_unread(SummaryView *summaryview, summaryview->deleted--; } MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_REPLIED | MSG_FORWARDED); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_unset_perm_flags(msginfo, MSG_REPLIED); if (!MSG_IS_UNREAD(msginfo->flags)) { MSG_SET_PERM_FLAGS(msginfo->flags, MSG_UNREAD); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_set_perm_flags(msginfo, MSG_UNREAD); summaryview->unread++; debug_print(_("Message %d is marked as unread\n"), msginfo->msgnum); @@ -2765,6 +2784,8 @@ static void summary_delete_row(SummaryView *summaryview, GtkCTreeNode *row) } msginfo->to_folder = NULL; MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_unset_perm_flags(msginfo, MSG_MARKED); MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE | MSG_COPY); MSG_SET_PERM_FLAGS(msginfo->flags, MSG_DELETED); CHANGE_FLAGS(msginfo); @@ -2890,10 +2911,11 @@ static void summary_unmark_row(SummaryView *summaryview, GtkCTreeNode *row) } msginfo->to_folder = NULL; MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED | MSG_DELETED); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_unset_perm_flags(msginfo, MSG_MARKED); MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE | MSG_COPY); CHANGE_FLAGS(msginfo); summary_set_row_marks(summaryview, row); - imap_do_unmark(msginfo); debug_print(_("Message %s/%d is unmarked\n"), msginfo->folder->path, msginfo->msgnum); } @@ -2903,8 +2925,7 @@ void summary_unmark(SummaryView *summaryview) GtkCTree *ctree = GTK_CTREE(summaryview->ctree); GList *cur; - for (cur = GTK_CLIST(ctree)->selection; cur != NULL; - cur = cur->next) + for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next) summary_unmark_row(summaryview, GTK_CTREE_NODE(cur->data)); summary_status_show(summaryview); @@ -2938,6 +2959,8 @@ static void summary_move_row_to(SummaryView *summaryview, GtkCTreeNode *row, msginfo->to_folder->op_count--; } MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED | MSG_DELETED); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_unset_perm_flags(msginfo, MSG_MARKED); MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_COPY); if (!MSG_IS_MOVE(msginfo->flags)) { MSG_SET_TMP_FLAGS(msginfo->flags, MSG_MOVE); @@ -3027,6 +3050,8 @@ static void summary_copy_row_to(SummaryView *summaryview, GtkCTreeNode *row, msginfo->to_folder->op_count--; } MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED | MSG_DELETED); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_unset_perm_flags(msginfo, MSG_MARKED); MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE); if (!MSG_IS_COPY(msginfo->flags)) { MSG_SET_TMP_FLAGS(msginfo->flags, MSG_COPY); @@ -4343,6 +4368,8 @@ static void summary_selected(GtkCTree *ctree, GtkCTreeNode *row, case S_COL_MARK: if (MSG_IS_MARKED(msginfo->flags)) { MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_unset_perm_flags(msginfo, MSG_MARKED); CHANGE_FLAGS(msginfo); summary_set_row_marks(summaryview, row); } else diff --git a/src/utils.h b/src/utils.h index 1d3729fec..3a65b15b6 100644 --- a/src/utils.h +++ b/src/utils.h @@ -111,16 +111,19 @@ ptr = __tmp; \ } -#define Xstrconcat_a(ptr, str1, str2, iffail) \ +#define Xstrcat_a(ptr, str1, str2, iffail) \ { \ gchar *__tmp; \ + gint len1, len2; \ \ - if ((__tmp = alloca(strlen(str1) + strlen(str2) + 1)) == NULL) { \ + len1 = strlen(str1); \ + len2 = strlen(str2); \ + if ((__tmp = alloca(len1 + len2 + 1)) == NULL) { \ g_warning("can't allocate memory\n"); \ iffail; \ } else { \ - strcpy(__tmp, str1); \ - strcat(__tmp, str2); \ + memcpy(__tmp, str1, len1); \ + memcpy(__tmp + len1, str2, len2 + 1); \ } \ \ ptr = __tmp; \ -- 2.25.1