From 357be24375ad0172a382292d80b958bfc940ab3f Mon Sep 17 00:00:00 2001 From: cx uname Date: Fri, 12 Oct 2012 13:40:02 +0400 Subject: [PATCH] update --- main.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 40a18b8..571fa51 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,7 @@ const room = "ttyh@conference.jabber.ru" const name = "Жобе" const me = "hypnotoad@xmpp.ru" +// const room = "kkkkkkk2@conference.jabber.ru" var ( ping time.Time admin []string @@ -24,7 +25,8 @@ var ( func main() { runtime.GOMAXPROCS(runtime.NumCPU()) - Conn, err := xmpp.Dial("xmpp.ru:5222", "hypnotoad", "xmpp.ru", "password", "AllHailHypnotoad", nil) +start: + Conn, err := xmpp.Dial("xmpp.ru:5222", "hypnotoad", "xmpp.ru", "pass", "AllHailHypnotoad", nil) if err != nil { log.Fatalln("Conn", err) } @@ -34,14 +36,13 @@ func main() { if err := Conn.SendPresence(room+"/"+name, ""); err != nil { log.Fatalln("Presence", err) } - - //just in case + go func() { for { select { case <-time.After(60 * time.Second): if _, _, err = Conn.SendIQ("xmpp.ru", "set", " 60 "); err != nil { - log.Fatalln("KeepAlive", err) + log.("KeepAlive", err) } log.Println("SENT 60") } @@ -51,7 +52,10 @@ func main() { for { next, err := Conn.Next() if err != nil { - log.Fatalln("Next", err) + log.Println("Next", err, "Conn", Conn) + Conn.Close() + time.Sleep(10 * time.Second) + goto start } switch t := next.Value.(type) { case *xmpp.ClientPresence: