GObjectification of protocols

Ankit Vani a at nevitus.org
Thu Aug 15 16:08:04 EDT 2013


This is a very simple and straightforward implementation proposal.

So I'm thinking instead of using interfaces like I proposed in my GSoC proposal,
PurpleProtocol should be an abstract object. This PurpleProtocol is basically
just the current PurplePluginProtocolInfo struct GObjectified and containing
some additional fields such as id and name.

Protocols can subclass this base type to for example, XMPPProtocol. Other
protocols that wish to make changes to XMPP can inherit XMPPProtocol and
override whatever methods they wish. These methods (current virtual functions in
PurplePluginProtocolInfo) will be in PurpleProtocolClass.

If we want to avoid getting the class instance from the object instance every
time we wish to use a protocol function, we can also provide API functions such
purple_protocol_register_user(PurpleProtocol *protocol, PurpleAccount *account)

Also, we would no longer have to check the size of the protocol info struct.

Any additional API changes required will be done after this. And as usual, some
currently unforseen API updates will also be made which I will inform about
after protocols are done.



More information about the Devel mailing list