Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
d30446a8
Verified
Commit
d30446a8
authored
3 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Don't spam key requests directly after startup
parent
eb6baf61
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/timeline/EventStore.cpp
+15
-0
15 additions, 0 deletions
src/timeline/EventStore.cpp
src/timeline/EventStore.h
+2
-0
2 additions, 0 deletions
src/timeline/EventStore.h
src/timeline/TimelineModel.cpp
+6
-0
6 additions, 0 deletions
src/timeline/TimelineModel.cpp
with
23 additions
and
0 deletions
src/timeline/EventStore.cpp
+
15
−
0
View file @
d30446a8
...
@@ -675,6 +675,9 @@ EventStore::decryptEvent(const IdIndex &idx,
...
@@ -675,6 +675,9 @@ EventStore::decryptEvent(const IdIndex &idx,
index
.
room_id
,
index
.
room_id
,
index
.
session_id
,
index
.
session_id
,
e
.
sender
);
e
.
sender
);
// we may not want to request keys during initial sync and such
if
(
suppressKeyRequests
)
break
;
// TODO: Check if this actually works and look in key backup
// TODO: Check if this actually works and look in key backup
auto
copy
=
e
;
auto
copy
=
e
;
copy
.
room_id
=
room_id_
;
copy
.
room_id
=
room_id_
;
...
@@ -816,6 +819,18 @@ EventStore::decryptEvent(const IdIndex &idx,
...
@@ -816,6 +819,18 @@ EventStore::decryptEvent(const IdIndex &idx,
return
asCacheEntry
(
std
::
move
(
decryptionResult
.
event
.
value
()));
return
asCacheEntry
(
std
::
move
(
decryptionResult
.
event
.
value
()));
}
}
void
EventStore
::
enableKeyRequests
(
bool
suppressKeyRequests_
)
{
if
(
!
suppressKeyRequests_
)
{
for
(
const
auto
&
key
:
decryptedEvents_
.
keys
())
if
(
key
.
room
==
this
->
room_id_
)
decryptedEvents_
.
remove
(
key
);
suppressKeyRequests
=
false
;
}
else
suppressKeyRequests
=
true
;
}
mtx
::
events
::
collections
::
TimelineEvents
*
mtx
::
events
::
collections
::
TimelineEvents
*
EventStore
::
get
(
std
::
string
id
,
std
::
string_view
related_to
,
bool
decrypt
,
bool
resolve_edits
)
EventStore
::
get
(
std
::
string
id
,
std
::
string_view
related_to
,
bool
decrypt
,
bool
resolve_edits
)
{
{
...
...
This diff is collapsed.
Click to expand it.
src/timeline/EventStore.h
+
2
−
0
View file @
d30446a8
...
@@ -115,6 +115,7 @@ public slots:
...
@@ -115,6 +115,7 @@ public slots:
void
addPending
(
mtx
::
events
::
collections
::
TimelineEvents
event
);
void
addPending
(
mtx
::
events
::
collections
::
TimelineEvents
event
);
void
receivedSessionKey
(
const
std
::
string
&
session_id
);
void
receivedSessionKey
(
const
std
::
string
&
session_id
);
void
clearTimeline
();
void
clearTimeline
();
void
enableKeyRequests
(
bool
suppressKeyRequests_
);
private
:
private
:
std
::
vector
<
mtx
::
events
::
collections
::
TimelineEvents
>
edits
(
const
std
::
string
&
event_id
);
std
::
vector
<
mtx
::
events
::
collections
::
TimelineEvents
>
edits
(
const
std
::
string
&
event_id
);
...
@@ -142,4 +143,5 @@ private:
...
@@ -142,4 +143,5 @@ private:
std
::
string
current_txn
;
std
::
string
current_txn
;
int
current_txn_error_count
=
0
;
int
current_txn_error_count
=
0
;
bool
noMoreMessages
=
false
;
bool
noMoreMessages
=
false
;
bool
suppressKeyRequests
=
true
;
};
};
This diff is collapsed.
Click to expand it.
src/timeline/TimelineModel.cpp
+
6
−
0
View file @
d30446a8
...
@@ -379,6 +379,7 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
...
@@ -379,6 +379,7 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
connect
(
&
events
,
&
EventStore
::
updateFlowEventId
,
this
,
[
this
](
std
::
string
event_id
)
{
connect
(
&
events
,
&
EventStore
::
updateFlowEventId
,
this
,
[
this
](
std
::
string
event_id
)
{
this
->
updateFlowEventId
(
event_id
);
this
->
updateFlowEventId
(
event_id
);
});
});
// When a message is sent, check if the current edit/reply relates to that message,
// When a message is sent, check if the current edit/reply relates to that message,
// and update the event_id so that it points to the sent message and not the pending one.
// and update the event_id so that it points to the sent message and not the pending one.
connect
(
&
events
,
connect
(
&
events
,
...
@@ -395,6 +396,11 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
...
@@ -395,6 +396,11 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
}
}
});
});
connect
(
manager_
,
&
TimelineViewManager
::
initialSyncChanged
,
&
events
,
&
EventStore
::
enableKeyRequests
);
showEventTimer
.
callOnTimeout
(
this
,
&
TimelineModel
::
scrollTimerEvent
);
showEventTimer
.
callOnTimeout
(
this
,
&
TimelineModel
::
scrollTimerEvent
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment