dont connect primary notification backend with signal notify

This commit is contained in:
Patrick von Reth 2010-07-22 18:03:22 +02:00
parent b4bf83a880
commit a6adddebbe
5 changed files with 7 additions and 10 deletions

View File

@ -89,10 +89,14 @@ void SnoreServer::publicatePlugin(SnorePlugin *plugin){
_primaryNotificationBackends.insert(pluginName,nb);
if(_notificationBackend==NULL){
_notificationBackend=nb;
}else{
connect(this,SIGNAL(notify(QSharedPointer<Notification>)),nb,SLOT(notify(QSharedPointer<Notification>)));
}
}else{
connect(this,SIGNAL(notify(QSharedPointer<Notification>)),nb,SLOT(notify(QSharedPointer<Notification>)));
}
_notyfier.insert(pluginName,nb);
connect(this,SIGNAL(notify(QSharedPointer<Notification>)),nb,SLOT(notify(QSharedPointer<Notification>)));
connect(this,SIGNAL(closeNotify(QSharedPointer<Notification>)),nb,SLOT(closeNotification(QSharedPointer<Notification>)));
connect(this,SIGNAL(applicationInitialized(Application*)),nb,SLOT(registerApplication(Application*)));
connect(this,SIGNAL(applicationRemoved(Application*)),nb,SLOT(unregisterApplication(Application*)));
@ -104,7 +108,6 @@ void SnoreServer::publicatePlugin(SnorePlugin *plugin){
int SnoreServer::broadcastNotification(QSharedPointer<Notification> notification){
emit notify(notification);
qDebug()<<"Broadcasting notification:"<<notification->toString();
if(_notificationBackend!=NULL){
notification->_id=_notificationBackend->notify(notification);
std::cout<<"Notification ID: "<<QString::number(notification->_id).toLatin1().data()<<std::endl;
@ -151,6 +154,8 @@ const QHash<QString,Notification_Backend*> &SnoreServer::primaryNotificationBack
}
void SnoreServer::setNotificationBackend(Notification_Backend *backend){
connect(this,SIGNAL(notify(QSharedPointer<Notification>)),_notificationBackend,SLOT(notify(QSharedPointer<Notification>)));
disconnect(backend,SLOT(notify(QSharedPointer<Notification>)));
_notificationBackend=backend;
}

View File

@ -45,16 +45,13 @@ void Growl_Backend::registerApplication(Application *application){
char **n = new char*[alertCount];
for (int i = 0 ; i < alertCount; ++i){
QString name = aList.at(i)->name();
qDebug()<<name;
n[i] = new char[name.length()+1];
strcpy(n[i],name.toLatin1().data());
qDebug()<<"Add alert to growl"<<n[i];
}
_applications.insert(application->name(),new Growl(GROWL_TCP,NULL,application->name().toLatin1().data(),(const char**)n,application->alerts().count()));
for (int i = 0 ; i < alertCount; ++i){
qDebug()<<"Delete"<<n[i];
delete [] n[i];
}
delete [] n;

View File

@ -51,11 +51,9 @@ void Snarl_Backend::registerApplication(Application *application){
wchar_t *appName = toWchar(application->name());
snarlInterface->RegisterApp(appName,L"",L"");
wprintf(L"Registering %s with Snarl.",appName);
foreach(Alert *alert,application->alerts()){
wchar_t *alertName = toWchar(alert->name());
wprintf(L"Registering %s als snarl alert classSnarl.",alertName);
snarlInterface->RegisterAlert(appName,alertName);
delete [] alertName;
}

View File

@ -50,8 +50,6 @@ Parser::Parser(SnarlNetworkFrontend *snarl):snarl(snarl)
SnarlNotification Parser::parse(QString &msg,QTcpSocket* client){
qDebug()<<msg;
SnarlNotification sNotification;
sNotification.httpClient=false;
sNotification.vailid=true;

View File

@ -48,7 +48,6 @@ int WebPoster::notify(QSharedPointer<Notification>notification){
QEventLoop loop;
connect(reply, SIGNAL(readyRead()), &loop, SLOT(quit()));
loop.exec();
std::cout<<"WbPoster"<<reply->readAll().data()<<std::endl;
return -1;
}