~singpolyma/cheogram

Merge branch 'guix-no-tc'

* guix-no-tc:
  Guixify
  No more TC
  Don't need to rewrite anymore
Don't need to rewrite anymore
Only list keys from TC for the rewrite and print progress
sadd and hset with no values are exceptions
Rewrite DB on boot to ensure all data is in both TC and Redis
Build hstatsd fork in CI
Only store muc_membersonly if True

The default is False anyway if not present.

This handler is overbroad and catches any disco#info that isn't caught
elsewhere, but assumes this must be a result from a MUC.  That was probably true
when this was written, but it's certainly not safe and we can see in the DB that
there are muc_membersonly keys set to False for non-MUC JIDs.  This change is
safe and not invasive but will cut down on DB contents at least.
Nothing ever sets resource to create anymore
Ensure that all stanzas coming out of cheogram have ids

They're not required to by the spec, but many usages need them and it's
certainly good practise, so if for any reason a stanza we are about to send
lacks one, add it.
Support passing through messages from alphanumeric senders

Some countries support these one-way SMS senders that come from ascii
alphanum+space senders.  All known SGX pass those through raw as the localpart,
so why not just allow them to and fix it up in Cheogram, since that's our whole
job is to make the SGX author's life easier.

Converts to Base10 (https://wiki.soprani.ca/TextEncodingBase10) and appends a
suitable phone-context.  Don't need to specially handle replies since these are
one-way senders anyway so any reply attempt will fail.  Adds the original
localpart as a nickname so that clients can show it rather than the Base10 gunk.
"Whisper" is an uncommon term of art
Update for network 3.0
Read from redis first, then TC -- write to both

If a key is in redis, use that value. Combine set and hash results from redis
and TC.  All writes go fully to both.

Redis keys are seperated by 0xFF instead of 0x0, the former is actually invalid
in UTF8 so is a fully safe seperator, and has the neat bonus of being used by
CBOR as a terminator (though the usage here does not make the keys valid CBOR).

Hashes are encoded so that we can store (Text, Maybe Text) -- a value of Just x
is stored UTF8 encoded, so if there are no Nothing values the hash looks like a
normal (Text, Text) would.  Nothing is stored as 0xF6, which is invalid UTF8
when alone so cannot be confused with valid text, and is the valid CBOR encoding
of null.

Enum are stored as the text representation of the corrosponding Int.  This is
only used on Bool in the codebase at the moment, so it will be 0 in Redis for
False, 1 for True.  This encoding is pretty common for integers in redis in
general.
DB contains a Redis connection also
Do not assert return value of TC.out
Log errors that happen in adhoc sessions
Show better call stack in byNode error
Guard more uses of byNode more carefully

byNode should die, but until then we should be pretty sure we have a node before
we call it.
Next