Commit Graph

14 Commits (master)

Author SHA1 Message Date
rcorniere 8798ff6fc1 - Changed IQ stanzas to pointer semantics
- Fixed commands from v 0.4.0 and tests
- Added primitive Result Sets support (XEP-0059)
4 years ago
remicorniere 1822089db6 Tests for Component and code style fixes (#129)
* Tests for Component and code style fixes
5 years ago
Mickael Remond ce05c3226c
Fix failing tests 5 years ago
Wichert Akkerman a0e74051fd Use a channel based API for SendIQ
This makes sending IQ more idiomatic Go, but more importantly it solves
a problem with contexts that were not being cancelled correctly with
the previous API.

As a side-effect of this change `Route.route` must now be invoked in a
go-routine to prevent deadlocks. This also allows for stanzas to be processed
in parallel, which can result in a nice performance win.
5 years ago
Wichert Akkerman 83bc8581fd Cleanup the IQ result route API
Simplify the API in several ways:

- provide the context to the IQ result handler, making it possible to pass in
  extra context and handle timeouts within the handler.
- pass the stanza in as an IQ type, removing the need to always type-cast it
  in the handler
- remove Router.HandleIqResult and Router.HandleFuncIqResult. Since the router
  is private to Client nobody would ever use these, and they do not really make
  things simpler anyway.
5 years ago
Wichert Akkerman 070934743f Add tests for iq result routes 5 years ago
Mickael Remond 428787d7ab
Refactor and move parsing and stanza to a separate package 5 years ago
Mickael Remond d6d371df4d Do not export Router.route as it is not supposed to be called directly 5 years ago
Mickael Remond e9c704eff5
Fix router after #62 merge 5 years ago
genofire d9fdff0839 Add constants (enumlike) for stanza types and simplify packet creation (#62)
* Add constants (enumlike) for stanza types
* NewIQ, NewMessage and NewPresence are now initialized with the Attrs struct
* Update examples
* Do not export backoff code. For now, we do not need to expose backoff in the documentation
* Make presence priority an int8
5 years ago
Mickaël Rémond 145fce6b3f
Add StanzaType matcher / Clarify empty route behaviour (#65)
* Add route to match on stanza type

* Add test checking that an empty route "always" matches
5 years ago
Mickael Remond af0ae525b8 An IQ can only have a single payload
"An IQ stanza of type "get" or "set" MUST contain exactly one
 child element, which specifies the semantics of the particular
 request."
5 years ago
Mickael Remond 9db33d5792 Introduce Sender interface to abstract client sending in router handlers 5 years ago
Mickael Remond b05e68c844 Add router to make it easier to set up routing info
- Using the router, the dispatch is not done anymore by receiving from
  receive channel, but by registering callback functions in routers,
  with matchers.
- Make IQPayload a real interface to make it easier to match namespaces.
- The StreamManager Run command is now blocking, waiting for StreamManager
  to terminate.
5 years ago