Cleanup in owl_zwrite_create on error cases

Before, the caller was required to cleanup, even on error. This is kind
of weird. In particular, owl_zwrite_create_and_send_from_line forgot to
so there was a small leak in there.

Also with 6329cd5136a27361dedf94bb92e20fa2d327e43c it's now possible to
error from owl_zwrite_create_from_line before the owl_zwrite is
initialized, which means that owl_zwrite_new_from_line on misquoted
strings explodes. Oops.  Although I don't think this is actually
possible to trigger now.

Also be consistent about whether rv != 0 or rv < 0 is the error
condition. Barring any actual arguments one or another, I'm going to
arbitrary declare it's the former since that function doesn't really
have a useful number to return.
Switch to interactive context before sourcing the startup file

There are no invariants that don't hold before the previous place we
flip the interactive bit; although default_style is applied afterwards,
there is still a style set before that code.

There is no code which reads the READCONFIG bit, so no behavior should
change from there. Setting the interactive bit makes
owl_function_load{login,}subs noisier, but that's fine. A number of
commands were labeled OWL_CTX_INTERACTIVE, but that doesn't change much
because, unless the command is OWLCMD_*_CTX, the bits are ignored.

What does change is that .owl/startup is allowed to leave with a context
on the stack. In particular, this /finally/ fixes #161.

More fundamentally, this makes .owl/startup identical to the user having
run those commands in succession, which is a nice simplification.
Don't leak old_msg in owl_function_zcrypt
Add completion for jabberlogout
rename default config file to .owl/init.pl

motivations: to make clear that the config file is a perl script, which
runs before and is neither shadowed nor superceded by .owl/startup.

fix doc wording per andersk

more doc fixes from andersk

clean up the else-case logic, per andersk
Allocate the mainwin on the heap

This lets us return NULL from owl_global_get_mainwin before the mainwin
has been initilized.

Since g has static duration, g.mw is automatically initialized to NULL.
Allocate owl_messagelist on the heap

This lets us return NULL from owl_global_get_messagelist before the
messagelist has been initilized.

Since g has static duration, g.ml is automatically initialized to NULL.
Flush the fmttext cache and redisplay on setting colorztext

This fixes trac-#147.

owl_function_calculate_topmsg should probably hang off the mainwin.
Currently, the implementation relies on the existence of the current
view and recwinlines (which relies on the existence of the global
mainpanel).  The global mainpanel is guarenteed to exist if the mainwin
has been created.  The scrollmode variable must also have already been
created (it is currently safe to assume that if the mainwin exists, then
all the variables have been created).
Stop pretending to support zwrite *

‘*’ is not a valid recipient, and pretending that it is just adds more
special cases to get wrong.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: David Benjamin <davidben@mit.edu>
Add function to test whether a recipient is personal

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: David Benjamin <davidben@mit.edu>
Don’t treat zwrite '' as personal

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: David Benjamin <davidben@mit.edu>
Don’t send public pings on zwrite '' or zwrite @REALM

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: David Benjamin <davidben@mit.edu>
Append the realm to the zsender if missing

This works around the problem where setting zsender to your username
makes outgoing zephyrs become unauthenticated.  It will also make
things less confusing on cross-realm classes with the next commit.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: David Benjamin <davidben@mit.edu>
Allow zsender spoofing on cross-realm classes

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: David Benjamin <davidben@mit.edu>
Don’t write CC: line on zwrite -C ''

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: David Benjamin <davidben@mit.edu>
Only add outgoing messages for personal part of half-personal messages

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: David Benjamin <davidben@mit.edu>
Fixed typo in unbindkey Usage error

[davidben@mit.edu: Oh hey, we have one of those in the help text too.
I'll just fix it here.]
Fix hang on empty zcrypt messages

send_receive will never close wfd if out is an empty string.
Consequently, the zcrypt end will keep waiting for something
to encrypt (or decrypt), thereby deadlocking the barnowl.

This closes wfd if we aren't going to write anything to it.
Consequently, zcrypt will terminate quickly, and we'll also
return.

This fixes a deadlock when sending (at least it's the user's
fault) or receiving (this one is a DoS possibility) empty zcrypted
messages.
Rewrite call_filter to use g_spawn_async_with_pipes

This simplifies the error-handling code. Also fixes a bug where file
descriptors get double-closed in call_filter. Also adds a unit test. The
separate prog argument is removed to avoid having to deal with
G_SPAWN_FILE_AND_ARGV_ZERO, and since we don't really use it anyway.
zephyr: Add an iterator interface to fields

Signed-off-by: Anders Kaseorg <andersk@mit.edu>