Don't load multiple version of the same add-on
Now solely the one of highest priority is used (e.g., `non-packaged/add-ons/` over `system/add-ons/`). Fixes #20
This commit is contained in:
parent
b7b45a8db0
commit
e092128200
|
@ -27,6 +27,13 @@ ChatProtocolAddOn::ChatProtocolAddOn(image_id image, const char* path, int32 sub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ChatProtocolAddOn::~ChatProtocolAddOn()
|
||||||
|
{
|
||||||
|
delete fIcon;
|
||||||
|
unload_add_on(fImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ChatProtocolAddOn::InitCheck() const
|
ChatProtocolAddOn::InitCheck() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,6 +17,7 @@ class ChatProtocolAddOn {
|
||||||
public:
|
public:
|
||||||
ChatProtocolAddOn(image_id image, const char* path,
|
ChatProtocolAddOn(image_id image, const char* path,
|
||||||
int32 subProto=0);
|
int32 subProto=0);
|
||||||
|
~ChatProtocolAddOn();
|
||||||
|
|
||||||
status_t InitCheck() const;
|
status_t InitCheck() const;
|
||||||
|
|
||||||
|
|
|
@ -47,10 +47,18 @@ ProtocolManager::Init(BDirectory dir, BHandler* target)
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If add-on's API version fits then load accounts…
|
// Refuse to load add-on under some circumstances…
|
||||||
ChatProtocolAddOn* addOn = new ChatProtocolAddOn(id, path.Path());
|
ChatProtocolAddOn* addOn = new ChatProtocolAddOn(id, path.Path());
|
||||||
if (addOn->Version() != APP_VERSION)
|
if (addOn->Version() != APP_VERSION || ProtocolAddOn(addOn->Signature()) != NULL) {
|
||||||
|
if (addOn->Version() != APP_VERSION)
|
||||||
|
printf("%s not loaded, due to insufficient version (%i v %i).\n",
|
||||||
|
addOn->Signature(), addOn->Version(), APP_VERSION);
|
||||||
|
else if (ProtocolAddOn(addOn->Signature()) != NULL)
|
||||||
|
printf("%s not loaded, due to another instance already having been loaded.\n",
|
||||||
|
addOn->Signature());
|
||||||
|
delete addOn;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
// If add-on has multiple protocols, also load them
|
// If add-on has multiple protocols, also load them
|
||||||
|
|
Ŝarĝante…
Reference in New Issue