diff options
Diffstat (limited to 'src/irc.cpp')
-rw-r--r-- | src/irc.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/irc.cpp b/src/irc.cpp index 237497055d..f20152495e 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -12,7 +12,6 @@ using namespace std; using namespace boost; int nGotIRCAddresses = 0; -bool fGotExternalIP = false; void ThreadIRCSeed2(void* parg); @@ -216,7 +215,6 @@ void ThreadIRCSeed2(void* parg) printf("ThreadIRCSeed started\n"); int nErrorWait = 10; int nRetryWait = 10; - bool fNameInUse = false; while (!fShutdown) { @@ -248,9 +246,10 @@ void ThreadIRCSeed2(void* parg) return; } + CNetAddr addrLocal; string strMyName; - if (addrLocalHost.IsRoutable() && !fUseProxy && !fNameInUse) - strMyName = EncodeAddress(addrLocalHost); + if (GetLocal(addrLocal, &addrConnect)) + strMyName = EncodeAddress(GetLocalAddress(&addrConnect)); else strMyName = strprintf("x%u", GetRand(1000000000)); @@ -265,7 +264,6 @@ void ThreadIRCSeed2(void* parg) if (nRet == 2) { printf("IRC name already in use\n"); - fNameInUse = true; Wait(10); continue; } @@ -285,9 +283,8 @@ void ThreadIRCSeed2(void* parg) if (!fUseProxy && addrFromIRC.IsRoutable()) { // IRC lets you to re-nick - fGotExternalIP = true; - addrLocalHost.SetIP(addrFromIRC); - strMyName = EncodeAddress(addrLocalHost); + AddLocal(addrFromIRC, LOCAL_IRC); + strMyName = EncodeAddress(GetLocalAddress(&addrConnect)); Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str()); } } |