Compare channels by their names
- Talking in #ircdocs, a channel name is unique when server case mapping is applied. - In short, #abc == #abc, #Abc != #abc
This commit is contained in:
parent
879580ccde
commit
30345b81fd
|
@ -10,8 +10,8 @@ namespace ChatSharp.Handlers
|
|||
{
|
||||
public static void HandleJoin(IrcClient client, IrcMessage message)
|
||||
{
|
||||
var channel = client.Channels.GetOrAdd(message.Parameters[0]);
|
||||
var user = client.Users.GetOrAdd(message.Prefix);
|
||||
var channel = client.Channels.GetOrAdd(message.Parameters[0]);
|
||||
|
||||
if (channel != null)
|
||||
{
|
||||
|
|
|
@ -107,5 +107,34 @@ namespace ChatSharp
|
|||
{
|
||||
Client.ChangeMode(Name, change);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if this channel is equal to another (compares names).
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool Equals(IrcChannel other)
|
||||
{
|
||||
return other.Name == Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if this channel is equal to another (compares names).
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is IrcChannel)
|
||||
return Equals((IrcChannel)obj);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the hash code of the channel's name.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue