GODT-2312: used space is properly updated.

This commit is contained in:
Xavier Michelon
2023-01-30 15:18:44 +01:00
parent ce03bfbf0f
commit c8065c8092
20 changed files with 1484 additions and 563 deletions

2
go.mod
View File

@ -7,7 +7,7 @@ require (
github.com/Masterminds/semver/v3 v3.1.1
github.com/ProtonMail/gluon v0.14.2-0.20230130104154-2c64e59b8f54
github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a
github.com/ProtonMail/go-proton-api v0.3.1-0.20230130093944-dd1190680368
github.com/ProtonMail/go-proton-api v0.3.1-0.20230130144605-4b05f1e5c427
github.com/ProtonMail/go-rfc5322 v0.11.0
github.com/ProtonMail/gopenpgp/v2 v2.4.10
github.com/PuerkitoBio/goquery v1.8.0

4
go.sum
View File

@ -41,8 +41,8 @@ github.com/ProtonMail/go-message v0.0.0-20210611055058-fabeff2ec753/go.mod h1:NB
github.com/ProtonMail/go-mime v0.0.0-20220302105931-303f85f7fe0f/go.mod h1:NYt+V3/4rEeDuaev/zw1zCq8uqVEuPHzDPo3OZrlGJ4=
github.com/ProtonMail/go-mime v0.0.0-20220429130430-2192574d760f h1:4IWzKjHzZxdrW9k4zl/qCwenOVHDbVDADPPHFLjs0Oc=
github.com/ProtonMail/go-mime v0.0.0-20220429130430-2192574d760f/go.mod h1:qRZgbeASl2a9OwmsV85aWwRqic0NHPh+9ewGAzb4cgM=
github.com/ProtonMail/go-proton-api v0.3.1-0.20230130093944-dd1190680368 h1:XWPaCK8ctgpvI+ZAYcsFiYWbuvkv3T4+WZq0o6Gnt2s=
github.com/ProtonMail/go-proton-api v0.3.1-0.20230130093944-dd1190680368/go.mod h1:JUo5IQG0hNuPRuDpOUsCOvtee6UjTEHHF1QN2i8RSos=
github.com/ProtonMail/go-proton-api v0.3.1-0.20230130144605-4b05f1e5c427 h1:M/sTrpruuxBtkeVFPoMd9WM2Kg36XlCTvYuv4q0urkg=
github.com/ProtonMail/go-proton-api v0.3.1-0.20230130144605-4b05f1e5c427/go.mod h1:JUo5IQG0hNuPRuDpOUsCOvtee6UjTEHHF1QN2i8RSos=
github.com/ProtonMail/go-rfc5322 v0.11.0 h1:o5Obrm4DpmQEffvgsVqG6S4BKwC1Wat+hYwjIp2YcCY=
github.com/ProtonMail/go-rfc5322 v0.11.0/go.mod h1:6oOKr0jXvpoE6pwTx/HukigQpX2J9WUf6h0auplrFTw=
github.com/ProtonMail/go-srp v0.0.5 h1:xhUioxZgDbCnpo9JehyFhwwsn9JLWkUGfB0oiKXgiGg=

View File

@ -156,3 +156,16 @@ type AddressModeChanged struct {
func (event AddressModeChanged) String() string {
return fmt.Sprintf("AddressModeChanged: UserID: %s, AddressMode: %s", event.UserID, event.AddressMode)
}
// UsedSpaceChanged is emitted when the storage space used by the user has changed.
type UsedSpaceChanged struct {
eventBase
UserID string
UsedSpace int
}
func (event UsedSpaceChanged) String() string {
return fmt.Sprintf("UsedSpaceChanged: UserID: %s, UsedSpace: %v", event.UserID, event.UsedSpace)
}

View File

@ -52,6 +52,7 @@ 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_.buttonUsedBytesChanged, &QPushButton::clicked, this, &UsersTab::onSendUsedBytesChangedEvent);
connect(ui_.checkUsernamePasswordError, &QCheckBox::toggled, this, &UsersTab::updateGUIState);
users_.append(randomUser());
@ -158,16 +159,50 @@ 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::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);
}

View File

@ -61,6 +61,7 @@ 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 updateGUIState(); ///< Update the GUI state.
private: // member functions.

View File

@ -66,6 +66,52 @@
</property>
</spacer>
</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>
<layout class="QHBoxLayout" name="hBoxUsedBytes" stretch="0,1">
<item>
<widget class="QLabel" name="labelUsedBytes">
<property name="text">
<string>Used Bytes</string>
</property>
</widget>
</item>
<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>
</layout>
</item>
<item>
<widget class="QPushButton" name="buttonUsedBytesChanged">
<property name="text">
<string>Send Used Bytes Changed</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxBadEvent">
<property name="minimumSize">

View File

@ -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);
}
@ -223,3 +224,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);
}

View File

@ -59,6 +59,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.

View File

@ -574,6 +574,20 @@ 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] errorCode The error errorCode.
/// \return The event.

View File

@ -78,6 +78,7 @@ 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.
// Generic error event
SPStreamEvent newGenericErrorEvent(grpc::ErrorCode errorCode); ///< Create a new GenericErrrorEvent event.

View File

@ -1374,6 +1374,14 @@ 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;
}
default:
this->logError("Unknown User event received.");
}

View File

@ -179,6 +179,7 @@ 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);
public: // keychain related calls
grpc::Status availableKeychains(QStringList &outKeychains);

View File

