utils: Fix direction_from_flag()

A system message can also be one that's received or sent.
So check if a message is system message before checking
if it's received or sent.

Also, update tests
8 jobs for wip/sadiq/fix-message-direction in 12 minutes and 32 seconds