]> git.zarvox.org Git - imoo.git/commitdiff
ribbon: emit events for buddy signing on
authorDrew Fisher <drew.m.fisher@gmail.com>
Sat, 26 Apr 2014 07:48:39 +0000 (00:48 -0700)
committerDrew Fisher <drew.m.fisher@gmail.com>
Sat, 26 Apr 2014 07:53:31 +0000 (00:53 -0700)
TODO: figure out what the universe of events we want to support looks like

ribbon/ribbonblist.cpp

index 6f45df10cfc4f9737b91ec863f66af584a5c9d55..c9bb6913557e9bfc7af487ca1c4a1f0b4111cd3b 100644 (file)
@@ -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);
 }