2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2020 The Claws Mail Team and Hiroyuki Yamamoto
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>
33 #include "procheader.h"
34 #include "addr_compl.h"
35 #include "gtk/inputdialog.h"
37 #include "quote_fmt.h"
38 #include "quote_fmt_lex.h"
40 #include "file-utils.h"
45 bison -p quote_fmt quote_fmt.y
50 static MsgInfo
*msginfo
= NULL
;
51 static PrefsAccount
*account
= NULL
;
53 static gchar default_dictionary
[BUFFSIZE
];
55 static gboolean
*visible
= NULL
;
56 static gboolean dry_run
= FALSE
;
57 static gint maxsize
= 0;
58 static gint stacksize
= 0;
59 static GHashTable
*var_table
= NULL
;
60 static GList
*attachments
= NULL
;
62 typedef
struct st_buffer
69 static struct st_buffer main_expr
= { NULL
, 0, 0 };
70 static struct st_buffer sub_expr
= { NULL
, 0, 0 };
71 static struct st_buffer
* current
= NULL
;
73 static const gchar
*quote_str
= NULL
;
74 static const gchar
*body
= NULL
;
75 static gint
error = 0;
77 static gint cursor_pos
= -1;
79 extern
int quote_fmt_firsttime
;
81 extern
int escaped_string
;
83 static void add_visibility
(gboolean val
)
86 if
(maxsize
< stacksize
) {
88 visible
= g_realloc
(visible
, maxsize
* sizeof
(gboolean
));
93 visible
[stacksize
- 1] = val
;
96 static void remove_visibility
(void)
100 g_warning
("error: visibility stack underflow");
105 static void add_buffer
(const gchar
*s
)
113 if
(current
->bufsize
+ len
+ 1 > current
->bufmax
) {
114 if
(current
->bufmax
== 0)
115 current
->bufmax
= 128;
116 while
(current
->bufsize
+ len
+ 1 > current
->bufmax
)
117 current
->bufmax
*= 2;
118 current
->buffer
= g_realloc
(current
->buffer
, current
->bufmax
);
120 strcpy
(current
->buffer
+ current
->bufsize
, s
);
121 current
->bufsize
+= len
;
124 static void clear_buffer
(void)
127 *current
->buffer
= '\0';
129 /* force to an empty string, as buffer should not be left unallocated */
131 current
->bufsize
= 0;
134 gchar
*quote_fmt_get_buffer
(void)
136 if
(current
!= &main_expr
)
137 g_warning
("error: parser still in sub-expr mode");
142 return current
->buffer
;
145 GList
*quote_fmt_get_attachments_list
(void)
150 gint quote_fmt_get_line
(void)
155 gint quote_fmt_get_cursor_pos
(void)
160 #define INSERT(buf) \
161 if
(stacksize
!= 0 && visible
[stacksize
- 1])\
164 #define INSERT_CHARACTER(chr) \
165 if
(stacksize
!= 0 && visible
[stacksize
- 1]) { \
172 void quote_fmt_reset_vartable
(void)
175 g_hash_table_destroy
(var_table
);
179 GList
*cur
= attachments
;
182 cur
= g_list_next
(cur
);
184 g_list_free
(attachments
);
190 void quote_fmt_init
(MsgInfo
*info
, const gchar
*my_quote_str
,
191 const gchar
*my_body
, gboolean my_dry_run
,
192 PrefsAccount
*compose_account
,
193 gboolean string_is_escaped
,
194 GtkAspell
*compose_gtkaspell
)
196 void quote_fmt_init
(MsgInfo
*info
, const gchar
*my_quote_str
,
197 const gchar
*my_body
, gboolean my_dry_run
,
198 PrefsAccount
*compose_account
,
199 gboolean string_is_escaped
)
202 quote_str
= my_quote_str
;
205 account
= compose_account
;
207 gchar
*dict
= gtkaspell_get_default_dictionary
(compose_gtkaspell
);
209 strncpy2
(default_dictionary
, dict
, sizeof
(default_dictionary
));
211 *default_dictionary
= '\0';
213 dry_run
= my_dry_run
;
215 add_visibility
(TRUE
);
216 main_expr.bufmax
= 0;
218 current
= &main_expr
;
222 escaped_string
= string_is_escaped
;
225 var_table
= g_hash_table_new_full
(g_str_hash
, g_str_equal
,
229 * force LEX initialization
231 quote_fmt_firsttime
= 1;
235 void quote_fmterror
(char *str
)
237 g_warning
("error: %s at line %d", str
, line
);
241 int quote_fmtwrap
(void)
246 static int isseparator
(int ch
)
248 return g_ascii_isspace
(ch
) || ch
== '.' || ch
== '-';
252 * Search for glibc extended strftime timezone specs within haystack.
253 * If not found NULL is returned and the integer pointed by tzspeclen is
255 * If found a pointer to the start of the specification within haystack
256 * is returned and the integer pointed by tzspeclen is set to the lenght
259 static const char* strtzspec
(const char *haystack
, int *tzspeclen
)
261 const char *p
= NULL
;
262 const char *q
= NULL
;
263 const char *r
= NULL
;
265 p
= strstr
(haystack
, "%");
268 if
(!*q
) return NULL
;
269 r
= strchr
("_-0^#", *q
); /* skip flags */
272 if
(!*q
) return NULL
;
274 while
(*q
>= '0' && *q
<= '9') ++q
; /* skip width */
275 if
(!*q
) return NULL
;
276 if
(*q
== 'z' ||
*q
== 'Z') { /* numeric or name */
277 *tzspeclen
= 1 + (q
- p
);
285 static void quote_fmt_show_date
(const MsgInfo
*msginfo
, const gchar
*format
)
298 * ALF - GNU C's strftime() has a nice format specifier
299 * for time zone offset (%z). Non-standard however, so
303 #define RLEFT (sizeof result) - (rptr - result)
307 if
(procheader_date_parse_to_tm
(msginfo
->date
, <
, zone
)) {
309 * break up format string in tiny bits delimited by valid %z's and
310 * feed it to strftime(). don't forget that '%%z' mean literal '%z'.
312 for
(rptr
= result
, fptr
= format
; fptr
&& *fptr
&& rptr
< &result
[sizeof result
- 1];) {
317 if
(NULL
!= (zptr
= strtzspec
(fptr
, &zlen
))) {
319 * count nr. of prepended percent chars
321 for
(perc
= 0, p
= zptr
; p
&& p
>= format
&& *p
== '%'; p
--, perc
++)
326 tmp
= g_strndup
(fptr
, zptr
- fptr
+ (perc %
2 ?
0 : zlen
));
328 rptr
+= strftime
(rptr
, RLEFT
, tmp
, <
);
332 * append time zone offset
334 if
(zone
[0] && perc %
2)
335 rptr
+= g_snprintf
(rptr
, RLEFT
, "%s", zone
);
338 rptr
+= strftime
(rptr
, RLEFT
, fptr
, <
);
343 if
(g_utf8_validate
(result
, -1, NULL
)) {
346 gchar
*utf
= conv_codeset_strdup
(result
,
347 conv_get_locale_charset_str_no_utf8
(),
350 !g_utf8_validate
(utf
, -1, NULL
)) {
352 utf
= g_malloc
(strlen
(result
)*2+1);
353 conv_localetodisp
(utf
,
354 strlen
(result
)*2+1, result
);
356 if
(g_utf8_validate
(utf
, -1, NULL
)) {
365 static void quote_fmt_show_first_name
(const MsgInfo
*msginfo
)
370 if
(!msginfo
->fromname
)
373 p
= (guchar
*)strchr
(msginfo
->fromname
, ',');
375 /* fromname is like "Duck, Donald" */
377 while
(*p
&& isspace
(*p
)) p
++;
378 str
= alloca
(strlen
((char *)p
) + 1);
380 strcpy
(str
, (char *)p
);
384 /* fromname is like "Donald Duck" */
385 str
= alloca
(strlen
(msginfo
->fromname
) + 1);
387 strcpy
(str
, msginfo
->fromname
);
389 while
(*p
&& !isspace
(*p
)) p
++;
396 static void quote_fmt_show_last_name
(const MsgInfo
*msginfo
)
401 /* This probably won't work together very well with Middle
402 names and the like - thth */
403 if
(!msginfo
->fromname
)
406 str
= alloca
(strlen
(msginfo
->fromname
) + 1);
408 strcpy
(str
, msginfo
->fromname
);
409 p
= strchr
(str
, ',');
411 /* fromname is like "Duck, Donald" */
415 /* fromname is like "Donald Duck" */
417 while
(*p
&& !isspace
(*p
)) p
++;
419 /* We found a space. Get first
420 none-space char and insert
421 rest of string from there. */
422 while
(*p
&& isspace
(*p
)) p
++;
426 /* If there is no none-space
427 char, just insert whole
432 /* If there is no space, just
433 insert whole fromname. */
440 static void quote_fmt_show_sender_initial
(const MsgInfo
*msginfo
)
442 #define MAX_SENDER_INITIAL 20
443 gchar tmp
[MAX_SENDER_INITIAL
];
448 if
(!msginfo
->fromname
)
451 p
= (guchar
*)msginfo
->fromname
;
454 if
(*p
&& g_utf8_validate
((gchar
*)p
, 1, NULL
)) {
458 if
(len
>= MAX_SENDER_INITIAL
- 1)
462 while
(*p
&& !isseparator
(*p
)) p
++;
463 while
(*p
&& isseparator
(*p
)) p
++;
469 static void quote_fmt_show_msg
(MsgInfo
*msginfo
, const gchar
*body
,
470 gboolean quoted
, gboolean signature
,
471 const gchar
*quote_str
)
476 if
(!(msginfo
->folder || body
))
480 fp
= str_open_as_stream
(body
);
482 if
(MSG_IS_ENCRYPTED
(msginfo
->flags
))
483 fp
= procmime_get_first_encrypted_text_content
(msginfo
);
485 fp
= procmime_get_first_text_content
(msginfo
);
489 g_warning
("can't get text part");
491 account_sigsep_matchlist_create
();
492 while
(fgets
(buf
, sizeof
(buf
), fp
) != NULL
) {
495 if
(!signature
&& account_sigsep_matchlist_nchar_found
(buf
, "%s\n"))
498 if
(quoted
&& quote_str
)
503 account_sigsep_matchlist_delete
();
508 static void quote_fmt_insert_file
(const gchar
*filename
)
511 char buffer
[PATH_MAX
];
513 if
((file
= g_fopen
(filename
, "rb")) != NULL
) {
514 while
(fgets
(buffer
, sizeof
(buffer
), file
)) {
522 static void quote_fmt_insert_program_output
(const gchar
*progname
)
525 char buffer
[BUFFSIZE
];
527 if
((file
= get_command_output_stream
(progname
)) != NULL
) {
528 while
(fgets
(buffer
, sizeof
(buffer
), file
)) {
535 static void quote_fmt_insert_user_input
(const gchar
*varname
)
543 if
((text
= g_hash_table_lookup
(var_table
, varname
)) == NULL
) {
544 buf
= g_strdup_printf
(_
("Enter text to replace '%s'"), varname
);
545 text
= input_dialog
(_
("Enter variable"), buf
, "");
549 g_hash_table_insert
(var_table
, g_strdup
(varname
), g_strdup
(text
));
551 /* don't free the one in hashtable at the end */
552 text
= g_strdup
(text
);
561 static void quote_fmt_attach_file
(const gchar
*filename
)
563 attachments
= g_list_append
(attachments
, g_strdup
(filename
));
566 static void quote_fmt_attach_file_program_output
(const gchar
*progname
)
569 char buffer
[BUFFSIZE
];
571 if
((file
= get_command_output_stream
(progname
)) != NULL
) {
572 /* get first line only */
573 if
(fgets
(buffer
, sizeof
(buffer
), file
)) {
574 /* trim trailing CR/LF */
576 attachments
= g_list_append
(attachments
, g_strdup
(buffer
));
582 static gchar
*quote_fmt_complete_address
(const gchar
*addr
)
585 gchar
*res
, *tmp
, *email_addr
;
588 debug_print
("quote_fmt_complete_address: %s\n", addr
);
592 /* if addr is a list of message, try the 1st element only */
593 split
= g_strsplit
(addr
, ",", -1);
594 if
(!split ||
!split
[0] ||
*split
[0] == '\0') {
599 Xstrdup_a
(email_addr
, split
[0], {
603 extract_address
(email_addr
);
610 start_address_completion
(NULL
);
611 if
(1 < (count
= complete_address
(email_addr
))) {
612 tmp
= get_complete_address
(1);
613 res
= procheader_get_fromname
(tmp
);
616 end_address_completion
();
619 debug_print
("quote_fmt_complete_address: matched %s\n", res
);
631 %token SHOW_NEWSGROUPS
632 %token SHOW_DATE SHOW_FROM SHOW_FULLNAME SHOW_FIRST_NAME SHOW_LAST_NAME
633 %token SHOW_SENDER_INITIAL SHOW_SUBJECT SHOW_TO SHOW_MESSAGEID
634 %token SHOW_PERCENT SHOW_CC SHOW_REFERENCES SHOW_MESSAGE
635 %token SHOW_QUOTED_MESSAGE SHOW_BACKSLASH SHOW_TAB SHOW_MAIL_ADDRESS
636 %token SHOW_QUOTED_MESSAGE_NO_SIGNATURE SHOW_MESSAGE_NO_SIGNATURE
637 %token SHOW_EOL SHOW_QUESTION_MARK SHOW_EXCLAMATION_MARK SHOW_PIPE SHOW_OPARENT SHOW_CPARENT
638 %token SHOW_ACCOUNT_FULL_NAME SHOW_ACCOUNT_MAIL_ADDRESS SHOW_ACCOUNT_NAME SHOW_ACCOUNT_ORGANIZATION
639 %token SHOW_ACCOUNT_DICT SHOW_ACCOUNT_SIG SHOW_ACCOUNT_SIGPATH
640 %token SHOW_DICT SHOW_TAGS
641 %token SHOW_ADDRESSBOOK_COMPLETION_FOR_CC
642 %token SHOW_ADDRESSBOOK_COMPLETION_FOR_FROM
643 %token SHOW_ADDRESSBOOK_COMPLETION_FOR_TO
645 %token QUERY_DATE QUERY_FROM
646 %token QUERY_FULLNAME QUERY_SUBJECT QUERY_TO QUERY_NEWSGROUPS
647 %token QUERY_MESSAGEID QUERY_CC QUERY_REFERENCES
648 %token QUERY_ACCOUNT_FULL_NAME QUERY_ACCOUNT_ORGANIZATION QUERY_ACCOUNT_DICT
649 %token QUERY_ACCOUNT_SIG QUERY_ACCOUNT_SIGPATH
651 %token QUERY_CC_FOUND_IN_ADDRESSBOOK
652 %token QUERY_FROM_FOUND_IN_ADDRESSBOOK
653 %token QUERY_TO_FOUND_IN_ADDRESSBOOK
654 /* tokens QUERY_NOT */
655 %token QUERY_NOT_DATE QUERY_NOT_FROM
656 %token QUERY_NOT_FULLNAME QUERY_NOT_SUBJECT QUERY_NOT_TO QUERY_NOT_NEWSGROUPS
657 %token QUERY_NOT_MESSAGEID QUERY_NOT_CC QUERY_NOT_REFERENCES
658 %token QUERY_NOT_ACCOUNT_FULL_NAME QUERY_NOT_ACCOUNT_ORGANIZATION QUERY_NOT_ACCOUNT_DICT
659 %token QUERY_NOT_ACCOUNT_SIG QUERY_NOT_ACCOUNT_SIGPATH
660 %token QUERY_NOT_DICT
661 %token QUERY_NOT_CC_FOUND_IN_ADDRESSBOOK
662 %token QUERY_NOT_FROM_FOUND_IN_ADDRESSBOOK
663 %token QUERY_NOT_TO_FOUND_IN_ADDRESSBOOK
665 %token INSERT_FILE INSERT_PROGRAMOUTPUT INSERT_USERINPUT
666 %token ATTACH_FILE ATTACH_PROGRAMOUTPUT
667 %token OPARENT CPARENT
669 %token SHOW_DATE_EXPR
670 %token SET_CURSOR_POS
674 %type
<chr
> CHARACTER
675 %type
<chr
> character
681 character_or_special_or_insert_or_query_list
;
684 character_or_special_list
;
686 character_or_special_or_insert_or_query_list:
687 character_or_special_or_insert_or_query character_or_special_or_insert_or_query_list
688 | character_or_special_or_insert_or_query
;
690 character_or_special_list:
691 character_or_special character_or_special_list
692 | character_or_special
;
694 character_or_special_or_insert_or_query:
701 character_or_special:
705 INSERT_CHARACTER
($1);
722 strncpy
($$
, $1, sizeof
($$
));
723 $$
[sizeof
($$
) - 1] = '\0';
725 if
(len
+ 1 < sizeof
($$
)) {
734 if
(msginfo
->newsgroups
)
735 INSERT
(msginfo
->newsgroups
);
737 | SHOW_DATE_EXPR OPARENT
string CPARENT
739 quote_fmt_show_date
(msginfo
, $3);
744 INSERT
(msginfo
->date
);
749 INSERT
(msginfo
->from
);
754 gchar
*stripped_address
= g_strdup
(msginfo
->from
);
755 extract_address
(stripped_address
);
756 INSERT
(stripped_address
);
757 g_free
(stripped_address
);
762 if
(msginfo
->fromname
)
763 INSERT
(msginfo
->fromname
);
767 quote_fmt_show_first_name
(msginfo
);
771 quote_fmt_show_last_name
(msginfo
);
773 | SHOW_SENDER_INITIAL
775 quote_fmt_show_sender_initial
(msginfo
);
779 if
(msginfo
->subject
)
780 INSERT
(msginfo
->subject
);
790 INSERT
(msginfo
->msgid
);
805 INSERT
(msginfo
->inreplyto
);
806 for
(item
= msginfo
->references
; item
!= NULL
; item
= g_slist_next
(item
))
812 quote_fmt_show_msg
(msginfo
, body
, FALSE
, TRUE
, quote_str
);
814 | SHOW_QUOTED_MESSAGE
816 quote_fmt_show_msg
(msginfo
, body
, TRUE
, TRUE
, quote_str
);
818 | SHOW_MESSAGE_NO_SIGNATURE
820 quote_fmt_show_msg
(msginfo
, body
, FALSE
, FALSE
, quote_str
);
822 | SHOW_QUOTED_MESSAGE_NO_SIGNATURE
824 quote_fmt_show_msg
(msginfo
, body
, TRUE
, FALSE
, quote_str
);
826 | SHOW_ACCOUNT_FULL_NAME
828 if
(account
&& account
->name
)
829 INSERT
(account
->name
);
831 | SHOW_ACCOUNT_MAIL_ADDRESS
833 if
(account
&& account
->address
)
834 INSERT
(account
->address
);
838 if
(account
&& account
->account_name
)
839 INSERT
(account
->account_name
);
841 | SHOW_ACCOUNT_ORGANIZATION
843 if
(account
&& account
->organization
)
844 INSERT
(account
->organization
);
848 gchar
*str
= account_get_signature_str
(account
);
852 | SHOW_ACCOUNT_SIGPATH
854 if
(account
&& account
->sig_path
)
855 INSERT
(account
->sig_path
);
860 if
(account
&& account
->enable_default_dictionary
) {
861 gchar
*dictname
= g_path_get_basename
(account
->default_dictionary
);
870 INSERT
(default_dictionary
);
875 gchar
*tags
= procmsg_msginfo_get_tags_str
(msginfo
);
897 | SHOW_EXCLAMATION_MARK
916 cursor_pos
= g_utf8_strlen
(current
->buffer
, -1);
920 | SHOW_ADDRESSBOOK_COMPLETION_FOR_CC
922 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->cc
);
928 | SHOW_ADDRESSBOOK_COMPLETION_FOR_FROM
930 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->from
);
936 | SHOW_ADDRESSBOOK_COMPLETION_FOR_TO
938 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->to
);
948 add_visibility
(msginfo
->date
!= NULL
);
950 OPARENT quote_fmt CPARENT
956 add_visibility
(msginfo
->from
!= NULL
);
958 OPARENT quote_fmt CPARENT
964 add_visibility
(msginfo
->fromname
!= NULL
);
966 OPARENT quote_fmt CPARENT
972 add_visibility
(msginfo
->subject
!= NULL
);
974 OPARENT quote_fmt CPARENT
980 add_visibility
(msginfo
->to
!= NULL
);
982 OPARENT quote_fmt CPARENT
988 add_visibility
(msginfo
->newsgroups
!= NULL
);
990 OPARENT quote_fmt CPARENT
996 add_visibility
(msginfo
->msgid
!= NULL
);
998 OPARENT quote_fmt CPARENT
1000 remove_visibility
();
1004 add_visibility
(msginfo
->cc
!= NULL
);
1006 OPARENT quote_fmt CPARENT
1008 remove_visibility
();
1015 found
= (msginfo
->inreplyto
!= NULL
);
1016 for
(item
= msginfo
->references
; found
== FALSE
&& item
!= NULL
; item
= g_slist_next
(item
))
1019 add_visibility
(found
== TRUE
);
1021 OPARENT quote_fmt CPARENT
1023 remove_visibility
();
1025 | QUERY_ACCOUNT_FULL_NAME
1027 add_visibility
(account
!= NULL
&& account
->name
!= NULL
);
1029 OPARENT quote_fmt CPARENT
1031 remove_visibility
();
1033 | QUERY_ACCOUNT_ORGANIZATION
1035 add_visibility
(account
!= NULL
&& account
->organization
!= NULL
);
1037 OPARENT quote_fmt CPARENT
1039 remove_visibility
();
1043 gchar
*str
= account_get_signature_str
(account
);
1044 add_visibility
(str
!= NULL
&& * str
!= '\0');
1047 OPARENT quote_fmt CPARENT
1049 remove_visibility
();
1051 | QUERY_ACCOUNT_SIGPATH
1053 add_visibility
(account
!= NULL
&& account
->sig_path
!= NULL
1054 && *account
->sig_path
!= '\0');
1056 OPARENT quote_fmt CPARENT
1058 remove_visibility
();
1060 | QUERY_ACCOUNT_DICT
1063 add_visibility
(account
!= NULL
&& account
->enable_default_dictionary
== TRUE
&&
1064 account
->default_dictionary
!= NULL
&& *account
->default_dictionary
!= '\0');
1066 add_visibility
(FALSE
);
1069 OPARENT quote_fmt CPARENT
1071 remove_visibility
();
1076 add_visibility
(*default_dictionary
!= '\0');
1078 add_visibility
(FALSE
);
1081 OPARENT quote_fmt CPARENT
1083 remove_visibility
();
1085 | QUERY_CC_FOUND_IN_ADDRESSBOOK
1087 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->cc
);
1088 add_visibility
(tmp
!= NULL
&& *tmp
!= '\0');
1091 OPARENT quote_fmt CPARENT
1093 remove_visibility
();
1095 | QUERY_FROM_FOUND_IN_ADDRESSBOOK
1097 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->from
);
1098 add_visibility
(tmp
!= NULL
&& *tmp
!= '\0');
1101 OPARENT quote_fmt CPARENT
1103 remove_visibility
();
1105 | QUERY_TO_FOUND_IN_ADDRESSBOOK
1107 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->to
);
1108 add_visibility
(tmp
!= NULL
&& *tmp
!= '\0');
1111 OPARENT quote_fmt CPARENT
1113 remove_visibility
();
1119 add_visibility
(msginfo
->date
== NULL
);
1121 OPARENT quote_fmt CPARENT
1123 remove_visibility
();
1127 add_visibility
(msginfo
->from
== NULL
);
1129 OPARENT quote_fmt CPARENT
1131 remove_visibility
();
1133 | QUERY_NOT_FULLNAME
1135 add_visibility
(msginfo
->fromname
== NULL
);
1137 OPARENT quote_fmt CPARENT
1139 remove_visibility
();
1143 add_visibility
(msginfo
->subject
== NULL
);
1145 OPARENT quote_fmt CPARENT
1147 remove_visibility
();
1151 add_visibility
(msginfo
->to
== NULL
);
1153 OPARENT quote_fmt CPARENT
1155 remove_visibility
();
1157 | QUERY_NOT_NEWSGROUPS
1159 add_visibility
(msginfo
->newsgroups
== NULL
);
1161 OPARENT quote_fmt CPARENT
1163 remove_visibility
();
1165 | QUERY_NOT_MESSAGEID
1167 add_visibility
(msginfo
->msgid
== NULL
);
1169 OPARENT quote_fmt CPARENT
1171 remove_visibility
();
1175 add_visibility
(msginfo
->cc
== NULL
);
1177 OPARENT quote_fmt CPARENT
1179 remove_visibility
();
1181 | QUERY_NOT_REFERENCES
1186 found
= (msginfo
->inreplyto
!= NULL
);
1187 for
(item
= msginfo
->references
; found
== FALSE
&& item
!= NULL
; item
= g_slist_next
(item
))
1190 add_visibility
(found
== FALSE
);
1192 OPARENT quote_fmt CPARENT
1194 remove_visibility
();
1196 | QUERY_NOT_ACCOUNT_FULL_NAME
1198 add_visibility
(account
== NULL || account
->name
== NULL
);
1200 OPARENT quote_fmt CPARENT
1202 remove_visibility
();
1204 | QUERY_NOT_ACCOUNT_ORGANIZATION
1206 add_visibility
(account
== NULL || account
->organization
== NULL
);
1208 OPARENT quote_fmt CPARENT
1210 remove_visibility
();
1212 | QUERY_NOT_ACCOUNT_SIG
1214 gchar
*str
= account_get_signature_str
(account
);
1215 add_visibility
(str
== NULL ||
*str
== '\0');
1218 OPARENT quote_fmt CPARENT
1220 remove_visibility
();
1222 | QUERY_NOT_ACCOUNT_SIGPATH
1224 add_visibility
(account
== NULL || account
->sig_path
== NULL
1225 ||
*account
->sig_path
== '\0');
1227 OPARENT quote_fmt CPARENT
1229 remove_visibility
();
1231 | QUERY_NOT_ACCOUNT_DICT
1234 add_visibility
(account
== NULL || account
->enable_default_dictionary
== FALSE
1235 ||
*account
->default_dictionary
== '\0');
1237 add_visibility
(FALSE
);
1240 OPARENT quote_fmt CPARENT
1242 remove_visibility
();
1247 add_visibility
(*default_dictionary
== '\0');
1249 add_visibility
(FALSE
);
1252 OPARENT quote_fmt CPARENT
1254 remove_visibility
();
1256 | QUERY_NOT_CC_FOUND_IN_ADDRESSBOOK
1258 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->cc
);
1259 add_visibility
(tmp
== NULL ||
*tmp
== '\0');
1262 OPARENT quote_fmt CPARENT
1264 remove_visibility
();
1266 | QUERY_NOT_FROM_FOUND_IN_ADDRESSBOOK
1268 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->from
);
1269 add_visibility
(tmp
== NULL ||
*tmp
== '\0');
1272 OPARENT quote_fmt CPARENT
1274 remove_visibility
();
1276 | QUERY_NOT_TO_FOUND_IN_ADDRESSBOOK
1278 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->to
);
1279 add_visibility
(tmp
== NULL ||
*tmp
== '\0');
1282 OPARENT quote_fmt CPARENT
1284 remove_visibility
();
1290 current
= &sub_expr
;
1293 OPARENT sub_expr CPARENT
1295 current
= &main_expr
;
1297 quote_fmt_insert_file
(sub_expr.buffer
);
1300 | INSERT_PROGRAMOUTPUT
1302 current
= &sub_expr
;
1305 OPARENT sub_expr CPARENT
1307 current
= &main_expr
;
1309 quote_fmt_insert_program_output
(sub_expr.buffer
);
1314 current
= &sub_expr
;
1317 OPARENT sub_expr CPARENT
1319 current
= &main_expr
;
1321 quote_fmt_insert_user_input
(sub_expr.buffer
);
1328 current
= &sub_expr
;
1331 OPARENT sub_expr CPARENT
1333 current
= &main_expr
;
1335 quote_fmt_attach_file
(sub_expr.buffer
);
1338 | ATTACH_PROGRAMOUTPUT
1340 current
= &sub_expr
;
1343 OPARENT sub_expr CPARENT
1345 current
= &main_expr
;
1347 quote_fmt_attach_file_program_output
(sub_expr.buffer
);