Skip to content

Commit

Permalink
fix: not send login state for clients
Browse files Browse the repository at this point in the history
send state for all clients

Log:
  • Loading branch information
justforlxz authored and Groveer committed Jul 25, 2024
1 parent 1201702 commit e2ae98b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/daemon/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,16 @@ namespace DDM {
stateConfig.Last.Session.setDefault();
stateConfig.save();

if (m_socket) {
emit loginSucceeded(m_socket, user);
daemonApp->displayManager()->setLastSession(auth->sessionId());
if (m_displayServerType == DisplayServerType::SingleCompositerServerType) {
auto* server = reinterpret_cast<SingleWaylandDisplayServer*>(m_displayServer);
server->onLoginSucceeded(user);
} else {
if (m_socket) {
emit loginSucceeded(m_socket, user);
daemonApp->displayManager()->setLastSession(auth->sessionId());
}
}

}
m_socket = nullptr;
}
Expand All @@ -613,8 +619,14 @@ namespace DDM {
return;

m_socketServer->informationMessage(m_socket, message);
if (error == Auth::ERROR_AUTHENTICATION)
emit loginFailed(m_socket, auth->user());
if (error == Auth::ERROR_AUTHENTICATION) {
if (m_displayServerType == DisplayServerType::SingleCompositerServerType) {
auto* server = reinterpret_cast<SingleWaylandDisplayServer*>(m_displayServer);
server->onLoginFailed(auth->user());
} else {
emit loginFailed(m_socket, auth->user());
}
}
}

void Display::slotHelperFinished(Auth::HelperExitStatus status) {
Expand Down
12 changes: 12 additions & 0 deletions src/daemon/SingleWaylandDisplayServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,15 @@ void SingleWaylandDisplayServer::activateUser(const QString &user) {
QString SingleWaylandDisplayServer::getUserWaylandSocket(const QString &user) const {
return m_waylandSockets.value(user);
}

void SingleWaylandDisplayServer::onLoginFailed(const QString &user) {
for (auto greeter : m_greeterSockets) {
SocketWriter(greeter) << quint32(DaemonMessages::LoginFailed) << user;
}
}

void SingleWaylandDisplayServer::onLoginSucceeded(const QString &user) {
for (auto greeter : m_greeterSockets) {
SocketWriter(greeter) << quint32(DaemonMessages::LoginSucceeded) << user;
}
}
2 changes: 2 additions & 0 deletions src/daemon/SingleWaylandDisplayServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class SingleWaylandDisplayServer : public DDM::WaylandDisplayServer
public Q_SLOTS:
void activateUser(const QString &user);
QString getUserWaylandSocket(const QString &user) const;
void onLoginFailed(const QString &user);
void onLoginSucceeded(const QString &user);

private:
DDM::SocketServer *m_socketServer;
Expand Down

0 comments on commit e2ae98b

Please sign in to comment.