Code:
addonData.XRICEvents:SetScript("OnEvent",function(self,event,...)
local args = { ... }
Stop doing this! Tables bad. Variables good. Use variables. No use tables.
See here for a quick and untested (but clean) conversion of the relevant parts of PhanxChat into a standalone addon:
http://www.wowace.com/paste/lmszetyg58bn621q/