|
|
@ -22,18 +22,20 @@ class PrivmsgHandler(CommandHandler): |
|
|
|
return |
|
|
|
|
|
|
|
out = PRIVMSG(recipient, raw_msg, prefix=client.id()) |
|
|
|
for name, other_client in server.clients_by_nick.items(): |
|
|
|
if name == recipient: |
|
|
|
if other_client.away: |
|
|
|
client.write_message( |
|
|
|
RPL_AWAY(client.nickname, name, other_client.away) |
|
|
|
) |
|
|
|
other_client.write_message(out) |
|
|
|
return |
|
|
|
|
|
|
|
for name, channel in server.channels_by_name.items(): |
|
|
|
if name == recipient: |
|
|
|
channel.write_message(out) |
|
|
|
return |
|
|
|
# Directly message a user |
|
|
|
if recipient in server.clients_by_nick: |
|
|
|
other_client = server.clients_by_nick[recipient] |
|
|
|
if other_client.away: |
|
|
|
client.write_message( |
|
|
|
RPL_AWAY(client.nickname, recipient, other_client.away) |
|
|
|
) |
|
|
|
other_client.write_message(out) |
|
|
|
return |
|
|
|
|
|
|
|
# Broadcast to channel |
|
|
|
if recipient in server.channels_by_name: |
|
|
|
server.channels_by_name[recipient].write_message(out) |
|
|
|
return |
|
|
|
|
|
|
|
client.write_message(ERR_NOSUCHNICK(client.nickname, recipient)) |