--- /dev/null
+#include "ribbonblist.h"
+#include "ribbonmanager.h"
+
+#include <QDebug>
+
+RibbonBlist::RibbonBlist(RibbonManager* parent) : QObject((QObject*)parent)
+{
+ _manager = parent;
+}
+
+RibbonBlist::~RibbonBlist()
+{
+}
+
+static void buddy_signed_on(PurpleBuddy* buddy, void* data)
+{
+ Q_UNUSED(data);
+ qDebug() << purple_buddy_get_contact_alias(buddy) << "signed on";
+}
+
+void RibbonBlist::init()
+{
+ static int handle;
+ void *blist_handle = purple_blist_get_handle();
+ purple_signal_connect(blist_handle, "buddy-signed-on", &handle,
+ PURPLE_CALLBACK(buddy_signed_on), NULL);
+}
#include "ribbonmanager.h"
#include "ribbonaccounts.h"
+#include "ribbonblist.h"
#include "ribbonconversations.h"
#include <QDebug>
printf("Account connected: \"%s\" (%s)\n", purple_account_get_username(account), purple_account_get_protocol_id(account));
}
-static void buddy_signed_on(PurpleBuddy* buddy, void* data)
-{
- Q_UNUSED(data);
- qDebug() << purple_buddy_get_contact_alias(buddy) << "signed on";
-}
-
static void connect_to_signals(void)
{
static int handle;
- void *blist_handle = purple_blist_get_handle();
void *connections_handle = purple_connections_get_handle();
purple_signal_connect(connections_handle, "signed-on", &handle,
PURPLE_CALLBACK(signed_on), NULL);
- purple_signal_connect(blist_handle, "buddy-signed-on", &handle,
- PURPLE_CALLBACK(buddy_signed_on), NULL);
}
RibbonManager::RibbonManager(QObject* parent) : QObject(parent)
{
_accounts = new RibbonAccounts(this);
+ _blist = new RibbonBlist(this);
_conversations = new RibbonConversations(this);
+ QObject::connect(_blist, SIGNAL(event(QString,QString,QVariantMap)),
+ this, SIGNAL(event(QString,QString,QVariantMap)));
QObject::connect(_conversations, SIGNAL(event(QString,QString,QVariantMap)),
this, SIGNAL(event(QString,QString,QVariantMap)));
}
connect_to_signals();
// TODO: add more children init() calls when refactoring
+ _blist->init();
_conversations->init();
}
// Forward declarations
class RibbonAccounts;
+class RibbonBlist;
class RibbonConversations;
#define UI_ID "ribbon"
// Called to configure libpurple and connect to purple signals
void init(void);
RibbonAccounts* accounts() { return _accounts; }
+ RibbonBlist* blist() { return _blist; }
RibbonConversations* conversations() { return _conversations; }
// Exposes purple_get_version()
private:
RibbonAccounts* _accounts;
+ RibbonBlist* _blist;
RibbonConversations* _conversations;
Q_DISABLE_COPY(RibbonManager)
};