From: Drew Fisher Date: Sat, 26 Apr 2014 07:48:39 +0000 (-0700) Subject: ribbon: emit events for buddy signing on X-Git-Url: http://git.zarvox.org/main.js?a=commitdiff_plain;h=d33f53b12568252efbae4abddd5a86bcc0191914;p=imoo.git ribbon: emit events for buddy signing on TODO: figure out what the universe of events we want to support looks like --- 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); }