From fd740bc499ebc6d3a381479316f74cdc736d02de Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:41:20 -0700 Subject: Extensive refactor, quality of life enhancements * Added ability to reload config, agreement, news, and user accounts without restarting the server by sending SIGHUP to the running process * Added ability to use modern unix or windows line breaks in Agreement.txt and MessageBoard.txt instead of classic MacOS `\r` breaks. * Extensive refactor towards swappable backends for the active server state * Extensive refactored towards making the hotline package generic and re-usable for alternate server implemenations * Fix bug where users whose accounts have been deleted would not be disconnected --- hotline/field.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'hotline/field.go') diff --git a/hotline/field.go b/hotline/field.go index 4c760d5..65ff394 100644 --- a/hotline/field.go +++ b/hotline/field.go @@ -92,8 +92,8 @@ func NewField(fieldType [2]byte, data []byte) Field { return f } -// fieldScanner implements bufio.SplitFunc for parsing byte slices into complete tokens -func fieldScanner(data []byte, _ bool) (advance int, token []byte, err error) { +// FieldScanner implements bufio.SplitFunc for parsing byte slices into complete tokens +func FieldScanner(data []byte, _ bool) (advance int, token []byte, err error) { if len(data) < minFieldLen { return 0, nil, nil } @@ -122,7 +122,7 @@ func (f *Field) DecodeInt() (int, error) { } func (f *Field) DecodeObfuscatedString() string { - return string(encodeString(f.Data)) + return string(EncodeString(f.Data)) } // DecodeNewsPath decodes the field data to a news path. @@ -185,7 +185,7 @@ func (f *Field) Write(p []byte) (int, error) { return minFieldLen + dataSize, nil } -func getField(id [2]byte, fields *[]Field) *Field { +func GetField(id [2]byte, fields *[]Field) *Field { for _, field := range *fields { if id == field.Type { return &field -- cgit