Commit Graph

133 Commits

Author SHA1 Message Date
Matt Goodall f9302660b0 Convenient method for creating an Iq response. 2012-07-18 11:22:59 +01:00
Matt Goodall 438164a9d9 Better/correct Error type.
XMPP errors are a real pain - they have up to 3 elements. 2 are
XMPP-specific and have one of two namespaces, the other is application
specific. Go's xml package is good, but it's not that good!

So, I've had to handle the error data as a generic Payload string attr
and provide methods for retrieving the bits as conveniently as possible.

Note: there's no application-specific error data yet but it should slot
in ok now.
2012-07-18 11:22:59 +01:00
Matt Goodall dde0afb688 Document more of the XMPP API. 2012-07-18 11:22:59 +01:00
Matt Goodall c1da50ce26 Organise code into better logical groups. 2012-07-18 11:22:59 +01:00
Matt Goodall cc012762e9 Replace Send/Recv funcs with In/Out channels.
Basically, make the channels public and just let the client handle a
stream/net error if it's interested.

This simplifies the API a little and also allows an application to
select {} from the XMPP channel and any other channels at the same time.
2012-07-18 11:22:59 +01:00
Matt Goodall e22b95e43e Add way to peek at Iq's payload element. 2012-07-16 16:06:13 +01:00
Matt Goodall 91b33a0f3d Mention a couple of bugs to fix at some point. 2012-07-16 16:04:46 +01:00
Matt Goodall b439198518 Convert FilterFn into the Matcher/MatcherFunc interface/adapter pair.
"Matcher" is a better name for how it's used. It also allows other types
to implement the interface.
2012-07-16 12:02:05 +01:00
Matt Goodall 17d143cb2c Add client session establishment. 2012-07-13 11:23:49 +01:00
Matt Goodall ba349b1058 Add Iq.Error and define xml tags for Error type. 2012-07-13 11:22:51 +01:00
Matt Goodall 466ab47e09 Add debug option to see XML stanzas. 2012-07-13 11:15:47 +01:00
Matt Goodall 1ab83b491b Add component handshake stanza namespace. 2012-07-12 01:17:27 +01:00
Matt Goodall 7cc19606e1 Oops, fix tail.go for new Stream config. 2012-07-12 01:16:21 +01:00
Matt Goodall e95528641b Combine Stream's Decode and DecodeElement methods. 2012-07-12 00:56:35 +01:00
Matt Goodall f97ed9ea37 Remove element name match test from Stream.Next().
Only one place still used it, so it might as well go.
2012-07-12 00:48:44 +01:00
Matt Goodall 6dfd9e096b Documentation tweaks and additions. 2012-07-12 00:40:55 +01:00
Matt Goodall 20c380ebc6 Add UUID4 func and use it instead of hard-coded <iq/> ids. 2012-07-12 00:38:51 +01:00
Matt Goodall 909d0f5fac Make example code easier to read with a bit of log-and-die trickery. 2012-07-12 00:38:51 +01:00
Matt Goodall 424c06855c Make stanza logging in the Stream optional. 2012-07-12 00:38:51 +01:00
Matt Goodall 2c5fbc7122 Log incoming stanzas before they're unmarshaled.
A couple of bits in stream.go are commented out at the moment. They'll
be back in a moment, once the send/recv logging is optional.
2012-07-11 23:24:32 +01:00
Matt Goodall 318a97947b Read incoming start element explicit part of sending outgoing start element. 2012-07-11 23:24:32 +01:00
Matt Goodall 30441cacf4 Fix typo. 2012-07-11 23:24:26 +01:00
Matt Goodall de92cf1a55 Some JID and XML writer tests. 2012-07-11 15:57:06 +01:00
Matt Goodall 9013ad6a6a Remove extra "has" from func comment. 2012-07-11 15:55:37 +01:00
Matt Goodall 85472a72b4 Ensure all methods that decode a stanza go via the same route. 2012-07-11 15:50:27 +01:00
Matt Goodall 2a11a800da Extract writeXMLStartElement func. 2012-07-11 15:35:52 +01:00
Matt Goodall 32bf10887c Keep filters in ordered list, with most recent at head. 2012-07-10 19:03:28 +01:00
Matt Goodall c31efeffe5 Protect XMPP filters from concurrent access. 2012-07-10 17:25:55 +01:00
Matt Goodall 15a35ce4ff Separate sections of attrs with useful comments. 2012-07-10 17:25:25 +01:00
Matt Goodall cf45380866 Only call with attrs that need to be non-zero. 2012-07-10 17:12:54 +01:00
Matt Goodall c33950f532 Fix EOF's package in overview doc. 2012-07-10 15:18:35 +01:00
Matt Goodall 38b727ed46 Fix client creation example code in overview docs. 2012-07-10 15:11:39 +01:00
Matt Goodall 5ab3a9be80 Extract/improve auth response check - it's common to all mechanisms. 2012-07-10 13:14:46 +01:00
Matt Goodall 6ccf6e41a8 Rename auth struct field. 2012-07-10 13:13:13 +01:00
Matt Goodall 32df77187c Make authentication a little more pluggable. 2012-07-10 12:27:29 +01:00
Matt Goodall 5966340a3a Package overview doc. 2012-07-10 10:45:16 +01:00
Matt Goodall de111bc744 Turn googletalk.go into a generic XMPP message tail tool. 2012-07-10 10:43:00 +01:00
Matt Goodall 2a32fc1e44 Add home server from JID lookup helper. 2012-07-10 10:35:39 +01:00
Matt Goodall 2776e78613 Nicer var name to it's clearer it's an error. 2012-07-10 10:08:49 +01:00
Matt Goodall c64a5bc2fe Add example of Google Talk. 2012-07-09 15:11:25 +01:00
Matt Goodall b752357c8d Remap EOF to ErrUnexpectedEOF now we're checking for end of stream. 2012-07-09 15:04:57 +01:00
Matt Goodall 6b01a7f10c Cleanly detect & signal end of stream, and fix code above. 2012-07-09 15:01:15 +01:00
Matt Goodall 5536f034bd Improve fatal error message. 2012-07-09 14:48:04 +01:00
Matt Goodall 4759e83863 Add <error/> stanza. 2012-07-09 14:47:50 +01:00
Matt Goodall b13d0baad0 Simplify error creation. 2012-07-09 13:27:49 +01:00
Matt Goodall 7a91f5d8ea Send stream's version='1.0' attr. 2012-07-09 02:51:16 +01:00
Matt Goodall e2c05fea94 Send xml PI encoding. Route through Stream.send for logging. 2012-07-09 02:50:43 +01:00
Matt Goodall 56a481ff8e No client config means default config. 2012-07-09 02:49:04 +01:00
Matt Goodall dc447769b2 go fmt 2012-07-09 02:21:18 +01:00
Matt Goodall 6a42d26a31 Log stanzas sent to the XMPP component. 2012-07-09 02:19:10 +01:00