re-implement copy_chatlist function

It turns out count_chatlist() and count_friendlist() are dangerous without their respective copy functions.