equal
deleted
inserted
replaced
379 |
379 |
380 // unlinked nick (if own one) |
380 // unlinked nick (if own one) |
381 return QString("<span class=\"nick\">%1</span>").arg(nickname.toHtmlEscaped()); |
381 return QString("<span class=\"nick\">%1</span>").arg(nickname.toHtmlEscaped()); |
382 } |
382 } |
383 |
383 |
384 const QRegExp HWChatWidget::URLREGEXP = QRegExp("(http(s)?://)?(www\\.)?((([^/:?&#]+\\.)?hedgewars\\.org|code\\.google\\.com|googlecode\\.com|hh\\.unit22\\.org)(/[^ ]*)?)"); |
384 // Regex to make some URLs clickable for selected domains: |
|
385 // - hedgewars.org (official website) |
|
386 // - hh.unit22.org (community addon server) |
|
387 const QRegExp HWChatWidget::URLREGEXP = QRegExp("(http(s)?://)?(www\\.)?((([^/:?&#]+\\.)?hedgewars\\.org|hh\\.unit22\\.org)(/[^ ]*)?)"); |
385 |
388 |
386 bool HWChatWidget::containsHighlight(const QString & sender, const QString & message) |
389 bool HWChatWidget::containsHighlight(const QString & sender, const QString & message) |
387 { |
390 { |
388 if ((sender != m_userNick) && (!m_userNick.isEmpty())) |
391 if ((sender != m_userNick) && (!m_userNick.isEmpty())) |
389 { |
392 { |
399 } |
402 } |
400 |
403 |
401 QString HWChatWidget::messageToHTML(const QString & message) |
404 QString HWChatWidget::messageToHTML(const QString & message) |
402 { |
405 { |
403 QString formattedStr = message.toHtmlEscaped(); |
406 QString formattedStr = message.toHtmlEscaped(); |
404 // link some urls |
407 // link some URLs |
405 formattedStr = formattedStr.replace(URLREGEXP, "<a href=\"http\\2://\\4\">\\4</a>"); |
408 formattedStr = formattedStr.replace(URLREGEXP, "<a href=\"http\\2://\\4\">\\4</a>"); |
406 return formattedStr; |
409 return formattedStr; |
407 } |
410 } |
408 |
411 |
409 void HWChatWidget::onChatAction(const QString & nick, const QString & action) |
412 void HWChatWidget::onChatAction(const QString & nick, const QString & action) |