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
c91f91d5
Verified
Commit
c91f91d5
authored
2 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Add /knock command
parent
cb76777f
Branches
pushrules
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#2915
passed
2 years ago
Stage: build
Stage: deploy
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
man/nheko.1.adoc
+3
-0
3 additions, 0 deletions
man/nheko.1.adoc
src/ChatPage.cpp
+19
-2
19 additions, 2 deletions
src/ChatPage.cpp
src/ChatPage.h
+1
-0
1 addition, 0 deletions
src/ChatPage.h
src/timeline/InputBar.cpp
+2
-0
2 additions, 0 deletions
src/timeline/InputBar.cpp
with
25 additions
and
2 deletions
man/nheko.1.adoc
+
3
−
0
View file @
c91f91d5
...
@@ -157,6 +157,9 @@ Send a message as a rainbow-colored notice.
...
@@ -157,6 +157,9 @@ Send a message as a rainbow-colored notice.
*/join* _<roomname>_::
*/join* _<roomname>_::
Join a room.
Join a room.
*/knock* _<roomname>_::
Ask to join a room.
*/part*, */leave*::
*/part*, */leave*::
Leave the current room.
Leave the current room.
...
...
This diff is collapsed.
Click to expand it.
src/ChatPage.cpp
+
19
−
2
View file @
c91f91d5
...
@@ -658,6 +658,25 @@ ChatPage::trySync()
...
@@ -658,6 +658,25 @@ ChatPage::trySync()
});
});
}
}
void
ChatPage
::
knockRoom
(
const
QString
&
room
)
{
const
auto
room_id
=
room
.
toStdString
();
if
(
QMessageBox
::
Yes
!=
QMessageBox
::
question
(
nullptr
,
tr
(
"Confirm knock"
),
tr
(
"Do you really want to ask to join %1?"
).
arg
(
room
)))
return
;
http
::
client
()
->
knock_room
(
room_id
,
{},
[
this
,
room_id
](
const
mtx
::
responses
::
RoomId
&
,
mtx
::
http
::
RequestErr
err
)
{
if
(
err
)
{
emit
showNotification
(
tr
(
"Failed to knock room: %1"
)
.
arg
(
QString
::
fromStdString
(
err
->
matrix_error
.
error
)));
return
;
}
});
}
void
void
ChatPage
::
joinRoom
(
const
QString
&
room
)
ChatPage
::
joinRoom
(
const
QString
&
room
)
{
{
...
@@ -686,8 +705,6 @@ ChatPage::joinRoomVia(const std::string &room_id,
...
@@ -686,8 +705,6 @@ ChatPage::joinRoomVia(const std::string &room_id,
return
;
return
;
}
}
emit
tr
(
"You joined the room"
);
// We remove any invites with the same room_id.
// We remove any invites with the same room_id.
try
{
try
{
cache
::
removeInvite
(
room_id
);
cache
::
removeInvite
(
room_id
);
...
...
This diff is collapsed.
Click to expand it.
src/ChatPage.h
+
1
−
0
View file @
c91f91d5
...
@@ -84,6 +84,7 @@ public slots:
...
@@ -84,6 +84,7 @@ public slots:
void
leaveRoom
(
const
QString
&
room_id
);
void
leaveRoom
(
const
QString
&
room_id
);
void
createRoom
(
const
mtx
::
requests
::
CreateRoom
&
req
);
void
createRoom
(
const
mtx
::
requests
::
CreateRoom
&
req
);
void
joinRoom
(
const
QString
&
room
);
void
joinRoom
(
const
QString
&
room
);
void
knockRoom
(
const
QString
&
room
);
void
joinRoomVia
(
const
std
::
string
&
room_id
,
void
joinRoomVia
(
const
std
::
string
&
room_id
,
const
std
::
vector
<
std
::
string
>
&
via
,
const
std
::
vector
<
std
::
string
>
&
via
,
bool
promptForConfirmation
=
true
);
bool
promptForConfirmation
=
true
);
...
...
This diff is collapsed.
Click to expand it.
src/timeline/InputBar.cpp
+
2
−
0
View file @
c91f91d5
...
@@ -670,6 +670,8 @@ InputBar::command(const QString &command, QString args)
...
@@ -670,6 +670,8 @@ InputBar::command(const QString &command, QString args)
reaction
(
eventId
,
args
.
trimmed
());
reaction
(
eventId
,
args
.
trimmed
());
}
else
if
(
command
==
QLatin1String
(
"join"
))
{
}
else
if
(
command
==
QLatin1String
(
"join"
))
{
ChatPage
::
instance
()
->
joinRoom
(
args
);
ChatPage
::
instance
()
->
joinRoom
(
args
);
}
else
if
(
command
==
QLatin1String
(
"knock"
))
{
ChatPage
::
instance
()
->
knockRoom
(
args
);
}
else
if
(
command
==
QLatin1String
(
"part"
)
||
command
==
QLatin1String
(
"leave"
))
{
}
else
if
(
command
==
QLatin1String
(
"part"
)
||
command
==
QLatin1String
(
"leave"
))
{
ChatPage
::
instance
()
->
timelineManager
()
->
openLeaveRoomDialog
(
room
->
roomId
());
ChatPage
::
instance
()
->
timelineManager
()
->
openLeaveRoomDialog
(
room
->
roomId
());
}
else
if
(
command
==
QLatin1String
(
"invite"
))
{
}
else
if
(
command
==
QLatin1String
(
"invite"
))
{
...
...
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