Commit graph

200 commits

Author SHA1 Message Date
Alex Musolino 2929a3bf67 upas/Mail: avoid showing empty To: and CC: lines in compose windows 2021-06-30 12:23:45 +00:00
Alex Musolino a5c4ac4804 upas/Mail: fix CC addresses in "Reply All" compose windows 2021-06-30 12:22:28 +00:00
Alex Musolino 347b552b18 merge 2021-06-05 01:42:10 +09:30
Alex Musolino 3568348260 upas/Mail: fix bug where Redraw must be executed twice to have an effect
In showlist, call bwindata instead of bwinopen in order to use a
pre-existing fd to write to the data file.  This existing fd will
properly honour any address set by a previous write to the addr file.
Specifically, the redraw function sets addr to "," before calling
showlist in order to overwrite the entire contents of the window.
2021-06-05 01:21:55 +09:30
Ori Bernstein b66bffe91c Mail: remove message about cyclic threads
They happen, and we break the cycle. There's nothing
the user can do, so there's no point in warning.
2021-05-01 15:33:31 -04:00
unobe f7ae890ecb patch for imap when imap fails
changeset:   8411:19f6a88ea241
branch:      mbp-2011
user:        Romano <unobe@cpan.org>
date:        Sat Apr 17 14:35:21 2021 -0700
files:       sys/src/cmd/upas/fs/imap.c
description:
When an imap fetch fails, it's helpful at times to know the underlying
cause.  This provides more details by providing the underlying error
message.
2021-04-17 18:52:11 -07:00
Ori Bernstein 9923ea348c Mail: remove impliicit headers (thanks unobe)
Setting headers from Mail can cause conflicts
with the headers that upas/marshal adds when
sending attachments.

So, let's not set them.
2021-04-17 18:46:02 -07:00
Ori Bernstein fd4e8eef0b Mail: correctly track the number of messages (thanks igor)
We forgot to update the message count when deleting
messages in mail, meaning we could access trailing
messages that had been freed.
2021-04-12 09:22:48 -07:00
Ori Bernstein 9162533526 Mail: separate deletion from relinking messages
Mutating lists that are being iterated is needlessly error
prone, and we were removing the wrong message in some cases
if it the dummy got inserted in the right place.

Separating deletion into a redraw/relink and zap phase
simplifies the problem.
2021-03-10 16:49:17 -08:00
Ori Bernstein f234b29c7f Mail: revert 096538d64724 2021-03-01 19:23:13 -08:00
Ori Bernstein 3555843110 Mail: fix infinite deletion loop
When deleting messages that came in just
the right order, we would end up stuck in
a loop deleting and reinserting a dummy
parent, rather than the messages we wanted
to remove.
2021-02-28 16:36:42 -08:00
Ori Bernstein f3a05b16ad upas/send: add \n to error in refuse() (thanks josuah) 2021-02-20 15:25:25 -08:00
Ori Bernstein 2d13ac5d39 marshal: remove debug junk.
Oops.
2021-02-20 13:03:35 -08:00
Ori Bernstein fb88cab9ff upas/marshal: use login instead of user (thanks sirjofri)
User is the upasname, and is unlikely to exist when we save
the message to the outbox. We should use the login name instead.
2021-02-20 13:01:48 -08:00
Ori Bernstein 245264e371 upas/marshal: handle nonexistent save folder correctly (thanks sirjofri)
When the save folder did not exist, and we could not create
it, we would handle up to one Biobuf worth of message, and
then fail, due to a failed tee. The sequence of events leading
up to this was:

	openfolder() -> error
	tee(0, fd, -1) -> wait for read
	write(0, data) ->
		write(fd, data) -> ok
		write(-1, data) -> error, tee terminates
	write(0, attachment) -> error

This change prevents us from writing to a closed fd, and
therefore from erroring out when sending.

We also warn the user.
2021-02-20 12:49:03 -08:00
Michael Forney 29fbba7b6d [9front] upas/vf: exclude mime boundary from temporary attachment files
validateattachment has no business with the mime boundary; it is not
part of the attachment itself.

Also, it causes the boundary to be dropped in the message output from
upas/vf, effectively dropping the following attachment (though the
content is still present after the last boundary of the wrapped first
attachment part).

Consider the following sequence of events:
1. upas/vf is run on a message containing two attachments.
2. The first attachment does not have a known extension, so is saved
   to a temporary file *including* the following mime boundary.
3. This file is opened as p->tmpbuf, which is used for subsequent
   reads until switching back to stdin.
4. The attachment fails validateattachment, so upas/vf wraps it in a
   multipart with a warning message.
5. problemchild() calls passbody(p, 0), which copies from p->tmpbuf
   until it hits the outer boundary line, which it excludes, seeks
   back one line, then returns the outer multipart.
6. problemchild() then writes its own boundary, and then copies one
   line from *stdin* to stdout, expecting the outer boundary.
   However, this boundary was already read from stdin in 2, so it ends
   up reading the first line of the subsequent part instead.

