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
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