2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include <glib/gi18n.h>
30 #include <sys/types.h>
37 #include "procheader.h"
38 #include "addr_compl.h"
39 #include "gtk/inputdialog.h"
41 #include "quote_fmt.h"
42 #include "quote_fmt_lex.h"
44 #include "file-utils.h"
49 bison -p quote_fmt quote_fmt.y
54 static MsgInfo *msginfo = NULL;
55 static PrefsAccount *account = NULL;
57 static gchar default_dictionary[BUFFSIZE];
59 static gboolean *visible = NULL;
60 static gboolean dry_run = FALSE;
61 static gint maxsize = 0;
62 static gint stacksize = 0;
63 static GHashTable *var_table = NULL;
64 static GList *attachments = NULL;
66 typedef struct st_buffer
73 static struct st_buffer main_expr = { NULL, 0, 0 };
74 static struct st_buffer sub_expr = { NULL, 0, 0 };
75 static struct st_buffer* current = NULL;
77 static const gchar *quote_str = NULL;
78 static const gchar *body = NULL;
79 static gint error = 0;
81 static gint cursor_pos = -1;
83 extern int quote_fmt_firsttime;
85 extern int escaped_string;
87 static void add_visibility(gboolean val)
90 if (maxsize < stacksize) {
92 visible = g_realloc(visible, maxsize * sizeof(gboolean));
97 visible[stacksize - 1] = val;
100 static void remove_visibility(void)
104 g_warning("Error: visibility stack underflow");
109 static void add_buffer(const gchar *s)
117 if (current->bufsize + len + 1 > current->bufmax) {
118 if (current->bufmax == 0)
119 current->bufmax = 128;
120 while (current->bufsize + len + 1 > current->bufmax)
121 current->bufmax *= 2;
122 current->buffer = g_realloc(current->buffer, current->bufmax);
124 strcpy(current->buffer + current->bufsize, s);
125 current->bufsize += len;
128 static void clear_buffer(void)
131 *current->buffer = '\0';
133 /* force to an empty string, as buffer should not be left unallocated */
135 current->bufsize = 0;
138 gchar *quote_fmt_get_buffer(void)
140 if (current != &main_expr)
141 g_warning("Error: parser still in sub-expr mode");
146 return current->buffer;
149 GList *quote_fmt_get_attachments_list(void)
154 gint quote_fmt_get_line(void)
159 gint quote_fmt_get_cursor_pos(void)
164 #define INSERT(buf) \
165 if (stacksize != 0 && visible[stacksize - 1])\
168 #define INSERT_CHARACTER(chr) \
169 if (stacksize != 0 && visible[stacksize - 1]) { \
176 void quote_fmt_reset_vartable(void)
179 g_hash_table_destroy(var_table);
183 GList *cur = attachments;
186 cur = g_list_next(cur);
188 g_list_free(attachments);
194 void quote_fmt_init(MsgInfo *info, const gchar *my_quote_str,
195 const gchar *my_body, gboolean my_dry_run,
196 PrefsAccount *compose_account,
197 gboolean string_is_escaped,
198 GtkAspell *compose_gtkaspell)
200 void quote_fmt_init(MsgInfo *info, const gchar *my_quote_str,
201 const gchar *my_body, gboolean my_dry_run,
202 PrefsAccount *compose_account,
203 gboolean string_is_escaped)
206 quote_str = my_quote_str;
209 account = compose_account;
211 gchar *dict = gtkaspell_get_default_dictionary(compose_gtkaspell);
213 strncpy2(default_dictionary, dict, sizeof(default_dictionary));
215 *default_dictionary = '\0';
217 dry_run = my_dry_run;
219 add_visibility(TRUE);
220 main_expr.bufmax = 0;
222 current = &main_expr;
226 escaped_string = string_is_escaped;
229 var_table = g_hash_table_new_full(g_str_hash, g_str_equal,
233 * force LEX initialization
235 quote_fmt_firsttime = 1;
239 void quote_fmterror(char *str)
241 g_warning("Error: %s at line %d", str, line);
245 int quote_fmtwrap(void)
250 static int isseparator(int ch)
252 return g_ascii_isspace(ch) || ch == '.' || ch == '-';
256 * Search for glibc extended strftime timezone specs within haystack.
257 * If not found NULL is returned and the integer pointed by tzspeclen is
259 * If found a pointer to the start of the specification within haystack
260 * is returned and the integer pointed by tzspeclen is set to the lenght
263 static const char* strtzspec(const char *haystack, int *tzspeclen)
265 const char *p = NULL;
266 const char *q = NULL;
267 const char *r = NULL;
269 p = strstr(haystack, "%");
272 if (!*q) return NULL;
273 r = strchr("_-0^#", *q); /* skip flags */
276 if (!*q) return NULL;
278 while (*q >= '0' && *q <= '9') ++q; /* skip width */
279 if (!*q) return NULL;
280 if (*q == 'z' || *q == 'Z') { /* numeric or name */
281 *tzspeclen = 1 + (q - p);
289 static void quote_fmt_show_date(const MsgInfo *msginfo, const gchar *format)
302 * ALF - GNU C's strftime() has a nice format specifier
303 * for time zone offset (%z). Non-standard however, so
307 #define RLEFT (sizeof result) - (rptr - result)
311 if (procheader_date_parse_to_tm(msginfo->date, <, zone)) {
313 * break up format string in tiny bits delimited by valid %z's and
314 * feed it to strftime(). don't forget that '%%z' mean literal '%z'.
316 for (rptr = result, fptr = format; fptr && *fptr && rptr < &result[sizeof result - 1];) {
321 if (NULL != (zptr = strtzspec(fptr, &zlen))) {
323 * count nr. of prepended percent chars
325 for (perc = 0, p = zptr; p && p >= format && *p == '%'; p--, perc++)
330 tmp = g_strndup(fptr, zptr - fptr + (perc % 2 ? 0 : zlen));
332 rptr += strftime(rptr, RLEFT, tmp, <);
336 * append time zone offset
338 if (zone[0] && perc % 2)
339 rptr += g_snprintf(rptr, RLEFT, "%s", zone);
342 rptr += strftime(rptr, RLEFT, fptr, <);
347 if (g_utf8_validate(result, -1, NULL)) {
350 gchar *utf = conv_codeset_strdup(result,
351 conv_get_locale_charset_str_no_utf8(),
354 !g_utf8_validate(utf, -1, NULL)) {
356 utf = g_malloc(strlen(result)*2+1);
357 conv_localetodisp(utf,
358 strlen(result)*2+1, result);
360 if (g_utf8_validate(utf, -1, NULL)) {
369 static void quote_fmt_show_first_name(const MsgInfo *msginfo)
374 if (!msginfo->fromname)
377 p = (guchar*)strchr(msginfo->fromname, ',');
379 /* fromname is like "Duck, Donald" */
381 while (*p && isspace(*p)) p++;
382 str = alloca(strlen((char *)p) + 1);
384 strcpy(str, (char *)p);
388 /* fromname is like "Donald Duck" */
389 str = alloca(strlen(msginfo->fromname) + 1);
391 strcpy(str, msginfo->fromname);
393 while (*p && !isspace(*p)) p++;
400 static void quote_fmt_show_last_name(const MsgInfo *msginfo)
405 /* This probably won't work together very well with Middle
406 names and the like - thth */
407 if (!msginfo->fromname)
410 str = alloca(strlen(msginfo->fromname) + 1);
412 strcpy(str, msginfo->fromname);
413 p = strchr(str, ',');
415 /* fromname is like "Duck, Donald" */
419 /* fromname is like "Donald Duck" */
421 while (*p && !isspace(*p)) p++;
423 /* We found a space. Get first
424 none-space char and insert
425 rest of string from there. */
426 while (*p && isspace(*p)) p++;
430 /* If there is no none-space
431 char, just insert whole
436 /* If there is no space, just
437 insert whole fromname. */
444 static void quote_fmt_show_sender_initial(const MsgInfo *msginfo)
446 #define MAX_SENDER_INITIAL 20
447 gchar tmp[MAX_SENDER_INITIAL];
452 if (!msginfo->fromname)
455 p = (guchar *)msginfo->fromname;
458 if (*p && g_utf8_validate((gchar *)p, 1, NULL)) {
462 if (len >= MAX_SENDER_INITIAL - 1)
466 while (*p && !isseparator(*p)) p++;
467 while (*p && isseparator(*p)) p++;
473 static void quote_fmt_show_msg(MsgInfo *msginfo, const gchar *body,
474 gboolean quoted, gboolean signature,
475 const gchar *quote_str)
480 if (!(msginfo->folder || body))
484 fp = str_open_as_stream(body);
486 if (MSG_IS_ENCRYPTED(msginfo->flags))
487 fp = procmime_get_first_encrypted_text_content(msginfo);
489 fp = procmime_get_first_text_content(msginfo);
493 g_warning("Can't get text part");
495 account_sigsep_matchlist_create();
496 while (fgets(buf, sizeof(buf), fp) != NULL) {
499 if (!signature && account_sigsep_matchlist_nchar_found(buf, "%s\n"))
502 if (quoted && quote_str)
507 account_sigsep_matchlist_delete();
512 static void quote_fmt_insert_file(const gchar *filename)
515 char buffer[PATH_MAX];
517 if ((file = g_fopen(filename, "rb")) != NULL) {
518 while (fgets(buffer, sizeof(buffer), file)) {
526 static void quote_fmt_insert_program_output(const gchar *progname)
536 /* turn the command-line string into an array */
540 ret = g_shell_parse_argv (progname, &argc, &argv, &error);
542 g_error("could not parse command line from '%s'", progname);
546 if (pipe(pipefd) == -1) {
547 g_error("can't pipe - error %s", g_strerror(errno));
551 if (0 == (pid = fork())) {
553 * redirect output to write end of pipe
556 dup2(pipefd[1], STDOUT_FILENO);
557 if (-1 == execvp(argv[0], argv))
560 char buffer[BUFFSIZE];
563 waitpid(pid, NULL, 0);
568 * make it non blocking
570 if (-1 == fcntl(pipefd[0], F_SETFL, fcntl(pipefd[0], F_GETFL) | O_NONBLOCK))
571 g_warning("set to non blocking failed");
577 r = read(pipefd[0], buffer, sizeof buffer - 1);
589 static void quote_fmt_insert_user_input(const gchar *varname)
597 if ((text = g_hash_table_lookup(var_table, varname)) == NULL) {
598 buf = g_strdup_printf(_("Enter text to replace '%s'"), varname);
599 text = input_dialog(_("Enter variable"), buf, "");
603 g_hash_table_insert(var_table, g_strdup(varname), g_strdup(text));
605 /* don't free the one in hashtable at the end */
606 text = g_strdup(text);
615 static void quote_fmt_attach_file(const gchar *filename)
617 attachments = g_list_append(attachments, g_strdup(filename));
620 static void quote_fmt_attach_file_program_output(const gchar *progname)
630 /* turn the command-line string into an array */
634 ret = g_shell_parse_argv (progname, &argc, &argv, &error);
636 g_error("could not parse command line from '%s'", progname);
640 if (pipe(pipefd) == -1) {
641 g_error("can't pipe - error %s", g_strerror(errno));
645 if (0 == (pid = fork())) {
647 * redirect output to write end of pipe
650 dup2(pipefd[1], STDOUT_FILENO);
651 if (-1 == execvp(argv[0], argv))
654 char buffer[BUFFSIZE];
657 waitpid(pid, NULL, 0);
662 * make it non blocking
664 if (-1 == fcntl(pipefd[0], F_SETFL, fcntl(pipefd[0], F_GETFL) | O_NONBLOCK))
665 g_warning("set to non blocking failed");
671 r = read(pipefd[0], buffer, sizeof buffer - 1);
674 /* trim trailing CR/LF */
676 attachments = g_list_append(attachments, g_strdup(buffer));
685 static gchar *quote_fmt_complete_address(const gchar *addr)
688 gchar *res, *tmp, *email_addr;
691 debug_print("quote_fmt_complete_address: %s\n", addr);
695 /* if addr is a list of message, try the 1st element only */
696 split = g_strsplit(addr, ",", -1);
697 if (!split || !split[0] || *split[0] == '\0') {
702 Xstrdup_a(email_addr, split[0], return NULL);
703 extract_address(email_addr);
710 start_address_completion(NULL);
711 if (1 < (count = complete_address(email_addr))) {
712 tmp = get_complete_address(1);
713 res = procheader_get_fromname(tmp);
716 end_address_completion();
719 debug_print("quote_fmt_complete_address: matched %s\n", res);
731 %token SHOW_NEWSGROUPS
732 %token SHOW_DATE SHOW_FROM SHOW_FULLNAME SHOW_FIRST_NAME SHOW_LAST_NAME
733 %token SHOW_SENDER_INITIAL SHOW_SUBJECT SHOW_TO SHOW_MESSAGEID
734 %token SHOW_PERCENT SHOW_CC SHOW_REFERENCES SHOW_MESSAGE
735 %token SHOW_QUOTED_MESSAGE SHOW_BACKSLASH SHOW_TAB SHOW_MAIL_ADDRESS
736 %token SHOW_QUOTED_MESSAGE_NO_SIGNATURE SHOW_MESSAGE_NO_SIGNATURE
737 %token SHOW_EOL SHOW_QUESTION_MARK SHOW_EXCLAMATION_MARK SHOW_PIPE SHOW_OPARENT SHOW_CPARENT
738 %token SHOW_ACCOUNT_FULL_NAME SHOW_ACCOUNT_MAIL_ADDRESS SHOW_ACCOUNT_NAME SHOW_ACCOUNT_ORGANIZATION
739 %token SHOW_ACCOUNT_DICT SHOW_ACCOUNT_SIG SHOW_ACCOUNT_SIGPATH
740 %token SHOW_DICT SHOW_TAGS
741 %token SHOW_ADDRESSBOOK_COMPLETION_FOR_CC
742 %token SHOW_ADDRESSBOOK_COMPLETION_FOR_FROM
743 %token SHOW_ADDRESSBOOK_COMPLETION_FOR_TO
745 %token QUERY_DATE QUERY_FROM
746 %token QUERY_FULLNAME QUERY_SUBJECT QUERY_TO QUERY_NEWSGROUPS
747 %token QUERY_MESSAGEID QUERY_CC QUERY_REFERENCES
748 %token QUERY_ACCOUNT_FULL_NAME QUERY_ACCOUNT_ORGANIZATION QUERY_ACCOUNT_DICT
749 %token QUERY_ACCOUNT_SIG QUERY_ACCOUNT_SIGPATH
751 %token QUERY_CC_FOUND_IN_ADDRESSBOOK
752 %token QUERY_FROM_FOUND_IN_ADDRESSBOOK
753 %token QUERY_TO_FOUND_IN_ADDRESSBOOK
754 /* tokens QUERY_NOT */
755 %token QUERY_NOT_DATE QUERY_NOT_FROM
756 %token QUERY_NOT_FULLNAME QUERY_NOT_SUBJECT QUERY_NOT_TO QUERY_NOT_NEWSGROUPS
757 %token QUERY_NOT_MESSAGEID QUERY_NOT_CC QUERY_NOT_REFERENCES
758 %token QUERY_NOT_ACCOUNT_FULL_NAME QUERY_NOT_ACCOUNT_ORGANIZATION QUERY_NOT_ACCOUNT_DICT
759 %token QUERY_NOT_ACCOUNT_SIG QUERY_NOT_ACCOUNT_SIGPATH
760 %token QUERY_NOT_DICT
761 %token QUERY_NOT_CC_FOUND_IN_ADDRESSBOOK
762 %token QUERY_NOT_FROM_FOUND_IN_ADDRESSBOOK
763 %token QUERY_NOT_TO_FOUND_IN_ADDRESSBOOK
765 %token INSERT_FILE INSERT_PROGRAMOUTPUT INSERT_USERINPUT
766 %token ATTACH_FILE ATTACH_PROGRAMOUTPUT
767 %token OPARENT CPARENT
769 %token SHOW_DATE_EXPR
770 %token SET_CURSOR_POS
774 %type <chr> CHARACTER
775 %type <chr> character
781 character_or_special_or_insert_or_query_list ;
784 character_or_special_list ;
786 character_or_special_or_insert_or_query_list:
787 character_or_special_or_insert_or_query character_or_special_or_insert_or_query_list
788 | character_or_special_or_insert_or_query ;
790 character_or_special_list:
791 character_or_special character_or_special_list
792 | character_or_special ;
794 character_or_special_or_insert_or_query:
801 character_or_special:
805 INSERT_CHARACTER($1);
822 strncpy($$, $1, sizeof($$));
823 $$[sizeof($$) - 1] = '\0';
825 if (len + 1 < sizeof($$)) {
834 if (msginfo->newsgroups)
835 INSERT(msginfo->newsgroups);
837 | SHOW_DATE_EXPR OPARENT string CPARENT
839 quote_fmt_show_date(msginfo, $3);
844 INSERT(msginfo->date);
849 INSERT(msginfo->from);
854 gchar *stripped_address = g_strdup(msginfo->from);
855 extract_address(stripped_address);
856 INSERT(stripped_address);
857 g_free(stripped_address);
862 if (msginfo->fromname)
863 INSERT(msginfo->fromname);
867 quote_fmt_show_first_name(msginfo);
871 quote_fmt_show_last_name(msginfo);
873 | SHOW_SENDER_INITIAL
875 quote_fmt_show_sender_initial(msginfo);
879 if (msginfo->subject)
880 INSERT(msginfo->subject);
890 INSERT(msginfo->msgid);
905 INSERT(msginfo->inreplyto);
906 for (item = msginfo->references; item != NULL; item = g_slist_next(item))
912 quote_fmt_show_msg(msginfo, body, FALSE, TRUE, quote_str);
914 | SHOW_QUOTED_MESSAGE
916 quote_fmt_show_msg(msginfo, body, TRUE, TRUE, quote_str);
918 | SHOW_MESSAGE_NO_SIGNATURE
920 quote_fmt_show_msg(msginfo, body, FALSE, FALSE, quote_str);
922 | SHOW_QUOTED_MESSAGE_NO_SIGNATURE
924 quote_fmt_show_msg(msginfo, body, TRUE, FALSE, quote_str);
926 | SHOW_ACCOUNT_FULL_NAME
928 if (account && account->name)
929 INSERT(account->name);
931 | SHOW_ACCOUNT_MAIL_ADDRESS
933 if (account && account->address)
934 INSERT(account->address);
938 if (account && account->account_name)
939 INSERT(account->account_name);
941 | SHOW_ACCOUNT_ORGANIZATION
943 if (account && account->organization)
944 INSERT(account->organization);
948 gchar *str = account_get_signature_str(account);
952 | SHOW_ACCOUNT_SIGPATH
954 if (account && account->sig_path)
955 INSERT(account->sig_path);
960 if (account && account->enable_default_dictionary) {
961 gchar *dictname = g_path_get_basename(account->default_dictionary);
970 INSERT(default_dictionary);
975 gchar *tags = procmsg_msginfo_get_tags_str(msginfo);
997 | SHOW_EXCLAMATION_MARK
1015 if (current->buffer)
1016 cursor_pos = g_utf8_strlen(current->buffer, -1);
1020 | SHOW_ADDRESSBOOK_COMPLETION_FOR_CC
1022 gchar *tmp = quote_fmt_complete_address(msginfo->cc);
1028 | SHOW_ADDRESSBOOK_COMPLETION_FOR_FROM
1030 gchar *tmp = quote_fmt_complete_address(msginfo->from);
1036 | SHOW_ADDRESSBOOK_COMPLETION_FOR_TO
1038 gchar *tmp = quote_fmt_complete_address(msginfo->to);
1048 add_visibility(msginfo->date != NULL);
1050 OPARENT quote_fmt CPARENT
1052 remove_visibility();
1056 add_visibility(msginfo->from != NULL);
1058 OPARENT quote_fmt CPARENT
1060 remove_visibility();
1064 add_visibility(msginfo->fromname != NULL);
1066 OPARENT quote_fmt CPARENT
1068 remove_visibility();
1072 add_visibility(msginfo->subject != NULL);
1074 OPARENT quote_fmt CPARENT
1076 remove_visibility();
1080 add_visibility(msginfo->to != NULL);
1082 OPARENT quote_fmt CPARENT
1084 remove_visibility();
1088 add_visibility(msginfo->newsgroups != NULL);
1090 OPARENT quote_fmt CPARENT
1092 remove_visibility();
1096 add_visibility(msginfo->msgid != NULL);
1098 OPARENT quote_fmt CPARENT
1100 remove_visibility();
1104 add_visibility(msginfo->cc != NULL);
1106 OPARENT quote_fmt CPARENT
1108 remove_visibility();
1115 found = (msginfo->inreplyto != NULL);
1116 for (item = msginfo->references; found == FALSE && item != NULL; item = g_slist_next(item))
1119 add_visibility(found == TRUE);
1121 OPARENT quote_fmt CPARENT
1123 remove_visibility();
1125 | QUERY_ACCOUNT_FULL_NAME
1127 add_visibility(account != NULL && account->name != NULL);
1129 OPARENT quote_fmt CPARENT
1131 remove_visibility();
1133 | QUERY_ACCOUNT_ORGANIZATION
1135 add_visibility(account != NULL && account->organization != NULL);
1137 OPARENT quote_fmt CPARENT
1139 remove_visibility();
1143 gchar *str = account_get_signature_str(account);
1144 add_visibility(str != NULL && * str != '\0');
1147 OPARENT quote_fmt CPARENT
1149 remove_visibility();
1151 | QUERY_ACCOUNT_SIGPATH
1153 add_visibility(account != NULL && account->sig_path != NULL
1154 && *account->sig_path != '\0');
1156 OPARENT quote_fmt CPARENT
1158 remove_visibility();
1160 | QUERY_ACCOUNT_DICT
1163 add_visibility(account != NULL && account->enable_default_dictionary == TRUE &&
1164 account->default_dictionary != NULL && *account->default_dictionary != '\0');
1166 add_visibility(FALSE);
1169 OPARENT quote_fmt CPARENT
1171 remove_visibility();
1176 add_visibility(*default_dictionary != '\0');
1178 add_visibility(FALSE);
1181 OPARENT quote_fmt CPARENT
1183 remove_visibility();
1185 | QUERY_CC_FOUND_IN_ADDRESSBOOK
1187 gchar *tmp = quote_fmt_complete_address(msginfo->cc);
1188 add_visibility(tmp != NULL && *tmp != '\0');
1191 OPARENT quote_fmt CPARENT
1193 remove_visibility();
1195 | QUERY_FROM_FOUND_IN_ADDRESSBOOK
1197 gchar *tmp = quote_fmt_complete_address(msginfo->from);
1198 add_visibility(tmp != NULL && *tmp != '\0');
1201 OPARENT quote_fmt CPARENT
1203 remove_visibility();
1205 | QUERY_TO_FOUND_IN_ADDRESSBOOK
1207 gchar *tmp = quote_fmt_complete_address(msginfo->to);
1208 add_visibility(tmp != NULL && *tmp != '\0');
1211 OPARENT quote_fmt CPARENT
1213 remove_visibility();
1219 add_visibility(msginfo->date == NULL);
1221 OPARENT quote_fmt CPARENT
1223 remove_visibility();
1227 add_visibility(msginfo->from == NULL);
1229 OPARENT quote_fmt CPARENT
1231 remove_visibility();
1233 | QUERY_NOT_FULLNAME
1235 add_visibility(msginfo->fromname == NULL);
1237 OPARENT quote_fmt CPARENT
1239 remove_visibility();
1243 add_visibility(msginfo->subject == NULL);
1245 OPARENT quote_fmt CPARENT
1247 remove_visibility();
1251 add_visibility(msginfo->to == NULL);
1253 OPARENT quote_fmt CPARENT
1255 remove_visibility();
1257 | QUERY_NOT_NEWSGROUPS
1259 add_visibility(msginfo->newsgroups == NULL);
1261 OPARENT quote_fmt CPARENT
1263 remove_visibility();
1265 | QUERY_NOT_MESSAGEID
1267 add_visibility(msginfo->msgid == NULL);
1269 OPARENT quote_fmt CPARENT
1271 remove_visibility();
1275 add_visibility(msginfo->cc == NULL);
1277 OPARENT quote_fmt CPARENT
1279 remove_visibility();
1281 | QUERY_NOT_REFERENCES
1286 found = (msginfo->inreplyto != NULL);
1287 for (item = msginfo->references; found == FALSE && item != NULL; item = g_slist_next(item))
1290 add_visibility(found == FALSE);
1292 OPARENT quote_fmt CPARENT
1294 remove_visibility();
1296 | QUERY_NOT_ACCOUNT_FULL_NAME
1298 add_visibility(account == NULL || account->name == NULL);
1300 OPARENT quote_fmt CPARENT
1302 remove_visibility();
1304 | QUERY_NOT_ACCOUNT_ORGANIZATION
1306 add_visibility(account == NULL || account->organization == NULL);
1308 OPARENT quote_fmt CPARENT
1310 remove_visibility();
1312 | QUERY_NOT_ACCOUNT_SIG
1314 gchar *str = account_get_signature_str(account);
1315 add_visibility(str == NULL || *str == '\0');
1318 OPARENT quote_fmt CPARENT
1320 remove_visibility();
1322 | QUERY_NOT_ACCOUNT_SIGPATH
1324 add_visibility(account == NULL || account->sig_path == NULL
1325 || *account->sig_path == '\0');
1327 OPARENT quote_fmt CPARENT
1329 remove_visibility();
1331 | QUERY_NOT_ACCOUNT_DICT
1334 add_visibility(account == NULL || account->enable_default_dictionary == FALSE
1335 || *account->default_dictionary == '\0');
1337 add_visibility(FALSE);
1340 OPARENT quote_fmt CPARENT
1342 remove_visibility();
1347 add_visibility(*default_dictionary == '\0');
1349 add_visibility(FALSE);
1352 OPARENT quote_fmt CPARENT
1354 remove_visibility();
1356 | QUERY_NOT_CC_FOUND_IN_ADDRESSBOOK
1358 gchar *tmp = quote_fmt_complete_address(msginfo->cc);
1359 add_visibility(tmp == NULL || *tmp == '\0');
1362 OPARENT quote_fmt CPARENT
1364 remove_visibility();
1366 | QUERY_NOT_FROM_FOUND_IN_ADDRESSBOOK
1368 gchar *tmp = quote_fmt_complete_address(msginfo->from);
1369 add_visibility(tmp == NULL || *tmp == '\0');
1372 OPARENT quote_fmt CPARENT
1374 remove_visibility();
1376 | QUERY_NOT_TO_FOUND_IN_ADDRESSBOOK
1378 gchar *tmp = quote_fmt_complete_address(msginfo->to);
1379 add_visibility(tmp == NULL || *tmp == '\0');
1382 OPARENT quote_fmt CPARENT
1384 remove_visibility();
1390 current = &sub_expr;
1393 OPARENT sub_expr CPARENT
1395 current = &main_expr;
1397 quote_fmt_insert_file(sub_expr.buffer);
1400 | INSERT_PROGRAMOUTPUT
1402 current = &sub_expr;
1405 OPARENT sub_expr CPARENT
1407 current = &main_expr;
1409 quote_fmt_insert_program_output(sub_expr.buffer);
1414 current = &sub_expr;
1417 OPARENT sub_expr CPARENT
1419 current = &main_expr;
1421 quote_fmt_insert_user_input(sub_expr.buffer);
1428 current = &sub_expr;
1431 OPARENT sub_expr CPARENT
1433 current = &main_expr;
1435 quote_fmt_attach_file(sub_expr.buffer);
1438 | ATTACH_PROGRAMOUTPUT
1440 current = &sub_expr;
1443 OPARENT sub_expr CPARENT
1445 current = &main_expr;
1447 quote_fmt_attach_file_program_output(sub_expr.buffer);