2017-11-22 06:05:36 +00:00
|
|
|
package libnmdc
|
|
|
|
|
|
|
|
type Protocol interface {
|
|
|
|
ProcessCommand(msg string)
|
|
|
|
|
|
|
|
SayPublic(string)
|
|
|
|
|
|
|
|
SayPrivate(user, message string)
|
|
|
|
|
|
|
|
ProtoMessageSeparator() string
|
|
|
|
}
|
2017-11-22 07:02:11 +00:00
|
|
|
|
|
|
|
type HubProtocol int
|
|
|
|
|
|
|
|
const (
|
|
|
|
HubProtocolAutodetect HubProtocol = 0
|
|
|
|
HubProtocolNmdc HubProtocol = 1
|
|
|
|
HubProtocolAdc HubProtocol = 2
|
|
|
|
)
|
|
|
|
|
|
|
|
func (hp HubProtocol) Create(hc *HubConnection) Protocol {
|
|
|
|
if hp == HubProtocolNmdc {
|
|
|
|
return NewNmdcProtocol(hc)
|
|
|
|
|
|
|
|
} else if hp == HubProtocolAdc {
|
|
|
|
return NewAdcProtocol(hc)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return NewAutodetectProtocol(hc)
|
|
|
|
}
|
|
|
|
}
|