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
b951d4cb
...
b951d4cb74d4389e157872ab4087a3820ba125c8
authored
2004-01-13 15:47:25 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fixed comments
1 parent
ad9f2c68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
frm/frm.c
frm/frm.c
View file @
b951d4c
...
...
@@ -43,6 +43,7 @@
#include <mailutils/tls.h>
#include <mailutils/error.h>
#include <mailutils/mutil.h>
#include <mailutils/mime.h>
static
char
*
show_field
;
static
int
show_to
;
...
...
@@ -99,7 +100,7 @@ abbreviation of those is also accepted.");
/* Attribute table handling */
/* Prepares the table for use
: computes minimum abbreviation lengths
*/
/* Prepares the table for use
. Computes minimum abbreviation lengths.
*/
static
void
prepare_attrs
(
void
)
{
...
...
@@ -205,7 +206,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
case
'Q'
:
/* Very silent. */
be_quiet
+=
2
;
if
(
freopen
(
"/dev/null"
,
"w"
,
stdout
)
==
NULL
)
if
(
freopen
(
"/dev/null"
,
"w"
,
stdout
)
==
NULL
)
{
perror
(
_
(
"Can not be very quiet"
));
exit
(
3
);
...
...
@@ -326,7 +327,7 @@ get_personal (header_t hdr, const char *field, char *personal, size_t buflen)
return
status
;
}
/* Observable
Action this is being call at every message discover.
*/
/* Observable
action is being called on discovery of each message.
*/
/* FIXME: The format of the display is poorly done, please correct. */
static
int
action
(
observer_t
o
,
size_t
type
)
...
...
@@ -351,8 +352,8 @@ action (observer_t o, size_t type)
message_get_header
(
msg
,
&
hdr
);
if
(((
select_attribute
&
IS_READ
)
&&
(
!
attribute_is_read
(
attr
)))
||
(
select_attribute
&
IS_NEW
)
&&
(
!
attribute_is_recent
(
attr
))
||
(
select_attribute
&
IS_OLD
)
&&
(
!
attribute_is_seen
(
attr
)))
||
(
(
select_attribute
&
IS_NEW
)
&&
(
!
attribute_is_recent
(
attr
)
))
||
(
(
select_attribute
&
IS_OLD
)
&&
(
!
attribute_is_seen
(
attr
)
)))
break
;
if
(
attribute_is_recent
(
attr
))
...
...
@@ -419,11 +420,11 @@ action (observer_t o, size_t type)
}
/* This is a clone of the elm program call "frm". It is a good example on
how to use the observable(callback) of libmail
utils
. "frm" has to
how to use the observable(callback) of libmail
box
. "frm" has to
be very interactive, it is not possible to call mailbox_messages_count()
and wait for the scanning to finish before displaying. As soon as the scan
find
a new message we want to know about it, t
his is done by registering
an observable type MU_MAILBOX_MSG_ADD.
The rest is forma
ting code. */
find
s a new message we want to know about it. T
his is done by registering
an observable type MU_MAILBOX_MSG_ADD.
The rest is format
ting code. */
int
main
(
int
argc
,
char
**
argv
)
...
...
@@ -524,7 +525,7 @@ cleanup:
mailbox_destroy
(
&
mbox
);
if
(
status
!=
0
)
if
(
status
!=
0
)
return
3
;
}
...
...
@@ -537,10 +538,11 @@ cleanup:
if
(
show_query
&&
have_new_mail
)
printf
(
_
(
"You have new mail.
\n
"
));
/* 0 - selected messages discover.
1 - have messages.
2 - no message.
*/
/* EXIT STATUS
Frm returns a zero status ("true") if messages matching `status' are
present. Frm returns 1 if no messages matching `status' are present,
but there are some messages, returns 2 if there are no messages at
all, or returns 3 if an error occurred. */
if
(
selected
)
status
=
0
;
...
...
Please
register
or
sign in
to post a comment