forked from blue/squawk
encrypted messages now are displayed in the feed
This commit is contained in:
parent
637eb702a8
commit
0a530bfa93
34 changed files with 439 additions and 245 deletions
|
@ -16,8 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SHARED_ENUMS_H
|
||||
#define SHARED_ENUMS_H
|
||||
#pragma once
|
||||
|
||||
#include <deque>
|
||||
|
||||
|
@ -170,4 +169,3 @@ static const EncryptionProtocol EncryptionProtocolHighest = EncryptionProtocol::
|
|||
static const EncryptionProtocol EncryptionProtocolLowest = EncryptionProtocol::omemo2;
|
||||
|
||||
}
|
||||
#endif // SHARED_ENUMS_H
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef EXCEPTION_H
|
||||
#define EXCEPTION_H
|
||||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
@ -36,5 +35,3 @@ namespace Utils
|
|||
const char* what() const noexcept( true );
|
||||
};
|
||||
}
|
||||
|
||||
#endif // EXCEPTION_H
|
||||
|
|
|
@ -62,70 +62,78 @@ Shared::Global::ColorSchemeName Shared::Global::colorSchemeName = 0;
|
|||
Shared::Global::CreatePalette Shared::Global::createPalette = 0;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Shared::Global::Global():
|
||||
availability({
|
||||
tr("Online", "Availability"),
|
||||
tr("Away", "Availability"),
|
||||
tr("Absent", "Availability"),
|
||||
tr("Busy", "Availability"),
|
||||
tr("Chatty", "Availability"),
|
||||
tr("Invisible", "Availability"),
|
||||
tr("Offline", "Availability")
|
||||
QCoreApplication::translate("Global", "Online", "Availability"),
|
||||
QCoreApplication::translate("Global", "Away", "Availability"),
|
||||
QCoreApplication::translate("Global", "Absent", "Availability"),
|
||||
QCoreApplication::translate("Global", "Busy", "Availability"),
|
||||
QCoreApplication::translate("Global", "Chatty", "Availability"),
|
||||
QCoreApplication::translate("Global", "Invisible", "Availability"),
|
||||
QCoreApplication::translate("Global", "Offline", "Availability")
|
||||
}),
|
||||
connectionState({
|
||||
tr("Disconnected", "ConnectionState"),
|
||||
tr("Scheduled", "ConnectionState"),
|
||||
tr("Connecting", "ConnectionState"),
|
||||
tr("Connected", "ConnectionState"),
|
||||
tr("Error", "ConnectionState")
|
||||
QCoreApplication::translate("Global", "Disconnected", "ConnectionState"),
|
||||
QCoreApplication::translate("Global", "Scheduled", "ConnectionState"),
|
||||
QCoreApplication::translate("Global", "Connecting", "ConnectionState"),
|
||||
QCoreApplication::translate("Global", "Connected", "ConnectionState"),
|
||||
QCoreApplication::translate("Global", "Error", "ConnectionState")
|
||||
}),
|
||||
subscriptionState({
|
||||
tr("None", "SubscriptionState"),
|
||||
tr("From", "SubscriptionState"),
|
||||
tr("To", "SubscriptionState"),
|
||||
tr("Both", "SubscriptionState"),
|
||||
tr("Unknown", "SubscriptionState")
|
||||
QCoreApplication::translate("Global", "None", "SubscriptionState"),
|
||||
QCoreApplication::translate("Global", "From", "SubscriptionState"),
|
||||
QCoreApplication::translate("Global", "To", "SubscriptionState"),
|
||||
QCoreApplication::translate("Global", "Both", "SubscriptionState"),
|
||||
QCoreApplication::translate("Global", "Unknown", "SubscriptionState")
|
||||
}),
|
||||
affiliation({
|
||||
tr("Unspecified", "Affiliation"),
|
||||
tr("Outcast", "Affiliation"),
|
||||
tr("Nobody", "Affiliation"),
|
||||
tr("Member", "Affiliation"),
|
||||
tr("Admin", "Affiliation"),
|
||||
tr("Owner", "Affiliation")
|
||||
QCoreApplication::translate("Global", "Unspecified", "Affiliation"),
|
||||
QCoreApplication::translate("Global", "Outcast", "Affiliation"),
|
||||
QCoreApplication::translate("Global", "Nobody", "Affiliation"),
|
||||
QCoreApplication::translate("Global", "Member", "Affiliation"),
|
||||
QCoreApplication::translate("Global", "Admin", "Affiliation"),
|
||||
QCoreApplication::translate("Global", "Owner", "Affiliation")
|
||||
}),
|
||||
role({
|
||||
tr("Unspecified", "Role"),
|
||||
tr("Nobody", "Role"),
|
||||
tr("Visitor", "Role"),
|
||||
tr("Participant", "Role"),
|
||||
tr("Moderator", "Role")
|
||||
QCoreApplication::translate("Global", "Unspecified", "Role"),
|
||||
QCoreApplication::translate("Global", "Nobody", "Role"),
|
||||
QCoreApplication::translate("Global", "Visitor", "Role"),
|
||||
QCoreApplication::translate("Global", "Participant", "Role"),
|
||||
QCoreApplication::translate("Global", "Moderator", "Role")
|
||||
}),
|
||||
messageState({
|
||||
tr("Pending", "MessageState"),
|
||||
tr("Sent", "MessageState"),
|
||||
tr("Delivered", "MessageState"),
|
||||
tr("Error", "MessageState")
|
||||
QCoreApplication::translate("Global", "Pending", "MessageState"),
|
||||
QCoreApplication::translate("Global", "Sent", "MessageState"),
|
||||
QCoreApplication::translate("Global", "Delivered", "MessageState"),
|
||||
QCoreApplication::translate("Global", "Error", "MessageState")
|
||||
}),
|
||||
accountPassword({
|
||||
tr("Plain", "AccountPassword"),
|
||||
tr("Jammed", "AccountPassword"),
|
||||
tr("Always Ask", "AccountPassword"),
|
||||
tr("KWallet", "AccountPassword")
|
||||
QCoreApplication::translate("Global", "Plain", "AccountPassword"),
|
||||
QCoreApplication::translate("Global", "Jammed", "AccountPassword"),
|
||||
QCoreApplication::translate("Global", "Always Ask", "AccountPassword"),
|
||||
QCoreApplication::translate("Global", "KWallet", "AccountPassword")
|
||||
}),
|
||||
trustLevel({
|
||||
tr("Undecided", "TrustLevel"),
|
||||
tr("Automatically distrusted", "TrustLevel"),
|
||||
tr("Manually distrusted", "TrustLevel"),
|
||||
tr("Automatically trusted", "TrustLevel"),
|
||||
tr("Manually trusted", "TrustLevel"),
|
||||
tr("Authenticated", "TrustLevel")
|
||||
QCoreApplication::translate("Global", "Undecided", "TrustLevel"),
|
||||
QCoreApplication::translate("Global", "Automatically distrusted", "TrustLevel"),
|
||||
QCoreApplication::translate("Global", "Manually distrusted", "TrustLevel"),
|
||||
QCoreApplication::translate("Global", "Automatically trusted", "TrustLevel"),
|
||||
QCoreApplication::translate("Global", "Manually trusted", "TrustLevel"),
|
||||
QCoreApplication::translate("Global", "Authenticated", "TrustLevel")
|
||||
}),
|
||||
encryptionProtocols({
|
||||
QCoreApplication::translate("Global", "None", "EncryptionProtocol"),
|
||||
QCoreApplication::translate("Global", "OMEMO 0", "EncryptionProtocol"),
|
||||
QCoreApplication::translate("Global", "OMEMO 1", "EncryptionProtocol"),
|
||||
QCoreApplication::translate("Global", "OMEMO 2", "EncryptionProtocol")
|
||||
}),
|
||||
accountPasswordDescription({
|
||||
tr("Your password is going to be stored in config file in plain text", "AccountPasswordDescription"),
|
||||
tr("Your password is going to be stored in config file but jammed with constant encryption key you can find in program source code. It might look like encryption but it's not", "AccountPasswordDescription"),
|
||||
tr("Squawk is going to query you for the password on every start of the program", "AccountPasswordDescription"),
|
||||
tr("Your password is going to be stored in KDE wallet storage (KWallet). You're going to be queried for permissions", "AccountPasswordDescription")
|
||||
QCoreApplication::translate("Global", "Your password is going to be stored in config file in plain text", "AccountPasswordDescription"),
|
||||
QCoreApplication::translate("Global", "Your password is going to be stored in config file but jammed with constant encryption key you can find in program source code. It might look like encryption but it's not", "AccountPasswordDescription"),
|
||||
QCoreApplication::translate("Global", "Squawk is going to query you for the password on every start of the program", "AccountPasswordDescription"),
|
||||
QCoreApplication::translate("Global", "Your password is going to be stored in KDE wallet storage (KWallet). You're going to be queried for permissions", "AccountPasswordDescription")
|
||||
}),
|
||||
defaultSystemStyle(QApplication::style()->objectName()),
|
||||
defaultSystemPalette(QApplication::palette()),
|
||||
|
@ -262,6 +270,10 @@ QString Shared::Global::getName(Shared::TrustLevel tl) {
|
|||
return instance->trustLevel[static_cast<int>(tl)];
|
||||
}
|
||||
|
||||
QString Shared::Global::getName(EncryptionProtocol ep) {
|
||||
return instance->encryptionProtocols[static_cast<int>(ep)];
|
||||
}
|
||||
|
||||
void Shared::Global::setSupported(const QString& pluginName, bool support) {
|
||||
std::map<QString, bool>::iterator itr = instance->pluginSupport.find(pluginName);
|
||||
if (itr != instance->pluginSupport.end()) {
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SHARED_GLOBAL_H
|
||||
#define SHARED_GLOBAL_H
|
||||
#pragma once
|
||||
|
||||
#include "enums.h"
|
||||
#include "message.h"
|
||||
|
@ -48,7 +47,6 @@
|
|||
namespace Shared {
|
||||
|
||||
class Global {
|
||||
Q_DECLARE_TR_FUNCTIONS(Global)
|
||||
public:
|
||||
struct FileInfo {
|
||||
enum class Preview {
|
||||
|
@ -75,6 +73,7 @@ namespace Shared {
|
|||
static QString getName(Message::State rl);
|
||||
static QString getName(AccountPassword ap);
|
||||
static QString getName(TrustLevel tl);
|
||||
static QString getName(EncryptionProtocol ep);
|
||||
|
||||
static QString getDescription(AccountPassword ap);
|
||||
|
||||
|
@ -86,6 +85,7 @@ namespace Shared {
|
|||
const std::deque<QString> messageState;
|
||||
const std::deque<QString> accountPassword;
|
||||
const std::deque<QString> trustLevel;
|
||||
const std::deque<QString> encryptionProtocols;
|
||||
|
||||
const std::deque<QString> accountPasswordDescription;
|
||||
|
||||
|
@ -124,7 +124,7 @@ namespace Shared {
|
|||
class EnumOutOfRange: public Utils::Exception {
|
||||
public:
|
||||
EnumOutOfRange(const std::string& p_name):Exception(), name(p_name) {}
|
||||
|
||||
|
||||
std::string getMessage() const{
|
||||
return "An attempt to get enum " + name + " from integer out of range of that enum";
|
||||
}
|
||||
|
@ -161,5 +161,3 @@ namespace Shared {
|
|||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SHARED_GLOBAL_H
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SHARED_ICONS_H
|
||||
#define SHARED_ICONS_H
|
||||
#pragma once
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
|
@ -175,8 +174,9 @@ static const std::map<QString, std::pair<QString, QString>> icons = {
|
|||
{"unfavorite", {"draw-star", "unfavorite"}},
|
||||
{"list-add", {"list-add", "add"}},
|
||||
{"folder", {"folder", "folder"}},
|
||||
{"document-preview", {"document-preview", "document-preview"}}
|
||||
{"document-preview", {"document-preview", "document-preview"}},
|
||||
{"secure", {"security-high", "shield"}},
|
||||
{"lock", {"lock", "lock"}},
|
||||
{"unlock", {"unlock", "unlock"}}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SHARED_ICONS_H
|
||||
|
|
|
@ -37,7 +37,8 @@ Shared::Message::Message(Shared::Message::Type p_type):
|
|||
originalMessage(),
|
||||
lastModified(),
|
||||
stanzaId(),
|
||||
attachPath()
|
||||
attachPath(),
|
||||
encryption(EncryptionProtocol::none)
|
||||
{}
|
||||
|
||||
Shared::Message::Message():
|
||||
|
@ -58,7 +59,8 @@ Shared::Message::Message():
|
|||
originalMessage(),
|
||||
lastModified(),
|
||||
stanzaId(),
|
||||
attachPath()
|
||||
attachPath(),
|
||||
encryption(EncryptionProtocol::none)
|
||||
{}
|
||||
|
||||
QString Shared::Message::getBody() const {
|
||||
|
@ -234,9 +236,8 @@ void Shared::Message::setType(Shared::Message::Type t) {
|
|||
void Shared::Message::setState(Shared::Message::State p_state) {
|
||||
state = p_state;
|
||||
|
||||
if (state != State::error) {
|
||||
if (state != State::error)
|
||||
errorText = "";
|
||||
}
|
||||
}
|
||||
|
||||
bool Shared::Message::serverStored() const {
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SHAPER_MESSAGE_H
|
||||
#define SHAPER_MESSAGE_H
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
|
@ -154,5 +153,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SHAPER_MESSAGE_H
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PATHCHECK_H
|
||||
#define PATHCHECK_H
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QStandardPaths>
|
||||
|
@ -40,5 +39,3 @@ QString squawkifyPath(QString path);
|
|||
bool isSubdirectoryOfSettings(const QString& path);
|
||||
|
||||
}
|
||||
|
||||
#endif // PATHCHECK_H
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SHARED_UTILS_H
|
||||
#define SHARED_UTILS_H
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
@ -76,5 +75,3 @@ enum class Hover {
|
|||
anchor
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SHARED_UTILS_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue