Skip to content

Commit

Permalink
Make sending reactions working + some incomplete changes for receiving
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Jun 28, 2024
1 parent 847c253 commit 5676920
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion iris
9 changes: 9 additions & 0 deletions src/chatdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ void ChatDlg::init()
chatView()->setMediaOpener(account()->fileSharingDeviceOpener());
#endif
chatView()->init();
connect(chatView(), &ChatView::outgoingReactions, this, &ChatDlg::sendOutgoingReactions);

// seems its useless hack
// connect(chatView(), SIGNAL(selectionChanged()), SLOT(logSelectionChanged())); //
Expand Down Expand Up @@ -759,6 +760,14 @@ void ChatDlg::doneSend()
resetComposing();
}

void ChatDlg::sendOutgoingReactions(const QString &messageId, const QSet<QString> &reactions)
{
Message m(jid());
m.setType(Message::Type::Chat);
m.setReactions({ messageId, reactions });
emit aSend(m);
}

void ChatDlg::encryptedMessageSent(int x, bool b, int e, const QString &dtext)
{
Q_UNUSED(e);
Expand Down
1 change: 1 addition & 0 deletions src/chatdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ private slots:
void initComposing();
void setComposing();
void getHistory();
void sendOutgoingReactions(const QString &messageId, const QSet<QString> &reactions);

protected slots:
void checkComposing();
Expand Down
2 changes: 1 addition & 1 deletion src/chatview_te.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void ChatView::contextMenuEvent(QContextMenuEvent *e)
const QUrl anc = QUrl::fromEncoded(anchorAt(e->pos()).toLatin1());

if (anc.scheme() == "addnick") {
emit showNM(anc.path().mid(1));
emit showNickMenu(anc.path().mid(1));
e->accept();
} else {
QMenu *menu = createStandardContextMenu(e->pos());
Expand Down
2 changes: 1 addition & 1 deletion src/chatview_te.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private slots:
void slotScroll();

signals:
void showNM(const QString &);
void showNickMenu(const QString &);
void quote(const QString &text);
void nickInsertClick(const QString &nick);
void outgoingReactions(const QString &messageId, const QSet<QString> &reactions);
Expand Down
2 changes: 1 addition & 1 deletion src/chatview_webkit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ void ChatView::contextMenuEvent(QContextMenuEvent *e)
linkUrl = d->webView->page()->mainFrame()->hitTestContent(e->pos()).linkUrl();
#endif
if (linkUrl.scheme() == "addnick") {
emit showNM(linkUrl.path().mid(1));
emit showNickMenu(linkUrl.path().mid(1));
e->accept();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/chatview_webkit.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private slots:
void sessionInited();

signals:
void showNM(const QString &);
void showNickMenu(const QString &);
void nickInsertClick(const QString &nick);
void quote(const QString &text);
void outgoingReactions(const QString &messageId, const QSet<QString> &reactions);
Expand Down
2 changes: 1 addition & 1 deletion src/groupchatdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ GCMainDlg::GCMainDlg(PsiAccount *pa, const Jid &j, TabManager *tabManager) : Tab
ui_.log->setMediaOpener(account()->fileSharingDeviceOpener());
#endif

connect(ui_.log, SIGNAL(showNM(QString)), this, SLOT(doContactContextMenu(QString)));
connect(ui_.log, SIGNAL(showNickMenu(QString)), this, SLOT(doContactContextMenu(QString)));
connect(URLObject::getInstance(), SIGNAL(openURL(QString)), SLOT(openURL(QString)));
connect(ui_.log, SIGNAL(nickInsertClick(QString)), SLOT(onNickInsertClick(QString)));
connect(ui_.log, &ChatView::outgoingReactions, this, &GCMainDlg::outgoingReactions);
Expand Down
2 changes: 1 addition & 1 deletion src/psiaccount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2821,7 +2821,7 @@ void PsiAccount::processIncomingMessage(const Message &_m)
if (_m.type() != Message::Type::Error && _m.body().isEmpty() && _m.urlList().isEmpty() && _m.invite().isEmpty()
&& !_m.containsEvents() && _m.chatState() == StateNone && _m.subject().isNull()
&& _m.rosterExchangeItems().isEmpty() && _m.mucInvites().isEmpty() && _m.getForm().fields().empty()
&& _m.messageReceipt() == ReceiptNone && _m.getMUCStatuses().isEmpty())
&& _m.messageReceipt() == ReceiptNone && _m.getMUCStatuses().isEmpty() && _m.reactions().targetId.isEmpty())
return;

// skip headlines?
Expand Down

0 comments on commit 5676920

Please sign in to comment.