[network/libktorrent] src/net: ABI break: use enum class for Socks::SetupState

Jack Hill <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 1dc61454fb264197d02700cfdc2c3a363a456997 by Jack Hill.
Committed on 15/08/2026 at 10:19.
Pushed by jackh into branch 'master'.

ABI break: use enum class for Socks::SetupState

M  +8    -8    src/net/socks.cpp
M  +1    -1    src/net/socks.h

https://invent.kde.org/network/libktorrent/-/commit/1dc61454fb264197d02700cfdc2c3a363a456997

diff --git a/src/net/socks.cpp b/src/net/socks.cpp
index 33be4f21..44cca368 100644
--- a/src/net/socks.cpp
+++ b/src/net/socks.cpp
@@ -29,7 +29,7 @@ Socks::Socks(mse::EncryptedPacketSocket *sock, const Address &dest)
     : sock(sock)
     , dest(dest)
     , state(IDLE)
-    , internal_state(NONE)
+    , internal_state(SetupState::NONE)
 {
     version = socks_version; // copy version in case it changes
 }
@@ -108,13 +108,13 @@ Socks::State Socks::onReadyToRead()
     }
 
     switch (internal_state) {
-    case AUTH_REQUEST_SENT:
+    case SetupState::AUTH_REQUEST_SENT:
         return handleAuthReply();
         break;
-    case USERNAME_AND_PASSWORD_SENT:
+    case SetupState::USERNAME_AND_PASSWORD_SENT:
         return handleUsernamePasswordReply();
         break;
-    case CONNECT_REQUEST_SENT:
+    case SetupState::CONNECT_REQUEST_SENT:
         return handleConnectReply();
         break;
     default:
@@ -137,7 +137,7 @@ Socks::State Socks::sendAuthRequest()
         req.methods[1] = socks5::AuthMethod::USERNAME_PASSWORD; // Username and password
         req.methods[2] = socks5::AuthMethod::GSSAPI; // GSSAPI
         sock->sendData(QByteArrayView{reinterpret_cast<const Uint8 *>(&req), req.size()});
-        internal_state = AUTH_REQUEST_SENT;
+        internal_state = SetupState::AUTH_REQUEST_SENT;
     } else {
         if (dest.protocol() == QAbstractSocket::IPv6Protocol) {
             Out(SYS_CON | LOG_IMPORTANT) << "SOCKSV4 does not support IPv6" << endl;
@@ -155,7 +155,7 @@ Socks::State Socks::sendAuthRequest()
         memcpy(req.ip, &ip, 4);
         strcpy(req.user_id, "KTorrent");
         sock->sendData(QByteArrayView{reinterpret_cast<const Uint8 *>(&req), req.size()});
-        internal_state = CONNECT_REQUEST_SENT;
+        internal_state = SetupState::CONNECT_REQUEST_SENT;
         // Out(SYS_CON|LOG_DEBUG) << "SOCKSV4 send connect" << endl;
     }
     return state;
@@ -205,7 +205,7 @@ void Socks::sendUsernamePassword()
     memcpy(buffer.data() + off, pwd.constData(), pwd.size());
     off += pwd.size();
     sock->sendData(QByteArrayView{buffer}.first(off));
-    internal_state = USERNAME_AND_PASSWORD_SENT;
+    internal_state = SetupState::USERNAME_AND_PASSWORD_SENT;
 }
 
 Socks::State Socks::handleUsernamePasswordReply()
@@ -249,7 +249,7 @@ void Socks::sendConnectRequest()
         req.address_type = socks5::AddressType::ADDR_IPV6;
     }
     sock->sendData(QByteArrayView{reinterpret_cast<const Uint8 *>(&req), len});
-    internal_state = CONNECT_REQUEST_SENT;
+    internal_state = SetupState::CONNECT_REQUEST_SENT;
 }
 
 Socks::State Socks::handleConnectReply()
diff --git a/src/net/socks.h b/src/net/socks.h
index f53a44bc..a838f04a 100644
--- a/src/net/socks.h
+++ b/src/net/socks.h
@@ -110,7 +110,7 @@ private Q_SLOTS:
     void resolved(net::AddressResolver *ar);
 
 private:
-    enum SetupState {
+    enum class SetupState {
         NONE,
         AUTH_REQUEST_SENT,
         USERNAME_AND_PASSWORD_SENT,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.