To fix this, pass 0 to passbody() in save() to exclude it from the
attachment file and make it available in stdin when expected.
2021-02-08 20:59:01 -08:00
Ori Bernstein 491fe25158 Mail: correct rendering of nested multipart messages
Reading nested subparts of messages into the root
message array allows deeply nested multipart trees
of messages to show correctly in the message view.
2021-02-07 20:30:04 -08:00
Michael Forney e20dcb151a [9front] upas/vf: remove debugging print statements
These messages aren't useful and were presumably left over from
someone debugging this code.
2021-02-07 20:17:06 -08:00
Michael Forney 827bf1b7da [9front] upas/vf: install %τ format specifier
upas/vf was converted to use tmdate, but the formatter was never
installed.  This caused it to send attachments to validateattachment
with header `From virusfilter %τ%`, which always failed since upas/fs
would just skip over the message.
2021-02-07 08:02:36 -08:00
Ori Bernstein 101312c1d7 mklib, upas/common: clean up libcommon properly (thanks mikan)
Despite pervious efforts, mk clean still doesn't remove libcommon.a*
files from cmd/upas/common/. To fix this, let's tell cmd/mklib to do
the job instead.
2021-02-03 08:10:11 -08:00
Ori Bernstein 49d7ca8d92 runq: clean up code, fix error handling.
Runq spawns a number of processes, and wait()s for them
in 2 different places. Because of the way that the exit
handling is done, the wait can get the wrong message.

It turns out that only one place in the code needs to
wait for the child, and in all other cases, it's just
muddling the problem.

This change adds the RFNOWAIT call to all the processes
we don't need to wait for, so that the places that do
need wait will always get the correct child.
2021-02-02 06:52:00 -08:00
Ori Bernstein 34ed7f7aa2 Mail: only clear upas-maintained flags on change (thanks deuteron)
When message flags change, Mail would clear all the flags and
recompute them. This would clobber internal flags like Ftodel.
So, don't do that.
2021-02-01 20:38:40 -08:00
Ori Bernstein 273c4bff7a Mail: fix inverted reply-all condition 2021-01-29 18:29:01 -08:00
Ori Bernstein bee6271ae1 Mail: rewrite.
Acme mail made it hard to do threading, so I wrote a new one.
2021-01-29 17:34:47 -08:00
Ori Bernstein ed2b1d5c61 upas/fs: fix swapped argument, dead code
With ntlm auth, we were trying to set 0 bytes of
the auth struct to its size. The args were clearly
swapped. Fix it.

While we're here, remove some dead code.
2021-01-23 18:02:46 -08:00
Ori Bernstein f164ee6dd9 upas/runq: fix typo
one slipped in to the last commit.
2021-01-23 16:38:32 -08:00
Ori Bernstein 51319cc5b5 upas/runq: bring back -a
Turns out -a is useful in crontab, so bring
back a simplified version of it. This only
iterates through directories one at a time.
2021-01-23 16:05:21 -08:00
Ori Bernstein f321298c55 upas/runq: support parallel queue processing, drop -a
When running a mail queue, it's useful to run it with limited
parallelism. This helps mailing lists process messages in a
reasonable time.

