~sircmpwn/ChatSharp

630d436de13469c56ca8615615bcf86aa3e51966 — Drew DeVault 4 years ago 274a572 + 6894e89
Merge pull request #91 from RockyTV/caps

Add support for chghost cap
M ChatSharp/Handlers/MessageHandlers.cs => ChatSharp/Handlers/MessageHandlers.cs +1 -0
@@ 48,6 48,7 @@ namespace ChatSharp.Handlers
            client.SetHandler("330", UserHandlers.HandleWhoIsLoggedInAs);
            client.SetHandler("354", UserHandlers.HandleWhox);
            client.SetHandler("ACCOUNT", UserHandlers.HandleAccount);
            client.SetHandler("CHGHOST", UserHandlers.HandleChangeHost);

            // Listing handlers
            client.SetHandler("367", ListingHandlers.HandleBanListPart);

M ChatSharp/Handlers/UserHandlers.cs => ChatSharp/Handlers/UserHandlers.cs +17 -0
@@ 204,5 204,22 @@ namespace ChatSharp.Handlers
            var user = client.Users.GetOrAdd(message.Prefix);
            user.Account = message.Parameters[0];
        }

        public static void HandleChangeHost(IrcClient client, IrcMessage message)
        {
            var user = client.Users.Get(message.Prefix);

            // Only handle CHGHOST for users we know
            if (user != null)
            {
                var newIdent = message.Parameters[0];
                var newHostname = message.Parameters[1];

                if (user.User != newIdent)
                    user.User = newIdent;
                if (user.Hostname != newHostname)
                    user.Hostname = newHostname;
            }
        }
    }
}

M ChatSharp/IrcClient.cs => ChatSharp/IrcClient.cs +1 -1
@@ 169,7 169,7 @@ namespace ChatSharp
            // List of supported capabilities
            Capabilities.AddRange(new string[] {
                "server-time", "multi-prefix", "cap-notify", "znc.in/server-time", "znc.in/server-time-iso",
                "account-notify"
                "account-notify", "chghost"
            });

            IsNegotiatingCapabilities = false;