Gajim doesn't store information in history about which user's account received/sent a message
problem
Gajim does not save in logs any information about the account that sent or received a message.
analysis
Every row in logs
table in the history database contains only information about recipient's or sender's JID, but information about the account that was used to send or receive this message is effectively lost.
Since JIDs in jids
table are unique and can belong to multiple accounts the only information that can be retrieved using roster_entry
table is "to which accounts does this particular JID belong right now?".
enhancement recommendation
Store id of the account (account_jid_id) for every row in logs
table.