Fixed issue with irc auto rename.
This commit is contained in:
@@ -32,6 +32,9 @@ using namespace std;
|
|||||||
#define IRC_WAIT_TERMINATION_MSEC 500
|
#define IRC_WAIT_TERMINATION_MSEC 500
|
||||||
#define IRC_MAX_RENAME_TRIES 5
|
#define IRC_MAX_RENAME_TRIES 5
|
||||||
|
|
||||||
|
#define IRC_RENAME_ATTACH "|Lobby"
|
||||||
|
#define IRC_MAX_NICK_LEN 16
|
||||||
|
|
||||||
|
|
||||||
struct IrcContext
|
struct IrcContext
|
||||||
{
|
{
|
||||||
@@ -55,9 +58,11 @@ void irc_auto_rename_nick(irc_session_t *session)
|
|||||||
{
|
{
|
||||||
// Automatically rename the nick on collision.
|
// Automatically rename the nick on collision.
|
||||||
// First: Try to append the string "Lobby".
|
// First: Try to append the string "Lobby".
|
||||||
if (context->nick.find("|Lobby") == string::npos)
|
if (context->nick.find(IRC_RENAME_ATTACH) == string::npos)
|
||||||
{
|
{
|
||||||
context->nick = context->nick + "|Lobby";
|
if (context->nick.length() + (sizeof(IRC_RENAME_ATTACH)) > IRC_MAX_NICK_LEN)
|
||||||
|
context->nick = context->nick.substr(0, IRC_MAX_NICK_LEN - (sizeof(IRC_RENAME_ATTACH)));
|
||||||
|
context->nick = context->nick + IRC_RENAME_ATTACH;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user