"I was talking with James."
Translation:Bha mi a' bruidhinn ri Seumas.
To sometimes works a translation for ri, but with is much more reliable. For example, either would work here but only with would work in
Bha e a' sabaid ri dràgon
He was fighting with a dragon
In my view, the best strategy to get the right meaning, rather the right English, is to try with first, then against.