Lower maximum size of cursor window on DB upgrade.

On some systems, the DB upgrade was failing because there were
too many rows for the cursor window.  This moves some looping
operations into single update statements by using the substr()
command, and chunks the rest using a series of LIMITs.
Fix for NPE
Include (somehow missed) support for send/receive encrypted MMS.
Bumping version to 0.9.9.1