Fixed a bug relating to changing nicknames and message origin in the IRC module.
This commit is contained in:
parent
7f6633a06f
commit
1047c4414c
1 changed files with 12 additions and 1 deletions
|
|
@ -255,8 +255,15 @@ proc processLine(irc: var TIRC, line: string): TIRCEvent =
|
||||||
irc.lastPong = epochTime()
|
irc.lastPong = epochTime()
|
||||||
if result.cmd == MNumeric:
|
if result.cmd == MNumeric:
|
||||||
if result.numeric == "001":
|
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):
|
for chan in items(irc.channelsToJoin):
|
||||||
irc.join(chan)
|
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 =
|
proc processOther(irc: var TIRC, ev: var TIRCEvent): bool =
|
||||||
result = false
|
result = false
|
||||||
|
|
@ -313,6 +320,10 @@ proc isConnected*(irc: var TIRC): bool =
|
||||||
## Returns whether this IRC client is connected to an IRC server.
|
## Returns whether this IRC client is connected to an IRC server.
|
||||||
return irc.status == SockConnected
|
return irc.status == SockConnected
|
||||||
|
|
||||||
|
proc getNick*(irc: var TIRC): string =
|
||||||
|
## Returns the current nickname of the client.
|
||||||
|
return irc.nick
|
||||||
|
|
||||||
# -- Asyncio dispatcher
|
# -- Asyncio dispatcher
|
||||||
|
|
||||||
proc connect*(irc: PAsyncIRC) =
|
proc connect*(irc: PAsyncIRC) =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue