资源说明:
Author: Chad KruegerThis Package provides basic XMPP protocol support in GO. ================================================================================ DEPENDENCIES ================================================================================ goinstall github.com/sloonz/go-iconv/src goinstall github.com/jteeuwen/go-pkg-xmlx ================================================================================ USAGE ================================================================================ $ cd /path/to/code/dir $ git clone http://github.com/krutcha/go-jabber.git $ cd go-jabber $ make ================================================================================ API ================================================================================ There are examples in the /example directory demonstrating use of the go-jabber pkg to interract with an xmpp server. Also there is a diagram in /doc/gojabber.odg which gives the jist of how the client pkg is meant to work. step 1: open a connection to the XMPP server jcon, err := gojabber.SpawnConnection(host, domain, username, password, port, useTLS) This will open a connection and begin the authentication process, obtain a roster, and begin to recieve presence updates. jcon is a struct containing useful connection related information. step 2: register callbacks currently 4 callbacks are supported and can be registered as follows: -1 avatar updates - user photo has changed jcon.ConnectHook_AvatarUpdate( func(host string, avatar gojabber.AvatarUpdate) {code}) -2 incoming messages - chat messages from users jcon.ConnectHook_Msg( func(host string, msg gojabber.MessageUpdate) {code}) -3 typing notification - if a user is actively typing a message to you jcon.ConnectHook_Typing( func(host string, JID string) {code}) -4 status updates - online, offline, away etc jcon.ConnectHook_Status( func(host string, JID string, status string) {code}) step 3: call call commands just 2 commands supported right now to call on a jabber connection: -1 Disconnect() - kill off the connection, clean up it's channels etc -2 SendMessage(msg string, contact *Contact, fromJID string) - send a chat message to a user For examples of use of all of the above, see /example/command_line.go KNOWN ISSUES: -sync mechanisms added for access to shared JabberCon structs are not enforced ================================================================================ LICENSE ================================================================================ This code is subject to a 1-clause BSD license. It's contents can be found in the LICENSE file.
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。