diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-07-17 15:41:20 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-07-17 15:42:37 -0700 |
| commit | fd740bc499ebc6d3a381479316f74cdc736d02de (patch) | |
| tree | e77563ce0997e51debaec75c9f7a053759ca3a0a /hotline/field.go | |
| parent | 80aed6b19ff0b0927670e459ce5cc7a16ef047ec (diff) | |
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
Diffstat (limited to 'hotline/field.go')
| -rw-r--r-- | hotline/field.go | 8 |
1 files changed, 4 insertions, 4 deletions
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 |