/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws Team
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Claws Mail Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
int yylex(void);
static MsgInfo *msginfo = NULL;
+static PrefsAccount *account = NULL;
static gboolean *visible = NULL;
static gboolean dry_run = FALSE;
static gint maxsize = 0;
{
if (current->buffer)
*current->buffer = '\0';
+ else
+ /* force to an empty string, as buffer should not be left unallocated */
+ add_buffer("");
current->bufsize = 0;
}
add_buffer(tmp); \
}
+void quote_fmt_reset_vartable(void)
+{
+ if (var_table) {
+ g_hash_table_destroy(var_table);
+ var_table = NULL;
+ }
+}
+
void quote_fmt_init(MsgInfo *info, const gchar *my_quote_str,
- const gchar *my_body, gboolean my_dry_run)
+ const gchar *my_body, gboolean my_dry_run,
+ PrefsAccount *compose_account)
{
quote_str = my_quote_str;
body = my_body;
msginfo = info;
+ account = compose_account;
dry_run = my_dry_run;
stacksize = 0;
add_visibility(TRUE);
current = &main_expr;
clear_buffer();
error = 0;
- if (var_table) {
- g_hash_table_destroy(var_table);
- var_table = NULL;
- }
- var_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+
+ if (!var_table)
+ var_table = g_hash_table_new_full(g_str_hash, g_str_equal,
+ g_free, g_free);
/*
* force LEX initialization
char str[256];
}
+/* tokens SHOW */
%token SHOW_NEWSGROUPS
%token SHOW_DATE SHOW_FROM SHOW_FULLNAME SHOW_FIRST_NAME SHOW_LAST_NAME
%token SHOW_SENDER_INITIAL SHOW_SUBJECT SHOW_TO SHOW_MESSAGEID
%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_EXCLAMATION_MARK SHOW_PIPE SHOW_OPARENT SHOW_CPARENT
+%token SHOW_ACCOUNT_FULL_NAME SHOW_ACCOUNT_MAIL_ADDRESS SHOW_ACCOUNT_NAME SHOW_ACCOUNT_ORGANIZATION
+/* tokens QUERY */
%token QUERY_DATE QUERY_FROM
%token QUERY_FULLNAME QUERY_SUBJECT QUERY_TO QUERY_NEWSGROUPS
%token QUERY_MESSAGEID QUERY_CC QUERY_REFERENCES
+%token QUERY_ACCOUNT_FULL_NAME QUERY_ACCOUNT_ORGANIZATION
+/* tokens QUERY_NOT */
%token QUERY_NOT_DATE QUERY_NOT_FROM
%token QUERY_NOT_FULLNAME QUERY_NOT_SUBJECT QUERY_NOT_TO QUERY_NOT_NEWSGROUPS
%token QUERY_NOT_MESSAGEID QUERY_NOT_CC QUERY_NOT_REFERENCES
+%token QUERY_NOT_ACCOUNT_FULL_NAME QUERY_NOT_ACCOUNT_ORGANIZATION
+/* other tokens */
%token INSERT_FILE INSERT_PROGRAMOUTPUT INSERT_USERINPUT
%token OPARENT CPARENT
%token CHARACTER
{
quote_fmt_show_msg(msginfo, body, TRUE, FALSE, quote_str);
}
+ | SHOW_ACCOUNT_FULL_NAME
+ {
+ if (account && account->name)
+ INSERT(account->name);
+ }
+ | SHOW_ACCOUNT_MAIL_ADDRESS
+ {
+ if (account && account->address)
+ INSERT(account->address);
+ }
+ | SHOW_ACCOUNT_NAME
+ {
+ if (account && account->account_name)
+ INSERT(account->account_name);
+ }
+ | SHOW_ACCOUNT_ORGANIZATION
+ {
+ if (account && account->organization)
+ INSERT(account->organization);
+ }
| SHOW_BACKSLASH
{
INSERT("\\");
add_visibility(found == TRUE);
}
OPARENT quote_fmt CPARENT
+ {
+ remove_visibility();
+ }
+ | QUERY_ACCOUNT_FULL_NAME
+ {
+ add_visibility(account != NULL && account->name != NULL);
+ }
+ OPARENT quote_fmt CPARENT
+ {
+ remove_visibility();
+ }
+ | QUERY_ACCOUNT_ORGANIZATION
+ {
+ add_visibility(account != NULL && account->organization != NULL);
+ }
+ OPARENT quote_fmt CPARENT
{
remove_visibility();
};
add_visibility(found == FALSE);
}
OPARENT quote_fmt CPARENT
+ {
+ remove_visibility();
+ }
+ | QUERY_NOT_ACCOUNT_FULL_NAME
+ {
+ add_visibility(account == NULL || account->name == NULL);
+ }
+ OPARENT quote_fmt CPARENT
+ {
+ remove_visibility();
+ }
+ | QUERY_NOT_ACCOUNT_ORGANIZATION
+ {
+ add_visibility(account == NULL || account->organization == NULL);
+ }
+ OPARENT quote_fmt CPARENT
{
remove_visibility();
};