Cleanup removed buffers properly
Found this when removing a network (via dialog). The network is removed from the database (in CoreSession), and there is a networkRemoved() signal sent back to the client. No further action is done.
This has the effect that a) the BufferSyncer does not get updated, causing it to spit our warning about unknown buffers; b) buffers in the client don't get deleted (they are not shown anymore though).
Suggested solution, pending further review/evaluation:
1) Acquire a list of BufferIds belonging to the network prior to deletion. A database interface should be a sane solution for that.
2) Call BufferSyncer::removeBuffer(). This should nicely clean up everything in Client, if I'm not mistaken.
3) Remove the network as usual.
Special care needs to be taken on the client side for a currently selected buffer, joined channels and the status buffer. These get special treatment for removal right now - we need to make sure that we sanely remove those, maybe by emitting a networkRemoved() signal to client before removing the buffers?