From d33f53b12568252efbae4abddd5a86bcc0191914 Mon Sep 17 00:00:00 2001 From: Drew Fisher Date: Sat, 26 Apr 2014 00:48:39 -0700 Subject: [PATCH] ribbon: emit events for buddy signing on TODO: figure out what the universe of events we want to support looks like --- ribbon/ribbonblist.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ribbon/ribbonblist.cpp b/ribbon/ribbonblist.cpp index 6f45df1..c9bb691 100644 --- a/ribbon/ribbonblist.cpp +++ b/ribbon/ribbonblist.cpp @@ -14,8 +14,18 @@ RibbonBlist::~RibbonBlist() static void buddy_signed_on(PurpleBuddy* buddy, void* data) { - Q_UNUSED(data); qDebug() << purple_buddy_get_contact_alias(buddy) << "signed on"; + + PurpleAccount* acct = purple_buddy_get_account(buddy); + QVariantMap m; + m["proto"] = QString::fromUtf8(purple_account_get_protocol_id(acct)); + m["account"] = QString::fromUtf8(purple_account_get_username(acct)); + m["buddy"] = QString::fromUtf8(purple_buddy_get_name(buddy)); + + RibbonBlist* blist = (RibbonBlist*)data; + blist->event(QString::fromUtf8("blist"), + QString::fromUtf8("buddy_signed_on"), + m); } void RibbonBlist::init() @@ -23,5 +33,5 @@ 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); + PURPLE_CALLBACK(buddy_signed_on), this); } -- 2.39.2