Fixed a bug relating to changing nicknames and message origin in the IRC module.

This commit is contained in:
Dominik Picheta
2012-11-17 21:16:27 +00:00
parent 7f6633a06f
commit 1047c4414c

View File

@@ -255,9 +255,16 @@ proc processLine(irc: var TIRC, line: string): TIRCEvent =
irc.lastPong = epochTime()
if result.cmd == MNumeric:
if result.numeric == "001":
# Check the nickname.
if irc.nick != result.params[0]:
assert ' ' notin result.params[0]
irc.nick = result.params[0]
for chan in items(irc.channelsToJoin):
irc.join(chan)
if result.cmd == MNick:
if result.nick == irc.nick:
irc.nick = result.params[0]
proc processOther(irc: var TIRC, ev: var TIRCEvent): bool =
result = false
if epochTime() - irc.lastPing >= 20.0:
@@ -313,6 +320,10 @@ proc isConnected*(irc: var TIRC): bool =
## Returns whether this IRC client is connected to an IRC server.
return irc.status == SockConnected
proc getNick*(irc: var TIRC): string =
## Returns the current nickname of the client.
return irc.nick
# -- Asyncio dispatcher
proc connect*(irc: PAsyncIRC) =