forked from jshiffer/go-xmpp
Fix examples
This commit is contained in:
parent
748282a14a
commit
f402673c8c
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
"github.com/mattn/go-xmpp"
|
||||
"log"
|
||||
@ -56,7 +57,7 @@ func main() {
|
||||
|
||||
dialog.AddButton(gtk.STOCK_OK, gtk.RESPONSE_OK)
|
||||
dialog.AddButton(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
|
||||
dialog.SetDefaultResponse(int(gtk.RESPONSE_OK))
|
||||
dialog.SetDefaultResponse(gtk.RESPONSE_OK)
|
||||
dialog.SetTransientFor(window)
|
||||
dialog.ShowAll()
|
||||
res := dialog.Run()
|
||||
@ -67,6 +68,11 @@ func main() {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
xmpp.DefaultConfig = tls.Config {
|
||||
ServerName: "talk.google.com",
|
||||
InsecureSkipVerify: false,
|
||||
}
|
||||
|
||||
talk, err := xmpp.NewClient("talk.google.com:443", username_, password_, false)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"crypto/tls"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/mattn/go-xmpp"
|
||||
@ -17,6 +18,10 @@ var notls = flag.Bool("notls", false, "No TLS")
|
||||
var debug = flag.Bool("debug", false, "debug output")
|
||||
var session = flag.Bool("session", false, "use server session")
|
||||
|
||||
func serverName(host string) string {
|
||||
return strings.Split(host, ":")[0]
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "usage: example [options]\n")
|
||||
@ -28,6 +33,13 @@ func main() {
|
||||
flag.Usage()
|
||||
}
|
||||
|
||||
if !*notls {
|
||||
xmpp.DefaultConfig = tls.Config {
|
||||
ServerName: serverName(*server),
|
||||
InsecureSkipVerify: false,
|
||||
}
|
||||
}
|
||||
|
||||
var talk *xmpp.Client
|
||||
var err error
|
||||
options := xmpp.Options{Host: *server,
|
||||
|
Loading…
Reference in New Issue
Block a user