Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
74f72efa
...
74f72efa675221352c73c2dd65c5eaa12b587bc3
authored
2004-01-05 13:50:11 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Brought in sync with recent changes to libsieve
1 parent
0f3de3f2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
6 deletions
mail.local/main.c
sieve/sieve.c
mail.local/main.c
View file @
74f72ef
...
...
@@ -230,7 +230,7 @@ _sieve_debug_printer (void *unused, const char *fmt, va_list ap)
static
void
_sieve_action_log
(
void
*
user_name
,
const
char
*
script
,
size_t
msgno
,
message_t
msg
,
const
sieve_locus_t
*
locus
,
size_t
msgno
,
message_t
msg
,
const
char
*
action
,
const
char
*
fmt
,
va_list
ap
)
{
char
*
text
=
NULL
;
...
...
@@ -243,7 +243,10 @@ _sieve_action_log (void *user_name,
if
(
header_aget_value
(
hdr
,
message_id_header
,
&
val
)
==
0
||
header_aget_value
(
hdr
,
MU_HEADER_MESSAGE_ID
,
&
val
)
==
0
)
{
asprintf
(
&
text
,
_
(
"%s on msg %s"
),
action
,
val
);
asprintf
(
&
text
,
_
(
"%s:%lu: %s on msg %s"
),
locus
->
source_file
,
(
unsigned
long
)
locus
->
source_line
,
action
,
val
);
free
(
val
);
}
}
...
...
@@ -251,7 +254,10 @@ _sieve_action_log (void *user_name,
{
size_t
uid
=
0
;
message_get_uid
(
msg
,
&
uid
);
asprintf
(
&
text
,
_
(
"%s on msg uid %d"
),
action
,
uid
);
asprintf
(
&
text
,
_
(
"%s:%lu: %s on msg uid %d"
),
locus
->
source_file
,
(
unsigned
long
)
locus
->
source_line
,
action
,
uid
);
}
if
(
fmt
&&
strlen
(
fmt
))
...
...
sieve/sieve.c
View file @
74f72ef
...
...
@@ -62,6 +62,8 @@ Debug flags:\n\
#define D_DEFAULT "TPt"
#define ARG_LINE_INFO 257
static
struct
argp_option
options
[]
=
{
{
"no-actions"
,
'n'
,
0
,
0
,
...
...
@@ -88,6 +90,9 @@ static struct argp_option options[] =
{
"verbose"
,
'v'
,
NULL
,
0
,
N_
(
"Log all actions"
),
0
},
{
"line-info"
,
ARG_LINE_INFO
,
N_
(
"BOOL"
),
OPTION_ARG_OPTIONAL
,
N_
(
"Print source location along with action logs (default)"
)
},
{
"email"
,
'e'
,
N_
(
"ADDRESS"
),
0
,
N_
(
"Override user email address"
),
0
},
...
...
@@ -106,6 +111,24 @@ struct options {
char
*
script
;
};
static
int
sieve_print_locus
=
1
;
/* Should the log messages include the
locus */
static
int
is_true_p
(
char
*
p
)
{
if
(
!
p
)
return
1
;
/* TRANSLATORS: This is the list of characters meaning 'Yes'. Please,
preserve yY in your translation, e.g., for German:
msgstr "yYjJ";
*/
if
(
strchr
(
_
(
"yY"
),
*
p
))
return
1
;
return
0
;
}
static
error_t
parser
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
{
...
...
@@ -197,6 +220,10 @@ parser (int key, char *arg, struct argp_state *state)
opts
->
verbose
=
1
;
break
;
case
ARG_LINE_INFO
:
sieve_print_locus
=
is_true_p
(
arg
);
break
;
case
ARGP_KEY_ARG
:
if
(
opts
->
script
)
argp_error
(
state
,
_
(
"only one SCRIPT can be specified"
));
...
...
@@ -267,14 +294,20 @@ syslog_debug_print (mu_debug_t unused, size_t level, const char *fmt,
static
void
stdout_action_log
(
void
*
unused
,
const
char
*
script
,
size_t
msgno
,
message_t
msg
,
const
sieve_locus_t
*
locus
,
size_t
msgno
,
message_t
msg
,
const
char
*
action
,
const
char
*
fmt
,
va_list
ap
)
{
size_t
uid
=
0
;
message_get_uid
(
msg
,
&
uid
);
if
(
sieve_print_locus
)
fprintf
(
stdout
,
_
(
"%s:%lu: %s on msg uid %lu"
),
locus
->
source_file
,
(
unsigned
long
)
locus
->
source_line
,
action
,
(
unsigned
long
)
uid
);
else
fprintf
(
stdout
,
_
(
"%s on msg uid %lu"
),
action
,
(
unsigned
long
)
uid
);
if
(
fmt
&&
strlen
(
fmt
))
{
fprintf
(
stdout
,
": "
);
...
...
@@ -285,7 +318,7 @@ stdout_action_log (void *unused,
static
void
syslog_action_log
(
void
*
unused
,
const
char
*
script
,
size_t
msgno
,
message_t
msg
,
const
sieve_locus_t
*
locus
,
size_t
msgno
,
message_t
msg
,
const
char
*
action
,
const
char
*
fmt
,
va_list
ap
)
{
size_t
uid
=
0
;
...
...
@@ -293,7 +326,13 @@ syslog_action_log (void *unused,
message_get_uid
(
msg
,
&
uid
);
asprintf
(
&
text
,
_
(
"%s on msg uid %d"
),
action
,
uid
);
if
(
sieve_print_locus
)
asprintf
(
&
text
,
_
(
"%s:%lu: %s on msg uid %lu"
),
locus
->
source_file
,
(
unsigned
long
)
locus
->
source_line
,
action
,
(
unsigned
long
)
uid
);
else
asprintf
(
&
text
,
_
(
"%s on msg uid %lu"
),
action
,
(
unsigned
long
)
uid
);
if
(
fmt
&&
strlen
(
fmt
))
{
char
*
diag
=
NULL
;
...
...
Please
register
or
sign in
to post a comment