void ChatSession::displayStdout(const QString& msg) { #ifdef GUILE ScmList l; l << msg; // m_scm->runHook("chatsession-output-hook", l); #endif emit outputMessage(msg); QString m(msg); QString output; if(filter(&m)) { escape(&m); m = m_filter->filterOut(m); QStringList list = QStringList::split("\n",m); for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { QString mm = *it; #if (QT_VERSION < 305) mm += "<br>"; #endif QRegExp rx("^(-?):(\\w+\\?" "?):([^ :]+):(.*)"); if (rx.exactMatch(mm)) { QString m(rx.cap(4)); #if (QT_VERSION < 305) m += "<br>"; #endif bool ok(!(rx.cap(2).endsWith("?"))); QString abbrev = ok ? rx.cap(2) : rx.cap(2).left(rx.cap(2).length()-1); for (std::vector<Page*>::iterator it = brothers.begin(); it != brothers.end(); ++it) if ((*it)->name() == rx.cap(3)) { output = Filter::expandVars(m,context()); unescape(&output); (*it)->append(output); ok = false; } if (ok) { Page * edit = mtp->getNewPage(abbrev,rx.cap(3),this,rx.cap(1)!="-"); if(edit) { brothers.push_back(edit); output = Filter::expandVars(m,context()); unescape(&output); edit->append(output); } // else { // displayStderr("Don't know what to do with : " + QStyleSheet::escape(mm)); // } } } else { output = Filter::expandVars(mm,context()); unescape(&output); m_chatpage->append(output); } } } }