aim-oscar-server/service_manager.go

23 lines
478 B
Go
Raw Normal View History

2021-12-24 12:41:16 -05:00
package main
2021-12-24 12:44:40 -05:00
import "aim-oscar/services"
2021-12-24 12:41:16 -05:00
type ServiceManager struct {
2021-12-24 12:44:40 -05:00
services map[uint16]services.Service
2021-12-24 12:41:16 -05:00
}
func NewServiceManager() *ServiceManager {
return &ServiceManager{
2021-12-24 12:44:40 -05:00
services: make(map[uint16]services.Service),
2021-12-24 12:41:16 -05:00
}
}
2021-12-24 12:44:40 -05:00
func (sm *ServiceManager) RegisterService(family uint16, service services.Service) {
2021-12-24 12:41:16 -05:00
sm.services[family] = service
}
2021-12-24 12:44:40 -05:00
func (sm *ServiceManager) GetService(family uint16) (services.Service, bool) {
2021-12-24 12:41:16 -05:00
s, ok := sm.services[family]
return s, ok
}