Giter Club home page Giter Club logo

hipchat's Introduction

hipchat

This is a abstraction in golang to Hipchat's implementation of XMPP. It communicates over TLS and requires zero knowledge of XML or the XMPP protocol.

bot building

Hipchat treats the "bot" resource differently from any other resource connected to their service. When connecting to Hipchat with a resource of "bot", a chat history will not be sent. Any other resource will receive a chat history.

example/hello.go

package main

import (
	"github.com/daneharrigan/hipchat"
)

func main() {
	user := "11111_22222"
	pass := "secret"
	resource := "bot"
	roomJid := "[email protected]"
	fullName := "Some Bot"

	client, err := hipchat.NewClient(user, pass, resource)
	if err != nil {
		fmt.Printf("client error: %s\n", err)
		return
	}

	client.Status("chat")
	client.Join(roomJid, fullName)
	client.Say(roomJid, fullName, "Hello")
	select {}
}

hipchat's People

Contributors

jschauma avatar dane avatar asdqwex avatar cjhubert avatar dacamp avatar davidwittman avatar hrak avatar moznion avatar

Stargazers

Curie avatar Aliberk Sandıkçı avatar Liuww avatar Ersoy Filinte avatar  avatar  avatar Aloysius Michael Tansy avatar Matt Harvey avatar Theofanis Despoudis avatar jefurry avatar  avatar Max Pajari avatar Rust Oceans avatar AEKnow avatar  avatar Piotr Wittchen avatar Charle Demers avatar  avatar taise avatar Fernando Hellwig Timm avatar Jeff Turner avatar Marcus Carlsson avatar cybai (Haku) avatar  avatar  avatar  avatar Patrick O. S. Kuti avatar Ahmed Kamel avatar Michael avatar Z.X.PING avatar Vasiliy Bukharev avatar Mante Luo avatar Willem D'Haese avatar  avatar Andrew Druzhinin avatar Igor Fokusov avatar LUCIANO FURTADO avatar Ezo Saleh avatar Jonathan Stasiak avatar flyeven avatar Mahadevan avatar Paul Redmond avatar Tehmasp Chaudhri avatar MOZGIII avatar Florian Schlachter avatar 秋 avatar Karl Åström avatar Остроумов Анатолий avatar Justin Shattuck avatar Tom Maiaroto avatar Kevin S. Clarke avatar Sam Zaydel avatar Alexander Savin avatar Peter Jiang avatar  avatar Tristan Wietsma avatar Charlie Knudsen avatar Kevin Le Brun avatar fightingbamboo avatar Vitalii Mikhnevych avatar Marconi Moreto Jr avatar Evan Lin avatar Doug Calobrisi avatar Ray Holder avatar Dane Harrigan avatar y_matsuwitter avatar Hiram Jerónimo Perez‮ avatar Tanmay Patel avatar liuyanghejerry avatar Viktor Vasilev avatar Petr Brzek avatar Bob TheBuilder avatar Christian Sullivan avatar dap avatar Athan avatar Daniel Durante avatar Ryan Smith avatar Christopher Blanchard avatar Suguru Namura avatar JadiysonTaki avatar Fredrik Forsmo avatar Adam Stokes avatar Sergey Storchay avatar atsumo avatar Ian Macalinao avatar Atish avatar kuno avatar Nicholas Hwang avatar Yung Hwa Kwon avatar TJ Holowaychuk avatar Ciaran Downey avatar Yuki Kuroda avatar C.C. avatar Dan Ryan avatar Paulo Pereira avatar José Ustra avatar Michael Hood avatar Daniel Mantilla avatar Lindsay Holmwood avatar Chris Farmiloe avatar

Watchers

Dane Harrigan avatar Neustradamus avatar Yue Wang avatar James Cloos avatar Ahmed Kamel avatar Fernando Hellwig Timm avatar ming avatar

hipchat's Issues

Cannot filter out old messages when joining a room

Upon joining a room, HipChat sends a dump of the room's recent history, which I want to filter out. This library does not expose any timestamp data (which I assume hipchat provides for these history messages). And I can't seem to connect as a bot by joining rooms with a JID of "bot" as per this support page.

License

What license is this code released under? I would like to fork it and adapt it for a different xmpp server.

Client JID domain != host when using Hipchat Server

When using Hipchat Server (on-prem Hipchat) the client domain is not the same as the hostname of the server. Currently this client assumes a JID of user@host.

Example scenario with Hipchat Server:

Hostname: hipchat.example.com
Username: 1_1
Client JID: [email protected]
MUC domain: conf.btf.hipchat.com

(Note the ".btf" bit which is also different from 'normal' Hipchat.)

This breaks things like requesting the roster etc.

Receiving unsolicited xmpp.NsDisco or xmpp.NsIqRoster will block listen function

This problem can be reproduced by connecting to hipchat and changing the name of a user.

The receivedRooms and receivedUsers channels are unbuffered, so sending data to this channel will block until something receives from this channel. The only time these channels are received from are in the Users() and Rooms() methods.

However, these messages generate a request so would still leave the listen thread blocked. We exposed the channels and used a goroutine similar to this to avoid the endless block. Note: Rooms() and Users() in this example just return the channels and don't make requests (the same as Messages()).

go func() {
    for {
        select {
        case message := <-client.Messages():
            log.Printf("Received message: %v", message)
        case rooms := <-client.Rooms():
            log.Printf("Received rooms: %v", rooms)
        case users := <-client.Users():
            log.Printf("Received users: %v", users)
        }
    }
}()

Obviously there still needs to be work done to communicate received rooms and users to other goroutines, but this is one way to avoid the problem.

Timeout after nickname change

While in the reply example you are listening to the incoming messages and someone changes his nickname via the web interface the connection will time out and the bot will shortly disconnect.

It only happens in this scenario.

Certificate issue

Hi,
i'm trying to use your library to connect to a self hosted hipchat instance and facing a problem with the TLS connection.
I'm everytime getting the following error:
client error: x509: certificate has expired or is not yet valid
So it seems that the certificate is expired but I want to connect anyway. So how can I disable the Cert verify?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.