diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-05-18 14:02:14 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-05-18 14:02:14 +0200 |
commit | 23e4408fa8a840b78984c97aa927a120a465fd12 (patch) | |
tree | 9ee54fe4fe5853e8ee8c8aa0e531142e04eec308 /src/ChatPage.cpp | |
parent | Tag rooms via context menu (diff) | |
download | nheko-23e4408fa8a840b78984c97aa927a120a465fd12.tar.xz |
Add /roomnick command
Diffstat (limited to 'src/ChatPage.cpp')
-rw-r--r-- | src/ChatPage.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index d0ca4670..90abc63e 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -301,6 +301,29 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent) connect(text_input_, &TextInputWidget::sendUnbanRoomRequest, this, &ChatPage::unbanUser); connect( + text_input_, &TextInputWidget::changeRoomNick, this, [this](const QString &displayName) { + mtx::events::state::Member member; + member.display_name = displayName.toStdString(); + member.avatar_url = + cache::avatarUrl(currentRoom(), + QString::fromStdString(http::client()->user_id().to_string())) + .toStdString(); + member.membership = mtx::events::state::Membership::Join; + + http::client() + ->send_state_event<mtx::events::state::Member, + mtx::events::EventType::RoomMember>( + currentRoom().toStdString(), + http::client()->user_id().to_string(), + member, + [](mtx::responses::EventId, mtx::http::RequestErr err) { + if (err) + nhlog::net()->error("Failed to set room displayname: {}", + err->matrix_error.error); + }); + }); + + connect( text_input_, &TextInputWidget::uploadMedia, this, |