+
+/*******************************/
+/******** CTCP HANDLING ********/
+/*******************************/
+
+void CoreSessionEventProcessor::processCtcpEvent(CtcpEvent *e) {
+ if(e->testFlag(EventManager::Self))
+ return; // ignore ctcp events generated by user input
+
+ if(e->type() != EventManager::CtcpEvent || e->ctcpType() != CtcpEvent::Query)
+ return;
+
+ handle(e->ctcpCmd(), Q_ARG(CtcpEvent *, e));
+}
+
+void CoreSessionEventProcessor::defaultHandler(const QString &ctcpCmd, CtcpEvent *e) {
+ // This handler is only there to avoid warnings for unknown CTCPs
+ Q_UNUSED(e);
+ Q_UNUSED(ctcpCmd);
+}
+
+void CoreSessionEventProcessor::handleCtcpAction(CtcpEvent *e) {
+ // This handler is only there to feed CLIENTINFO
+ Q_UNUSED(e);
+}
+
+void CoreSessionEventProcessor::handleCtcpClientinfo(CtcpEvent *e) {
+ QStringList supportedHandlers;
+ foreach(QString handler, providesHandlers())
+ supportedHandlers << handler.toUpper();
+ qSort(supportedHandlers);
+ e->setReply(supportedHandlers.join(" "));
+}
+
+void CoreSessionEventProcessor::handleCtcpPing(CtcpEvent *e) {
+ e->setReply(e->param());
+}
+
+void CoreSessionEventProcessor::handleCtcpTime(CtcpEvent *e) {
+ e->setReply(QDateTime::currentDateTime().toString());
+}
+
+void CoreSessionEventProcessor::handleCtcpVersion(CtcpEvent *e) {
+ e->setReply(QString("Quassel IRC %1 (built on %2) -- http://www.quassel-irc.org")
+ .arg(Quassel::buildInfo().plainVersionString).arg(Quassel::buildInfo().buildDate));
+}