@ -759,6 +759,20 @@ struct UserBadEventDefaultTypeInternal {
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 UserBadEventDefaultTypeInternal _UserBadEvent_default_instance_;
PROTOBUF_CONSTEXPR UsedBytesChangedEvent::UsedBytesChangedEvent(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.userid_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.usedbytes_)*/int64_t{0}
, /*decltype(_impl_._cached_size_)*/{}} {}
struct UsedBytesChangedEventDefaultTypeInternal {
PROTOBUF_CONSTEXPR UsedBytesChangedEventDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
~UsedBytesChangedEventDefaultTypeInternal() {}
union {
UsedBytesChangedEvent _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 UsedBytesChangedEventDefaultTypeInternal _UsedBytesChangedEvent_default_instance_;
PROTOBUF_CONSTEXPR GenericErrorEvent::GenericErrorEvent(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.code_)*/0
@ -773,7 +787,7 @@ struct GenericErrorEventDefaultTypeInternal {
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GenericErrorEventDefaultTypeInternal _GenericErrorEvent_default_instance_;
} // namespace grpc
static ::_pb::Metadata file_level_metadata_bridge_2eproto[58];
static ::_pb::Metadata file_level_metadata_bridge_2eproto[59];
static const ::_pb::EnumDescriptor* file_level_enum_descriptors_bridge_2eproto[7];
static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_bridge_2eproto = nullptr;
@ -1199,6 +1213,7 @@ const uint32_t TableStruct_bridge_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(p
::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag,
PROTOBUF_FIELD_OFFSET(::grpc::UserEvent, _impl_.event_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::grpc::ToggleSplitModeFinishedEvent, _internal_metadata_),
@ -1230,6 +1245,14 @@ const uint32_t TableStruct_bridge_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(p
PROTOBUF_FIELD_OFFSET(::grpc::UserBadEvent, _impl_.userid_),
PROTOBUF_FIELD_OFFSET(::grpc::UserBadEvent, _impl_.errormessage_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::grpc::UsedBytesChangedEvent, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
PROTOBUF_FIELD_OFFSET(::grpc::UsedBytesChangedEvent, _impl_.userid_),
PROTOBUF_FIELD_OFFSET(::grpc::UsedBytesChangedEvent, _impl_.usedbytes_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::grpc::GenericErrorEvent, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
@ -1291,11 +1314,12 @@ static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protode
{ 398, -1, -1, sizeof(::grpc::AddressChangedLogoutEvent)},
{ 405, -1, -1, sizeof(::grpc::ApiCertIssueEvent)},
{ 411, -1, -1, sizeof(::grpc::UserEvent)},
{ 422, -1, -1, sizeof(::grpc::ToggleSplitModeFinishedEvent)},
{ 429, -1, -1, sizeof(::grpc::UserDisconnectedEvent)},
{ 436, -1, -1, sizeof(::grpc::UserChangedEvent)},
{ 443, -1, -1, sizeof(::grpc::UserBadEvent)},
{ 451, -1, -1, sizeof(::grpc::GenericErrorEvent)},
{ 423, -1, -1, sizeof(::grpc::ToggleSplitModeFinishedEvent)},
{ 430, -1, -1, sizeof(::grpc::UserDisconnectedEvent)},
{ 437, -1, -1, sizeof(::grpc::UserChangedEvent)},
{ 444, -1, -1, sizeof(::grpc::UserBadEvent)},
{ 452, -1, -1, sizeof(::grpc::UsedBytesChangedEvent)},
{ 460, -1, -1, sizeof(::grpc::GenericErrorEvent)},
};
static const ::_pb::Message* const file_default_instances[] = {
@ -1356,6 +1380,7 @@ static const ::_pb::Message* const file_default_instances[] = {
&::grpc::_UserDisconnectedEvent_default_instance_._instance,
&::grpc::_UserChangedEvent_default_instance_._instance,
&::grpc::_UserBadEvent_default_instance_._instance,
&::grpc::_UsedBytesChangedEvent_default_instance_._instance,
&::grpc::_GenericErrorEvent_default_instance_._instance,
};
@ -1477,135 +1502,138 @@ const char descriptor_table_protodef_bridge_2eproto[] PROTOBUF_SECTION_VARIABLE(
"KeyForRecipientEvent\022\r\n\005email\030\001 \001(\t\"&\n\023A"
"ddressChangedEvent\022\017\n\007address\030\001 \001(\t\",\n\031A"
"ddressChangedLogoutEvent\022\017\n\007address\030\001 \001("
"\t\"\023\n\021ApiCertIssueEvent\"\357\001\n\tUserEvent\022E\n\027"
"\t\"\023\n\021ApiCertIssueEvent\"\255\002\n\tUserEvent\022E\n\027"
"toggleSplitModeFinished\030\001 \001(\0132\".grpc.Tog"
"gleSplitModeFinishedEventH\000\0227\n\020userDisco"
"nnected\030\002 \001(\0132\033.grpc.UserDisconnectedEve"
"ntH\000\022-\n\013userChanged\030\003 \001(\0132\026.grpc.UserCha"
"ngedEventH\000\022*\n\014userBadEvent\030\004 \001(\0132\022.grpc"
".UserBadEventH\000B\007\n\005event\".\n\034ToggleSplitM"
"odeFinishedEvent\022\016\n\006userID\030\001 \001(\t\")\n\025User"
"DisconnectedEvent\022\020\n\010username\030\001 \001(\t\"\"\n\020U"
"serChangedEvent\022\016\n\006userID\030\001 \001(\t\"4\n\014UserB"
"adEvent\022\016\n\006userID\030\001 \001(\t\022\024\n\014errorMessage\030"
"\002 \001(\t\"2\n\021GenericErrorEvent\022\035\n\004code\030\001 \001(\016"
"2\017.grpc.ErrorCode*q\n\010LogLevel\022\r\n\tLOG_PAN"
"IC\020\000\022\r\n\tLOG_FATAL\020\001\022\r\n\tLOG_ERROR\020\002\022\014\n\010LO"
"G_WARN\020\003\022\014\n\010LOG_INFO\020\004\022\r\n\tLOG_DEBUG\020\005\022\r\n"
"\tLOG_TRACE\020\006*6\n\tUserState\022\016\n\nSIGNED_OUT\020"
"\000\022\n\n\006LOCKED\020\001\022\r\n\tCONNECTED\020\002*\242\001\n\016LoginEr"
"rorType\022\033\n\027USERNAME_PASSWORD_ERROR\020\000\022\r\n\t"
"FREE_USER\020\001\022\024\n\020CONNECTION_ERROR\020\002\022\r\n\tTFA"
"_ERROR\020\003\022\r\n\tTFA_ABORT\020\004\022\027\n\023TWO_PASSWORDS"
"_ERROR\020\005\022\027\n\023TWO_PASSWORDS_ABORT\020\006*[\n\017Upd"
"ateErrorType\022\027\n\023UPDATE_MANUAL_ERROR\020\000\022\026\n"
"\022UPDATE_FORCE_ERROR\020\001\022\027\n\023UPDATE_SILENT_E"
"RROR\020\002*k\n\022DiskCacheErrorType\022 \n\034DISK_CAC"
"HE_UNAVAILABLE_ERROR\020\000\022\036\n\032CANT_MOVE_DISK"
"_CACHE_ERROR\020\001\022\023\n\017DISK_FULL_ERROR\020\002*\335\001\n\033"
"MailServerSettingsErrorType\022\033\n\027IMAP_PORT"
"_STARTUP_ERROR\020\000\022\033\n\027SMTP_PORT_STARTUP_ER"
"ROR\020\001\022\032\n\026IMAP_PORT_CHANGE_ERROR\020\002\022\032\n\026SMT"
"P_PORT_CHANGE_ERROR\020\003\022%\n!IMAP_CONNECTION"
"_MODE_CHANGE_ERROR\020\004\022%\n!SMTP_CONNECTION_"
"MODE_CHANGE_ERROR\020\005*S\n\tErrorCode\022\021\n\rUNKN"
"OWN_ERROR\020\000\022\031\n\025TLS_CERT_EXPORT_ERROR\020\001\022\030"
"\n\024TLS_KEY_EXPORT_ERROR\020\0022\231\035\n\006Bridge\022I\n\013C"
"heckTokens\022\034.google.protobuf.StringValue"
"\032\034.google.protobuf.StringValue\022\?\n\013AddLog"
"Entry\022\030.grpc.AddLogEntryRequest\032\026.google"
".protobuf.Empty\022:\n\010GuiReady\022\026.google.pro"
"tobuf.Empty\032\026.grpc.GuiReadyResponse\0226\n\004Q"
"uit\022\026.google.protobuf.Empty\032\026.google.pro"
"tobuf.Empty\0229\n\007Restart\022\026.google.protobuf"
".Empty\032\026.google.protobuf.Empty\022C\n\rShowOn"
"Startup\022\026.google.protobuf.Empty\032\032.google"
".protobuf.BoolValue\022F\n\020SetIsAutostartOn\022"
"\032.google.protobuf.BoolValue\032\026.google.pro"
"tobuf.Empty\022C\n\rIsAutostartOn\022\026.google.pr"
"otobuf.Empty\032\032.google.protobuf.BoolValue"
"\022F\n\020SetIsBetaEnabled\022\032.google.protobuf.B"
"oolValue\032\026.google.protobuf.Empty\022C\n\rIsBe"
"taEnabled\022\026.google.protobuf.Empty\032\032.goog"
"le.protobuf.BoolValue\022I\n\023SetIsAllMailVis"
"ible\022\032.google.protobuf.BoolValue\032\026.googl"
"e.protobuf.Empty\022F\n\020IsAllMailVisible\022\026.g"
"oogle.protobuf.Empty\032\032.google.protobuf.B"
"oolValue\022<\n\004GoOs\022\026.google.protobuf.Empty"
"\032\034.google.protobuf.StringValue\022>\n\014Trigge"
"rReset\022\026.google.protobuf.Empty\032\026.google."
"protobuf.Empty\022\?\n\007Version\022\026.google.proto"
"buf.Empty\032\034.google.protobuf.StringValue\022"
"@\n\010LogsPath\022\026.google.protobuf.Empty\032\034.go"
"ogle.protobuf.StringValue\022C\n\013LicensePath"
".UserBadEventH\000\022<\n\025usedBytesChangedEvent"
"\030\005 \001(\0132\033.grpc.UsedBytesChangedEventH\000B\007\n"
"\005event\".\n\034ToggleSplitModeFinishedEvent\022\016"
"\n\006userID\030\001 \001(\t\")\n\025UserDisconnectedEvent\022"
"\020\n\010username\030\001 \001(\t\"\"\n\020UserChangedEvent\022\016\n"
"\006userID\030\001 \001(\t\"4\n\014UserBadEvent\022\016\n\006userID\030"
"\001 \001(\t\022\024\n\014errorMessage\030\002 \001(\t\":\n\025UsedBytes"
"ChangedEvent\022\016\n\006userID\030\001 \001(\t\022\021\n\tusedByte"
"s\030\002 \001(\003\"2\n\021GenericErrorEvent\022\035\n\004code\030\001 \001"
"(\0162\017.grpc.ErrorCode*q\n\010LogLevel\022\r\n\tLOG_P"
"ANIC\020\000\022\r\n\tLOG_FATAL\020\001\022\r\n\tLOG_ERROR\020\002\022\014\n\010"
"LOG_WARN\020\003\022\014\n\010LOG_INFO\020\004\022\r\n\tLOG_DEBUG\020\005\022"
"\r\n\tLOG_TRACE\020\006*6\n\tUserState\022\016\n\nSIGNED_OU"
"T\020\000\022\n\n\006LOCKED\020\001\022\r\n\tCONNECTED\020\002*\242\001\n\016Login"
"ErrorType\022\033\n\027USERNAME_PASSWORD_ERROR\020\000\022\r"
"\n\tFREE_USER\020\001\022\024\n\020CONNECTION_ERROR\020\002\022\r\n\tT"
"FA_ERROR\020\003\022\r\n\tTFA_ABORT\020\004\022\027\n\023TWO_PASSWOR"
"DS_ERROR\020\005\022\027\n\023TWO_PASSWORDS_ABORT\020\006*[\n\017U"
"pdateErrorType\022\027\n\023UPDATE_MANUAL_ERROR\020\000\022"
"\026\n\022UPDATE_FORCE_ERROR\020\001\022\027\n\023UPDATE_SILENT"
"_ERROR\020\002*k\n\022DiskCacheErrorType\022 \n\034DISK_C"
"ACHE_UNAVAILABLE_ERROR\020\000\022\036\n\032CANT_MOVE_DI"
"SK_CACHE_ERROR\020\001\022\023\n\017DISK_FULL_ERROR\020\002*\335\001"
"\n\033MailServerSettingsErrorType\022\033\n\027IMAP_PO"
"RT_STARTUP_ERROR\020\000\022\033\n\027SMTP_PORT_STARTUP_"
"ERROR\020\001\022\032\n\026IMAP_PORT_CHANGE_ERROR\020\002\022\032\n\026S"
"MTP_PORT_CHANGE_ERROR\020\003\022%\n!IMAP_CONNECTI"
"ON_MODE_CHANGE_ERROR\020\004\022%\n!SMTP_CONNECTIO"
"N_MODE_CHANGE_ERROR\020\005*S\n\tErrorCode\022\021\n\rUN"
"KNOWN_ERROR\020\000\022\031\n\025TLS_CERT_EXPORT_ERROR\020\001"
"\022\030\n\024TLS_KEY_EXPORT_ERROR\020\0022\231\035\n\006Bridge\022I\n"
"\013CheckTokens\022\034.google.protobuf.StringVal"
"ue\032\034.google.protobuf.StringValue\022\?\n\013AddL"
"ogEntry\022\030.grpc.AddLogEntryRequest\032\026.goog"
"le.protobuf.Empty\022:\n\010GuiReady\022\026.google.p"
"rotobuf.Empty\032\026.grpc.GuiReadyResponse\0226\n"
"\004Quit\022\026.google.protobuf.Empty\032\026.google.p"
"rotobuf.Empty\0229\n\007Restart\022\026.google.protob"
"uf.Empty\032\026.google.protobuf.Empty\022C\n\rShow"
"OnStartup\022\026.google.protobuf.Empty\032\032.goog"
"le.protobuf.BoolValue\022F\n\020SetIsAutostartO"
"n\022\032.google.protobuf.BoolValue\032\026.google.p"
"rotobuf.Empty\022C\n\rIsAutostartOn\022\026.google."
"protobuf.Empty\032\032.google.protobuf.BoolVal"
"ue\022F\n\020SetIsBetaEnabled\022\032.google.protobuf"
".BoolValue\032\026.google.protobuf.Empty\022C\n\rIs"
"BetaEnabled\022\026.google.protobuf.Empty\032\032.go"
"ogle.protobuf.BoolValue\022I\n\023SetIsAllMailV"
"isible\022\032.google.protobuf.BoolValue\032\026.goo"
"gle.protobuf.Empty\022F\n\020IsAllMailVisible\022\026"
".google.protobuf.Empty\032\032.google.protobuf"
".BoolValue\022<\n\004GoOs\022\026.google.protobuf.Emp"
"ty\032\034.google.protobuf.StringValue\022>\n\014Trig"
"gerReset\022\026.google.protobuf.Empty\032\026.googl"
"e.protobuf.Empty\022\?\n\007Version\022\026.google.pro"
"tobuf.Empty\032\034.google.protobuf.StringValu"
"e\022@\n\010LogsPath\022\026.google.protobuf.Empty\032\034."
"google.protobuf.StringValue\022C\n\013LicensePa"
"th\022\026.google.protobuf.Empty\032\034.google.prot"
"obuf.StringValue\022L\n\024ReleaseNotesPageLink"
"\022\026.google.protobuf.Empty\032\034.google.protob"
"uf.StringValue\022L\n\024ReleaseNotesPageLink\022\026"
".google.protobuf.Empty\032\034.google.protobuf"
".StringValue\022N\n\026DependencyLicensesLink\022\026"
".google.protobuf.Empty\032\034.google.protobuf"
".StringValue\022G\n\017LandingPageLink\022\026.google"
".protobuf.Empty\032\034.google.protobuf.String"
"Value\022J\n\022SetColorSchemeName\022\034.google.pro"
"tobuf.StringValue\032\026.google.protobuf.Empt"
"y\022G\n\017ColorSchemeName\022\026.google.protobuf.E"
"mpty\032\034.google.protobuf.StringValue\022J\n\022Cu"
"rrentEmailClient\022\026.google.protobuf.Empty"
"\032\034.google.protobuf.StringValue\022;\n\tReport"
"Bug\022\026.grpc.ReportBugRequest\032\026.google.pro"
"tobuf.Empty\022M\n\025ExportTLSCertificates\022\034.g"
"oogle.protobuf.StringValue\032\026.google.prot"
"obuf.Empty\022E\n\rForceLauncher\022\034.google.pro"
"tobuf.StringValue\032\026.google.protobuf.Empt"
"y\022I\n\021SetMainExecutable\022\034.google.protobuf"
".StringValue\032\026.google.protobuf.Empty\0223\n\005"
"Login\022\022.grpc.LoginRequest\032\026.google.proto"
"buf.Empty\0226\n\010Login2FA\022\022.grpc.LoginReques"
"t\032\026.google.protobuf.Empty\022=\n\017Login2Passw"
"ords\022\022.grpc.LoginRequest\032\026.google.protob"
"uf.Empty\022=\n\nLoginAbort\022\027.grpc.LoginAbort"
"Request\032\026.google.protobuf.Empty\022=\n\013Check"
"Update\022\026.google.protobuf.Empty\032\026.google."
"protobuf.Empty\022\?\n\rInstallUpdate\022\026.google"
".protobuf.Empty\032\026.google.protobuf.Empty\022"
"L\n\026SetIsAutomaticUpdateOn\022\032.google.proto"
"buf.BoolValue\032\026.google.protobuf.Empty\022I\n"
"\023IsAutomaticUpdateOn\022\026.google.protobuf.E"
"mpty\032\032.google.protobuf.BoolValue\022E\n\rDisk"
"CachePath\022\026.google.protobuf.Empty\032\034.goog"
"le.protobuf.StringValue\022H\n\020SetDiskCacheP"
"ath\022\034.google.protobuf.StringValue\032\026.goog"
"le.protobuf.Empty\022E\n\017SetIsDoHEnabled\022\032.g"
"oogle.protobuf.BoolValue\032\026.google.protob"
"uf.Empty\022B\n\014IsDoHEnabled\022\026.google.protob"
"uf.Empty\032\032.google.protobuf.BoolValue\022D\n\022"
"MailServerSettings\022\026.google.protobuf.Emp"
"ty\032\026.grpc.ImapSmtpSettings\022G\n\025SetMailSer"
"verSettings\022\026.grpc.ImapSmtpSettings\032\026.go"
"ogle.protobuf.Empty\022@\n\010Hostname\022\026.google"
".protobuf.Empty\032\034.google.protobuf.String"
"Value\022E\n\nIsPortFree\022\033.google.protobuf.In"
"t32Value\032\032.google.protobuf.BoolValue\022N\n\022"
"AvailableKeychains\022\026.google.protobuf.Emp"
"ty\032 .grpc.AvailableKeychainsResponse\022J\n\022"
"SetCurrentKeychain\022\034.google.protobuf.Str"
"ingValue\032\026.google.protobuf.Empty\022G\n\017Curr"
"entKeychain\022\026.google.protobuf.Empty\032\034.go"
"ogle.protobuf.StringValue\022=\n\013GetUserList"
"\022\026.google.protobuf.Empty\032\026.grpc.UserList"
"Response\0223\n\007GetUser\022\034.google.protobuf.St"
"ringValue\032\n.grpc.User\022F\n\020SetUserSplitMod"
"e\022\032.grpc.UserSplitModeRequest\032\026.google.p"
"rotobuf.Empty\022B\n\nLogoutUser\022\034.google.pro"
"tobuf.StringValue\032\026.google.protobuf.Empt"
"y\022B\n\nRemoveUser\022\034.google.protobuf.String"
"Value\032\026.google.protobuf.Empty\022Q\n\026Configu"
"reUserAppleMail\022\037.grpc.ConfigureAppleMai"
"lRequest\032\026.google.protobuf.Empty\022\?\n\016RunE"
"ventStream\022\030.grpc.EventStreamRequest\032\021.g"
"rpc.StreamEvent0\001\022A\n\017StopEventStream\022\026.g"
"oogle.protobuf.Empty\032\026.google.protobuf.E"
"mptyB6Z4github.com/ProtonMail/proton-bri"
"dge/v3/internal/grpcb\006proto3"
"uf.StringValue\022N\n\026DependencyLicensesLink"
"\022\026.google.protobuf.Empty\032\034.google.protob"
"uf.StringValue\022G\n\017LandingPageLink\022\026.goog"
"le.protobuf.Empty\032\034.google.protobuf.Stri"
"ngValue\022J\n\022SetColorSchemeName\022\034.google.p"
"rotobuf.StringValue\032\026.google.protobuf.Em"
"pty\022G\n\017ColorSchemeName\022\026.google.protobuf"
".Empty\032\034.google.protobuf.StringValue\022J\n\022"
"CurrentEmailClient\022\026.google.protobuf.Emp"
"ty\032\034.google.protobuf.StringValue\022;\n\tRepo"
"rtBug\022\026.grpc.ReportBugRequest\032\026.google.p"
"rotobuf.Empty\022M\n\025ExportTLSCertificates\022\034"
".google.protobuf.StringValue\032\026.google.pr"
"otobuf.Empty\022E\n\rForceLauncher\022\034.google.p"
"rotobuf.StringValue\032\026.google.protobuf.Em"
"pty\022I\n\021SetMainExecutable\022\034.google.protob"
"uf.StringValue\032\026.google.protobuf.Empty\0223"
"\n\005Login\022\022.grpc.LoginRequest\032\026.google.pro"
"tobuf.Empty\0226\n\010Login2FA\022\022.grpc.LoginRequ"
"est\032\026.google.protobuf.Empty\022=\n\017Login2Pas"
"swords\022\022.grpc.LoginRequest\032\026.google.prot"
"obuf.Empty\022=\n\nLoginAbort\022\027.grpc.LoginAbo"
"rtRequest\032\026.google.protobuf.Empty\022=\n\013Che"
"ckUpdate\022\026.google.protobuf.Empty\032\026.googl"
"e.protobuf.Empty\022\?\n\rInstallUpdate\022\026.goog"
"le.protobuf.Empty\032\026.google.protobuf.Empt"
"y\022L\n\026SetIsAutomaticUpdateOn\022\032.google.pro"
"tobuf.BoolValue\032\026.google.protobuf.Empty\022"
"I\n\023IsAutomaticUpdateOn\022\026.google.protobuf"
".Empty\032\032.google.protobuf.BoolValue\022E\n\rDi"
"skCachePath\022\026.google.protobuf.Empty\032\034.go"
"ogle.protobuf.StringValue\022H\n\020SetDiskCach"
"ePath\022\034.google.protobuf.StringValue\032\026.go"
"ogle.protobuf.Empty\022E\n\017SetIsDoHEnabled\022\032"
".google.protobuf.BoolValue\032\026.google.prot"
"obuf.Empty\022B\n\014IsDoHEnabled\022\026.google.prot"
"obuf.Empty\032\032.google.protobuf.BoolValue\022D"
"\n\022MailServerSettings\022\026.google.protobuf.E"
"mpty\032\026.grpc.ImapSmtpSettings\022G\n\025SetMailS"
"erverSettings\022\026.grpc.ImapSmtpSettings\032\026."
"google.protobuf.Empty\022@\n\010Hostname\022\026.goog"
"le.protobuf.Empty\032\034.google.protobuf.Stri"
"ngValue\022E\n\nIsPortFree\022\033.google.protobuf."
"Int32Value\032\032.google.protobuf.BoolValue\022N"
"\n\022AvailableKeychains\022\026.google.protobuf.E"
"mpty\032 .grpc.AvailableKeychainsResponse\022J"
"\n\022SetCurrentKeychain\022\034.google.protobuf.S"
"tringValue\032\026.google.protobuf.Empty\022G\n\017Cu"
"rrentKeychain\022\026.google.protobuf.Empty\032\034."
"google.protobuf.StringValue\022=\n\013GetUserLi"
"st\022\026.google.protobuf.Empty\032\026.grpc.UserLi"
"stResponse\0223\n\007GetUser\022\034.google.protobuf."
"StringValue\032\n.grpc.User\022F\n\020SetUserSplitM"
"ode\022\032.grpc.UserSplitModeRequest\032\026.google"
".protobuf.Empty\022B\n\nLogoutUser\022\034.google.p"
"rotobuf.StringValue\032\026.google.protobuf.Em"
"pty\022B\n\nRemoveUser\022\034.google.protobuf.Stri"
"ngValue\032\026.google.protobuf.Empty\022Q\n\026Confi"
"gureUserAppleMail\022\037.grpc.ConfigureAppleM"
"ailRequest\032\026.google.protobuf.Empty\022\?\n\016Ru"
"nEventStream\022\030.grpc.EventStreamRequest\032\021"
".grpc.StreamEvent0\001\022A\n\017StopEventStream\022\026"
".google.protobuf.Empty\032\026.google.protobuf"
".EmptyB6Z4github.com/ProtonMail/proton-b"
"ridge/v3/internal/grpcb\006proto3"
;
static const ::_pbi::DescriptorTable* const descriptor_table_bridge_2eproto_deps[2] = {
&::descriptor_table_google_2fprotobuf_2fempty_2eproto,
@ -1613,9 +1641,9 @@ static const ::_pbi::DescriptorTable* const descriptor_table_bridge_2eproto_deps
};
static ::_pbi::once_flag descriptor_table_bridge_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_bridge_2eproto = {
false, false, 9828, descriptor_table_protodef_bridge_2eproto,
false, false, 9950, descriptor_table_protodef_bridge_2eproto,
"bridge.proto",
&descriptor_table_bridge_2eproto_once, descriptor_table_bridge_2eproto_deps, 2, 58,
&descriptor_table_bridge_2eproto_once, descriptor_table_bridge_2eproto_deps, 2, 59,
schemas, file_default_instances, TableStruct_bridge_2eproto::offsets,
file_level_metadata_bridge_2eproto, file_level_enum_descriptors_bridge_2eproto,
file_level_service_descriptors_bridge_2eproto,
@ -12378,6 +12406,7 @@ class UserEvent::_Internal {
static const ::grpc::UserDisconnectedEvent& userdisconnected(const UserEvent* msg);
static const ::grpc::UserChangedEvent& userchanged(const UserEvent* msg);
static const ::grpc::UserBadEvent& userbadevent(const UserEvent* msg);
static const ::grpc::UsedBytesChangedEvent& usedbyteschangedevent(const UserEvent* msg);
};
const ::grpc::ToggleSplitModeFinishedEvent&
@ -12396,6 +12425,10 @@ const ::grpc::UserBadEvent&
UserEvent::_Internal::userbadevent(const UserEvent* msg) {
return *msg->_impl_.event_.userbadevent_;
}
const ::grpc::UsedBytesChangedEvent&
UserEvent::_Internal::usedbyteschangedevent(const UserEvent* msg) {
return *msg->_impl_.event_.usedbyteschangedevent_;
}
void UserEvent::set_allocated_togglesplitmodefinished(::grpc::ToggleSplitModeFinishedEvent* togglesplitmodefinished) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_event();
@ -12456,6 +12489,21 @@ void UserEvent::set_allocated_userbadevent(::grpc::UserBadEvent* userbadevent) {
}
// @@protoc_insertion_point(field_set_allocated:grpc.UserEvent.userBadEvent)
}
void UserEvent::set_allocated_usedbyteschangedevent(::grpc::UsedBytesChangedEvent* usedbyteschangedevent) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_event();
if (usedbyteschangedevent) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(usedbyteschangedevent);
if (message_arena != submessage_arena) {
usedbyteschangedevent = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, usedbyteschangedevent, submessage_arena);
}
set_has_usedbyteschangedevent();
_impl_.event_.usedbyteschangedevent_ = usedbyteschangedevent;
}
// @@protoc_insertion_point(field_set_allocated:grpc.UserEvent.usedBytesChangedEvent)
}
UserEvent::UserEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
@ -12493,6 +12541,11 @@ UserEvent::UserEvent(const UserEvent& from)
from._internal_userbadevent());
break;
}
case kUsedBytesChangedEvent: {
_this->_internal_mutable_usedbyteschangedevent()->::grpc::UsedBytesChangedEvent::MergeFrom(
from._internal_usedbyteschangedevent());
break;
}
case EVENT_NOT_SET: {
break;
}
@ -12559,6 +12612,12 @@ void UserEvent::clear_event() {
}
break;
}
case kUsedBytesChangedEvent: {
if (GetArenaForAllocation() == nullptr) {
delete _impl_.event_.usedbyteschangedevent_;
}
break;
}
case EVENT_NOT_SET: {
break;
}
@ -12615,6 +12674,14 @@ const char* UserEvent::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx
} else
goto handle_unusual;
continue;
// .grpc.UsedBytesChangedEvent usedBytesChangedEvent = 5;
case 5:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
ptr = ctx->ParseMessage(_internal_mutable_usedbyteschangedevent(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
default:
goto handle_unusual;
} // switch
@ -12672,6 +12739,13 @@ uint8_t* UserEvent::_InternalSerialize(
_Internal::userbadevent(this).GetCachedSize(), target, stream);
}
// .grpc.UsedBytesChangedEvent usedBytesChangedEvent = 5;
if (_internal_has_usedbyteschangedevent()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(5, _Internal::usedbyteschangedevent(this),
_Internal::usedbyteschangedevent(this).GetCachedSize(), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
@ -12717,6 +12791,13 @@ size_t UserEvent::ByteSizeLong() const {
*_impl_.event_.userbadevent_);
break;
}
// .grpc.UsedBytesChangedEvent usedBytesChangedEvent = 5;
case kUsedBytesChangedEvent: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.event_.usedbyteschangedevent_);
break;
}
case EVENT_NOT_SET: {
break;
}
@ -12760,6 +12841,11 @@ void UserEvent::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROT
from._internal_userbadevent());
break;
}
case kUsedBytesChangedEvent: {
_this->_internal_mutable_usedbyteschangedevent()->::grpc::UsedBytesChangedEvent::MergeFrom(
from._internal_usedbyteschangedevent());
break;
}
case EVENT_NOT_SET: {
break;
}
@ -13655,6 +13741,236 @@ void UserBadEvent::InternalSwap(UserBadEvent* other) {
// ===================================================================
class UsedBytesChangedEvent::_Internal {
public:
};
UsedBytesChangedEvent::UsedBytesChangedEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:grpc.UsedBytesChangedEvent)
}
UsedBytesChangedEvent::UsedBytesChangedEvent(const UsedBytesChangedEvent& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
UsedBytesChangedEvent* const _this = this; (void)_this;
new (&_impl_) Impl_{
decltype(_impl_.userid_){}
, decltype(_impl_.usedbytes_){}
, /*decltype(_impl_._cached_size_)*/{}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
_impl_.userid_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.userid_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_userid().empty()) {
_this->_impl_.userid_.Set(from._internal_userid(),
_this->GetArenaForAllocation());
}
_this->_impl_.usedbytes_ = from._impl_.usedbytes_;
// @@protoc_insertion_point(copy_constructor:grpc.UsedBytesChangedEvent)
}
inline void UsedBytesChangedEvent::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_.userid_){}
, decltype(_impl_.usedbytes_){int64_t{0}}
, /*decltype(_impl_._cached_size_)*/{}
};
_impl_.userid_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.userid_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
UsedBytesChangedEvent::~UsedBytesChangedEvent() {
// @@protoc_insertion_point(destructor:grpc.UsedBytesChangedEvent)
if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
(void)arena;
return;
}
SharedDtor();
}
inline void UsedBytesChangedEvent::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
_impl_.userid_.Destroy();
}
void UsedBytesChangedEvent::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
void UsedBytesChangedEvent::Clear() {
// @@protoc_insertion_point(message_clear_start:grpc.UsedBytesChangedEvent)
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_impl_.userid_.ClearToEmpty();
_impl_.usedbytes_ = int64_t{0};
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
const char* UsedBytesChangedEvent::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string userID = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_userid();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
CHK_(::_pbi::VerifyUTF8(str, "grpc.UsedBytesChangedEvent.userID"));
} else
goto handle_unusual;
continue;
// int64 usedBytes = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
_impl_.usedbytes_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
default:
goto handle_unusual;
} // switch
handle_unusual:
if ((tag == 0) || ((tag & 7) == 4)) {
CHK_(ptr);
ctx->SetLastTag(tag);
goto message_done;
}
ptr = UnknownFieldParse(
tag,
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
ptr, ctx);
CHK_(ptr != nullptr);
} // while
message_done:
return ptr;
failure:
ptr = nullptr;
goto message_done;
#undef CHK_
}
uint8_t* UsedBytesChangedEvent::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:grpc.UsedBytesChangedEvent)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string userID = 1;
if (!this->_internal_userid().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_userid().data(), static_cast<int>(this->_internal_userid().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"grpc.UsedBytesChangedEvent.userID");
target = stream->WriteStringMaybeAliased(
1, this->_internal_userid(), target);
}
// int64 usedBytes = 2;
if (this->_internal_usedbytes() != 0) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteInt64ToArray(2, this->_internal_usedbytes(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:grpc.UsedBytesChangedEvent)
return target;
}
size_t UsedBytesChangedEvent::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:grpc.UsedBytesChangedEvent)
size_t total_size = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// string userID = 1;
if (!this->_internal_userid().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_userid());
}
// int64 usedBytes = 2;
if (this->_internal_usedbytes() != 0) {
total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_usedbytes());
}
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UsedBytesChangedEvent::_class_data_ = {
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
UsedBytesChangedEvent::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*UsedBytesChangedEvent::GetClassData() const { return &_class_data_; }
void UsedBytesChangedEvent::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
auto* const _this = static_cast<UsedBytesChangedEvent*>(&to_msg);
auto& from = static_cast<const UsedBytesChangedEvent&>(from_msg);
// @@protoc_insertion_point(class_specific_merge_from_start:grpc.UsedBytesChangedEvent)
GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_userid().empty()) {
_this->_internal_set_userid(from._internal_userid());
}
if (from._internal_usedbytes() != 0) {
_this->_internal_set_usedbytes(from._internal_usedbytes());
}
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void UsedBytesChangedEvent::CopyFrom(const UsedBytesChangedEvent& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:grpc.UsedBytesChangedEvent)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool UsedBytesChangedEvent::IsInitialized() const {
return true;
}
void UsedBytesChangedEvent::InternalSwap(UsedBytesChangedEvent* other) {
using std::swap;
auto* lhs_arena = GetArenaForAllocation();
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&_impl_.userid_, lhs_arena,
&other->_impl_.userid_, rhs_arena
);
swap(_impl_.usedbytes_, other->_impl_.usedbytes_);
}
::PROTOBUF_NAMESPACE_ID::Metadata UsedBytesChangedEvent::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_bridge_2eproto_getter, &descriptor_table_bridge_2eproto_once,
file_level_metadata_bridge_2eproto[57]);
}
// ===================================================================
class GenericErrorEvent::_Internal {
public:
};
@ -13831,7 +14147,7 @@ void GenericErrorEvent::InternalSwap(GenericErrorEvent* other) {
::PROTOBUF_NAMESPACE_ID::Metadata GenericErrorEvent::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_bridge_2eproto_getter, &descriptor_table_bridge_2eproto_once,
file_level_metadata_bridge_2eproto[57]);
file_level_metadata_bridge_2eproto[58]);
}
// @@protoc_insertion_point(namespace_scope)
@ -14065,6 +14381,10 @@ template<> PROTOBUF_NOINLINE ::grpc::UserBadEvent*
Arena::CreateMaybeMessage< ::grpc::UserBadEvent >(Arena* arena) {
return Arena::CreateMessageInternal< ::grpc::UserBadEvent >(arena);
}
template<> PROTOBUF_NOINLINE ::grpc::UsedBytesChangedEvent*
Arena::CreateMaybeMessage< ::grpc::UsedBytesChangedEvent >(Arena* arena) {
return Arena::CreateMessageInternal< ::grpc::UsedBytesChangedEvent >(arena);
}
template<> PROTOBUF_NOINLINE ::grpc::GenericErrorEvent*
Arena::CreateMaybeMessage< ::grpc::GenericErrorEvent >(Arena* arena) {
return Arena::CreateMessageInternal< ::grpc::GenericErrorEvent >(arena);

View File

@ -202,6 +202,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_;
@ -276,6 +279,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 +9081,7 @@ class UserEvent final :
kUserDisconnected = 2,
kUserChanged = 3,
kUserBadEvent = 4,
kUsedBytesChangedEvent = 5,
EVENT_NOT_SET = 0,
};
@ -9162,6 +9167,7 @@ class UserEvent final :
kUserDisconnectedFieldNumber = 2,
kUserChangedFieldNumber = 3,
kUserBadEventFieldNumber = 4,
kUsedBytesChangedEventFieldNumber = 5,
};
// .grpc.ToggleSplitModeFinishedEvent toggleSplitModeFinished = 1;
bool has_togglesplitmodefinished() const;
@ -9235,6 +9241,24 @@ 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();
void clear_event();
EventCase event_case() const;
// @@protoc_insertion_point(class_scope:grpc.UserEvent)
@ -9244,6 +9268,7 @@ class UserEvent final :
void set_has_userdisconnected();
void set_has_userchanged();
void set_has_userbadevent();
void set_has_usedbyteschangedevent();
inline bool has_event() const;
inline void clear_has_event();
@ -9259,6 +9284,7 @@ class UserEvent final :
::grpc::UserDisconnectedEvent* userdisconnected_;
::grpc::UserChangedEvent* userchanged_;
::grpc::UserBadEvent* userbadevent_;
::grpc::UsedBytesChangedEvent* usedbyteschangedevent_;
} event_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
uint32_t _oneof_case_[1];
@ -9897,6 +9923,170 @@ 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 GenericErrorEvent final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:grpc.GenericErrorEvent) */ {
public:
@ -9945,7 +10135,7 @@ class GenericErrorEvent final :
&_GenericErrorEvent_default_instance_);
}
static constexpr int kIndexInFileMessages =
57;
58;
friend void swap(GenericErrorEvent& a, GenericErrorEvent& b) {
a.Swap(&b);
@ -15728,6 +15918,80 @@ 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;
}
inline bool UserEvent::has_event() const {
return event_case() != EVENT_NOT_SET;
}
@ -16005,6 +16269,80 @@ 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)
}
// -------------------------------------------------------------------
// GenericErrorEvent
// .grpc.ErrorCode code = 1;
@ -16144,6 +16482,8 @@ inline void GenericErrorEvent::set_code(::grpc::ErrorCode value) {
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// @@protoc_insertion_point(namespace_scope)

File diff suppressed because it is too large Load Diff

View File

@ -448,6 +448,7 @@ message UserEvent {
UserDisconnectedEvent userDisconnected = 2;
UserChangedEvent userChanged = 3;
UserBadEvent userBadEvent = 4;
UsedBytesChangedEvent usedBytesChangedEvent= 5;
}
}
@ -468,6 +469,11 @@ message UserBadEvent {
string errorMessage = 2;
}
message UsedBytesChangedEvent {
string userID = 1;
int64 usedBytes = 2;
}
//**********************************************************
// Generic errors
//**********************************************************

