File related fixes

* Fix filenames for IPv6.  Colons replaced by underscores.
* Fix log saving when ip has a port.
* Fix chat logging twice sometimes.
Merge remote-tracking branch 'upstream/master' into pm_tweaks