/* Opens jabber connection for client */ func (client *Client) Connect(pass string, host string, port uint16) error { jid_i := C.CString(client.Jid) pass_i := C.CString(pass) var host_i *C.char = nil log.Println("xmpp.Connect: ", client.Jid) if len(host) > 0 { host_i = C.CString(host) } mutex.Lock() counter += 1 mutex.Unlock() client.ConnInfo = C.open_xmpp_conn(jid_i, pass_i, host_i, C.short(port), C.int(counter)) if client.ConnInfo != nil { client.Id = counter clients[counter] = client return nil } return errors.New("Connection error") }
/* Opens jabber connection for client */ func (client *Client) Connect(pass string, host string, port uint16) error { jid_i := C.CString(client.Jid) pass_i := C.CString(pass) var host_i *C.char = nil if len(host) > 0 { host_i = C.CString(host) } client.ConnInfo = C.open_xmpp_conn(jid_i, pass_i, host_i, C.short(port)) if client.ConnInfo != nil { clients[client.Jid] = client return nil } return errors.New("Connection error") }