summaryrefslogtreecommitdiff
path: root/xmpp/router_test.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-06-30 13:07:12 +0200
committerxengineering <me@xengineering.eu>2023-06-30 13:07:12 +0200
commit8b608265772ba5df13d24071117c694bdfd1212a (patch)
treed78bbd26a438e645c807f6a917b4101d20fe18b1 /xmpp/router_test.go
parent372575cd38a939d1c8f412c8cea653c86bc725df (diff)
downloadlimox-8b608265772ba5df13d24071117c694bdfd1212a.tar
limox-8b608265772ba5df13d24071117c694bdfd1212a.tar.zst
limox-8b608265772ba5df13d24071117c694bdfd1212a.zip
Add session pointer to routing infrastructure
It is nearly useless to route a XML element to an appropriate handler function if the latter has no idea how to send responses to the server or the GUI. Passing a pointer to the session solves this issue.
Diffstat (limited to 'xmpp/router_test.go')
-rw-r--r--xmpp/router_test.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/xmpp/router_test.go b/xmpp/router_test.go
index ea13712..41484c5 100644
--- a/xmpp/router_test.go
+++ b/xmpp/router_test.go
@@ -23,9 +23,10 @@ type routerTest struct {
// validated.
func TestRouter(t *testing.T) {
var testpoint int
+ var s session
- factory := func(tp *int, i int) func([]xml.Token) {
- return func([]xml.Token) {
+ factory := func(tp *int, i int) func(*session, []xml.Token) {
+ return func(*session, []xml.Token) {
*tp = i
}
}
@@ -60,7 +61,7 @@ func TestRouter(t *testing.T) {
tokens = append(tokens, xml.CopyToken(token))
}
- route(tokens, testRouting)
+ route(&s, tokens, testRouting)
if testpoint != v.value {
t.Fatalf("XML element was not routed correctly!\n")