irungentoo/toxcore — pull request #1194 by wrouesnel (2014-12-08 21:00:18+00:00)
Title: Change prototype for custom_packet_handler functions

Change the custom_packet_handler callback function interface to be consistent with other callback interfaces.

The new interface takes the Messenger object calling as the first parameter, friend ID as the second parameter and moves the user data object to be the last parameter.1

This makes it comparable to the callbacks for file transfer and the like, and greatly simplifies building interfaces in object orientated languages (I've been able to use this interface to provide a very easy to use PyTox implementation of the same concept, it should translate to other languages just as simply).

The new prototype is:
`int (*)(Messenger *m, int32_t friendnumber, const uint8_t *data, uint32_t len, void *object)`

This would be a breaking API change, however very little code presently uses the custom packet interface externally. If needed, this could be implemented in a backwards compatible fashion.