diff options
Diffstat (limited to 'xmpp/stream_pair.go')
| -rw-r--r-- | xmpp/stream_pair.go | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/xmpp/stream_pair.go b/xmpp/stream_pair.go index 4690f57..87df86a 100644 --- a/xmpp/stream_pair.go +++ b/xmpp/stream_pair.go @@ -105,3 +105,27 @@ func streamFeaturesHandler(s *session, e []xml.Token) {  	log.Println("Stream has no implemented features!")  } + +func iqHandler(s *session, e []xml.Token) { +	isResult := false +	idMatches := false + +	result := xml.Attr{xml.Name{"", "type"}, "result"} +	id := xml.Attr{xml.Name{"", "id"}, s.resourceReq} + +	switch start := e[0].(type) { +	case xml.StartElement: +		for _, v := range start.Attr { +			if v == result { +				isResult = true +			} +			if v == id { +				idMatches = true +			} +		} + +		if isResult && idMatches { +			s.sendPresence() +		} +	} +} | 
