Skip to content

Commit

Permalink
Current version of Psi+ is 1.5.2052
Browse files Browse the repository at this point in the history
It is based on:
* psi: 31774cb5
* plugins: 347230b
* psimedia: 478567e
* resources: fc4cfc1
  • Loading branch information
tehnick committed Sep 29, 2024
1 parent caaed81 commit f6107fd
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/groupchatdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ GCMainDlg::GCMainDlg(PsiAccount *pa, const Jid &j, TabManager *tabManager) : Tab
connect(ui_.log, &ChatView::editMessageRequested, ui_.mle->chatEdit(), &ChatEdit::startCorrection);
connect(ui_.log, &ChatView::forwardMessageRequested, account(),
[this](const QString &messageId, const QString &nick, const QString &text) {
account()->psi()->invokeForwardMessage(jid().withResource(nick), text);
account()->psi()->invokeForwardMessage(messageId, jid().withResource(nick), text);
});
connect(ui_.log, &ChatView::openInfoRequested, account(),
[this](const QString &nick) { account()->invokeGCInfo(jid().withResource(nick)); });
Expand Down
48 changes: 44 additions & 4 deletions src/psicon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "edbsqlite.h"
#include "eventdlg.h"
#include "globalshortcut/globalshortcutmanager.h"
#include "xmpp/xmpp-im/xmpp_forwarding.h"
#ifdef GROUPCHAT
#include "groupchatdlg.h"
#endif
Expand Down Expand Up @@ -1986,9 +1987,38 @@ int PsiCon::idle() const { return d->idleSettings_.secondsIdle; }

ContactUpdatesManager *PsiCon::contactUpdatesManager() const { return contactUpdatesManager_; }

void PsiCon::invokeForwardMessage(const Jid &from, const QString &text)
void PsiCon::invokeForwardMessage(const QString &fromMessageId, const Jid &from, const QString &text)
{
Message m, dm;
dm.setFrom(from);
dm.setBody(text);
dm.setId(fromMessageId);

Forwarding fwd;
fwd.setMessage(dm);
fwd.setType(Forwarding::ForwardedMessage);

m.setType(Message::Type::Chat);
m.setForwarded(fwd);

auto sender = [m = std::move(m)](const QList<PsiContact *> &destinationsContacts) {
QHash<PsiAccount *, QList<PsiContact *>> perAcc;
for (auto contact : destinationsContacts) {
if (contact->account()->isAvailable()) {
perAcc[contact->account()].append(contact);
}
}
for (auto it = perAcc.begin(); it != perAcc.end(); ++it) {
for (auto c : it.value()) {
Message m_ = m;
m_.setTo(c->jid());
it.key()->dj_sendMessage(m_);
}
}
};

auto dlg = new QDialog(d->mainwin);
dlg->setAttribute(Qt::WA_DeleteOnClose, true);
dlg->resize(200, 600);
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->setWindowIcon(IconsetFactory::icon("psi/action_contacts_manager").icon());
Expand All @@ -1998,11 +2028,21 @@ void PsiCon::invokeForwardMessage(const Jid &from, const QString &text)
auto roster = new PsiRosterWidget(d->mainwin);
roster->setContactList(d->contactList);
roster->setPickContactMode(true);
connect(roster, &PsiRosterWidget::contactPick, this,
[](PsiContact *c) { qDebug("TODO forwarding to: %s", qPrintable(c->jid().full())); });
connect(roster, &PsiRosterWidget::contactPick, this, [this, roster, sender, dlg](PsiContact *c) {
sender(QList<PsiContact *> { c });
roster->deleteLater();
dlg->close();
});

auto btn = new QPushButton(tr("Forward"));
connect(btn, &QPushButton::clicked, dlg, [this, roster](bool) { qDebug("TODO: implement forwarding"); });
connect(btn, &QPushButton::clicked, dlg, [this, roster, sender, dlg](bool) {
auto contacts = roster->selectedContacts();
if (!contacts.empty()) {
sender(roster->selectedContacts());
roster->deleteLater();
dlg->close();
}
});

layout->addWidget(roster);
layout->addWidget(btn);
Expand Down
4 changes: 2 additions & 2 deletions src/psicon.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class ProxyManager;
class PsiAccount;
class PsiActionList;
class PsiCon;
class PsiContact;
class PsiContactList;
class PsiThemeManager;
class PsiToolBar;
Expand Down Expand Up @@ -137,8 +138,7 @@ class PsiCon : public QObject {
PopupManager *popupManager() const;
QStringList xmppFatures() const;

void invokeForwardMessage(const Jid &from, const QString &text);

void invokeForwardMessage(const QString &fromMessageId, const Jid &from, const QString &text);
signals:
void quit(int);
void accountAdded(PsiAccount *);
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.2051 (2024-09-29, 56f6c039)
1.5.2052 (2024-09-30, 31774cb5)

0 comments on commit f6107fd

Please sign in to comment.