#include <QDebug>
#include <QDateTime>
+#include <QDir>
RibbonBlist::RibbonBlist(RibbonManager* parent) : QObject((QObject*)parent)
{
m);
}
+void RibbonBlist::on_buddy_icon_change(PurpleBuddy* buddy)
+{
+ qDebug() << purple_buddy_get_contact_alias(buddy) << "buddy icon changed";
+ QVariantMap m = RibbonAccounts::context(buddy);
+ PurpleBuddyIcon* bicon = purple_buddy_icons_find(
+ purple_buddy_get_account(buddy),
+ purple_buddy_get_name(buddy)
+ );
+ QString icon_abspath = QString::fromUtf8(purple_buddy_icon_get_full_path(bicon));
+ QDir state_dir(_manager->get_state_dir());
+ QString relative_path = state_dir.relativeFilePath(icon_abspath);
+ m["url"] = relative_path;
+ emit event(QString::fromUtf8("blist"),
+ QString::fromUtf8("buddy_icon_changed"),
+ m);
+}
+
+static void buddy_icon_changed(PurpleBuddy* buddy, void* data)
+{
+ RibbonBlist* blist = (RibbonBlist*)data;
+ blist->on_buddy_icon_change(buddy);
+}
+
void RibbonBlist::init()
{
/* Create and load the buddylist */
PURPLE_CALLBACK(buddy_signed_off), this);
purple_signal_connect(blist_handle, "buddy-status-changed", &handle,
PURPLE_CALLBACK(buddy_status_changed), this);
+ purple_signal_connect(blist_handle, "buddy-icon-changed", &handle,
+ PURPLE_CALLBACK(buddy_icon_changed), this);
}