Skip to content

Commit

Permalink
Azoth VB: kludge for libpurple loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
0xd34df00d committed Feb 28, 2013
1 parent 5f315f8 commit 9afb40d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/plugins/azoth/plugins/velvetbird/velvetbird.cpp
Expand Up @@ -27,6 +27,17 @@ namespace VelvetBird
{
void Plugin::Init (ICoreProxy_ptr proxy)
{
ProtoMgr_ = 0;

PurpleLib_.setLoadHints (QLibrary::ExportExternalSymbolsHint | QLibrary::ResolveAllSymbolsHint);
PurpleLib_.setFileName ("purple");
if (!PurpleLib_.load ())
{
qWarning () << Q_FUNC_INFO
<< "unable to re-load libpurple, disabling VelvetBird";
return;
}

ProtoMgr_ = new ProtoManager (proxy, this);
connect (ProtoMgr_,
SIGNAL (gotEntity (LeechCraft::Entity)),
Expand All @@ -40,11 +51,13 @@ namespace VelvetBird

void Plugin::SecondInit ()
{
ProtoMgr_->PluginsAvailable ();
if (ProtoMgr_)
ProtoMgr_->PluginsAvailable ();
}

void Plugin::Release ()
{
PurpleLib_.unload ();
}

QByteArray Plugin::GetUniqueID () const
Expand Down Expand Up @@ -82,7 +95,7 @@ namespace VelvetBird

QList<QObject*> Plugin::GetProtocols () const
{
return ProtoMgr_->GetProtoObjs ();
return ProtoMgr_ ? ProtoMgr_->GetProtoObjs () : QList<QObject*> ();
}

void Plugin::initPlugin (QObject *proxy)
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/azoth/plugins/velvetbird/velvetbird.h
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include <QObject>
#include <QLibrary>
#include <interfaces/iinfo.h>
#include <interfaces/iplugin2.h>
#include <interfaces/azoth/iprotocolplugin.h>
Expand All @@ -39,6 +40,7 @@ namespace VelvetBird
Q_OBJECT
Q_INTERFACES (IInfo IPlugin2 LeechCraft::Azoth::IProtocolPlugin)

QLibrary PurpleLib_;
ProtoManager *ProtoMgr_;
public:
void Init (ICoreProxy_ptr);
Expand Down

0 comments on commit 9afb40d

Please sign in to comment.