From: Hoà Viêt Dinh Date: Sun, 17 Jun 2001 15:02:08 +0000 (+0000) Subject: some stuff around composing and forwarding messages X-Git-Tag: VERSION_0_5_0~83 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=b967539a5dbe294db74154dbcf2a9e5de48981fa some stuff around composing and forwarding messages --- diff --git a/ChangeLog.claws b/ChangeLog.claws index 28d8632a6..db403869d 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,22 @@ +2001-06-17 [hoa] + + * src/compose.c + forwarding use the current account. + + * src/mainwindow.c + the "compose message" button has been replaced with + "new mail" and "new news" buttons + + * src/prefs_common.[ch] + added a configuration option to use the forward button + as "forward as attachment" + changed reply and forward format description + + * src/quote_fmt_lex.l + * src/quote_fmt_parse.y + added message with no signature in format for reply + and forward. + 2001-06-17 [paul] Minor UI stuff diff --git a/src/compose.c b/src/compose.c index c9e9648f5..e319ac534 100644 --- a/src/compose.c +++ b/src/compose.c @@ -807,8 +807,11 @@ Compose * compose_forward(PrefsAccount * account, MsgInfo *msginfo, g_return_val_if_fail(msginfo->folder != NULL, NULL); if (account == NULL) { + account = cur_account; + /* account = msginfo->folder->folder->account; if (!account) account = cur_account; + */ } g_return_val_if_fail(account != NULL, NULL); diff --git a/src/mainwindow.c b/src/mainwindow.c index 31f3279bb..1e2a861eb 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -112,6 +112,10 @@ static void toolbar_send_cb (GtkWidget *widget, static void toolbar_compose_cb (GtkWidget *widget, gpointer data); +static void toolbar_compose_news_cb (GtkWidget *widget, + gpointer data); +static void toolbar_compose_mail_cb (GtkWidget *widget, + gpointer data); static void toolbar_reply_cb (GtkWidget *widget, gpointer data); static void toolbar_reply_to_all_cb (GtkWidget *widget, @@ -218,6 +222,10 @@ static void send_queue_cb (MainWindow *mainwin, static void compose_cb (MainWindow *mainwin, guint action, GtkWidget *widget); +static void compose_mail_cb(MainWindow *mainwin, guint action, + GtkWidget *widget); +static void compose_news_cb(MainWindow *mainwin, guint action, + GtkWidget *widget); static void reply_cb (MainWindow *mainwin, guint action, GtkWidget *widget); @@ -472,7 +480,8 @@ static GtkItemFactoryEntry mainwin_entries[] = {N_("/_Message/Send queued messa_ges"), NULL, send_queue_cb, 0, NULL}, {N_("/_Message/---"), NULL, NULL, 0, ""}, - {N_("/_Message/Compose _new message"), "N", compose_cb, 0, NULL}, + {N_("/_Message/Compose a _new mail"), "N", compose_mail_cb, 0, NULL}, + {N_("/_Message/Compose a news message"), NULL, compose_news_cb, 0, NULL}, {N_("/_Message/_Reply"), "R", reply_cb, COMPOSE_REPLY, NULL}, {N_("/_Message/Repl_y to sender"), "R", reply_cb, COMPOSE_REPLY_TO_SENDER, NULL}, {N_("/_Message/Reply to a_ll"), "R", reply_cb, COMPOSE_REPLY_TO_ALL, NULL}, @@ -1476,11 +1485,19 @@ static void main_window_toolbar_create(MainWindow *mainwin, CREATE_TOOLBAR_ICON(stock_mail_compose_xpm); compose_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), - _("Compose"), - _("Compose new message"), + _("New mail"), + _("Compose a new mail"), + "New", + icon_wid, + toolbar_compose_mail_cb, + mainwin); + CREATE_TOOLBAR_ICON(stock_mail_compose_xpm); + compose_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), + _("New news"), + _("Compose a news message"), "New", icon_wid, - toolbar_compose_cb, + toolbar_compose_news_cb, mainwin); CREATE_TOOLBAR_ICON(stock_mail_reply_xpm); reply_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), @@ -1622,6 +1639,22 @@ static void toolbar_compose_cb (GtkWidget *widget, compose_cb(mainwin, 0, NULL); } +static void toolbar_compose_news_cb (GtkWidget *widget, + gpointer data) +{ + MainWindow *mainwin = (MainWindow *)data; + + compose_news_cb(mainwin, 0, NULL); +} + +static void toolbar_compose_mail_cb (GtkWidget *widget, + gpointer data) +{ + MainWindow *mainwin = (MainWindow *)data; + + compose_mail_cb(mainwin, 0, NULL); +} + static void toolbar_reply_cb (GtkWidget *widget, gpointer data) { @@ -1651,7 +1684,10 @@ static void toolbar_forward_cb (GtkWidget *widget, { MainWindow *mainwin = (MainWindow *)data; - reply_cb(mainwin, COMPOSE_FORWARD, NULL); + if (prefs_common.forward_as_attachment) + reply_cb(mainwin, COMPOSE_FORWARD_AS_ATTACH, NULL); + else + reply_cb(mainwin, COMPOSE_FORWARD, NULL); } static void toolbar_delete_cb (GtkWidget *widget, @@ -1957,6 +1993,57 @@ static void compose_cb(MainWindow *mainwin, guint action, GtkWidget *widget) compose_new(NULL); } +static void compose_mail_cb(MainWindow *mainwin, guint action, + GtkWidget *widget) +{ + PrefsAccount * ac; + GList * list; + GList * cur; + + if (mainwin->summaryview->folder_item) { + ac = mainwin->summaryview->folder_item->folder->account; + if (ac && ac->protocol != A_NNTP) { + compose_new(ac); + return; + } + } + + list = account_get_list(); + for(cur = list ; cur != NULL ; cur = g_list_next(cur)) { + ac = (PrefsAccount *) cur->data; + if (ac->protocol != A_NNTP) { + compose_new(ac); + return; + } + } +} + +static void compose_news_cb(MainWindow *mainwin, guint action, + GtkWidget *widget) +{ + PrefsAccount * ac; + GList * list; + GList * cur; + + if (mainwin->summaryview->folder_item) { + ac = mainwin->summaryview->folder_item->folder->account; + if (ac && ac->protocol == A_NNTP) { + FolderItem * item = mainwin->summaryview->folder_item; + compose_new_with_recipient(ac, item->path); + return; + } + } + + list = account_get_list(); + for(cur = list ; cur != NULL ; cur = g_list_next(cur)) { + ac = (PrefsAccount *) cur->data; + if (ac->protocol == A_NNTP) { + compose_new(ac); + return; + } + } +} + static void reply_cb(MainWindow *mainwin, guint action, GtkWidget *widget) { MsgInfo *msginfo; diff --git a/src/prefs_common.c b/src/prefs_common.c index fd9578ca4..affdcb4dd 100644 --- a/src/prefs_common.c +++ b/src/prefs_common.c @@ -100,6 +100,8 @@ static struct Compose { GtkObject *spinbtn_linewrap_adj; GtkWidget *checkbtn_wrapquote; GtkWidget *checkbtn_wrapatsend; + + GtkWidget * checkbtn_forward_as_attachment; } compose; static struct Display { @@ -278,6 +280,9 @@ static PrefParam param[] = { &prefs_common.linewrap_at_send, P_BOOL, &compose.checkbtn_wrapatsend, prefs_set_data_from_toggle, prefs_set_toggle}, + {"forward_as_attachment", "FALSE", &prefs_common.forward_as_attachment, + P_BOOL, &compose.checkbtn_forward_as_attachment, + prefs_set_data_from_toggle, prefs_set_toggle}, {"show_ruler", "TRUE", &prefs_common.show_ruler, P_BOOL, NULL, NULL, NULL}, @@ -1041,6 +1046,8 @@ static void prefs_compose_create(void) GtkWidget *checkbtn_wrapquote; GtkWidget *checkbtn_wrapatsend; + GtkWidget *checkbtn_forward_as_attachment; + vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); @@ -1165,6 +1172,10 @@ static void prefs_compose_create(void) PACK_CHECK_BUTTON (hbox4, checkbtn_wrapatsend, _("Wrap before sending")); + PACK_CHECK_BUTTON (vbox1, checkbtn_forward_as_attachment, + _("Forward as attachment")); + + /* compose.checkbtn_quote = checkbtn_quote; compose.entry_quotemark = entry_quotemark; @@ -1177,6 +1188,9 @@ static void prefs_compose_create(void) compose.spinbtn_linewrap_adj = spinbtn_linewrap_adj; compose.checkbtn_wrapquote = checkbtn_wrapquote; compose.checkbtn_wrapatsend = checkbtn_wrapatsend; + + compose.checkbtn_forward_as_attachment = + checkbtn_forward_as_attachment; } static void date_format_ok_btn_clicked(GtkButton *button, GtkWidget **widget) @@ -2440,6 +2454,8 @@ static void prefs_quote_description_create(void) "\n" "%M\n" "%Q\n" + "%m\n" + "%q\n" "%%"); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); @@ -2464,6 +2480,8 @@ static void prefs_quote_description_create(void) "\n" "Message body\n" "Quoted message body\n" + "Message body without signature\n" + "Quoted message body without signature\n" "%")); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); diff --git a/src/prefs_common.h b/src/prefs_common.h index 1c191af5c..ab528c71f 100644 --- a/src/prefs_common.h +++ b/src/prefs_common.h @@ -64,6 +64,7 @@ struct _PrefsCommon gboolean show_ruler; gchar *fw_quotemark; gchar *fw_quotefmt; + gboolean forward_as_attachment; /* Display */ gchar *widgetfont; diff --git a/src/quote_fmt_lex.l b/src/quote_fmt_lex.l index 09bf36613..4216b6454 100644 --- a/src/quote_fmt_lex.l +++ b/src/quote_fmt_lex.l @@ -21,6 +21,8 @@ "%r" /* references */ return SHOW_REFERENCES; "%M" /* message */ return SHOW_MESSAGE; "%Q" /* quoted message */ return SHOW_QUOTED_MESSAGE; +"%m" /* message with no signature */ return SHOW_MESSAGE_NO_SIGNATURE; +"%q" /* quoted message with no signature */ return SHOW_QUOTED_MESSAGE_NO_SIGNATURE; "%%" /* % */ return SHOW_PERCENT; "\\\\" /* \ */ return SHOW_BACKSLASH; "\\t" /* tab */ return SHOW_TAB; diff --git a/src/quote_fmt_parse.y b/src/quote_fmt_parse.y index 873190e3e..9cde46d30 100644 --- a/src/quote_fmt_parse.y +++ b/src/quote_fmt_parse.y @@ -130,6 +130,7 @@ static int isseparator(char ch) %token SHOW_SENDER_INITIAL SHOW_SUBJECT SHOW_TO SHOW_MESSAGEID %token SHOW_PERCENT SHOW_CC SHOW_REFERENCES SHOW_MESSAGE %token SHOW_QUOTED_MESSAGE SHOW_BACKSLASH SHOW_TAB +%token SHOW_QUOTED_MESSAGE_NO_SIGNATURE SHOW_MESSAGE_NO_SIGNATURE %token SHOW_EOL SHOW_QUESTION_MARK SHOW_OPARENT SHOW_CPARENT %token QUERY_DATE QUERY_FROM %token QUERY_FULLNAME QUERY_SUBJECT QUERY_TO QUERY_NEWSGROUPS @@ -284,6 +285,36 @@ special: } fclose(fp); } + | SHOW_MESSAGE_NO_SIGNATURE + { + gchar buf[BUFFSIZE]; + FILE * fp; + + if ((fp = procmime_get_text_part(msginfo)) == NULL) + g_warning(_("Can't get text part\n")); + while (fgets(buf, sizeof(buf), fp) != NULL) { + if (strncmp(buf, "-- ", 3) == 0) + break; + INSERT(buf); + } + fclose(fp); + } + | SHOW_QUOTED_MESSAGE_NO_SIGNATURE + { + gchar buf[BUFFSIZE]; + FILE * fp; + + if ((fp = procmime_get_text_part(msginfo)) == NULL) + g_warning(_("Can't get text part\n")); + while (fgets(buf, sizeof(buf), fp) != NULL) { + if (strncmp(buf, "-- ", 3) == 0) + break; + if (quote_str) + INSERT(quote_str); + INSERT(buf); + } + fclose(fp); + } | SHOW_BACKSLASH { INSERT("\\");