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>
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"
44 bison -p quote_fmt quote_fmt.y
49 static MsgInfo
*msginfo
= NULL
;
50 static PrefsAccount
*account
= NULL
;
52 static gchar default_dictionary
[BUFFSIZE
];
54 static gboolean
*visible
= NULL
;
55 static gboolean dry_run
= FALSE
;
56 static gint maxsize
= 0;
57 static gint stacksize
= 0;
58 static GHashTable
*var_table
= NULL
;
59 static GList
*attachments
= NULL
;
61 typedef
struct st_buffer
68 static struct st_buffer main_expr
= { NULL
, 0, 0 };
69 static struct st_buffer sub_expr
= { NULL
, 0, 0 };
70 static struct st_buffer
* current
= NULL
;
72 static const gchar
*quote_str
= NULL
;
73 static const gchar
*body
= NULL
;
74 static gint
error = 0;
76 static gint cursor_pos
= -1;
78 extern
int quote_fmt_firsttime
;
80 extern
int escaped_string
;
82 static void add_visibility
(gboolean val
)
85 if
(maxsize
< stacksize
) {
87 visible
= g_realloc
(visible
, maxsize
* sizeof
(gboolean
));
92 visible
[stacksize
- 1] = val
;
95 static void remove_visibility
(void)
99 g_warning
("Error: visibility stack underflow");
104 static void add_buffer
(const gchar
*s
)
112 if
(current
->bufsize
+ len
+ 1 > current
->bufmax
) {
113 if
(current
->bufmax
== 0)
114 current
->bufmax
= 128;
115 while
(current
->bufsize
+ len
+ 1 > current
->bufmax
)
116 current
->bufmax
*= 2;
117 current
->buffer
= g_realloc
(current
->buffer
, current
->bufmax
);
119 strcpy
(current
->buffer
+ current
->bufsize
, s
);
120 current
->bufsize
+= len
;
123 static void clear_buffer
(void)
126 *current
->buffer
= '\0';
128 /* force to an empty string, as buffer should not be left unallocated */
130 current
->bufsize
= 0;
133 gchar
*quote_fmt_get_buffer
(void)
135 if
(current
!= &main_expr
)
136 g_warning
("Error: parser still in sub-expr mode");
141 return current
->buffer
;
144 GList
*quote_fmt_get_attachments_list
(void)
149 gint quote_fmt_get_line
(void)
154 gint quote_fmt_get_cursor_pos
(void)
159 #define INSERT(buf) \
160 if
(stacksize
!= 0 && visible
[stacksize
- 1])\
163 #define INSERT_CHARACTER(chr) \
164 if
(stacksize
!= 0 && visible
[stacksize
- 1]) { \
171 void quote_fmt_reset_vartable
(void)
174 g_hash_table_destroy
(var_table
);
178 GList
*cur
= attachments
;
181 cur
= g_list_next
(cur
);
183 g_list_free
(attachments
);
189 void quote_fmt_init
(MsgInfo
*info
, const gchar
*my_quote_str
,
190 const gchar
*my_body
, gboolean my_dry_run
,
191 PrefsAccount
*compose_account
,
192 gboolean string_is_escaped
,
193 GtkAspell
*compose_gtkaspell
)
195 void quote_fmt_init
(MsgInfo
*info
, const gchar
*my_quote_str
,
196 const gchar
*my_body
, gboolean my_dry_run
,
197 PrefsAccount
*compose_account
,
198 gboolean string_is_escaped
)
201 quote_str
= my_quote_str
;
204 account
= compose_account
;
206 gchar
*dict
= gtkaspell_get_default_dictionary
(compose_gtkaspell
);
208 strncpy2
(default_dictionary
, dict
, sizeof
(default_dictionary
));
210 *default_dictionary
= '\0';
212 dry_run
= my_dry_run
;
214 add_visibility
(TRUE
);
215 main_expr.bufmax
= 0;
217 current
= &main_expr
;
221 escaped_string
= string_is_escaped
;
224 var_table
= g_hash_table_new_full
(g_str_hash
, g_str_equal
,
228 * force LEX initialization
230 quote_fmt_firsttime
= 1;
234 void quote_fmterror
(char *str
)
236 g_warning
("Error: %s at line %d", str
, line
);
240 int quote_fmtwrap
(void)
245 static int isseparator
(int ch
)
247 return g_ascii_isspace
(ch
) || ch
== '.' || ch
== '-';
251 * Search for glibc extended strftime timezone specs within haystack.
252 * If not found NULL is returned and the integer pointed by tzspeclen is
254 * If found a pointer to the start of the specification within haystack
255 * is returned and the integer pointed by tzspeclen is set to the lenght
258 static const char* strtzspec
(const char *haystack
, int *tzspeclen
)
260 const char *p
= NULL
;
261 const char *q
= NULL
;
262 const char *r
= NULL
;
264 p
= strstr
(haystack
, "%");
267 if
(!*q
) return NULL
;
268 r
= strchr
("_-0^#", *q
); /* skip flags */
271 if
(!*q
) return NULL
;
273 while
(*q
>= '0' && *q
<= '9') ++q
; /* skip width */
274 if
(!*q
) return NULL
;
275 if
(*q
== 'z' ||
*q
== 'Z') { /* numeric or name */
276 *tzspeclen
= 1 + (q
- p
);
284 static void quote_fmt_show_date
(const MsgInfo
*msginfo
, const gchar
*format
)
297 * ALF - GNU C's strftime() has a nice format specifier
298 * for time zone offset (%z). Non-standard however, so
302 #define RLEFT (sizeof result) - (rptr - result)
306 if
(procheader_date_parse_to_tm
(msginfo
->date
, <
, zone
)) {
308 * break up format string in tiny bits delimited by valid %z's and
309 * feed it to strftime(). don't forget that '%%z' mean literal '%z'.
311 for
(rptr
= result
, fptr
= format
; fptr
&& *fptr
&& rptr
< &result
[sizeof result
- 1];) {
316 if
(NULL
!= (zptr
= strtzspec
(fptr
, &zlen
))) {
318 * count nr. of prepended percent chars
320 for
(perc
= 0, p
= zptr
; p
&& p
>= format
&& *p
== '%'; p
--, perc
++)
325 tmp
= g_strndup
(fptr
, zptr
- fptr
+ (perc %
2 ?
0 : zlen
));
327 rptr
+= strftime
(rptr
, RLEFT
, tmp
, <
);
331 * append time zone offset
333 if
(zone
[0] && perc %
2)
334 rptr
+= g_snprintf
(rptr
, RLEFT
, "%s", zone
);
337 rptr
+= strftime
(rptr
, RLEFT
, fptr
, <
);
342 if
(g_utf8_validate
(result
, -1, NULL
)) {
345 gchar
*utf
= conv_codeset_strdup
(result
,
346 conv_get_locale_charset_str_no_utf8
(),
349 !g_utf8_validate
(utf
, -1, NULL
)) {
351 utf
= g_malloc
(strlen
(result
)*2+1);
352 conv_localetodisp
(utf
,
353 strlen
(result
)*2+1, result
);
355 if
(g_utf8_validate
(utf
, -1, NULL
)) {
364 static void quote_fmt_show_first_name
(const MsgInfo
*msginfo
)
369 if
(!msginfo
->fromname
)
372 p
= (guchar
*)strchr
(msginfo
->fromname
, ',');
374 /* fromname is like "Duck, Donald" */
376 while
(*p
&& isspace
(*p
)) p
++;
377 str
= alloca
(strlen
((char *)p
) + 1);
379 strcpy
(str
, (char *)p
);
383 /* fromname is like "Donald Duck" */
384 str
= alloca
(strlen
(msginfo
->fromname
) + 1);
386 strcpy
(str
, msginfo
->fromname
);
388 while
(*p
&& !isspace
(*p
)) p
++;
395 static void quote_fmt_show_last_name
(const MsgInfo
*msginfo
)
400 /* This probably won't work together very well with Middle
401 names and the like - thth */
402 if
(!msginfo
->fromname
)
405 str
= alloca
(strlen
(msginfo
->fromname
) + 1);
407 strcpy
(str
, msginfo
->fromname
);
408 p
= strchr
(str
, ',');
410 /* fromname is like "Duck, Donald" */
414 /* fromname is like "Donald Duck" */
416 while
(*p
&& !isspace
(*p
)) p
++;
418 /* We found a space. Get first
419 none-space char and insert
420 rest of string from there. */
421 while
(*p
&& isspace
(*p
)) p
++;
425 /* If there is no none-space
426 char, just insert whole
431 /* If there is no space, just
432 insert whole fromname. */
439 static void quote_fmt_show_sender_initial
(const MsgInfo
*msginfo
)
441 #define MAX_SENDER_INITIAL 20
442 gchar tmp
[MAX_SENDER_INITIAL
];
447 if
(!msginfo
->fromname
)
450 p
= (guchar
*)msginfo
->fromname
;
453 if
(*p
&& g_utf8_validate
((gchar
*)p
, 1, NULL
)) {
457 if
(len
>= MAX_SENDER_INITIAL
- 1)
461 while
(*p
&& !isseparator
(*p
)) p
++;
462 while
(*p
&& isseparator
(*p
)) p
++;
468 static void quote_fmt_show_msg
(MsgInfo
*msginfo
, const gchar
*body
,
469 gboolean quoted
, gboolean signature
,
470 const gchar
*quote_str
)
475 if
(!(msginfo
->folder || body
))
479 fp
= str_open_as_stream
(body
);
481 if
(MSG_IS_ENCRYPTED
(msginfo
->flags
))
482 fp
= procmime_get_first_encrypted_text_content
(msginfo
);
484 fp
= procmime_get_first_text_content
(msginfo
);
488 g_warning
("Can't get text part");
490 while
(fgets
(buf
, sizeof
(buf
), fp
) != NULL
) {
493 if
(!signature
&& strncmp
(buf
, "-- \n", 4) == 0)
496 if
(quoted
&& quote_str
)
505 static void quote_fmt_insert_file
(const gchar
*filename
)
510 if
((file
= g_fopen
(filename
, "rb")) != NULL
) {
511 while
(fgets
(buffer
, sizeof
(buffer
), file
)) {
519 static void quote_fmt_insert_program_output
(const gchar
*progname
)
524 if
((file
= popen
(progname
, "r")) != NULL
) {
525 while
(fgets
(buffer
, sizeof
(buffer
), file
)) {
532 static void quote_fmt_insert_user_input
(const gchar
*varname
)
540 if
((text
= g_hash_table_lookup
(var_table
, varname
)) == NULL
) {
541 buf
= g_strdup_printf
(_
("Enter text to replace '%s'"), varname
);
542 text
= input_dialog
(_
("Enter variable"), buf
, "");
546 g_hash_table_insert
(var_table
, g_strdup
(varname
), g_strdup
(text
));
548 /* don't free the one in hashtable at the end */
549 text
= g_strdup
(text
);
558 static void quote_fmt_attach_file
(const gchar
*filename
)
560 attachments
= g_list_append
(attachments
, g_strdup
(filename
));
563 static void quote_fmt_attach_file_program_output
(const gchar
*progname
)
566 char buffer
[PATH_MAX
];
568 if
((file
= popen
(progname
, "r")) != NULL
) {
569 /* get first line only */
570 if
(fgets
(buffer
, sizeof
(buffer
), file
)) {
571 /* trim trailing CR/LF */
573 attachments
= g_list_append
(attachments
, g_strdup
(buffer
));
579 static gchar
*quote_fmt_complete_address
(const gchar
*addr
)
582 gchar
*res
, *tmp
, *email_addr
;
585 debug_print
("quote_fmt_complete_address: %s\n", addr
);
589 /* if addr is a list of message, try the 1st element only */
590 split
= g_strsplit
(addr
, ",", -1);
591 if
(!split ||
!split
[0] ||
*split
[0] == '\0') {
596 Xstrdup_a
(email_addr
, split
[0], return NULL
);
597 extract_address
(email_addr
);
604 start_address_completion
(NULL
);
605 if
(1 < (count
= complete_address
(email_addr
))) {
606 tmp
= get_complete_address
(1);
607 res
= procheader_get_fromname
(tmp
);
610 end_address_completion
();
613 debug_print
("quote_fmt_complete_address: matched %s\n", res
);
625 %token SHOW_NEWSGROUPS
626 %token SHOW_DATE SHOW_FROM SHOW_FULLNAME SHOW_FIRST_NAME SHOW_LAST_NAME
627 %token SHOW_SENDER_INITIAL SHOW_SUBJECT SHOW_TO SHOW_MESSAGEID
628 %token SHOW_PERCENT SHOW_CC SHOW_REFERENCES SHOW_MESSAGE
629 %token SHOW_QUOTED_MESSAGE SHOW_BACKSLASH SHOW_TAB SHOW_MAIL_ADDRESS
630 %token SHOW_QUOTED_MESSAGE_NO_SIGNATURE SHOW_MESSAGE_NO_SIGNATURE
631 %token SHOW_EOL SHOW_QUESTION_MARK SHOW_EXCLAMATION_MARK SHOW_PIPE SHOW_OPARENT SHOW_CPARENT
632 %token SHOW_ACCOUNT_FULL_NAME SHOW_ACCOUNT_MAIL_ADDRESS SHOW_ACCOUNT_NAME SHOW_ACCOUNT_ORGANIZATION
633 %token SHOW_ACCOUNT_DICT SHOW_ACCOUNT_SIG SHOW_ACCOUNT_SIGPATH
634 %token SHOW_DICT SHOW_TAGS
635 %token SHOW_ADDRESSBOOK_COMPLETION_FOR_CC
636 %token SHOW_ADDRESSBOOK_COMPLETION_FOR_FROM
637 %token SHOW_ADDRESSBOOK_COMPLETION_FOR_TO
639 %token QUERY_DATE QUERY_FROM
640 %token QUERY_FULLNAME QUERY_SUBJECT QUERY_TO QUERY_NEWSGROUPS
641 %token QUERY_MESSAGEID QUERY_CC QUERY_REFERENCES
642 %token QUERY_ACCOUNT_FULL_NAME QUERY_ACCOUNT_ORGANIZATION QUERY_ACCOUNT_DICT
643 %token QUERY_ACCOUNT_SIG QUERY_ACCOUNT_SIGPATH
645 %token QUERY_CC_FOUND_IN_ADDRESSBOOK
646 %token QUERY_FROM_FOUND_IN_ADDRESSBOOK
647 %token QUERY_TO_FOUND_IN_ADDRESSBOOK
648 /* tokens QUERY_NOT */
649 %token QUERY_NOT_DATE QUERY_NOT_FROM
650 %token QUERY_NOT_FULLNAME QUERY_NOT_SUBJECT QUERY_NOT_TO QUERY_NOT_NEWSGROUPS
651 %token QUERY_NOT_MESSAGEID QUERY_NOT_CC QUERY_NOT_REFERENCES
652 %token QUERY_NOT_ACCOUNT_FULL_NAME QUERY_NOT_ACCOUNT_ORGANIZATION QUERY_NOT_ACCOUNT_DICT
653 %token QUERY_NOT_ACCOUNT_SIG QUERY_NOT_ACCOUNT_SIGPATH
654 %token QUERY_NOT_DICT
655 %token QUERY_NOT_CC_FOUND_IN_ADDRESSBOOK
656 %token QUERY_NOT_FROM_FOUND_IN_ADDRESSBOOK
657 %token QUERY_NOT_TO_FOUND_IN_ADDRESSBOOK
659 %token INSERT_FILE INSERT_PROGRAMOUTPUT INSERT_USERINPUT
660 %token ATTACH_FILE ATTACH_PROGRAMOUTPUT
661 %token OPARENT CPARENT
663 %token SHOW_DATE_EXPR
664 %token SET_CURSOR_POS
668 %type
<chr
> CHARACTER
669 %type
<chr
> character
675 character_or_special_or_insert_or_query_list
;
678 character_or_special_list
;
680 character_or_special_or_insert_or_query_list:
681 character_or_special_or_insert_or_query character_or_special_or_insert_or_query_list
682 | character_or_special_or_insert_or_query
;
684 character_or_special_list:
685 character_or_special character_or_special_list
686 | character_or_special
;
688 character_or_special_or_insert_or_query:
695 character_or_special:
699 INSERT_CHARACTER
($1);
716 strncpy
($$
, $1, sizeof
($$
));
717 $$
[sizeof
($$
) - 1] = '\0';
719 if
(len
+ 1 < sizeof
($$
)) {
728 if
(msginfo
->newsgroups
)
729 INSERT
(msginfo
->newsgroups
);
731 | SHOW_DATE_EXPR OPARENT
string CPARENT
733 quote_fmt_show_date
(msginfo
, $3);
738 INSERT
(msginfo
->date
);
743 INSERT
(msginfo
->from
);
748 gchar
*stripped_address
= g_strdup
(msginfo
->from
);
749 extract_address
(stripped_address
);
750 INSERT
(stripped_address
);
751 g_free
(stripped_address
);
756 if
(msginfo
->fromname
)
757 INSERT
(msginfo
->fromname
);
761 quote_fmt_show_first_name
(msginfo
);
765 quote_fmt_show_last_name
(msginfo
);
767 | SHOW_SENDER_INITIAL
769 quote_fmt_show_sender_initial
(msginfo
);
773 if
(msginfo
->subject
)
774 INSERT
(msginfo
->subject
);
784 INSERT
(msginfo
->msgid
);
799 INSERT
(msginfo
->inreplyto
);
800 for
(item
= msginfo
->references
; item
!= NULL
; item
= g_slist_next
(item
))
806 quote_fmt_show_msg
(msginfo
, body
, FALSE
, TRUE
, quote_str
);
808 | SHOW_QUOTED_MESSAGE
810 quote_fmt_show_msg
(msginfo
, body
, TRUE
, TRUE
, quote_str
);
812 | SHOW_MESSAGE_NO_SIGNATURE
814 quote_fmt_show_msg
(msginfo
, body
, FALSE
, FALSE
, quote_str
);
816 | SHOW_QUOTED_MESSAGE_NO_SIGNATURE
818 quote_fmt_show_msg
(msginfo
, body
, TRUE
, FALSE
, quote_str
);
820 | SHOW_ACCOUNT_FULL_NAME
822 if
(account
&& account
->name
)
823 INSERT
(account
->name
);
825 | SHOW_ACCOUNT_MAIL_ADDRESS
827 if
(account
&& account
->address
)
828 INSERT
(account
->address
);
832 if
(account
&& account
->account_name
)
833 INSERT
(account
->account_name
);
835 | SHOW_ACCOUNT_ORGANIZATION
837 if
(account
&& account
->organization
)
838 INSERT
(account
->organization
);
842 gchar
*str
= account_get_signature_str
(account
);
846 | SHOW_ACCOUNT_SIGPATH
848 if
(account
&& account
->sig_path
)
849 INSERT
(account
->sig_path
);
854 if
(account
&& account
->enable_default_dictionary
) {
855 gchar
*dictname
= g_path_get_basename
(account
->default_dictionary
);
864 INSERT
(default_dictionary
);
869 gchar
*tags
= procmsg_msginfo_get_tags_str
(msginfo
);
891 | SHOW_EXCLAMATION_MARK
910 cursor_pos
= g_utf8_strlen
(current
->buffer
, -1);
914 | SHOW_ADDRESSBOOK_COMPLETION_FOR_CC
916 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->cc
);
922 | SHOW_ADDRESSBOOK_COMPLETION_FOR_FROM
924 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->from
);
930 | SHOW_ADDRESSBOOK_COMPLETION_FOR_TO
932 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->to
);
942 add_visibility
(msginfo
->date
!= NULL
);
944 OPARENT quote_fmt CPARENT
950 add_visibility
(msginfo
->from
!= NULL
);
952 OPARENT quote_fmt CPARENT
958 add_visibility
(msginfo
->fromname
!= NULL
);
960 OPARENT quote_fmt CPARENT
966 add_visibility
(msginfo
->subject
!= NULL
);
968 OPARENT quote_fmt CPARENT
974 add_visibility
(msginfo
->to
!= NULL
);
976 OPARENT quote_fmt CPARENT
982 add_visibility
(msginfo
->newsgroups
!= NULL
);
984 OPARENT quote_fmt CPARENT
990 add_visibility
(msginfo
->msgid
!= NULL
);
992 OPARENT quote_fmt CPARENT
998 add_visibility
(msginfo
->cc
!= NULL
);
1000 OPARENT quote_fmt CPARENT
1002 remove_visibility
();
1009 found
= (msginfo
->inreplyto
!= NULL
);
1010 for
(item
= msginfo
->references
; found
== FALSE
&& item
!= NULL
; item
= g_slist_next
(item
))
1013 add_visibility
(found
== TRUE
);
1015 OPARENT quote_fmt CPARENT
1017 remove_visibility
();
1019 | QUERY_ACCOUNT_FULL_NAME
1021 add_visibility
(account
!= NULL
&& account
->name
!= NULL
);
1023 OPARENT quote_fmt CPARENT
1025 remove_visibility
();
1027 | QUERY_ACCOUNT_ORGANIZATION
1029 add_visibility
(account
!= NULL
&& account
->organization
!= NULL
);
1031 OPARENT quote_fmt CPARENT
1033 remove_visibility
();
1037 gchar
*str
= account_get_signature_str
(account
);
1038 add_visibility
(str
!= NULL
&& * str
!= '\0');
1041 OPARENT quote_fmt CPARENT
1043 remove_visibility
();
1045 | QUERY_ACCOUNT_SIGPATH
1047 add_visibility
(account
!= NULL
&& account
->sig_path
!= NULL
1048 && *account
->sig_path
!= '\0');
1050 OPARENT quote_fmt CPARENT
1052 remove_visibility
();
1054 | QUERY_ACCOUNT_DICT
1057 add_visibility
(account
!= NULL
&& account
->enable_default_dictionary
== TRUE
&&
1058 account
->default_dictionary
!= NULL
&& *account
->default_dictionary
!= '\0');
1060 add_visibility
(FALSE
);
1063 OPARENT quote_fmt CPARENT
1065 remove_visibility
();
1070 add_visibility
(*default_dictionary
!= '\0');
1072 add_visibility
(FALSE
);
1075 OPARENT quote_fmt CPARENT
1077 remove_visibility
();
1079 | QUERY_CC_FOUND_IN_ADDRESSBOOK
1081 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->cc
);
1082 add_visibility
(tmp
!= NULL
&& *tmp
!= '\0');
1085 OPARENT quote_fmt CPARENT
1087 remove_visibility
();
1089 | QUERY_FROM_FOUND_IN_ADDRESSBOOK
1091 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->from
);
1092 add_visibility
(tmp
!= NULL
&& *tmp
!= '\0');
1095 OPARENT quote_fmt CPARENT
1097 remove_visibility
();
1099 | QUERY_TO_FOUND_IN_ADDRESSBOOK
1101 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->to
);
1102 add_visibility
(tmp
!= NULL
&& *tmp
!= '\0');
1105 OPARENT quote_fmt CPARENT
1107 remove_visibility
();
1113 add_visibility
(msginfo
->date
== NULL
);
1115 OPARENT quote_fmt CPARENT
1117 remove_visibility
();
1121 add_visibility
(msginfo
->from
== NULL
);
1123 OPARENT quote_fmt CPARENT
1125 remove_visibility
();
1127 | QUERY_NOT_FULLNAME
1129 add_visibility
(msginfo
->fromname
== NULL
);
1131 OPARENT quote_fmt CPARENT
1133 remove_visibility
();
1137 add_visibility
(msginfo
->subject
== NULL
);
1139 OPARENT quote_fmt CPARENT
1141 remove_visibility
();
1145 add_visibility
(msginfo
->to
== NULL
);
1147 OPARENT quote_fmt CPARENT
1149 remove_visibility
();
1151 | QUERY_NOT_NEWSGROUPS
1153 add_visibility
(msginfo
->newsgroups
== NULL
);
1155 OPARENT quote_fmt CPARENT
1157 remove_visibility
();
1159 | QUERY_NOT_MESSAGEID
1161 add_visibility
(msginfo
->msgid
== NULL
);
1163 OPARENT quote_fmt CPARENT
1165 remove_visibility
();
1169 add_visibility
(msginfo
->cc
== NULL
);
1171 OPARENT quote_fmt CPARENT
1173 remove_visibility
();
1175 | QUERY_NOT_REFERENCES
1180 found
= (msginfo
->inreplyto
!= NULL
);
1181 for
(item
= msginfo
->references
; found
== FALSE
&& item
!= NULL
; item
= g_slist_next
(item
))
1184 add_visibility
(found
== FALSE
);
1186 OPARENT quote_fmt CPARENT
1188 remove_visibility
();
1190 | QUERY_NOT_ACCOUNT_FULL_NAME
1192 add_visibility
(account
== NULL || account
->name
== NULL
);
1194 OPARENT quote_fmt CPARENT
1196 remove_visibility
();
1198 | QUERY_NOT_ACCOUNT_ORGANIZATION
1200 add_visibility
(account
== NULL || account
->organization
== NULL
);
1202 OPARENT quote_fmt CPARENT
1204 remove_visibility
();
1206 | QUERY_NOT_ACCOUNT_SIG
1208 gchar
*str
= account_get_signature_str
(account
);
1209 add_visibility
(str
== NULL ||
*str
== '\0');
1212 OPARENT quote_fmt CPARENT
1214 remove_visibility
();
1216 | QUERY_NOT_ACCOUNT_SIGPATH
1218 add_visibility
(account
== NULL || account
->sig_path
== NULL
1219 ||
*account
->sig_path
== '\0');
1221 OPARENT quote_fmt CPARENT
1223 remove_visibility
();
1225 | QUERY_NOT_ACCOUNT_DICT
1228 add_visibility
(account
== NULL || account
->enable_default_dictionary
== FALSE
1229 ||
*account
->default_dictionary
== '\0');
1231 add_visibility
(FALSE
);
1234 OPARENT quote_fmt CPARENT
1236 remove_visibility
();
1241 add_visibility
(*default_dictionary
== '\0');
1243 add_visibility
(FALSE
);
1246 OPARENT quote_fmt CPARENT
1248 remove_visibility
();
1250 | QUERY_NOT_CC_FOUND_IN_ADDRESSBOOK
1252 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->cc
);
1253 add_visibility
(tmp
== NULL ||
*tmp
== '\0');
1256 OPARENT quote_fmt CPARENT
1258 remove_visibility
();
1260 | QUERY_NOT_FROM_FOUND_IN_ADDRESSBOOK
1262 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->from
);
1263 add_visibility
(tmp
== NULL ||
*tmp
== '\0');
1266 OPARENT quote_fmt CPARENT
1268 remove_visibility
();
1270 | QUERY_NOT_TO_FOUND_IN_ADDRESSBOOK
1272 gchar
*tmp
= quote_fmt_complete_address
(msginfo
->to
);
1273 add_visibility
(tmp
== NULL ||
*tmp
== '\0');
1276 OPARENT quote_fmt CPARENT
1278 remove_visibility
();
1284 current
= &sub_expr
;
1287 OPARENT sub_expr CPARENT
1289 current
= &main_expr
;
1291 quote_fmt_insert_file
(sub_expr.buffer
);
1294 | INSERT_PROGRAMOUTPUT
1296 current
= &sub_expr
;
1299 OPARENT sub_expr CPARENT
1301 current
= &main_expr
;
1303 quote_fmt_insert_program_output
(sub_expr.buffer
);
1308 current
= &sub_expr
;
1311 OPARENT sub_expr CPARENT
1313 current
= &main_expr
;
1315 quote_fmt_insert_user_input
(sub_expr.buffer
);
1322 current
= &sub_expr
;
1325 OPARENT sub_expr CPARENT
1327 current
= &main_expr
;
1329 quote_fmt_attach_file
(sub_expr.buffer
);
1332 | ATTACH_PROGRAMOUTPUT
1334 current
= &sub_expr
;
1337 OPARENT sub_expr CPARENT
1339 current
= &main_expr
;
1341 quote_fmt_attach_file_program_output
(sub_expr.buffer
);