added ylwrap to .cvsignore

fixed gpg signing and encodin
added --status option to get new, unread and total message count from a running sylpheed
temporary fix for reply_with_quote problem (don't call functions for non existing widget)
one more check for ignored threads
This commit is contained in:
Christoph Hohmann 2001-11-23 15:58:59 +00:00
parent e6e2ad49f5
commit 0d249e3c40
9 changed files with 165 additions and 46 deletions

View file

@ -1,3 +1,21 @@
2001-11-23 [christoph] 0.6.5claws29
* src/.cvsignore
added ylwrap
* src/compose.c
fixed gpg signing and encoding
* src/folder.[ch]
* src/main.c
added --status option to get new, unread and total
message count from a running sylpheed
* src/prefs_common.c
temporary fix for reply_with_quote problem
(don't call functions for non existing widget)
* src/procmsg.c
one more check for ignored threads but still not
always working correctly. probably a recursive
check for all parents is needed
2001-11-23 [darko] 0.6.5claws28
* src/compose.c
@ -149,6 +167,7 @@
2001-11-13 [christoph] 0.6.5claws11
* src/compose.c
Cleanup a mess i add before commiting
2001-11-13 [hoa] 0.6.5claws10

View file

@ -8,7 +8,7 @@ MINOR_VERSION=6
MICRO_VERSION=5
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=claws28
EXTRA_VERSION=claws29
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl

View file

@ -13,3 +13,4 @@ matcher_parser_lex.c
matcher_parser_parse.c
matcher_parser_parse.h
version.h
ylwrap

View file

@ -2840,7 +2840,7 @@ static gint compose_bounce_write_to_file(Compose *compose, const gchar *file)
return -1;
}
if ((fdest = fopen(file, "a+")) == NULL) {
if ((fdest = fopen(file, "w")) == NULL) {
FILE_OP_ERROR(file, "fopen");
fclose(fp);
return -1;
@ -2893,7 +2893,7 @@ static gint compose_write_to_file(Compose *compose, const gchar *file,
const gchar *out_codeset;
EncodingType encoding;
if ((fp = fopen(file, "a+")) == NULL) {
if ((fp = fopen(file, "w")) == NULL) {
FILE_OP_ERROR(file, "fopen");
return -1;
}
@ -3117,7 +3117,7 @@ static gint compose_remove_reedit_target(Compose *compose)
static gint compose_queue(Compose *compose, gint *msgnum, FolderItem **item)
{
FolderItem *queue;
gchar *tmpfilename, *queue_path;
gchar *tmp, *tmp2, *queue_path;
FILE *fp, *src_fp;
GSList *cur;
gchar buf[BUFFSIZE];
@ -3143,22 +3143,6 @@ static gint compose_queue(Compose *compose, gint *msgnum, FolderItem **item)
return -1;
}
if (prefs_common.linewrap_at_send)
compose_wrap_line_all(compose);
/* write to temporary file */
tmpfilename = g_strdup_printf("%s%cqueue.%d", g_get_tmp_dir(),
G_DIR_SEPARATOR, (gint)compose);
if ((fp = fopen(tmpfilename, "w")) == NULL) {
FILE_OP_ERROR(tmpfilename, "fopen");
g_free(tmpfilename);
return -1;
}
if (change_file_mode_rw(fp, tmpfilename) < 0) {
FILE_OP_ERROR(tmpfilename, "chmod");
g_warning(_("can't change file mode\n"));
}
if(compose->to_list) {
if (compose->account->protocol != A_NNTP)
mailac = compose->account;
@ -3167,7 +3151,6 @@ static gint compose_queue(Compose *compose, gint *msgnum, FolderItem **item)
else if (cur_account && cur_account->protocol != A_NNTP)
mailac = cur_account;
else if (!(mailac = compose_current_mail_account())) {
unlink(tmpfilename);
lock = FALSE;
alertpanel_error(_("No account for sending mails available!"));
return -1;
@ -3178,13 +3161,56 @@ static gint compose_queue(Compose *compose, gint *msgnum, FolderItem **item)
if (compose->account->protocol == A_NNTP)
newsac = compose->account;
else if(!(newsac = compose->orig_account) || (newsac->protocol != A_NNTP)) {
unlink(tmpfilename);
lock = FALSE;
alertpanel_error(_("No account for posting news available!"));
return -1;
}
}
if (prefs_common.linewrap_at_send)
compose_wrap_line_all(compose);
/* write to temporary file */
tmp2 = g_strdup_printf("%s%ctmp%d", g_get_tmp_dir(),
G_DIR_SEPARATOR, (gint)compose);
if (compose->bounce_filename != NULL) {
if (compose_bounce_write_to_file(compose, tmp2) < 0) {
unlink(tmp2);
lock = FALSE;
return -1;
}
}
else {
if (compose_write_to_file(compose, tmp2, FALSE) < 0) {
unlink(tmp2);
lock = FALSE;
return -1;
}
}
/* add queue header */
tmp = g_strdup_printf("%s%cqueue.%d", g_get_tmp_dir(),
G_DIR_SEPARATOR, (gint)compose);
if ((fp = fopen(tmp, "w")) == NULL) {
FILE_OP_ERROR(tmp, "fopen");
g_free(tmp);
return -1;
}
if ((src_fp = fopen(tmp2, "r")) == NULL) {
FILE_OP_ERROR(tmp2, "fopen");
fclose(fp);
unlink(tmp);
g_free(tmp);
unlink(tmp2);
g_free(tmp2);
return -1;
}
if (change_file_mode_rw(fp, tmp) < 0) {
FILE_OP_ERROR(tmp, "chmod");
g_warning(_("can't change file mode\n"));
}
/* queueing variables */
fprintf(fp, "AF:\n");
fprintf(fp, "NF:0\n");
@ -3233,21 +3259,27 @@ static gint compose_queue(Compose *compose, gint *msgnum, FolderItem **item)
fprintf(fp, "NAID:%d\n", newsac->account_id);
}
fprintf(fp, "\n");
fclose(fp);
if (compose->bounce_filename != NULL) {
if (compose_bounce_write_to_file(compose, tmpfilename) < 0) {
unlink(tmpfilename);
lock = FALSE;
while (fgets(buf, sizeof(buf), src_fp) != NULL) {
if (fputs(buf, fp) == EOF) {
FILE_OP_ERROR(tmp, "fputs");
fclose(fp);
fclose(src_fp);
unlink(tmp);
g_free(tmp);
unlink(tmp2);
g_free(tmp2);
return -1;
}
}
else {
if (compose_write_to_file(compose, tmpfilename, FALSE) < 0) {
unlink(tmpfilename);
lock = FALSE;
return -1;
}
fclose(src_fp);
if (fclose(fp) == EOF) {
FILE_OP_ERROR(tmp, "fclose");
unlink(tmp);
g_free(tmp);
unlink(tmp2);
g_free(tmp2);
return -1;
}
/* queue message */
@ -3257,14 +3289,17 @@ static gint compose_queue(Compose *compose, gint *msgnum, FolderItem **item)
queue_path = folder_item_get_path(queue);
if (!is_dir_exist(queue_path))
make_dir_hier(queue_path);
if ((num = folder_item_add_msg(queue, tmpfilename, TRUE)) < 0) {
if ((num = folder_item_add_msg(queue, tmp, TRUE)) < 0) {
g_warning(_("can't queue the message\n"));
unlink(tmpfilename);
g_free(tmpfilename);
unlink(tmp);
g_free(tmp);
g_free(queue_path);
return -1;
}
g_free(tmpfilename);
unlink(tmp);
g_free(tmp);
unlink(tmp2);
g_free(tmp2);
if (compose->mode == COMPOSE_REEDIT) {
compose_remove_reedit_target(compose);

View file

@ -1499,3 +1499,41 @@ FolderItem * folder_find_item_from_identifier(const gchar *identifier)
folder_item_find_func, d);
return d[1];
}
static void folder_count_total_newmsgs_func(const GNode *node, guint *newmsgs,
guint *unreadmsgs, guint *totalmsgs)
{
if (node->data) {
FolderItem *item = node->data;
*newmsgs += item->new;
*unreadmsgs += item->unread;
*totalmsgs += item->total;
}
if (node->children)
folder_count_total_newmsgs_func(node->children, newmsgs, unreadmsgs, totalmsgs);
if (node->next)
folder_count_total_newmsgs_func(node->next, newmsgs, unreadmsgs, totalmsgs);
}
void folder_count_total_msgs(guint *newmsgs, guint *unreadmsgs, guint *totalmsgs)
{
GList *list;
Folder *folder;
*newmsgs = 0;
*unreadmsgs = 0;
*totalmsgs = 0;
debug_print(_("Counting total number of messages...\n"));
list = folder_get_list();
for (; list != NULL; list = list->next) {
folder = FOLDER(list->data);
if (folder->node)
folder_count_total_newmsgs_func(folder->node, newmsgs, unreadmsgs, totalmsgs);
}
debug_print(_(" New: %d\n"), *newmsgs);
debug_print(_(" Unread: %d\n"), *unreadmsgs);
debug_print(_(" Total: %d\n"), *totalmsgs);
return;
}

View file

@ -262,10 +262,13 @@ void folder_tree_destroy (Folder *folder);
void folder_add (Folder *folder);
GList *folder_get_list (void);
gint folder_read_list (void);
void folder_write_list (void);
void folder_update_op_count (void);
GList *folder_get_list (void);
gint folder_read_list (void);
void folder_write_list (void);
void folder_update_op_count (void);
void folder_count_total_msgs (guint *newmsgs,
guint *unreadmsgs,
guint *totalmsgs);
Folder *folder_find_from_path (const gchar *path);
FolderItem *folder_find_item_from_path (const gchar *path);

View file

@ -93,6 +93,7 @@ static struct Cmd {
gboolean receive_all;
gboolean compose;
const gchar *compose_mailto;
gboolean status;
} cmd;
static void parse_cmd_opt(int argc, char *argv[]);
@ -194,7 +195,11 @@ int main(int argc, char *argv[])
/* check and create unix domain socket */
lock_socket = prohibit_duplicate_launch();
if (lock_socket < 0) return 0;
if (cmd.status) {
puts("0 Sylpheed not running.\n");
return 0;
}
/* backup if old rc file exists */
if (is_file_exist(RC_DIR)) {
if (rename(RC_DIR, RC_DIR ".bak") < 0)
@ -333,6 +338,8 @@ static void parse_cmd_opt(int argc, char *argv[])
} else if (!strncmp(argv[i], "--version", 9)) {
puts("Sylpheed version " VERSION);
exit(0);
} else if (!strncmp(argv[i], "--status", 5)) {
cmd.status = TRUE;
} else if (!strncmp(argv[i], "--help", 6)) {
g_print(_("Usage: %s [OPTION]...\n"),
g_basename(argv[0]));
@ -470,6 +477,12 @@ static gint prohibit_duplicate_launch(void)
fd_write(uxsock, compose_str, strlen(compose_str));
g_free(compose_str);
} else if (cmd.status) {
gchar buf[BUFFSIZE];
fd_write(uxsock, "status\n", 9);
fd_gets(uxsock, buf, sizeof(buf));
puts(buf);
} else
fd_write(uxsock, "popup\n", 6);
@ -487,7 +500,6 @@ static void lock_socket_input_cb(gpointer data,
sock = fd_accept(source);
fd_gets(sock, buf, sizeof(buf));
fd_close(sock);
if (!strncmp(buf, "popup", 5)){
main_window_popup(mainwin);
@ -499,7 +511,15 @@ static void lock_socket_input_cb(gpointer data,
inc_mail(mainwin);
} else if (!strncmp(buf, "compose", 7)) {
open_compose_new_with_recipient(buf + strlen("compose") + 1);
} else if (!strncmp(buf, "status", 6)) {
gchar buf[BUFFSIZE];
guint newmsgs, unreadmsgs, totalmsgs;
folder_count_total_msgs(&newmsgs, &unreadmsgs, &totalmsgs);
snprintf(buf, sizeof(buf), "%d %d %d\n", newmsgs, unreadmsgs, totalmsgs);
fd_write(sock, buf, strlen(buf));
}
fd_close(sock);
}
static void open_compose_new_with_recipient(const gchar *address)

View file

@ -350,8 +350,7 @@ static PrefParam param[] = {
prefs_dictionary_set_data_from_optmenu, prefs_dictionary_set_optmenu },
#endif
{"reply_with_quote", "TRUE", &prefs_common.reply_with_quote, P_BOOL,
&compose.checkbtn_quote,
prefs_set_data_from_toggle, prefs_set_toggle},
NULL, NULL, NULL},
/* Account autoselection */
{"reply_account_autoselect", "TRUE",

View file

@ -547,13 +547,13 @@ GNode *procmsg_get_thread_tree(GSList *mlist)
next = node->next;
msginfo = (MsgInfo *)node->data;
parent = NULL;
/* CLAWS: ignore thread */
if (msginfo->inreplyto)
parent = g_hash_table_lookup(msgid_table, msginfo->inreplyto);
if (parent && parent != node) {
g_node_unlink(node);
g_node_insert_before
(parent, parent->children, node);
/* CLAWS: ignore thread */
if(MSG_IS_IGNORE_THREAD(((MsgInfo *)parent->data)->flags)) {
MSG_SET_PERM_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
}
@ -584,6 +584,10 @@ GNode *procmsg_get_thread_tree(GSList *mlist)
if (parent) {
g_node_unlink(node);
g_node_append(parent, node);
/* CLAWS: ignore thread */
if(MSG_IS_IGNORE_THREAD(((MsgInfo *)parent->data)->flags)) {
MSG_SET_PERM_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
}
}
}
node = next;