[smuxi: 6/7] Engine-XMPP: fixed MUC joins with modified/forced nick by the server



commit 1db75aeea09dd2f52f3bfeb3b37baa8a983c0c5a
Author: Mirco Bauer <meebey meebey net>
Date:   Wed May 14 22:27:49 2014 +0200

    Engine-XMPP: fixed MUC joins with modified/forced nick by the server

 .../Protocols/Xmpp/XmppProtocolManager.cs          |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/Engine-XMPP/Protocols/Xmpp/XmppProtocolManager.cs 
b/src/Engine-XMPP/Protocols/Xmpp/XmppProtocolManager.cs
index a9084fc..553fa77 100644
--- a/src/Engine-XMPP/Protocols/Xmpp/XmppProtocolManager.cs
+++ b/src/Engine-XMPP/Protocols/Xmpp/XmppProtocolManager.cs
@@ -1825,7 +1825,13 @@ namespace Smuxi.Engine
                     chat.UnsafePersons.Add(person.ID, person);
 
                     // did I join? then the chat roster is fully received
-                    if (pres.From.Resource == chat.OwnNickname) {
+                    if (pres.From.Resource == chat.OwnNickname ||
+                        pres.MucUser.StatusCodes.Exists(x => x.Code == StatusCode.SelfPresence)) {
+                        if (pres.MucUser.StatusCodes.Exists(x => x.Code == StatusCode.ModifiedNick)) {
+                            // as per XEP-0045 7.2.3 Example 24 the server is
+                            // allowed to give us a different nick than we requested
+                            chat.OwnNickname = pres.From.Resource;
+                        }
                         chat.IsJoining = false;
                         // HACK: lower probability of sync race condition swallowing messages
                         ThreadPool.QueueUserWorkItem(delegate {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]