licq-im/licq — pull request #27 by erijo (2013-02-25 21:18:04+00:00)
Title: Support multiple owners per protocol

Add the missing piece to support multiple owners for protocols.

Each plugin now implements the following two interfaces:

* **GeneralPluginFactory** or **ProtocolPluginFactory** (inherits PluginFactory):
Used to fetch static data such as name, version, etc. for plugins. It is also used to create and destroy plugin interfaces. When a plugin is first loaded, a factory is created and kept around until the plugin is unloaded.

* **GeneralPluginInterface** or **ProtocolPluginInterface** (inherits PluginInterface):
This interface is used to control each plugin, e.g. start/stop, send signals, etc.

For general plugins, only one interface is ever created, and this is done when loading the plugin.

For protocol plugins, an initial interface is created when loading the plugin. Then, as new owners are added, new interface instances are created. Each instance is bound to an owner to be able to send signals to the correct receiver.

For access to plugins from other plugins (and also internally in the daemon) we have the classes **Plugin** and **PluginInstance** (and their general and protocol variants). The Plugin class maps to a loaded PluginFactory and can be used to query for name, version, running instances etc.

A PluginInstance is used when accessing an instance of PluginInterface. Each PluginInstance runs in a separate thread and has an unique id.

I have enabled multiple owner support for jabber and msn (I haven't tested multiple owner on msn, only jabber). For icq we need to remove the use of statics in the protocol, but also change all callers of PluginManager::getProtocolInstance(LICQ_PPID) to instead get an instance for a specific owner.