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
03f373a8
...
03f373a811406eb664e5536a95f5f34855e67a8c
authored
2005-09-17 12:23:47 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(mh_quote,mh_expand_aliases): New functions
1 parent
6c7f202f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
mh/mh_init.c
mh/mh_init.c
View file @
03f373a
...
...
@@ -825,3 +825,73 @@ mh_decode_2047 (char *text, char **decoded_text)
return
mu_rfc2047_decode
(
charset
,
text
,
decoded_text
);
}
void
mh_quote
(
const
char
*
in
,
char
**
out
)
{
size_t
len
=
strlen
(
in
);
if
(
len
&&
in
[
0
]
==
'"'
&&
in
[
len
-
1
]
==
'"'
)
{
const
char
*
p
;
char
*
q
;
for
(
p
=
in
+
1
;
p
<
in
+
len
-
1
;
p
++
)
if
(
*
p
==
'\\'
||
*
p
==
'"'
)
len
++
;
*
out
=
xmalloc
(
len
+
1
);
q
=
*
out
;
p
=
in
;
*
q
++
=
*
p
++
;
while
(
p
[
1
])
{
if
(
*
p
==
'\\'
||
*
p
==
'"'
)
*
q
++
=
'\\'
;
*
q
++
=
*
p
++
;
}
*
q
++
=
*
p
++
;
*
q
=
0
;
}
else
*
out
=
xstrdup
(
in
);
}
void
mh_expand_aliases
(
mu_message_t
msg
,
mu_address_t
*
addr_to
,
mu_address_t
*
addr_cc
,
mu_address_t
*
addr_bcc
)
{
mu_header_t
hdr
;
size_t
i
,
num
;
char
*
buf
;
mu_message_get_header
(
msg
,
&
hdr
);
mu_header_get_field_count
(
hdr
,
&
num
);
for
(
i
=
1
;
i
<=
num
;
i
++
)
{
if
(
mu_header_aget_field_name
(
hdr
,
i
,
&
buf
)
==
0
)
{
if
(
strcasecmp
(
buf
,
MU_HEADER_TO
)
==
0
||
strcasecmp
(
buf
,
MU_HEADER_CC
)
==
0
||
strcasecmp
(
buf
,
MU_HEADER_BCC
)
==
0
)
{
char
*
value
;
mu_address_t
addr
=
NULL
;
int
incl
;
mu_header_aget_field_value_unfold
(
hdr
,
i
,
&
value
);
mh_alias_expand
(
value
,
&
addr
,
&
incl
);
free
(
value
);
if
(
strcasecmp
(
buf
,
MU_HEADER_TO
)
==
0
)
mu_address_union
(
addr_to
,
addr
);
else
if
(
strcasecmp
(
buf
,
MU_HEADER_CC
)
==
0
)
mu_address_union
(
addr_cc
?
addr_cc
:
addr_to
,
addr
);
else
if
(
strcasecmp
(
buf
,
MU_HEADER_BCC
)
==
0
)
mu_address_union
(
addr_bcc
?
addr_bcc
:
addr_to
,
addr
);
}
free
(
buf
);
}
}
}
...
...
Please
register
or
sign in
to post a comment