From 2e3d328fddd6b8dc04985d81cd89af07ef1c0f6a Mon Sep 17 00:00:00 2001 From: chteufleur Date: Sat, 16 Jul 2016 08:51:03 +0200 Subject: [PATCH] Send request by message if client send service-unavailable --- xmpp/xmpp.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xmpp/xmpp.go b/xmpp/xmpp.go index 6d53aa9..e81c3c1 100644 --- a/xmpp/xmpp.go +++ b/xmpp/xmpp.go @@ -4,6 +4,7 @@ import ( "git.kingpenguin.tk/chteufleur/go-xmpp.git/src/xmpp" "log" + "strings" ) const ( @@ -117,7 +118,13 @@ func processConfirm(x interface{}, client *Client) { if mesOK && mes.Error != nil { client.ChanReply <- false } else if iqOK && iq.Error != nil { - client.ChanReply <- false + if iq.Error.Condition().Local == "service-unavailable" { + // send by message if client doesn't implemente it + client.JID = strings.SplitN(client.JID, "/", 2)[0] + go client.QueryClient() + } else { + client.ChanReply <- false + } } else { client.ChanReply <- true }