mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-22 18:16:43 +00:00
chore: merge branch release/perth_narrows to devel
This commit is contained in:
@ -52,6 +52,8 @@ UsersTab::UsersTab(QWidget *parent)
|
||||
connect(ui_.tableUserList, &QTableView::doubleClicked, this, &UsersTab::onEditUserButton);
|
||||
connect(ui_.buttonRemoveUser, &QPushButton::clicked, this, &UsersTab::onRemoveUserButton);
|
||||
connect(ui_.buttonUserBadEvent, &QPushButton::clicked, this, &UsersTab::onSendUserBadEvent);
|
||||
connect(ui_.buttonImapLoginFailed, &QPushButton::clicked, this, &UsersTab::onSendIMAPLoginFailedEvent);
|
||||
connect(ui_.buttonUsedBytesChanged, &QPushButton::clicked, this, &UsersTab::onSendUsedBytesChangedEvent);
|
||||
connect(ui_.checkUsernamePasswordError, &QCheckBox::toggled, this, &UsersTab::updateGUIState);
|
||||
|
||||
users_.append(randomUser());
|
||||
@ -158,16 +160,66 @@ void UsersTab::onSendUserBadEvent() {
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void UsersTab::onSendUsedBytesChangedEvent() {
|
||||
SPUser const user = selectedUser();
|
||||
int const index = this->selectedIndex();
|
||||
|
||||
if (!user) {
|
||||
app().log().error(QString("%1 failed. Unkown user.").arg(__FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
if (UserState::Connected != user->state()) {
|
||||
app().log().error(QString("%1 failed. User is not connected").arg(__FUNCTION__));
|
||||
}
|
||||
|
||||
qint64 const usedBytes = qint64(ui_.spinUsedBytes->value());
|
||||
user->setUsedBytes(usedBytes);
|
||||
users_.touch(index);
|
||||
|
||||
GRPCService &grpc = app().grpc();
|
||||
if (grpc.isStreaming()) {
|
||||
QString const userID = user->id();
|
||||
grpc.sendEvent(newUsedBytesChangedEvent(userID, usedBytes));
|
||||
}
|
||||
|
||||
this->updateGUIState();
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void UsersTab::onSendIMAPLoginFailedEvent() {
|
||||
GRPCService &grpc = app().grpc();
|
||||
if (grpc.isStreaming()) {
|
||||
grpc.sendEvent(newIMAPLoginFailedEvent(ui_.editIMAPLoginFailedUsername->text()));
|
||||
}
|
||||
|
||||
this->updateGUIState();
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void UsersTab::updateGUIState() {
|
||||
SPUser const user = selectedUser();
|
||||
bool const hasSelectedUser = user.get();
|
||||
UserState const state = user ? user->state() : UserState::SignedOut;
|
||||
|
||||
ui_.buttonEditUser->setEnabled(hasSelectedUser);
|
||||
ui_.buttonRemoveUser->setEnabled(hasSelectedUser);
|
||||
ui_.groupBoxBadEvent->setEnabled(hasSelectedUser && (UserState::SignedOut != user->state()));
|
||||
ui_.groupBoxBadEvent->setEnabled(hasSelectedUser && (UserState::SignedOut != state));
|
||||
ui_.groupBoxUsedSpace->setEnabled(hasSelectedUser && (UserState::Connected == state));
|
||||
ui_.editUsernamePasswordError->setEnabled(ui_.checkUsernamePasswordError->isChecked());
|
||||
ui_.spinUsedBytes->setValue(user ? user->usedBytes() : 0.0);
|
||||
|
||||
if (user)
|
||||
ui_.editIMAPLoginFailedUsername->setText(user->primaryEmailOrUsername());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -61,6 +61,8 @@ private slots:
|
||||
void onRemoveUserButton(); ///< Remove the currently selected user.
|
||||
void onSelectionChanged(QItemSelection, QItemSelection); ///< Slot for the change of the selection.
|
||||
void onSendUserBadEvent(); ///< Slot for the 'Send Bad Event Error' button.
|
||||
void onSendUsedBytesChangedEvent(); ///< Slot for the 'Send Used Bytes Changed Event' button.
|
||||
void onSendIMAPLoginFailedEvent(); ///< Slot for the 'Send IMAP Login failure Event' button.
|
||||
void updateGUIState(); ///< Update the GUI state.
|
||||
|
||||
private: // member functions.
|
||||
|
||||
@ -80,13 +80,6 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelUserBadEvent">
|
||||
<property name="text">
|
||||
<string>Message: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editUserBadEvent">
|
||||
<property name="minimumSize">
|
||||
@ -96,18 +89,102 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bad event error.</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>error message</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonUserBadEvent">
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxUsedSpace">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Used Bytes Changed</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonUserBadEvent">
|
||||
<property name="text">
|
||||
<string>Send Bad Event Error</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="hBoxUsedBytes" stretch="1,0">
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spinUsedBytes">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000000000000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonUsedBytesChanged">
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxIMAPLoginFailed">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>IMAP Login Failure</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editIMAPLoginFailedUsername">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>username or primary email</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonImapLoginFailed">
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
@ -24,5 +24,7 @@
|
||||
#define PROJECT_VER "@BRIDGE_APP_VERSION@"
|
||||
#define PROJECT_REVISION "@BRIDGE_REVISION@"
|
||||
#define PROJECT_BUILD_TIME "@BRIDGE_BUILD_TIME@"
|
||||
#define PROJECT_DSN_SENTRY "@BRIDGE_DSN_SENTRY@"
|
||||
#define PROJECT_BUILD_ENV "@BRIDGE_BUILD_ENV@"
|
||||
|
||||
#endif // BRIDGE_GUI_VERSION_H
|
||||
@ -85,20 +85,12 @@ message(STATUS "Using Qt ${Qt6_VERSION}")
|
||||
#*****************************************************************************************************************************************************
|
||||
find_package(sentry CONFIG REQUIRED)
|
||||
|
||||
set(DSN_SENTRY "https://ea31dfe8574849108fb8ba044fec3620@api.protonmail.ch/core/v4/reports/sentry/7")
|
||||
set(SENTRY_CONFIG_GENERATED_FILE_DIR ${CMAKE_CURRENT_BINARY_DIR}/sentry-generated)
|
||||
set(SENTRY_CONFIG_FILE ${SENTRY_CONFIG_GENERATED_FILE_DIR}/project_sentry_config.h)
|
||||
file(GENERATE OUTPUT ${SENTRY_CONFIG_FILE} CONTENT
|
||||
"// AUTO GENERATED FILE, DO NOT MODIFY\n#pragma once\nconst char* SentryDNS=\"${DSN_SENTRY}\";\nconst char* SentryProductID=\"bridge-mail@${BRIDGE_APP_VERSION}\";\n"
|
||||
)
|
||||
|
||||
|
||||
|
||||
#*****************************************************************************************************************************************************
|
||||
# Source files and output
|
||||
#*****************************************************************************************************************************************************
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/Version.h)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/BuildConfig.h.in ${CMAKE_CURRENT_SOURCE_DIR}/BuildConfig.h)
|
||||
|
||||
if (NOT TARGET bridgepp)
|
||||
add_subdirectory(../bridgepp bridgepp)
|
||||
@ -122,7 +114,7 @@ add_executable(bridge-gui
|
||||
EventStreamWorker.cpp EventStreamWorker.h
|
||||
main.cpp
|
||||
Pch.h
|
||||
Version.h
|
||||
BuildConfig.h
|
||||
QMLBackend.cpp QMLBackend.h
|
||||
UserList.cpp UserList.h
|
||||
SentryUtils.cpp SentryUtils.h
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
#include "QMLBackend.h"
|
||||
#include "EventStreamWorker.h"
|
||||
#include "Version.h"
|
||||
#include "BuildConfig.h"
|
||||
#include <bridgepp/GRPC/GRPCClient.h>
|
||||
#include <bridgepp/Exception/Exception.h>
|
||||
#include <bridgepp/Worker/Overseer.h>
|
||||
@ -467,6 +467,7 @@ bool QMLBackend::isDoHEnabled() const {
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The value for the 'isAutomaticUpdateOn' property.
|
||||
//****************************************************************************************************************************************************
|
||||
@ -875,8 +876,9 @@ void QMLBackend::onLoginAlreadyLoggedIn(QString const &userID) {
|
||||
void QMLBackend::onUserBadEvent(QString const &userID, QString const &errorMessage) {
|
||||
HANDLE_EXCEPTION(
|
||||
SPUser const user = users_->getUserWithID(userID);
|
||||
if (!user)
|
||||
if (!user) {
|
||||
app().log().error(QString("Received bad event for unknown user %1").arg(user->id()));
|
||||
}
|
||||
user->setState(UserState::SignedOut);
|
||||
emit userBadEvent(
|
||||
tr("Internal error: %1 was automatically logged out. Please log in again or report this problem if the issue persists.").arg(user->primaryEmailOrUsername()),
|
||||
@ -888,6 +890,24 @@ void QMLBackend::onUserBadEvent(QString const &userID, QString const &errorMessa
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] username The username (or primary email address)
|
||||
//****************************************************************************************************************************************************
|
||||
void QMLBackend::onIMAPLoginFailed(QString const &username) {
|
||||
HANDLE_EXCEPTION(
|
||||
SPUser const user = users_->getUserWithUsernameOrEmail(username);
|
||||
if ((!user) || (user->state() != UserState::SignedOut)) { // We want to pop-up only if a signed-out user has been detected
|
||||
return;
|
||||
}
|
||||
if (user->isInIMAPLoginFailureCooldown())
|
||||
return;
|
||||
user->startImapLoginFailureCooldown(60 * 60 * 1000); // 1 hour cooldown during which we will not display this notification to this user again.
|
||||
emit selectUser(user->id());
|
||||
emit imapLoginWhileSignedOut(username);
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
@ -996,5 +1016,7 @@ void QMLBackend::connectGrpcEvents() {
|
||||
// user events
|
||||
connect(client, &GRPCClient::userDisconnected, this, &QMLBackend::userDisconnected);
|
||||
connect(client, &GRPCClient::userBadEvent, this, &QMLBackend::onUserBadEvent);
|
||||
connect(client, &GRPCClient::imapLoginFailed, this, &QMLBackend::onIMAPLoginFailed);
|
||||
|
||||
users_->connectGRPCEvents();
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
|
||||
#include "MacOS/DockIcon.h"
|
||||
#include "Version.h"
|
||||
#include "BuildConfig.h"
|
||||
#include "UserList.h"
|
||||
#include <bridgepp/GRPC/GRPCClient.h>
|
||||
#include <bridgepp/GRPC/GRPCUtils.h>
|
||||
@ -180,6 +180,7 @@ public slots: // slot for signals received from gRPC that need transformation in
|
||||
void onLoginFinished(QString const &userID, bool wasSignedOut); ///< Slot for LoginFinished gRPC event.
|
||||
void onLoginAlreadyLoggedIn(QString const &userID); ///< Slot for the LoginAlreadyLoggedIn gRPC event.
|
||||
void onUserBadEvent(QString const& userID, QString const& errorMessage); ///< Slot for the userBadEvent gRPC event.
|
||||
void onIMAPLoginFailed(QString const& username); ///< Slot the the imapLoginFailed event.
|
||||
|
||||
signals: // Signals received from the Go backend, to be forwarded to QML
|
||||
void toggleAutostartFinished(); ///< Signal for the 'toggleAutostartFinished' gRPC stream event.
|
||||
@ -233,6 +234,7 @@ signals: // Signals received from the Go backend, to be forwarded to QML
|
||||
void hideMainWindow(); ///< Signal for the 'hideMainWindow' gRPC stream event.
|
||||
void genericError(QString const &title, QString const &description); ///< Signal for the 'genericError' gRPC stream event.
|
||||
void selectUser(QString const); ///< Signal that request the given user account to be displayed.
|
||||
void imapLoginWhileSignedOut(QString const& username); ///< Signal for the notification of IMAP login attempt on a signed out account.
|
||||
|
||||
// This signal is emitted when an exception is intercepted is calls triggered by QML. QML engine would intercept the exception otherwise.
|
||||
void fatalError(QString const &function, QString const &message) const; ///< Signal emitted when an fatal error occurs.
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "SentryUtils.h"
|
||||
#include "Version.h"
|
||||
#include "BuildConfig.h"
|
||||
#include <bridgepp/BridgeUtils.h>
|
||||
|
||||
#include <QByteArray>
|
||||
@ -31,13 +31,39 @@ QByteArray getProtectedHostname() {
|
||||
return hostname.toHex();
|
||||
}
|
||||
|
||||
QString getApiOS() {
|
||||
#if defined(Q_OS_DARWIN)
|
||||
return "macos";
|
||||
#elif defined(Q_OS_WINDOWS)
|
||||
return "windows";
|
||||
#else
|
||||
return "linux";
|
||||
#endif
|
||||
}
|
||||
|
||||
QString appVersion(const QString& version) {
|
||||
return QString("%1-bridge@%2").arg(getApiOS()).arg(version);
|
||||
}
|
||||
|
||||
void setSentryReportScope() {
|
||||
sentry_set_tag("OS", bridgepp::goos().toUtf8());
|
||||
sentry_set_tag("Client", PROJECT_FULL_NAME);
|
||||
sentry_set_tag("Version", PROJECT_VER);
|
||||
sentry_set_tag("UserAgent", QString("/ (%1)").arg(bridgepp::goos()).toUtf8());
|
||||
sentry_set_tag("HostArch", QSysInfo::currentCpuArchitecture().toUtf8());
|
||||
sentry_set_tag("server_name", getProtectedHostname());
|
||||
sentry_set_tag("Version", QByteArray(PROJECT_REVISION).toHex());
|
||||
sentry_set_tag("HostArch", QSysInfo::currentCpuArchitecture().toUtf8());
|
||||
sentry_set_tag("server_name", getProtectedHostname());
|
||||
}
|
||||
|
||||
sentry_options_t* newSentryOptions(const char *sentryDNS, const char *cacheDir) {
|
||||
sentry_options_t *sentryOptions = sentry_options_new();
|
||||
sentry_options_set_dsn(sentryOptions, sentryDNS);
|
||||
sentry_options_set_database_path(sentryOptions, cacheDir);
|
||||
sentry_options_set_release(sentryOptions, appVersion(PROJECT_VER).toUtf8());
|
||||
sentry_options_set_max_breadcrumbs(sentryOptions, 50);
|
||||
sentry_options_set_environment(sentryOptions, PROJECT_BUILD_ENV);
|
||||
// Enable this for debugging sentry.
|
||||
// sentry_options_set_debug(sentryOptions, 1);
|
||||
|
||||
return sentryOptions;
|
||||
}
|
||||
|
||||
sentry_uuid_t reportSentryEvent(sentry_level_t level, const char *message) {
|
||||
@ -51,3 +77,5 @@ sentry_uuid_t reportSentryException(sentry_level_t level, const char *message, c
|
||||
sentry_event_add_exception(event, sentry_value_new_exception(exceptionType, exception));
|
||||
return sentry_capture_event(event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include <sentry.h>
|
||||
|
||||
void setSentryReportScope();
|
||||
sentry_options_t* newSentryOptions(const char * sentryDNS, const char * cacheDir);
|
||||
sentry_uuid_t reportSentryEvent(sentry_level_t level, const char *message);
|
||||
sentry_uuid_t reportSentryException(sentry_level_t level, const char *message, const char *exceptionType, const char *exception);
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ void UserList::connectGRPCEvents() const {
|
||||
GRPCClient &client = app().grpc();
|
||||
connect(&client, &GRPCClient::userChanged, this, &UserList::onUserChanged);
|
||||
connect(&client, &GRPCClient::toggleSplitModeFinished, this, &UserList::onToggleSplitModeFinished);
|
||||
connect(&client, &GRPCClient::usedBytesChanged, this, &UserList::onUsedBytesChanged);
|
||||
}
|
||||
|
||||
|
||||
@ -148,6 +149,19 @@ bridgepp::SPUser UserList::getUserWithID(QString const &userID) const {
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] username The username or email.
|
||||
/// \return The user with the given ID.
|
||||
/// \return A null pointer if the user could not be found.
|
||||
//****************************************************************************************************************************************************
|
||||
bridgepp::SPUser UserList::getUserWithUsernameOrEmail(QString const &username) const {
|
||||
QList<SPUser>::const_iterator it = std::find_if(users_.begin(), users_.end(), [username](SPUser const &user) -> bool {
|
||||
return user && ((username.compare(user->username(), Qt::CaseInsensitive) == 0) || user->addresses().contains(username, Qt::CaseInsensitive));
|
||||
});
|
||||
return (it == users_.end()) ? nullptr : *it;
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] row The row.
|
||||
//****************************************************************************************************************************************************
|
||||
@ -223,3 +237,17 @@ void UserList::onToggleSplitModeFinished(QString const &userID) {
|
||||
int UserList::count() const {
|
||||
return users_.size();
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] userID The userID.
|
||||
/// \param[in] usedBytes The used space, in bytes.
|
||||
//****************************************************************************************************************************************************
|
||||
void UserList::onUsedBytesChanged(QString const &userID, qint64 usedBytes) {
|
||||
int const index = this->rowOfUserID(userID);
|
||||
if (index < 0) {
|
||||
app().log().error(QString("Received usedBytesChanged event for unknown userID %1").arg(userID));
|
||||
return;
|
||||
}
|
||||
users_[index]->setUsedBytes(usedBytes);
|
||||
}
|
||||
|
||||
@ -44,6 +44,7 @@ public: // member functions.
|
||||
void appendUser(bridgepp::SPUser const &user); ///< Add a new user.
|
||||
void updateUserAtRow(int row, bridgepp::User const &user); ///< Update the user at given row.
|
||||
bridgepp::SPUser getUserWithID(QString const &userID) const; ///< Retrieve the user with the given ID.
|
||||
bridgepp::SPUser getUserWithUsernameOrEmail(QString const& username) const; ///< Retrieve the user with the given primary email address or username
|
||||
|
||||
// the userCount property.
|
||||
Q_PROPERTY(int count READ count NOTIFY countChanged)
|
||||
@ -59,6 +60,7 @@ public:
|
||||
public slots: ///< handler for signals coming from the gRPC service
|
||||
void onUserChanged(QString const &userID);
|
||||
void onToggleSplitModeFinished(QString const &userID);
|
||||
void onUsedBytesChanged(QString const &userID, qint64 usedBytes); ///< Slot for usedBytesChanged events.
|
||||
|
||||
private: // data members
|
||||
QList<bridgepp::SPUser> users_; ///< The user list.
|
||||
|
||||
@ -76,6 +76,15 @@ function check_exit() {
|
||||
Write-host "Running build for version $bridgeVersion - $buildConfig in $buildDir"
|
||||
|
||||
$REVISION_HASH = git rev-parse --short=10 HEAD
|
||||
$bridgeDsnSentry = ($env:BRIDGE_DSN_SENTRY)
|
||||
$bridgeBuidTime = ($env:BRIDGE_BUILD_TIME)
|
||||
|
||||
$bridgeBuildEnv = ($env:BRIDGE_BUILD_ENV)
|
||||
if ($null -eq $bridgeBuildEnv)
|
||||
{
|
||||
$bridgeBuildEnv = "dev"
|
||||
}
|
||||
|
||||
git submodule update --init --recursive $vcpkgRoot
|
||||
. $vcpkgBootstrap -disableMetrics
|
||||
. $vcpkgExe install sentry-native:x64-windows grpc:x64-windows --clean-after-build
|
||||
@ -85,6 +94,9 @@ git submodule update --init --recursive $vcpkgRoot
|
||||
-DBRIDGE_VENDOR="$bridgeVendor" `
|
||||
-DBRIDGE_REVISION=$REVISION_HASH `
|
||||
-DBRIDGE_APP_VERSION="$bridgeVersion" `
|
||||
-DBRIDGE_BUILD_TIME="$bridgeBuidTime" `
|
||||
-DBRIDGE_DSN_SENTRY="$bridgeDsnSentry" `
|
||||
-DBRIDGE_BUILD_ENV="$bridgeBuildEnv" `
|
||||
-S . -B $buildDir
|
||||
|
||||
check_exit "CMake failed"
|
||||
|
||||
@ -56,6 +56,9 @@ BUILD_CONFIG=${BRIDGE_GUI_BUILD_CONFIG:-Debug}
|
||||
BUILD_DIR=$(echo "./cmake-build-${BUILD_CONFIG}" | tr '[:upper:]' '[:lower:]')
|
||||
VCPKG_ROOT="${BRIDGE_REPO_ROOT}/extern/vcpkg"
|
||||
BRIDGE_REVISION=$(git rev-parse --short=10 HEAD)
|
||||
BRIDGE_DSN_SENTRY=${BRIDGE_DSN_SENTRY}
|
||||
BRIDGE_BUILD_TIME=${BRIDGE_BUILD_TIME}
|
||||
BRIDGE_BUILD_ENV= ${BRIDGE_BUILD_ENV:-"dev"}
|
||||
git submodule update --init --recursive ${VCPKG_ROOT}
|
||||
check_exit "Failed to initialize vcpkg as a submodule."
|
||||
|
||||
@ -94,6 +97,9 @@ cmake \
|
||||
-DBRIDGE_APP_FULL_NAME="${BRIDGE_APP_FULL_NAME}" \
|
||||
-DBRIDGE_VENDOR="${BRIDGE_VENDOR}" \
|
||||
-DBRIDGE_REVISION="${BRIDGE_REVISION}" \
|
||||
-DBRIDGE_DSN_SENTRY="${BRIDGE_DSN_SENTRY}" \
|
||||
-DBRIDGE_BRIDGE_TIME="${BRIDGE_BRIDGE_TIME}" \
|
||||
-DBRIDGE_BUILD_ENV="${BRIDGE_BUILD_ENV}" \
|
||||
-DBRIDGE_APP_VERSION="${BRIDGE_APP_VERSION}" "${BRIDGE_CMAKE_MACOS_OPTS}" \
|
||||
-G Ninja \
|
||||
-S . \
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#include "CommandLine.h"
|
||||
#include "QMLBackend.h"
|
||||
#include "SentryUtils.h"
|
||||
#include "Version.h"
|
||||
#include "BuildConfig.h"
|
||||
#include <bridgepp/BridgeUtils.h>
|
||||
#include <bridgepp/Exception/Exception.h>
|
||||
#include <bridgepp/FocusGRPC/FocusGRPCClient.h>
|
||||
@ -29,7 +29,6 @@
|
||||
#include <bridgepp/ProcessMonitor.h>
|
||||
#include <sentry.h>
|
||||
#include <SentryUtils.h>
|
||||
#include <project_sentry_config.h>
|
||||
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
@ -229,8 +228,21 @@ bool isBridgeRunning() {
|
||||
void focusOtherInstance() {
|
||||
try {
|
||||
FocusGRPCClient client;
|
||||
GRPCConfig sc;
|
||||
QString const path = FocusGRPCClient::grpcFocusServerConfigPath();
|
||||
QFile file(path);
|
||||
if (file.exists()) {
|
||||
if (!sc.load(path)) {
|
||||
throw Exception("The gRPC focus service configuration file is invalid.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw Exception("Server did not provide gRPC Focus service configuration.");
|
||||
}
|
||||
|
||||
|
||||
QString error;
|
||||
if (!client.connectToServer(5000, &error)) {
|
||||
if (!client.connectToServer(5000, sc.port, &error)) {
|
||||
throw Exception(QString("Could not connect to bridge focus service for a raise call: %1").arg(error));
|
||||
}
|
||||
if (!client.raise().ok()) {
|
||||
@ -292,15 +304,8 @@ void closeBridgeApp() {
|
||||
//****************************************************************************************************************************************************
|
||||
int main(int argc, char *argv[]) {
|
||||
// Init sentry.
|
||||
sentry_options_t *sentryOptions = sentry_options_new();
|
||||
sentry_options_set_dsn(sentryOptions, SentryDNS);
|
||||
{
|
||||
const QString sentryCachePath = sentryCacheDir();
|
||||
sentry_options_set_database_path(sentryOptions, sentryCachePath.toStdString().c_str());
|
||||
}
|
||||
sentry_options_set_release(sentryOptions, QByteArray(PROJECT_REVISION).toHex());
|
||||
// Enable this for debugging sentry.
|
||||
// sentry_options_set_debug(sentryOptions, 1);
|
||||
sentry_options_t *sentryOptions = newSentryOptions(PROJECT_DSN_SENTRY, sentryCacheDir().toStdString().c_str());
|
||||
|
||||
if (sentry_init(sentryOptions) != 0) {
|
||||
std::cerr << "Failed to initialize sentry" << std::endl;
|
||||
}
|
||||
@ -344,6 +349,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
// before launching bridge, we remove any trailing service config file, because we need to make sure we get a newly generated one.
|
||||
FocusGRPCClient::removeServiceConfigFile();
|
||||
GRPCClient::removeServiceConfigFile();
|
||||
launchBridge(cliOptions.bridgeArgs);
|
||||
}
|
||||
|
||||
@ -81,6 +81,7 @@ QtObject {
|
||||
root.apiCertIssue,
|
||||
root.noActiveKeyForRecipient,
|
||||
root.userBadEvent,
|
||||
root.imapLoginWhileSignedOut,
|
||||
root.genericError
|
||||
]
|
||||
|
||||
@ -1147,6 +1148,34 @@ QtObject {
|
||||
|
||||
}
|
||||
|
||||
property Notification imapLoginWhileSignedOut: Notification {
|
||||
title: qsTr("IMAP Login failed")
|
||||
brief: title
|
||||
description: "#PlaceHolderText"
|
||||
icon: "./icons/ic-exclamation-circle-filled.svg"
|
||||
type: Notification.NotificationType.Danger
|
||||
group: Notifications.Group.Connection
|
||||
|
||||
Connections {
|
||||
target: Backend
|
||||
function onImapLoginWhileSignedOut(username) {
|
||||
root.imapLoginWhileSignedOut.description = qsTr("An email client tried to connect to the account %1, but this account is signed " +
|
||||
"out. Please sign-in to continue.").arg(username)
|
||||
root.imapLoginWhileSignedOut.active = true
|
||||
}
|
||||
}
|
||||
|
||||
action: [
|
||||
Action {
|
||||
text: qsTr("OK")
|
||||
|
||||
onTriggered: {
|
||||
root.imapLoginWhileSignedOut.active = false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
property Notification genericError: Notification {
|
||||
title: "#PlaceholderText#"
|
||||
description: "#PlaceholderText#"
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
|
||||
#include "FocusGRPCClient.h"
|
||||
#include "../BridgeUtils.h"
|
||||
#include "../Exception/Exception.h"
|
||||
|
||||
|
||||
@ -29,7 +30,6 @@ namespace {
|
||||
|
||||
|
||||
Empty empty; ///< Empty protobuf message, re-used across calls.
|
||||
qint64 const port = 1042; ///< The port for the focus service.
|
||||
QString const hostname = "127.0.0.1"; ///< The hostname of the focus service.
|
||||
|
||||
|
||||
@ -39,12 +39,43 @@ QString const hostname = "127.0.0.1"; ///< The hostname of the focus service.
|
||||
namespace bridgepp {
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return the gRPC Focus server config file name
|
||||
//****************************************************************************************************************************************************
|
||||
QString grpcFocusServerConfigFilename() {
|
||||
return "grpcFocusServerConfig.json";
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The absolute path of the focus service config path.
|
||||
//****************************************************************************************************************************************************
|
||||
QString FocusGRPCClient::grpcFocusServerConfigPath() {
|
||||
return QDir(userConfigDir()).absoluteFilePath(grpcFocusServerConfigFilename());
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void FocusGRPCClient::removeServiceConfigFile() {
|
||||
QString const path = grpcFocusServerConfigPath();
|
||||
if (!QFile(path).exists()) {
|
||||
return;
|
||||
}
|
||||
if (!QFile().remove(path)) {
|
||||
throw Exception("Could not remove gRPC focus service config file.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] timeoutMs The timeout for the connexion.
|
||||
/// \param[in] port The gRPC server port.
|
||||
/// \param[out] outError if not null and the function returns false.
|
||||
/// \return true iff the connexion was successfully established.
|
||||
//****************************************************************************************************************************************************
|
||||
bool FocusGRPCClient::connectToServer(qint64 timeoutMs, QString *outError) {
|
||||
bool FocusGRPCClient::connectToServer(qint64 timeoutMs, quint16 port, QString *outError) {
|
||||
try {
|
||||
QString const address = QString("%1:%2").arg(hostname).arg(port);
|
||||
channel_ = grpc::CreateChannel(address.toStdString(), grpc::InsecureChannelCredentials());
|
||||
|
||||
@ -31,6 +31,9 @@ namespace bridgepp {
|
||||
/// \brief Focus GRPC client class
|
||||
//**********************************************************************************************************************
|
||||
class FocusGRPCClient {
|
||||
public: // static member functions
|
||||
static void removeServiceConfigFile(); ///< Delete the service config file.
|
||||
static QString grpcFocusServerConfigPath(); ///< Return the path of the gRPC Focus server config file.
|
||||
public: // member functions.
|
||||
FocusGRPCClient() = default; ///< Default constructor.
|
||||
FocusGRPCClient(FocusGRPCClient const &) = delete; ///< Disabled copy-constructor.
|
||||
@ -38,7 +41,7 @@ public: // member functions.
|
||||
~FocusGRPCClient() = default; ///< Destructor.
|
||||
FocusGRPCClient &operator=(FocusGRPCClient const &) = delete; ///< Disabled assignment operator.
|
||||
FocusGRPCClient &operator=(FocusGRPCClient &&) = delete; ///< Disabled move assignment operator.
|
||||
bool connectToServer(qint64 timeoutMs, QString *outError = nullptr); ///< Connect to the focus server
|
||||
bool connectToServer(qint64 timeoutMs, quint16 port, QString *outError = nullptr); ///< Connect to the focus server
|
||||
|
||||
grpc::Status raise(); ///< Performs the 'raise' call.
|
||||
grpc::Status version(QString &outVersion); ///< Performs the 'version' call.
|
||||
|
||||
@ -574,6 +574,33 @@ SPStreamEvent newUserBadEvent(QString const &userID, QString const &errorMessage
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] userID The userID.
|
||||
/// \param[in] usedBytes The number of used bytes.
|
||||
//****************************************************************************************************************************************************
|
||||
SPStreamEvent newUsedBytesChangedEvent(QString const &userID, qint64 usedBytes) {
|
||||
auto event = new grpc::UsedBytesChangedEvent;
|
||||
event->set_userid(userID.toStdString());
|
||||
event->set_usedbytes(usedBytes);
|
||||
auto userEvent = new grpc::UserEvent;
|
||||
userEvent->set_allocated_usedbyteschangedevent(event);
|
||||
return wrapUserEvent(userEvent);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] username The username that was provided for the failed IMAP login attempt.
|
||||
/// \return The event.
|
||||
//****************************************************************************************************************************************************
|
||||
SPStreamEvent newIMAPLoginFailedEvent(QString const &username) {
|
||||
auto event = new grpc::ImapLoginFailedEvent;
|
||||
event->set_username(username.toStdString());
|
||||
auto userEvent = new grpc::UserEvent;
|
||||
userEvent->set_allocated_imaploginfailedevent(event);
|
||||
return wrapUserEvent(userEvent);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] errorCode The error errorCode.
|
||||
/// \return The event.
|
||||
|
||||
@ -78,6 +78,8 @@ SPStreamEvent newToggleSplitModeFinishedEvent(QString const &userID); ///< Creat
|
||||
SPStreamEvent newUserDisconnectedEvent(QString const &username); ///< Create a new UserDisconnectedEvent event.
|
||||
SPStreamEvent newUserChangedEvent(QString const &userID); ///< Create a new UserChangedEvent event.
|
||||
SPStreamEvent newUserBadEvent(QString const &userID, QString const& errorMessage); ///< Create a new UserBadEvent event.
|
||||
SPStreamEvent newUsedBytesChangedEvent(QString const &userID, qint64 usedBytes); ///< Create a new UsedBytesChangedEvent event.
|
||||
SPStreamEvent newIMAPLoginFailedEvent(QString const &username); ///< Create a new ImapLoginFailedEvent event.
|
||||
|
||||
// Generic error event
|
||||
SPStreamEvent newGenericErrorEvent(grpc::ErrorCode errorCode); ///< Create a new GenericErrrorEvent event.
|
||||
|
||||
@ -1374,6 +1374,21 @@ void GRPCClient::processUserEvent(UserEvent const &event) {
|
||||
emit userBadEvent(userID, errorMessage);
|
||||
break;
|
||||
}
|
||||
case UserEvent::kUsedBytesChangedEvent: {
|
||||
UsedBytesChangedEvent const& e = event.usedbyteschangedevent();
|
||||
QString const userID = QString::fromStdString(e.userid());
|
||||
qint64 const usedBytes = e.usedbytes();
|
||||
this->logTrace(QString("User event received: UsedBytesChangedEvent (userID = %1, usedBytes = %2).").arg(userID).arg(usedBytes));
|
||||
emit usedBytesChanged(userID, usedBytes);
|
||||
break;
|
||||
}
|
||||
case UserEvent::kImapLoginFailedEvent: {
|
||||
ImapLoginFailedEvent const& e = event.imaploginfailedevent();
|
||||
QString const username = QString::fromStdString(e.username());
|
||||
this->logTrace(QString("User event received: IMAPLoginFailed (username = %1).:").arg(username));
|
||||
emit imapLoginFailed(username);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
this->logError("Unknown User event received.");
|
||||
}
|
||||
|
||||
@ -179,6 +179,8 @@ signals:
|
||||
void userDisconnected(QString const &username);
|
||||
void userChanged(QString const &userID);
|
||||
void userBadEvent(QString const &userID, QString const& errorMessage);
|
||||
void usedBytesChanged(QString const &userID, qint64 usedBytes);
|
||||
void imapLoginFailed(QString const& username);
|
||||
|
||||
public: // keychain related calls
|
||||
grpc::Status availableKeychains(QStringList &outKeychains);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -100,6 +100,9 @@ extern GuiReadyResponseDefaultTypeInternal _GuiReadyResponse_default_instance_;
|
||||
class HasNoKeychainEvent;
|
||||
struct HasNoKeychainEventDefaultTypeInternal;
|
||||
extern HasNoKeychainEventDefaultTypeInternal _HasNoKeychainEvent_default_instance_;
|
||||
class ImapLoginFailedEvent;
|
||||
struct ImapLoginFailedEventDefaultTypeInternal;
|
||||
extern ImapLoginFailedEventDefaultTypeInternal _ImapLoginFailedEvent_default_instance_;
|
||||
class ImapSmtpSettings;
|
||||
struct ImapSmtpSettingsDefaultTypeInternal;
|
||||
extern ImapSmtpSettingsDefaultTypeInternal _ImapSmtpSettings_default_instance_;
|
||||
@ -202,6 +205,9 @@ extern UpdateSilentRestartNeededDefaultTypeInternal _UpdateSilentRestartNeeded_d
|
||||
class UpdateVersionChanged;
|
||||
struct UpdateVersionChangedDefaultTypeInternal;
|
||||
extern UpdateVersionChangedDefaultTypeInternal _UpdateVersionChanged_default_instance_;
|
||||
class UsedBytesChangedEvent;
|
||||
struct UsedBytesChangedEventDefaultTypeInternal;
|
||||
extern UsedBytesChangedEventDefaultTypeInternal _UsedBytesChangedEvent_default_instance_;
|
||||
class User;
|
||||
struct UserDefaultTypeInternal;
|
||||
extern UserDefaultTypeInternal _User_default_instance_;
|
||||
@ -242,6 +248,7 @@ template<> ::grpc::EventStreamRequest* Arena::CreateMaybeMessage<::grpc::EventSt
|
||||
template<> ::grpc::GenericErrorEvent* Arena::CreateMaybeMessage<::grpc::GenericErrorEvent>(Arena*);
|
||||
template<> ::grpc::GuiReadyResponse* Arena::CreateMaybeMessage<::grpc::GuiReadyResponse>(Arena*);
|
||||
template<> ::grpc::HasNoKeychainEvent* Arena::CreateMaybeMessage<::grpc::HasNoKeychainEvent>(Arena*);
|
||||
template<> ::grpc::ImapLoginFailedEvent* Arena::CreateMaybeMessage<::grpc::ImapLoginFailedEvent>(Arena*);
|
||||
template<> ::grpc::ImapSmtpSettings* Arena::CreateMaybeMessage<::grpc::ImapSmtpSettings>(Arena*);
|
||||
template<> ::grpc::InternetStatusEvent* Arena::CreateMaybeMessage<::grpc::InternetStatusEvent>(Arena*);
|
||||
template<> ::grpc::KeychainEvent* Arena::CreateMaybeMessage<::grpc::KeychainEvent>(Arena*);
|
||||
@ -276,6 +283,7 @@ template<> ::grpc::UpdateManualReadyEvent* Arena::CreateMaybeMessage<::grpc::Upd
|
||||
template<> ::grpc::UpdateManualRestartNeededEvent* Arena::CreateMaybeMessage<::grpc::UpdateManualRestartNeededEvent>(Arena*);
|
||||
template<> ::grpc::UpdateSilentRestartNeeded* Arena::CreateMaybeMessage<::grpc::UpdateSilentRestartNeeded>(Arena*);
|
||||
template<> ::grpc::UpdateVersionChanged* Arena::CreateMaybeMessage<::grpc::UpdateVersionChanged>(Arena*);
|
||||
template<> ::grpc::UsedBytesChangedEvent* Arena::CreateMaybeMessage<::grpc::UsedBytesChangedEvent>(Arena*);
|
||||
template<> ::grpc::User* Arena::CreateMaybeMessage<::grpc::User>(Arena*);
|
||||
template<> ::grpc::UserBadEvent* Arena::CreateMaybeMessage<::grpc::UserBadEvent>(Arena*);
|
||||
template<> ::grpc::UserChangedEvent* Arena::CreateMaybeMessage<::grpc::UserChangedEvent>(Arena*);
|
||||
@ -9077,6 +9085,8 @@ class UserEvent final :
|
||||
kUserDisconnected = 2,
|
||||
kUserChanged = 3,
|
||||
kUserBadEvent = 4,
|
||||
kUsedBytesChangedEvent = 5,
|
||||
kImapLoginFailedEvent = 6,
|
||||
EVENT_NOT_SET = 0,
|
||||
};
|
||||
|
||||
@ -9162,6 +9172,8 @@ class UserEvent final :
|
||||
kUserDisconnectedFieldNumber = 2,
|
||||
kUserChangedFieldNumber = 3,
|
||||
kUserBadEventFieldNumber = 4,
|
||||
kUsedBytesChangedEventFieldNumber = 5,
|
||||
kImapLoginFailedEventFieldNumber = 6,
|
||||
};
|
||||
// .grpc.ToggleSplitModeFinishedEvent toggleSplitModeFinished = 1;
|
||||
bool has_togglesplitmodefinished() const;
|
||||
@ -9235,6 +9247,42 @@ class UserEvent final :
|
||||
::grpc::UserBadEvent* userbadevent);
|
||||
::grpc::UserBadEvent* unsafe_arena_release_userbadevent();
|
||||
|
||||
// .grpc.UsedBytesChangedEvent usedBytesChangedEvent = 5;
|
||||
bool has_usedbyteschangedevent() const;
|
||||
private:
|
||||
bool _internal_has_usedbyteschangedevent() const;
|
||||
public:
|
||||
void clear_usedbyteschangedevent();
|
||||
const ::grpc::UsedBytesChangedEvent& usedbyteschangedevent() const;
|
||||
PROTOBUF_NODISCARD ::grpc::UsedBytesChangedEvent* release_usedbyteschangedevent();
|
||||
::grpc::UsedBytesChangedEvent* mutable_usedbyteschangedevent();
|
||||
void set_allocated_usedbyteschangedevent(::grpc::UsedBytesChangedEvent* usedbyteschangedevent);
|
||||
private:
|
||||
const ::grpc::UsedBytesChangedEvent& _internal_usedbyteschangedevent() const;
|
||||
::grpc::UsedBytesChangedEvent* _internal_mutable_usedbyteschangedevent();
|
||||
public:
|
||||
void unsafe_arena_set_allocated_usedbyteschangedevent(
|
||||
::grpc::UsedBytesChangedEvent* usedbyteschangedevent);
|
||||
::grpc::UsedBytesChangedEvent* unsafe_arena_release_usedbyteschangedevent();
|
||||
|
||||
// .grpc.ImapLoginFailedEvent imapLoginFailedEvent = 6;
|
||||
bool has_imaploginfailedevent() const;
|
||||
private:
|
||||
bool _internal_has_imaploginfailedevent() const;
|
||||
public:
|
||||
void clear_imaploginfailedevent();
|
||||
const ::grpc::ImapLoginFailedEvent& imaploginfailedevent() const;
|
||||
PROTOBUF_NODISCARD ::grpc::ImapLoginFailedEvent* release_imaploginfailedevent();
|
||||
::grpc::ImapLoginFailedEvent* mutable_imaploginfailedevent();
|
||||
void set_allocated_imaploginfailedevent(::grpc::ImapLoginFailedEvent* imaploginfailedevent);
|
||||
private:
|
||||
const ::grpc::ImapLoginFailedEvent& _internal_imaploginfailedevent() const;
|
||||
::grpc::ImapLoginFailedEvent* _internal_mutable_imaploginfailedevent();
|
||||
public:
|
||||
void unsafe_arena_set_allocated_imaploginfailedevent(
|
||||
::grpc::ImapLoginFailedEvent* imaploginfailedevent);
|
||||
::grpc::ImapLoginFailedEvent* unsafe_arena_release_imaploginfailedevent();
|
||||
|
||||
void clear_event();
|
||||
EventCase event_case() const;
|
||||
// @@protoc_insertion_point(class_scope:grpc.UserEvent)
|
||||
@ -9244,6 +9292,8 @@ class UserEvent final :
|
||||
void set_has_userdisconnected();
|
||||
void set_has_userchanged();
|
||||
void set_has_userbadevent();
|
||||
void set_has_usedbyteschangedevent();
|
||||
void set_has_imaploginfailedevent();
|
||||
|
||||
inline bool has_event() const;
|
||||
inline void clear_has_event();
|
||||
@ -9259,6 +9309,8 @@ class UserEvent final :
|
||||
::grpc::UserDisconnectedEvent* userdisconnected_;
|
||||
::grpc::UserChangedEvent* userchanged_;
|
||||
::grpc::UserBadEvent* userbadevent_;
|
||||
::grpc::UsedBytesChangedEvent* usedbyteschangedevent_;
|
||||
::grpc::ImapLoginFailedEvent* imaploginfailedevent_;
|
||||
} event_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
uint32_t _oneof_case_[1];
|
||||
@ -9897,6 +9949,323 @@ class UserBadEvent final :
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class UsedBytesChangedEvent final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:grpc.UsedBytesChangedEvent) */ {
|
||||
public:
|
||||
inline UsedBytesChangedEvent() : UsedBytesChangedEvent(nullptr) {}
|
||||
~UsedBytesChangedEvent() override;
|
||||
explicit PROTOBUF_CONSTEXPR UsedBytesChangedEvent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
|
||||
UsedBytesChangedEvent(const UsedBytesChangedEvent& from);
|
||||
UsedBytesChangedEvent(UsedBytesChangedEvent&& from) noexcept
|
||||
: UsedBytesChangedEvent() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline UsedBytesChangedEvent& operator=(const UsedBytesChangedEvent& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline UsedBytesChangedEvent& operator=(UsedBytesChangedEvent&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const UsedBytesChangedEvent& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
static inline const UsedBytesChangedEvent* internal_default_instance() {
|
||||
return reinterpret_cast<const UsedBytesChangedEvent*>(
|
||||
&_UsedBytesChangedEvent_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
57;
|
||||
|
||||
friend void swap(UsedBytesChangedEvent& a, UsedBytesChangedEvent& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(UsedBytesChangedEvent* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(UsedBytesChangedEvent* other) {
|
||||
if (other == this) return;
|
||||
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
UsedBytesChangedEvent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<UsedBytesChangedEvent>(arena);
|
||||
}
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const UsedBytesChangedEvent& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom( const UsedBytesChangedEvent& from) {
|
||||
UsedBytesChangedEvent::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
size_t ByteSizeLong() const final;
|
||||
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
|
||||
uint8_t* _InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
|
||||
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(UsedBytesChangedEvent* other);
|
||||
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "grpc.UsedBytesChangedEvent";
|
||||
}
|
||||
protected:
|
||||
explicit UsedBytesChangedEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
public:
|
||||
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kUserIDFieldNumber = 1,
|
||||
kUsedBytesFieldNumber = 2,
|
||||
};
|
||||
// string userID = 1;
|
||||
void clear_userid();
|
||||
const std::string& userid() const;
|
||||
template <typename ArgT0 = const std::string&, typename... ArgT>
|
||||
void set_userid(ArgT0&& arg0, ArgT... args);
|
||||
std::string* mutable_userid();
|
||||
PROTOBUF_NODISCARD std::string* release_userid();
|
||||
void set_allocated_userid(std::string* userid);
|
||||
private:
|
||||
const std::string& _internal_userid() const;
|
||||
inline PROTOBUF_ALWAYS_INLINE void _internal_set_userid(const std::string& value);
|
||||
std::string* _internal_mutable_userid();
|
||||
public:
|
||||
|
||||
// int64 usedBytes = 2;
|
||||
void clear_usedbytes();
|
||||
int64_t usedbytes() const;
|
||||
void set_usedbytes(int64_t value);
|
||||
private:
|
||||
int64_t _internal_usedbytes() const;
|
||||
void _internal_set_usedbytes(int64_t value);
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:grpc.UsedBytesChangedEvent)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
typedef void InternalArenaConstructable_;
|
||||
typedef void DestructorSkippable_;
|
||||
struct Impl_ {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr userid_;
|
||||
int64_t usedbytes_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
friend struct ::TableStruct_bridge_2eproto;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class ImapLoginFailedEvent final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:grpc.ImapLoginFailedEvent) */ {
|
||||
public:
|
||||
inline ImapLoginFailedEvent() : ImapLoginFailedEvent(nullptr) {}
|
||||
~ImapLoginFailedEvent() override;
|
||||
explicit PROTOBUF_CONSTEXPR ImapLoginFailedEvent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
|
||||
ImapLoginFailedEvent(const ImapLoginFailedEvent& from);
|
||||
ImapLoginFailedEvent(ImapLoginFailedEvent&& from) noexcept
|
||||
: ImapLoginFailedEvent() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline ImapLoginFailedEvent& operator=(const ImapLoginFailedEvent& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline ImapLoginFailedEvent& operator=(ImapLoginFailedEvent&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const ImapLoginFailedEvent& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
static inline const ImapLoginFailedEvent* internal_default_instance() {
|
||||
return reinterpret_cast<const ImapLoginFailedEvent*>(
|
||||
&_ImapLoginFailedEvent_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
58;
|
||||
|
||||
friend void swap(ImapLoginFailedEvent& a, ImapLoginFailedEvent& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(ImapLoginFailedEvent* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(ImapLoginFailedEvent* other) {
|
||||
if (other == this) return;
|
||||
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
ImapLoginFailedEvent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<ImapLoginFailedEvent>(arena);
|
||||
}
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const ImapLoginFailedEvent& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom( const ImapLoginFailedEvent& from) {
|
||||
ImapLoginFailedEvent::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
size_t ByteSizeLong() const final;
|
||||
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
|
||||
uint8_t* _InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
|
||||
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(ImapLoginFailedEvent* other);
|
||||
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "grpc.ImapLoginFailedEvent";
|
||||
}
|
||||
protected:
|
||||
explicit ImapLoginFailedEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
public:
|
||||
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kUsernameFieldNumber = 1,
|
||||
};
|
||||
// string username = 1;
|
||||
void clear_username();
|
||||
const std::string& username() const;
|
||||
template <typename ArgT0 = const std::string&, typename... ArgT>
|
||||
void set_username(ArgT0&& arg0, ArgT... args);
|
||||
std::string* mutable_username();
|
||||
PROTOBUF_NODISCARD std::string* release_username();
|
||||
void set_allocated_username(std::string* username);
|
||||
private:
|
||||
const std::string& _internal_username() const;
|
||||
inline PROTOBUF_ALWAYS_INLINE void _internal_set_username(const std::string& value);
|
||||
std::string* _internal_mutable_username();
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:grpc.ImapLoginFailedEvent)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
typedef void InternalArenaConstructable_;
|
||||
typedef void DestructorSkippable_;
|
||||
struct Impl_ {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr username_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
friend struct ::TableStruct_bridge_2eproto;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class GenericErrorEvent final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:grpc.GenericErrorEvent) */ {
|
||||
public:
|
||||
@ -9945,7 +10314,7 @@ class GenericErrorEvent final :
|
||||
&_GenericErrorEvent_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
57;
|
||||
59;
|
||||
|
||||
friend void swap(GenericErrorEvent& a, GenericErrorEvent& b) {
|
||||
a.Swap(&b);
|
||||
@ -15728,6 +16097,154 @@ inline ::grpc::UserBadEvent* UserEvent::mutable_userbadevent() {
|
||||
return _msg;
|
||||
}
|
||||
|
||||
// .grpc.UsedBytesChangedEvent usedBytesChangedEvent = 5;
|
||||
inline bool UserEvent::_internal_has_usedbyteschangedevent() const {
|
||||
return event_case() == kUsedBytesChangedEvent;
|
||||
}
|
||||
inline bool UserEvent::has_usedbyteschangedevent() const {
|
||||
return _internal_has_usedbyteschangedevent();
|
||||
}
|
||||
inline void UserEvent::set_has_usedbyteschangedevent() {
|
||||
_impl_._oneof_case_[0] = kUsedBytesChangedEvent;
|
||||
}
|
||||
inline void UserEvent::clear_usedbyteschangedevent() {
|
||||
if (_internal_has_usedbyteschangedevent()) {
|
||||
if (GetArenaForAllocation() == nullptr) {
|
||||
delete _impl_.event_.usedbyteschangedevent_;
|
||||
}
|
||||
clear_has_event();
|
||||
}
|
||||
}
|
||||
inline ::grpc::UsedBytesChangedEvent* UserEvent::release_usedbyteschangedevent() {
|
||||
// @@protoc_insertion_point(field_release:grpc.UserEvent.usedBytesChangedEvent)
|
||||
if (_internal_has_usedbyteschangedevent()) {
|
||||
clear_has_event();
|
||||
::grpc::UsedBytesChangedEvent* temp = _impl_.event_.usedbyteschangedevent_;
|
||||
if (GetArenaForAllocation() != nullptr) {
|
||||
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
|
||||
}
|
||||
_impl_.event_.usedbyteschangedevent_ = nullptr;
|
||||
return temp;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
inline const ::grpc::UsedBytesChangedEvent& UserEvent::_internal_usedbyteschangedevent() const {
|
||||
return _internal_has_usedbyteschangedevent()
|
||||
? *_impl_.event_.usedbyteschangedevent_
|
||||
: reinterpret_cast< ::grpc::UsedBytesChangedEvent&>(::grpc::_UsedBytesChangedEvent_default_instance_);
|
||||
}
|
||||
inline const ::grpc::UsedBytesChangedEvent& UserEvent::usedbyteschangedevent() const {
|
||||
// @@protoc_insertion_point(field_get:grpc.UserEvent.usedBytesChangedEvent)
|
||||
return _internal_usedbyteschangedevent();
|
||||
}
|
||||
inline ::grpc::UsedBytesChangedEvent* UserEvent::unsafe_arena_release_usedbyteschangedevent() {
|
||||
// @@protoc_insertion_point(field_unsafe_arena_release:grpc.UserEvent.usedBytesChangedEvent)
|
||||
if (_internal_has_usedbyteschangedevent()) {
|
||||
clear_has_event();
|
||||
::grpc::UsedBytesChangedEvent* temp = _impl_.event_.usedbyteschangedevent_;
|
||||
_impl_.event_.usedbyteschangedevent_ = nullptr;
|
||||
return temp;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
inline void UserEvent::unsafe_arena_set_allocated_usedbyteschangedevent(::grpc::UsedBytesChangedEvent* usedbyteschangedevent) {
|
||||
clear_event();
|
||||
if (usedbyteschangedevent) {
|
||||
set_has_usedbyteschangedevent();
|
||||
_impl_.event_.usedbyteschangedevent_ = usedbyteschangedevent;
|
||||
}
|
||||
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:grpc.UserEvent.usedBytesChangedEvent)
|
||||
}
|
||||
inline ::grpc::UsedBytesChangedEvent* UserEvent::_internal_mutable_usedbyteschangedevent() {
|
||||
if (!_internal_has_usedbyteschangedevent()) {
|
||||
clear_event();
|
||||
set_has_usedbyteschangedevent();
|
||||
_impl_.event_.usedbyteschangedevent_ = CreateMaybeMessage< ::grpc::UsedBytesChangedEvent >(GetArenaForAllocation());
|
||||
}
|
||||
return _impl_.event_.usedbyteschangedevent_;
|
||||
}
|
||||
inline ::grpc::UsedBytesChangedEvent* UserEvent::mutable_usedbyteschangedevent() {
|
||||
::grpc::UsedBytesChangedEvent* _msg = _internal_mutable_usedbyteschangedevent();
|
||||
// @@protoc_insertion_point(field_mutable:grpc.UserEvent.usedBytesChangedEvent)
|
||||
return _msg;
|
||||
}
|
||||
|
||||
// .grpc.ImapLoginFailedEvent imapLoginFailedEvent = 6;
|
||||
inline bool UserEvent::_internal_has_imaploginfailedevent() const {
|
||||
return event_case() == kImapLoginFailedEvent;
|
||||
}
|
||||
inline bool UserEvent::has_imaploginfailedevent() const {
|
||||
return _internal_has_imaploginfailedevent();
|
||||
}
|
||||
inline void UserEvent::set_has_imaploginfailedevent() {
|
||||
_impl_._oneof_case_[0] = kImapLoginFailedEvent;
|
||||
}
|
||||
inline void UserEvent::clear_imaploginfailedevent() {
|
||||
if (_internal_has_imaploginfailedevent()) {
|
||||
if (GetArenaForAllocation() == nullptr) {
|
||||
delete _impl_.event_.imaploginfailedevent_;
|
||||
}
|
||||
clear_has_event();
|
||||
}
|
||||
}
|
||||
inline ::grpc::ImapLoginFailedEvent* UserEvent::release_imaploginfailedevent() {
|
||||
// @@protoc_insertion_point(field_release:grpc.UserEvent.imapLoginFailedEvent)
|
||||
if (_internal_has_imaploginfailedevent()) {
|
||||
clear_has_event();
|
||||
::grpc::ImapLoginFailedEvent* temp = _impl_.event_.imaploginfailedevent_;
|
||||
if (GetArenaForAllocation() != nullptr) {
|
||||
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
|
||||
}
|
||||
_impl_.event_.imaploginfailedevent_ = nullptr;
|
||||
return temp;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
inline const ::grpc::ImapLoginFailedEvent& UserEvent::_internal_imaploginfailedevent() const {
|
||||
return _internal_has_imaploginfailedevent()
|
||||
? *_impl_.event_.imaploginfailedevent_
|
||||
: reinterpret_cast< ::grpc::ImapLoginFailedEvent&>(::grpc::_ImapLoginFailedEvent_default_instance_);
|
||||
}
|
||||
inline const ::grpc::ImapLoginFailedEvent& UserEvent::imaploginfailedevent() const {
|
||||
// @@protoc_insertion_point(field_get:grpc.UserEvent.imapLoginFailedEvent)
|
||||
return _internal_imaploginfailedevent();
|
||||
}
|
||||
inline ::grpc::ImapLoginFailedEvent* UserEvent::unsafe_arena_release_imaploginfailedevent() {
|
||||
// @@protoc_insertion_point(field_unsafe_arena_release:grpc.UserEvent.imapLoginFailedEvent)
|
||||
if (_internal_has_imaploginfailedevent()) {
|
||||
clear_has_event();
|
||||
::grpc::ImapLoginFailedEvent* temp = _impl_.event_.imaploginfailedevent_;
|
||||
_impl_.event_.imaploginfailedevent_ = nullptr;
|
||||
return temp;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
inline void UserEvent::unsafe_arena_set_allocated_imaploginfailedevent(::grpc::ImapLoginFailedEvent* imaploginfailedevent) {
|
||||
clear_event();
|
||||
if (imaploginfailedevent) {
|
||||
set_has_imaploginfailedevent();
|
||||
_impl_.event_.imaploginfailedevent_ = imaploginfailedevent;
|
||||
}
|
||||
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:grpc.UserEvent.imapLoginFailedEvent)
|
||||
}
|
||||
inline ::grpc::ImapLoginFailedEvent* UserEvent::_internal_mutable_imaploginfailedevent() {
|
||||
if (!_internal_has_imaploginfailedevent()) {
|
||||
clear_event();
|
||||
set_has_imaploginfailedevent();
|
||||
_impl_.event_.imaploginfailedevent_ = CreateMaybeMessage< ::grpc::ImapLoginFailedEvent >(GetArenaForAllocation());
|
||||
}
|
||||
return _impl_.event_.imaploginfailedevent_;
|
||||
}
|
||||
inline ::grpc::ImapLoginFailedEvent* UserEvent::mutable_imaploginfailedevent() {
|
||||
::grpc::ImapLoginFailedEvent* _msg = _internal_mutable_imaploginfailedevent();
|
||||
// @@protoc_insertion_point(field_mutable:grpc.UserEvent.imapLoginFailedEvent)
|
||||
return _msg;
|
||||
}
|
||||
|
||||
inline bool UserEvent::has_event() const {
|
||||
return event_case() != EVENT_NOT_SET;
|
||||
}
|
||||
@ -16005,6 +16522,134 @@ inline void UserBadEvent::set_allocated_errormessage(std::string* errormessage)
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// UsedBytesChangedEvent
|
||||
|
||||
// string userID = 1;
|
||||
inline void UsedBytesChangedEvent::clear_userid() {
|
||||
_impl_.userid_.ClearToEmpty();
|
||||
}
|
||||
inline const std::string& UsedBytesChangedEvent::userid() const {
|
||||
// @@protoc_insertion_point(field_get:grpc.UsedBytesChangedEvent.userID)
|
||||
return _internal_userid();
|
||||
}
|
||||
template <typename ArgT0, typename... ArgT>
|
||||
inline PROTOBUF_ALWAYS_INLINE
|
||||
void UsedBytesChangedEvent::set_userid(ArgT0&& arg0, ArgT... args) {
|
||||
|
||||
_impl_.userid_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
|
||||
// @@protoc_insertion_point(field_set:grpc.UsedBytesChangedEvent.userID)
|
||||
}
|
||||
inline std::string* UsedBytesChangedEvent::mutable_userid() {
|
||||
std::string* _s = _internal_mutable_userid();
|
||||
// @@protoc_insertion_point(field_mutable:grpc.UsedBytesChangedEvent.userID)
|
||||
return _s;
|
||||
}
|
||||
inline const std::string& UsedBytesChangedEvent::_internal_userid() const {
|
||||
return _impl_.userid_.Get();
|
||||
}
|
||||
inline void UsedBytesChangedEvent::_internal_set_userid(const std::string& value) {
|
||||
|
||||
_impl_.userid_.Set(value, GetArenaForAllocation());
|
||||
}
|
||||
inline std::string* UsedBytesChangedEvent::_internal_mutable_userid() {
|
||||
|
||||
return _impl_.userid_.Mutable(GetArenaForAllocation());
|
||||
}
|
||||
inline std::string* UsedBytesChangedEvent::release_userid() {
|
||||
// @@protoc_insertion_point(field_release:grpc.UsedBytesChangedEvent.userID)
|
||||
return _impl_.userid_.Release();
|
||||
}
|
||||
inline void UsedBytesChangedEvent::set_allocated_userid(std::string* userid) {
|
||||
if (userid != nullptr) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
_impl_.userid_.SetAllocated(userid, GetArenaForAllocation());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (_impl_.userid_.IsDefault()) {
|
||||
_impl_.userid_.Set("", GetArenaForAllocation());
|
||||
}
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
// @@protoc_insertion_point(field_set_allocated:grpc.UsedBytesChangedEvent.userID)
|
||||
}
|
||||
|
||||
// int64 usedBytes = 2;
|
||||
inline void UsedBytesChangedEvent::clear_usedbytes() {
|
||||
_impl_.usedbytes_ = int64_t{0};
|
||||
}
|
||||
inline int64_t UsedBytesChangedEvent::_internal_usedbytes() const {
|
||||
return _impl_.usedbytes_;
|
||||
}
|
||||
inline int64_t UsedBytesChangedEvent::usedbytes() const {
|
||||
// @@protoc_insertion_point(field_get:grpc.UsedBytesChangedEvent.usedBytes)
|
||||
return _internal_usedbytes();
|
||||
}
|
||||
inline void UsedBytesChangedEvent::_internal_set_usedbytes(int64_t value) {
|
||||
|
||||
_impl_.usedbytes_ = value;
|
||||
}
|
||||
inline void UsedBytesChangedEvent::set_usedbytes(int64_t value) {
|
||||
_internal_set_usedbytes(value);
|
||||
// @@protoc_insertion_point(field_set:grpc.UsedBytesChangedEvent.usedBytes)
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// ImapLoginFailedEvent
|
||||
|
||||
// string username = 1;
|
||||
inline void ImapLoginFailedEvent::clear_username() {
|
||||
_impl_.username_.ClearToEmpty();
|
||||
}
|
||||
inline const std::string& ImapLoginFailedEvent::username() const {
|
||||
// @@protoc_insertion_point(field_get:grpc.ImapLoginFailedEvent.username)
|
||||
return _internal_username();
|
||||
}
|
||||
template <typename ArgT0, typename... ArgT>
|
||||
inline PROTOBUF_ALWAYS_INLINE
|
||||
void ImapLoginFailedEvent::set_username(ArgT0&& arg0, ArgT... args) {
|
||||
|
||||
_impl_.username_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
|
||||
// @@protoc_insertion_point(field_set:grpc.ImapLoginFailedEvent.username)
|
||||
}
|
||||
inline std::string* ImapLoginFailedEvent::mutable_username() {
|
||||
std::string* _s = _internal_mutable_username();
|
||||
// @@protoc_insertion_point(field_mutable:grpc.ImapLoginFailedEvent.username)
|
||||
return _s;
|
||||
}
|
||||
inline const std::string& ImapLoginFailedEvent::_internal_username() const {
|
||||
return _impl_.username_.Get();
|
||||
}
|
||||
inline void ImapLoginFailedEvent::_internal_set_username(const std::string& value) {
|
||||
|
||||
_impl_.username_.Set(value, GetArenaForAllocation());
|
||||
}
|
||||
inline std::string* ImapLoginFailedEvent::_internal_mutable_username() {
|
||||
|
||||
return _impl_.username_.Mutable(GetArenaForAllocation());
|
||||
}
|
||||
inline std::string* ImapLoginFailedEvent::release_username() {
|
||||
// @@protoc_insertion_point(field_release:grpc.ImapLoginFailedEvent.username)
|
||||
return _impl_.username_.Release();
|
||||
}
|
||||
inline void ImapLoginFailedEvent::set_allocated_username(std::string* username) {
|
||||
if (username != nullptr) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
_impl_.username_.SetAllocated(username, GetArenaForAllocation());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (_impl_.username_.IsDefault()) {
|
||||
_impl_.username_.Set("", GetArenaForAllocation());
|
||||
}
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
// @@protoc_insertion_point(field_set_allocated:grpc.ImapLoginFailedEvent.username)
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// GenericErrorEvent
|
||||
|
||||
// .grpc.ErrorCode code = 1;
|
||||
@ -16144,6 +16789,10 @@ inline void GenericErrorEvent::set_code(::grpc::ErrorCode value) {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
|
||||
@ -34,7 +34,8 @@ SPUser User::newUser(QObject *parent) {
|
||||
/// \param[in] parent The parent object.
|
||||
//****************************************************************************************************************************************************
|
||||
User::User(QObject *parent)
|
||||
: QObject(parent) {
|
||||
: QObject(parent)
|
||||
, imapFailureCooldownEndTime_(QDateTime::currentDateTime()) {
|
||||
|
||||
}
|
||||
|
||||
@ -311,4 +312,24 @@ QString User::stateToString(UserState state) {
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// We display a notification and pop the application window if an IMAP client tries to connect to a signed out account, but we do not want to
|
||||
/// do it repeatedly, as it's an intrusive action. This function let's you define a period of time during which the notification should not be
|
||||
/// displayed.
|
||||
///
|
||||
/// \param durationMSecs The duration of the period in milliseconds.
|
||||
//****************************************************************************************************************************************************
|
||||
void User::startImapLoginFailureCooldown(qint64 durationMSecs) {
|
||||
imapFailureCooldownEndTime_ = QDateTime::currentDateTime().addMSecs(durationMSecs);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return true if we currently are in a cooldown period for the notification
|
||||
//****************************************************************************************************************************************************
|
||||
bool User::isInIMAPLoginFailureCooldown() const {
|
||||
return QDateTime::currentDateTime() < imapFailureCooldownEndTime_;
|
||||
}
|
||||
|
||||
|
||||
} // namespace bridgepp
|
||||
|
||||
@ -74,6 +74,8 @@ public: // member functions.
|
||||
User &operator=(User &&) = delete; ///< Disabled move assignment operator.
|
||||
void update(User const &user); ///< Update the user.
|
||||
Q_INVOKABLE QString primaryEmailOrUsername() const; ///< Return the user primary email, or, if unknown its username.
|
||||
void startImapLoginFailureCooldown(qint64 durationMSecs); ///< Start the user cooldown period for the IMAP login attempt while signed-out notification.
|
||||
bool isInIMAPLoginFailureCooldown() const; ///< Check if the user in a IMAP login failure notification.
|
||||
|
||||
public slots:
|
||||
// slots for QML generated calls
|
||||
@ -137,6 +139,7 @@ private: // member functions.
|
||||
User(QObject *parent); ///< Default constructor.
|
||||
|
||||
private: // data members.
|
||||
QDateTime imapFailureCooldownEndTime_; ///< The end date/time for the IMAP login failure notification cooldown period.
|
||||
QString id_; ///< The userID.
|
||||
QString username_; ///< The username
|
||||
QString password_; ///< The IMAP password of the user.
|
||||
|
||||
Reference in New Issue
Block a user