Added a ClientSettings field to specify whether a random nickname should be generated and added a check in IrcUser constructor if there is a hostname included
This commit is contained in:
parent
78583783f1
commit
701f702436
|
@ -11,6 +11,7 @@ namespace ChatSharp
|
|||
{
|
||||
WhoIsOnConnect = true;
|
||||
ModeOnJoin = true;
|
||||
GenerateRandomNickIfRefused = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -24,5 +25,9 @@ namespace ChatSharp
|
|||
/// IrcChannel.Mode will be null until the mode is explicitly requested.
|
||||
/// </summary>
|
||||
public bool ModeOnJoin { get; set; }
|
||||
/// <summary>
|
||||
/// If true, the library will generate a random nick with alphanumerical characters if it
|
||||
/// encounters a NICK error.
|
||||
public bool GenerateRandomNickIfRefused { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace ChatSharp.Handlers
|
|||
if (message.Command == "433") // Nick in use
|
||||
client.OnNickInUse(eventArgs);
|
||||
// else ... TODO
|
||||
if (!eventArgs.DoNotHandle)
|
||||
if (!eventArgs.DoNotHandle && client.Settings.GenerateRandomNickIfRefused)
|
||||
client.Nick(eventArgs.NewNick);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,14 @@ namespace ChatSharp
|
|||
string[] mask = host.Split('@', '!');
|
||||
Nick = mask[0];
|
||||
User = mask[1];
|
||||
Hostname = mask[2];
|
||||
if (mask.Length <= 2)
|
||||
{
|
||||
Hostname = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
Hostname = mask[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue