summaryrefslogtreecommitdiff
path: root/xmpp/router.go
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp/router.go')
-rw-r--r--xmpp/router.go40
1 files changed, 0 insertions, 40 deletions
diff --git a/xmpp/router.go b/xmpp/router.go
deleted file mode 100644
index d437b28..0000000
--- a/xmpp/router.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package xmpp
-
-import (
- "encoding/xml"
-)
-
-// routingTable is a data structure which contains routing information for XML
-// elements. The xml.StartElement at the beginning of an XML element has a name
-// containing the XML namespace and a local name. Based on this compisition
-// which forms the xml.Name the appropriate handler function is defined by each
-// entry of the routingTable.
-type routingTable []struct {
- name xml.Name
- handler func(s *xml.StartElement, d *xml.Decoder, c chan<- any)
-}
-
-// getRoutingTable returns the routing table used in
-// xengineering.eu/limox/xmpp. Since Go does not allow such a datatype as a
-// constant such a function is a simple yet inefficient approach to guarantee
-// that an unmodified routing table is delivered to each user. A global
-// variable would have the problem that it could be altered during execution.
-func getRoutingTable() routingTable {
- return routingTable{
- {xml.Name{`http://etherx.jabber.org/streams`, `features`}, streamFeaturesHandler},
-// {xml.Name{`urn:ietf:params:xml:ns:xmpp-sasl`, `success`}, saslSuccessHandler},
-// {xml.Name{`urn:ietf:params:xml:ns:xmpp-sasl`, `failure`}, saslFailureHandler},
-// {xml.Name{`jabber:client`, `iq`}, iqHandler},
- }
-}
-
-// route determines the correct handler function for the given XML element by a
-// given routingTable. In addition it executes the determined handler function.
-// If no handler function is found an error message is send via the log module.
-func route(s *xml.StartElement, d *xml.Decoder, c chan<- any, t routingTable) {
- for _, v := range t {
- if v.name == (*s).Name {
- v.handler(s, d, c)
- }
- }
-}