upgrade to support libnmdc v0.18.0

This commit is contained in:
mappu 2020-05-07 19:14:49 +12:00
parent beaf18eb8e
commit 6641d00247

11
main.go
View File

@ -60,13 +60,14 @@ func (this *HubWorker) MainLoop(addr, nick, password string) {
opts := libnmdc.HubConnectionOptions{
Address: libnmdc.HubAddress(addr),
SkipVerifyTLS: !VerifyTLS,
Self: *libnmdc.NewUserInfo(nick),
Self: libnmdc.NewUserInfo(nick),
NickPassword: password,
}
hub := opts.Connect()
for {
event := <-hub.OnEvent
evChan := make(chan libnmdc.HubEvent, 1)
hub := libnmdc.ConnectAsync(&opts, evChan)
for event := range evChan {
if DebugMode {
fmt.Printf("DEBUG: %s %v\n", addr, event)
@ -75,7 +76,7 @@ func (this *HubWorker) MainLoop(addr, nick, password string) {
switch event.EventType {
case libnmdc.EVENT_CONNECTION_STATE_CHANGED:
if LogConnectionState {
str := "* " + event.StateChange.Format()
str := "* " + event.StateChange.String()
if len(event.Message) > 0 {
str += " (" + event.Message + ")"
}