Adding znc buffer handling.

I don't think this works yet. I need to find out how to debug the js.