fix bug in history db, refactor message history, add handlers for incorrect transfer ids

1. fix db history insertion
When blight receives two or more messages (from single contact) within a second it causes query-exec to throw exception, because new entry is added to DB with duplicate three fields which causes INDEX UNIQUE to error.
 changed to use milliseconds for timestamp should handle that.
 tested on both amd64 and x32.
2. refactor message history to separate class
3. handle incorrect transfer IDs. If i cancel the transfer with ID=0 toxic will use ID=1 for next transfer, but blight will see the next transfer as ID=0. Not sure why, just handle this case.