/usr/share/jed/lib/mailutils.sl is in jed-common 1:0.99.19-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | % This file contains some routines for dealing with buffers that are used for
% composing email
%
% Public Functions:
% Int_Type mailutils_find_header_separator ()
% Int_Type mailutils_narrow_to_header ()
% mailutils_get_keyword_value (kw)
% mailutils_set_keyword_value (field, value)
%!%+
%\function{mailutils_find_header_separator}
%\synopsis{Searches for the header/body separator}
%\usage{Int_Type mailutils_find_header_separator ()}
%\description
% This function searches for the line separating the mail headers
% from the body. It returns 1 if found, and 0 otherwise.
%\seealso{mailutils_narrow_to_header}
%!%-
public define mailutils_find_header_separator ()
{
bob ();
if (bol_fsearch ("--- Do not modify this line. Enter your message below ---\n"))
return 1;
!if (re_looking_at ("[-A-Za-z0-9_]+: "))
return 0;
return bol_fsearch ("\n");
}
%!%+
%\function{mailutils_narrow_to_header}
%\synopsis{Narrow to the mail headers}
%\usage{Int_Type mailutils_narrow_to_header ()}
%\description
% This function narrows the buffer to the mail headers. It returns 0
% if sucessful (headers were found), or -1 upon failure.
%\seealso{mailutils_find_header_separator, mailutils_set_keyword_value, widen}
%!%-
public define mailutils_narrow_to_header ()
{
bob ();
push_mark ();
if (mailutils_find_header_separator ())
{
narrow_to_region ();
bob ();
return 0;
}
pop_mark (0);
return -1;
}
private define mark_this_keywords_value ()
{
() = ffind (":");
go_right_1 ();
push_mark ();
while (down (1))
{
skip_chars ("\t ");
if (bolp ())
break;
eol ();
}
go_left (1);
}
%!%+
%\function{mailutils_get_keyword_value}
%\synopsis{Obtain the value of a header keyword}
%\usage{String_Type mailutils_get_keyword_value (kw)}
%\description
% This function returns the value of a mail header specified by the
% \exmp{kw} parameter. If no such header exists, \NULL will be
% returned.
%\notes
% This function does not preserve the editing point.
%\seealso{mailutils_set_keyword_value}
%!%-
public define mailutils_get_keyword_value (kw)
{
push_spot ();
EXIT_BLOCK
{
pop_spot ();
}
if (-1 == mailutils_narrow_to_header ())
return NULL;
variable exists = bol_fsearch (kw);
widen_region ();
if (exists == 0)
return NULL;
mark_this_keywords_value ();
return strtrim (bufsubstr ());
}
%!%+
%\function{mailutils_set_keyword_value}
%\synopsis{Set the value of a mail header}
%\usage{mailutils_set_keyword_value (String_Type kw, String_Type val)}
%\description
% This function sets the value of the header keyword specified by the
% \exmp{kw} argument to that of the \exmp{val} argument. If no such
% header exists, one will be created. The editing point will be left
% at the end of the header's value. If the header exists and has a
% value, then that value will be replace.
%\notes
% This function does not preserve the editing point.
%\seealso{mailutils_get_keyword_value, mailutils_find_header_separator}
%!%-
public define mailutils_set_keyword_value (field, value)
{
if (-1 == mailutils_narrow_to_header ())
return;
variable exists = bol_fsearch (field);
widen_region ();
if (exists == 0)
{
() = mailutils_find_header_separator ();
% Do it this way to avoid moving a line mark
go_left (1);
vinsert ("\n%s", field);
bol ();
}
mark_this_keywords_value ();
del_region ();
insert (" ");
insert (strtrim (value));
}
provide ("mailutils");
|