summarylogtreecommitdiffstats
path: root/0003-Catch-presence-error-when-joining-MUC.patch
blob: ec1b05f19b25e848ac6152f3d8ad945f52651acf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From a18f290da33301433db6cea8a0b7eddce42d4e4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Thu, 5 Sep 2019 23:57:05 +0200
Subject: [PATCH 3/6] Catch presence error when joining MUC
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 src/xmpp.rs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/xmpp.rs b/src/xmpp.rs
index 0eafdce..3952e64 100644
--- a/src/xmpp.rs
+++ b/src/xmpp.rs
@@ -33,8 +33,14 @@ impl Agent {
                             .unwrap();
                     }
                     Event::Stanza(el) => {
-                        if el.name() == "presence" && el.attr("from") == Some(&muc_jid_str) {
-                            info!("Entered MUC {}", muc_jid);
+                        if el.is("presence", "jabber:client") {
+                            if el.attr("from") == Some(&muc_jid_str) {
+                                if el.attr("type") == PresenceType::Error {
+                                    info!("Failed to enter MUC {:?}", muc_jid);
+                                } else {
+                                    info!("Entered MUC {:?}", muc_jid);
+                                }
+                            }
                         }
                     }
                     _ => {}
-- 
2.23.0