Commit 72a1301f 72a1301f065d94157b5cf7130924049e265af72d by Alain Magloire

* mailbox/mbx_imap.c (imap_message_lines): If the message_size

	is not set fallback on body_lines and header_lines.

	* mail/print.c:  Lines number are not always known for
	example for POP or IMAP, it is not known until the mail
	is dowloaded so take a guess base on the size.
1 parent 1b691c26
......@@ -10,6 +10,13 @@
* mailbox/mbx_mh.c: Provide a prototype for mh_message_number()
there is no provision for it in the current Mailbox API.
* mailbox/mbx_imap.c (imap_message_lines): If the message_size
is not set fallback on body_lines and header_lines.
* mail/print.c: Lines number are not always known for
example for POP or IMAP, it is not known until the mail
is dowloaded so take a guess base on the size.
2001-10-08 Sergey Poznyakoff
* mail/z.c: Bugfix: Did not display the last message when the
......
......@@ -48,6 +48,21 @@ mail_print (int argc, char **argv)
return 1;
message_lines (mesg, &lines);
/* If it is POP or IMAP the lines number is not known try
to be smart about it. */
if (lines == 0)
{
if ((util_find_env("crt"))->set)
{
size_t col = (size_t)util_getcols ();
if (col)
{
size_t size = 0;
message_size (mesg, &size);
lines = size / col;
}
}
}
if ((util_find_env("crt"))->set && lines > (size_t)util_getlines ())
out = popen (getenv("PAGER"), "w");
......
......@@ -970,7 +970,12 @@ imap_message_lines (message_t msg, size_t *plines)
{
msg_imap_t msg_imap = message_get_owner (msg);
if (plines && msg_imap)
*plines = msg_imap->message_lines;
{
if (msg_imap->message_lines == 0)
*plines = msg_imap->body_lines + msg_imap->header_lines;
else
*plines = msg_imap->message_lines;
}
return 0;
}
......