aboutsummaryrefslogtreecommitdiff
path: root/hotline
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2022-06-25 21:12:03 -0700
committerGitHub <noreply@github.com>2022-06-25 21:12:03 -0700
commitda5bdd82beef668f49c2cec09cea85435c0bec34 (patch)
treefd0734aa654e78ee9ddfcbe98998d55208ce1e9f /hotline
parentcb162e0bcfeb3c3d06e85a82ecbc47e6de951406 (diff)
parent688c86d220b0d2eef1f2a3ef0a389261dc48be93 (diff)
Merge pull request #46 from jhalter/implement_access_no_agreement
Implement Don't Show Agreement permission
Diffstat (limited to 'hotline')
-rw-r--r--hotline/access.go16
-rw-r--r--hotline/field.go1
-rw-r--r--hotline/server.go8
3 files changed, 15 insertions, 10 deletions
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) {