From: Jeff Halter Date: Sun, 26 Jun 2022 04:10:55 +0000 (-0700) Subject: Implement Don't Show Agreement permission X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/commitdiff_plain/688c86d220b0d2eef1f2a3ef0a389261dc48be93?hp=264b7c27c7a46e2d0eb699812c8e38cf771fcf00 Implement Don't Show Agreement permission --- diff --git a/hotline/access.go b/hotline/access.go index 1bee72c..bc3cb0d 100644 --- a/hotline/access.go +++ b/hotline/access.go @@ -27,14 +27,14 @@ const ( accessModifyUser = 17 // accessChangeOwnPass = 18 // Documented but unused? // accessSendPrivMsg = 19 // This doesn't do what it seems like it should do. TODO: Investigate - accessNewsReadArt = 20 - accessNewsPostArt = 21 - accessDisconUser = 22 // Toggles red user name in user list - accessCannotBeDiscon = 23 - accessGetClientInfo = 24 - accessUploadAnywhere = 25 - accessAnyName = 26 - // accessNoAgreement = 27 + accessNewsReadArt = 20 + accessNewsPostArt = 21 + accessDisconUser = 22 // Toggles red user name in user list + accessCannotBeDiscon = 23 + accessGetClientInfo = 24 + accessUploadAnywhere = 25 + accessAnyName = 26 + accessNoAgreement = 27 accessSetFileComment = 28 accessSetFolderComment = 29 accessViewDropBoxes = 30 diff --git a/hotline/field.go b/hotline/field.go index aef790d..c9db3d9 100644 --- a/hotline/field.go +++ b/hotline/field.go @@ -24,6 +24,7 @@ const fieldChatID = 114 const fieldChatSubject = 115 const fieldWaitingCount = 116 const fieldBannerType = 152 +const fieldNoServerAgreement = 152 const fieldVersion = 160 const fieldCommunityBannerID = 161 const fieldServerName = 162 diff --git a/hotline/server.go b/hotline/server.go index 41b9a97..f3574de 100644 --- a/hotline/server.go +++ b/hotline/server.go @@ -653,8 +653,12 @@ func (s *Server) handleNewConnection(ctx context.Context, rwc io.ReadWriteCloser // Send user access privs so client UI knows how to behave c.Server.outbox <- *NewTransaction(tranUserAccess, c.ID, NewField(fieldUserAccess, *c.Account.Access)) - // Show agreement to client - c.Server.outbox <- *NewTransaction(tranShowAgreement, c.ID, NewField(fieldData, s.Agreement)) + // Users with accessNoAgreement do not receive the server agreement on login + if c.Authorize(accessNoAgreement) { + c.Server.outbox <- *NewTransaction(tranShowAgreement, c.ID, NewField(fieldNoServerAgreement, []byte{1})) + } else { + c.Server.outbox <- *NewTransaction(tranShowAgreement, c.ID, NewField(fieldData, s.Agreement)) + } // Used simplified hotline v1.2.3 login flow for clients that do not send login info in tranAgreed if c.Version == nil || bytes.Equal(c.Version, nostalgiaVersion) {