int main(int argc, char **argv) { const char *n[2] = { "alice" , "bob" }; Growl *growl = new Growl(GROWL_UDP,"password","gntp_send++",(const char **const)n,2); growl->Notify("bob","title","message"); delete(growl); return 0; }
void GrowlBackend::slotRegisterApplication(const Application &application) { snoreDebug(SNORE_DEBUG) << application.name(); std::vector<std::string> alerts; foreach (const Alert &a, application.alerts()) { snoreDebug(SNORE_DEBUG) << a.name(); alerts.push_back(a.name().toUtf8().constData()); } Growl *growl = new Growl(GROWL_TCP, settingsValue(QLatin1String("Host")).toString().toUtf8().constData(), settingsValue(QLatin1String("Password")).toString().toUtf8().constData(), application.name().toUtf8().constData()); m_applications.insert(application.name(), growl); growl->Register(alerts, application.icon().localUrl().toUtf8().constData()); }
void GrowlBackend::slotNotify(Notification notification) { Growl *growl = m_applications.value(notification.application().name()); QString alert = notification.alert().name(); snoreDebug(SNORE_DEBUG) << "Notify Growl:" << notification.application() << alert << notification.title(); GrowlNotificationData data(alert.toUtf8().constData(), notification.id(), notification.title().toUtf8().constData(), notification.text().toUtf8().constData()); if (notification.icon().isValid()) { data.setIcon(notification.icon().localUrl().toUtf8().constData()); } data.setCallbackData("1"); growl->Notify(data); slotNotificationDisplayed(notification); }