View File

@ -177,6 +177,10 @@ func NewUserBadEvent(userID string, errorMessage string) *StreamEvent {
return userEvent(&UserEvent{Event: &UserEvent_UserBadEvent{UserBadEvent: &UserBadEvent{UserID: userID, ErrorMessage: errorMessage}}})
}
func NewUsedBytesChangedEvent(userID string, usedBytes int) *StreamEvent {
return userEvent(&UserEvent{Event: &UserEvent_UsedBytesChangedEvent{UsedBytesChangedEvent: &UsedBytesChangedEvent{UserID: userID, UsedBytes: int64(usedBytes)}}})
}
func NewGenericErrorEvent(errorCode ErrorCode) *StreamEvent {
return genericErrorEvent(&GenericErrorEvent{Code: errorCode})
}

View File

@ -305,6 +305,9 @@ func (s *Service) watchEvents() {
case events.AddressModeChanged:
_ = s.SendEvent(NewUserChangedEvent(event.UserID))
case events.UsedSpaceChanged:
_ = s.SendEvent(NewUsedBytesChangedEvent(event.UserID, event.UsedSpace))
case events.UserDeauth:
// This is the event the GUI cares about.
_ = s.SendEvent(NewUserChangedEvent(event.UserID))

View File

@ -174,6 +174,7 @@ func (s *Service) StartEventTest() error { //nolint:funlen
NewUserToggleSplitModeFinishedEvent("userID"),
NewUserDisconnectedEvent("username"),
NewUserChangedEvent("userID"),
NewUsedBytesChangedEvent("userID", 1000),
}
for _, event := range events {

View File

@ -66,6 +66,10 @@ func (user *User) handleAPIEvent(ctx context.Context, event proton.Event) error
}
}
if event.UsedSpace != nil {
user.handleUsedSpaceChange(*event.UsedSpace)
}
return nil
}
@ -655,6 +659,20 @@ func (user *User) handleUpdateDraftEvent(ctx context.Context, event proton.Messa
}, user.apiUserLock, user.apiAddrsLock, user.apiLabelsLock, user.updateChLock)
}
func (user *User) handleUsedSpaceChange(usedSpace int) {
safe.Lock(func() {
if user.apiUser.UsedSpace == usedSpace {
return
}
user.apiUser.UsedSpace = usedSpace
user.eventCh.Enqueue(events.UsedSpaceChanged{
UserID: user.apiUser.ID,
UsedSpace: usedSpace,
})
}, user.apiUserLock)
}
func getMailboxName(label proton.Label) []string {
var name []string