Why not have it save the person's nick as the filename? Then just keep a history in each file for each person. Check to see if the file exists... if not create it. Sorta like logs are done now for channels. Same concept. It would save having to parse a long file.