diff --git a/src/chatview_webkit.cpp b/src/chatview_webkit.cpp index 1198f01eb1..a19ed7c4ce 100644 --- a/src/chatview_webkit.cpp +++ b/src/chatview_webkit.cpp @@ -171,8 +171,13 @@ class ChatViewJSObject : public ChatViewThemeSession { std::function callback) { if (url.path().startsWith("/psibob/")) { - QString cid = url.path().mid(sizeof("/psibob/") - 1); - _view->d->account_->loadBob(_view->d->jid_, cid, this, callback); + QString cid = url.path().mid(sizeof("/psibob/") - 1); + auto sender = QUrlQuery(url).queryItemValue("sender", QUrl::FullyDecoded); + auto j = _view->d->jid_; + if (!sender.isEmpty()) { + j = j.withResource(sender); + } + _view->d->account_->loadBob(j, cid, this, callback); return true; } // qDebug("Unhandled url: %s", qPrintable(url.toString())); diff --git a/themes/chatview/psi/adapter.js b/themes/chatview/psi/adapter.js index 1c1b7217c0..80d745cd14 100644 --- a/themes/chatview/psi/adapter.js +++ b/themes/chatview/psi/adapter.js @@ -117,7 +117,7 @@ function psiThemeAdapter(chat) { if (nextEl) { chat.util.siblingHtml(nextEl, html); } else { - chat.util.appendHtml(shared.chatElement, html); + chat.util.appendHtml(shared.chatElement, html, shared.isMuc? shared.cdata.sender : ""); } shared.scroller.invalidate(); }, diff --git a/themes/chatview/util.js b/themes/chatview/util.js index c3af7d8ca1..14bb020de9 100644 --- a/themes/chatview/util.js +++ b/themes/chatview/util.js @@ -226,11 +226,14 @@ function initPsiTheme() { } }, - replaceBob : function(el) { + replaceBob : function(el, sender) { var els = el.querySelectorAll("img"); // frozen list for (var i=0; i < els.length; i++) { if (els[i].src.indexOf('cid:') == 0) { - els[i].src = "/psibob/" + els[i].src.slice(4); + els[i].src = "psibob/" + els[i].src.slice(4); + if (sender) { + els[i].src += "?sender=" + encodeURIComponent(sender); + } } } }, @@ -394,21 +397,21 @@ function initPsiTheme() { } }, - prepareContents : function(html) { + prepareContents : function(html, sender) { htmlSource.innerHTML = html; - chat.util.replaceBob(htmlSource); + chat.util.replaceBob(htmlSource, sender); chat.util.handleLinks(htmlSource); chat.util.replaceIcons(htmlSource); chat.util.handleShares(htmlSource); }, - appendHtml : function(dest, html) { - chat.util.prepareContents(html); + appendHtml : function(dest, html, sender) { + chat.util.prepareContents(html, sender); while (htmlSource.firstChild) dest.appendChild(htmlSource.firstChild); }, - siblingHtml : function(dest, html) { - chat.util.prepareContents(html); + siblingHtml : function(dest, html, sourceUser) { + chat.util.prepareContents(html, sourceUser); while (htmlSource.firstChild) dest.parentNode.insertBefore(htmlSource.firstChild, dest); },