Skip to content

Commit

Permalink
Current version of Psi+ is 1.5.2011
Browse files Browse the repository at this point in the history
It is based on:
* psi: 2d5823c1
* plugins: 7a65467
* psimedia: 478567e
* resources: e32ef4b
  • Loading branch information
tehnick committed Jun 30, 2024
1 parent fb4c8ef commit a797897
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/chatview_webkit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,12 @@ class ChatViewJSObject : public ChatViewThemeSession {

Q_INVOKABLE void deleteMessage(const QString &messageId) { qDebug() << "deleteMessage" << messageId; }

Q_INVOKABLE void replyMessage(const QString &messageId) { qDebug() << "replyMessage" << messageId; }
Q_INVOKABLE void replyMessage(const QString &messageId, const QString &quotedHtml)
{
auto plainText = TextUtil::rich2plain(quotedHtml);
emit _view->quote(plainText);
qDebug() << "replyMessage" << messageId;
}

Q_INVOKABLE void copyMessage(const QString &messageId) { qDebug() << "copyMessage" << messageId; }

Expand Down
40 changes: 33 additions & 7 deletions themes/chatview/psi/bubble/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</div>
<span class="time" title="%time{LL}%">%time%</span>
%quoteTxt%
<span class="msgtext">%message%</span>
<span class="%msgtextClasses%">%message%</span>
</div>%next%`;

shared.initTheme({
Expand All @@ -47,7 +47,7 @@
dateFormat : "HH:mm",
proxy : function() { //optional
if (shared.cdata.mtype == "reactions") {
render_reactions(shared.cdata);
renderReactions(shared.cdata);
return false;
}
},
Expand All @@ -62,6 +62,13 @@
}
return classes.join(" ");
},
msgtextClasses: function() {
let classes = ["msgtext"];
if (shared.cdata.alert) {
classes.push("alert");
}
return classes.join(" ");
},
nickControl: function() {
return shared.cdata.local? "": `<div class="reply">Reply</div>`;
},
Expand All @@ -86,10 +93,23 @@
bq.addEventListener("click", () => { quoteMsg.scrollIntoView({ "behavior": "smooth", "block": "center" }) });
}
}
var replyBtn = el.getElementsByClassName("reply").item(0);
if (replyBtn) {
replyBtn.addEventListener("click", ()=>{onReplyClicked(el);});
}
var nickEl = el.getElementsByClassName("nick").item(0);
if (nickEl) {
nickEl.addEventListener("click", ()=>{shared.session.nickInsertClick(nickEl.textContent);});
}
}
});

function setup_context_menu() {
function onReplyClicked(el) {
var textEl = el.getElementsByClassName("msgtext").item(0);
shared.session.replyMessage(el.id, textEl.innerHTML);
}

function setupContextMenu() {
chatMenu.addItemProvider((event) => {
const isNick = event.target.className == "nick";
let msgNode;
Expand All @@ -113,7 +133,7 @@
} else {
items = [
{ text: "Delete", action: ()=>{ shared.session.deleteMessage(msgNode.id); } },
{ text: "Reply", action: ()=>{ shared.session.replyMessage(msgNode.id); } },
{ text: "Reply", action: ()=>{ onReplyClicked(msgNode); } },
{ text: "Forward", action: ()=>{ shared.session.forwardMessage(msgNode.id); } },
{ text: "Copy", action: ()=>{ shared.session.copyMessage(msgNode.id); } }
]
Expand All @@ -125,7 +145,7 @@
}


function render_reactions(event) {
function renderReactions(event) {
const msg = document.getElementById(event.messageid);
if (!msg) {
return;
Expand Down Expand Up @@ -154,7 +174,9 @@
const nicks = value.nicks.sort().filter((x, i, a) => !i || x != a[i-1]);
const reaction = document.createElement("span");
reaction.innerHTML = `${nicks.length} ${value.text}`;
reaction.title = nicks.join("\n");
if (shared.isMuc) {
reaction.title = nicks.join("\n");
}
reaction.addEventListener("click", (event)=>{
if (event.target.nodeName == "EM") {
shared.session.react(msg.id, event.target.textContent);
Expand All @@ -166,7 +188,7 @@
}
}

setup_context_menu();
setupContextMenu();

applyPsiSettings();

Expand Down Expand Up @@ -262,6 +284,10 @@
clip: rect(0.6rem, 3rem, 1.5rem, 2rem);
}

.msg:hover::before {
border-color: #ffffff;
}

.mymsg {
margin-left: 0.5rem;
margin-right: 3rem;
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.2010 (2024-06-30, ca2cf662)
1.5.2011 (2024-06-30, 2d5823c1)

0 comments on commit a797897

Please sign in to comment.