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/chat.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/chat.go')
| -rw-r--r-- | hotline/chat.go | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/hotline/chat.go b/hotline/chat.go index 6f2a4dd..dcde1d3 100644 --- a/hotline/chat.go +++ b/hotline/chat.go @@ -23,41 +23,6 @@ type ChatManager interface { Members(id ChatID) []*ClientConn } -type MockChatManager struct { - mock.Mock -} - -func (m *MockChatManager) New(cc *ClientConn) ChatID { - args := m.Called(cc) - - return args.Get(0).(ChatID) -} - -func (m *MockChatManager) GetSubject(id ChatID) string { - args := m.Called(id) - - return args.String(0) -} - -func (m *MockChatManager) Join(id ChatID, cc *ClientConn) { - m.Called(id, cc) -} - -func (m *MockChatManager) Leave(id ChatID, clientID [2]byte) { - m.Called(id, clientID) -} - -func (m *MockChatManager) SetSubject(id ChatID, subject string) { - m.Called(id, subject) - -} - -func (m *MockChatManager) Members(id ChatID) []*ClientConn { - args := m.Called(id) - - return args.Get(0).([]*ClientConn) -} - type MemChatManager struct { chats map[ChatID]*PrivateChat @@ -135,3 +100,38 @@ func (cm *MemChatManager) SetSubject(id ChatID, subject string) { chat.Subject = subject } + +type MockChatManager struct { + mock.Mock +} + +func (m *MockChatManager) New(cc *ClientConn) ChatID { + args := m.Called(cc) + + return args.Get(0).(ChatID) +} + +func (m *MockChatManager) GetSubject(id ChatID) string { + args := m.Called(id) + + return args.String(0) +} + +func (m *MockChatManager) Join(id ChatID, cc *ClientConn) { + m.Called(id, cc) +} + +func (m *MockChatManager) Leave(id ChatID, clientID [2]byte) { + m.Called(id, clientID) +} + +func (m *MockChatManager) SetSubject(id ChatID, subject string) { + m.Called(id, subject) + +} + +func (m *MockChatManager) Members(id ChatID) []*ClientConn { + args := m.Called(id) + + return args.Get(0).([]*ClientConn) +} |