better notification sending, edited message now modifies notification (or sends), little structure change

This commit is contained in:
Blue 2022-04-19 20:24:41 +03:00
parent 18859cb960
commit 83cb220175
Signed by untrusted user: blue
GPG Key ID: 9B203B252A63EE38
13 changed files with 31 additions and 16 deletions

View File

@ -8,8 +8,6 @@ target_sources(squawk PRIVATE
account.h
adapterfunctions.cpp
adapterfunctions.h
archive.cpp
archive.h
conference.cpp
conference.h
contact.cpp
@ -23,13 +21,10 @@ target_sources(squawk PRIVATE
signalcatcher.h
squawk.cpp
squawk.h
storage.cpp
storage.h
urlstorage.cpp
urlstorage.h
)
target_include_directories(squawk PRIVATE ${LMDB_INCLUDE_DIRS})
add_subdirectory(handlers)
add_subdirectory(storage)
add_subdirectory(passwordStorageEngines)

View File

@ -30,7 +30,7 @@
#include <set>
#include "urlstorage.h"
#include "storage/urlstorage.h"
#include "shared/pathcheck.h"
namespace Core {

View File

@ -34,7 +34,7 @@
#include "shared/enums.h"
#include "shared/message.h"
#include "shared/vcard.h"
#include "archive.h"
#include "storage/archive.h"
#include "adapterfunctions.h"
namespace Core {

View File

@ -0,0 +1,8 @@
target_sources(squawk PRIVATE
archive.cpp
archive.h
storage.cpp
storage.h
urlstorage.cpp
urlstorage.h
)

View File

@ -357,8 +357,9 @@ void Shared::Global::notify(const QString& account, const Shared::Message& msg)
QString name = QString(instance->rosterModel->getContactName(account, msg.getPenPalJid()));
QString path = QString(instance->rosterModel->getContactIconPath(account, msg.getPenPalJid(), msg.getPenPalResource()));
QVariantList args;
args << QString(QCoreApplication::applicationName());
args << QVariant(QVariant::UInt); //TODO some normal id
args << QString();
args << qHash(msg.getId());
if (path.size() > 0) {
args << path;
} else {
@ -378,8 +379,13 @@ void Shared::Global::notify(const QString& account, const Shared::Message& msg)
args << body;
args << QStringList();
args << QVariantMap();
args << 3000;
args << QVariantMap({
{"desktop-entry", QString(QCoreApplication::applicationName())},
{"category", QString("message")},
// {"sound-file", "/path/to/macaw/squawk"},
{"sound-name", QString("message-new-instant")}
});
args << -1;
instance->dbus.callWithArgumentList(QDBus::AutoDetect, "Notify", args);
}

View File

@ -801,10 +801,10 @@ void Models::Roster::addRoom(const QString& account, const QString jid, const QM
}
Room* room = new Room(acc, jid, data);
connect(room, &Contact::requestArchive, this, &Roster::onElementRequestArchive);
connect(room, &Contact::fileDownloadRequest, this, &Roster::fileDownloadRequest);
connect(room, &Contact::unnoticedMessage, this, &Roster::unnoticedMessage);
connect(room, &Contact::localPathInvalid, this, &Roster::localPathInvalid);
connect(room, &Room::requestArchive, this, &Roster::onElementRequestArchive);
connect(room, &Room::fileDownloadRequest, this, &Roster::fileDownloadRequest);
connect(room, &Room::unnoticedMessage, this, &Roster::unnoticedMessage);
connect(room, &Room::localPathInvalid, this, &Roster::localPathInvalid);
rooms.insert(std::make_pair(id, room));
acc->appendChild(room);
}

View File

@ -163,6 +163,12 @@ void Models::MessageFeed::changeMessage(const QString& id, const QMap<QString, Q
}
emit dataChanged(index, index, cr);
if (observersAmount == 0 && !msg->getForwarded() && changeRoles.count(MessageRoles::Text) > 0) {
unreadMessages->insert(id);
emit unreadMessagesCountChanged();
emit unnoticedMessage(*msg);
}
}
}