At the same time, we can remove the load balancing from runq,
since the kinds of systems that this matters on no longer
exist, and running multiple queues at once can be better
done through xargs.
2021-01-23 11:03:05 -08:00
Ori Bernstein 417dc79cff upas/ml: touch the artwork
Global variables deserve more greppable names,
since I'm likely to know where they're used.
2021-01-19 18:12:30 -08:00
cinap_lenrek eb1dfed9ab libauth: change programs to use the new procsetuser() function 2020-12-19 18:02:37 +01:00
Alex Musolino 781a8f8d9f upas: fix mk nuke 2020-11-25 19:54:52 +10:30
Ori Bernstein bd6747ccd0 upas/*: fix mkfile issues (thanks amavect)
Fixes 3 issues in our upas mkfiles:
- mk/mkfile and send/mkfile were rebuilding
  only the rfc822.tab.$O, even though the
  header also needed to be rebuilt.
- CLEANFILES had a pattern that  would not
  get expanded.
- Third, ../upas/mkfile was being included
  in the wrong place and making the wrong
  rule default.
2020-11-22 11:36:23 -08:00
Ori Bernstein 03f209427b upas: make 'all' the default target
When consolidating the duplicated targets, the
one that actually got built ended up arbitrary.
Put in a 'default' target that runs 'mk all'.
2020-11-21 16:13:20 -08:00
Ori Bernstein 1e3dd86128 upas/*: cleanup mkfiles (thanks amavect)
Changeset 50ad211fb12f broke the libcommon rule in
mkupas. Deleting the 'mk clean' in the recipe fixes
this.

Cleanup includes deleting UPDATE vars from all mkfiles,
reorganization of vars in TARG,LIB,OFILE,HFILE order,
and deletion of extra vars used for UPDATE.
2020-11-17 18:37:38 -08:00
Ori Bernstein e543995bba imap4d: imap4date should ignore time and timezone (RFC3501, 6.4.4) 2020-11-08 14:21:14 -08:00
Ori Bernstein 4257a5292a upas/marshal: add -S saveto to save outgoing mail, fix -F
Upas/marshal -F was broken with the '-8' command, and silly
without it: It used aliases passed on the command line, so
the destination address was ignored with -8 was passed.

In addition, it would create a new mailbox for any aliases
being sent to, instead of putting them all in one location.

The new -S option is similar to -F, but specifies where the
message should go.
2020-11-06 18:15:15 -08:00
Ori Bernstein 97de3f67c2 upas/common: delete library on 'mk clean'
libcommon.a$O doesn't end with a .a, so mk
doesn't know how to look inside it in order
to check if the files are up to date.

This means that when 'mk clean' is run,
libcommon.a$O looks up to date:

	% mk clean
	...
	% mk
	mk: 'default' is up to date

Deleting the library works around this problem.
2020-11-02 13:12:34 -08:00
khm 19273fdee3 upas/fs/mbox.c: fix cosmetic typo 2020-10-22 13:46:00 -07:00
Ori Bernstein a41b74059b upas: fix appendfolder timestamps (thanks umbraticus)
When moving messages between folders, mbappend,
deliver, and nedmail were trying to parse the
timestamp ouut of the message. They were doing
it incorrectly, trying to include the user name
as part of the date format.

Change to pass just the date to the date parser.
2020-10-17 18:59:36 -07:00
cinap_lenrek 3e880cd07d upas/fs: fix truncation of plumb date
the new date format introduced by the previous commit;
using numeric timezone offsets; needs one character more,
so increase the date format buffer to 31 characters.
2020-10-11 14:59:49 +02:00
Ori Bernstein d9f9e10e7b upas: convert to tmdate, change timezone format
Complete the conversion of upas to remove ctime,
use the new date library, and print time zones
in +hhmm format, instead of NNN format.

This may affect code that expects specific names
for timezones. Fix that code.
2020-09-26 11:20:42 -07:00
Ori Bernstein e3166b4fe8 upas/fs: fix handing of multi-line header fields (thanks theinicke)
Right now, upasfs exposes header lines as is, without stripping
out new lines. It also documents that it provides one header per
line in the info file.

As a result, when we get a mail with headers that span lines,
our tools get confused.

These split lines are not semantically meaningful. From RFC5322:

  2.2.3.  Long Header Fields

   Each header field is logically a single line of characters comprising
   the field name, the colon, and the field body.  For convenience
   however, and to deal with the 998/78 character limitations per line,
   the field body portion of a header field can be split into a
   multiple-line representation; this is called "folding".  The general
   rule is that wherever this specification allows for folding white
   space (not simply WSP characters), a CRLF may be inserted before any
   WSP.

As a result, to simplify processing, we should just strip out the
line separators when exposing the headers from upasfs.
2020-09-17 16:11:10 -07:00
cinap_lenrek e9cd41467e upas: appendfolder() don't be picky about the timezone of ctime()
This is temporary fix, we should try to emulate the previous
behaviour where we accept at least our local timezone, and
otherwise ignore the offset.
2020-09-01 23:08:58 +02:00
cinap_lenrek 20d8cd0d63 upas: appendfolder(): skip the address from unix header before date 2020-09-01 23:01:45 +02:00
cinap_lenrek feda48624b upas/fs: extract proper date from unix header
do not try to parse the m->unixfrom field, it only contains
the unix mail address.

instead, have parseunix() save a pointer into the unixheader
after the unix mail address for the unixdate, and later use
it to derive the mails timestamp.
2020-09-01 21:39:45 +02:00
Alex Musolino 79b4ec29a1 upas/fs: remove unused function date822tounix 2020-09-01 22:25:06 +09:30
Ori Bernstein e702cfcafd upas/fs: port date parsing to libc apis
There was a lot of code in upas/fs to deal with dates.
Now there isn't.
2020-08-09 19:46:38 -07:00
kvik e5894dccea pre-lib9p servers: fix incorrect Tversion handling
version(5) says:

	If the server does not understand the client's version
	string, it should respond with an Rversion message (not
	Rerror) with the version string the 7 characters
	``unknown''.

Pre-lib9p file servers -- all except cwfs(4) -- do return Rerror.

lib9p(2) follows the above spec, although ignoring the next part
concerning comparison after period-stripping.  It assumes an
Fcall.version starting with "9P" is correctly formed and returns
the only supported version of the protocol, which seems alright.

This patch brings pre-lib9p servers in accordance with the spec.
2020-08-01 15:27:28 +02:00
Ori Bernstein c03079ad08 upasfs: make imap debug logging less noisy
The current logging prints a debug line for every
message in an inbox, which is unusably verbose.
This removes the prints for unchanged messages,
and adds a print for flag changes.
2020-07-26 19:12:48 -07:00
cinap_lenrek ad26dc48a6 imap4d: fix missing return in %δ format of Dfmt() 2020-07-05 22:15:02 +02:00