MUC: do not destroy previous room invitation to create a new one
authorMikael Berthe <mikael@lilotux.net>
Sat, 25 Aug 2012 15:40:50 +0200
changeset 2026 564d99cdf0d1
parent 2025 33426f7fb4a9
child 2027 107d39cd968b
MUC: do not destroy previous room invitation to create a new one If a previous similar mediated invitation exists, we do not remove it to create a new one (it's very confusing) unless the new one looks better, e.g. if the new invitation allows us to decline the invitation and the old one did not.
mcabber/mcabber/xmpp_muc.c
--- a/mcabber/mcabber/xmpp_muc.c	Sat Aug 25 12:05:31 2012 +0200
+++ b/mcabber/mcabber/xmpp_muc.c	Sat Aug 25 15:40:50 2012 +0200
@@ -787,6 +787,13 @@
       iel = iel -> next;
       if (!g_strcmp0(to, invitation->to) &&
           !g_strcmp0(passwd, invitation->passwd)) {
+        // found a previous invitation
+        // We keep the old one, unless the current one is better and allows us
+        // to send a reply.
+        if (!reply || invitation->reply) {
+          g_free(barejid);
+          return;
+        }
         scr_LogPrint(LPRINT_DEBUG, "Destroying previous invitation event %s.",
                      invitation->evid);
         evs_del(invitation->evid);