Hacked up the tab-expansion code in Xchat. It was doing a rather lazy first-fit, and I kept talking to Greg Lehey's backup connection, groggy-B, instead of his primary connection, groggy-P. Attempts to modify his naming convention met with a stone wall of 'this is how we named things at Tandem, so it must be right.'
I also implemented a weighted selection; when you choose one amibguous definition over another it will prefer the one you just selected over all others. For instance, once you've addressed groggy-P in a message, the next time gr<tab> will select groggy-P over groggy-B and green.
I haven't decided if I like the weighting or not. I'll work with a few more days, make a decision, and contact the Xchat maintainer to see if he is interested in the patches. If not, I may add them to the BSD port/pkg kits.