Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix irc server example #265

Merged
merged 3 commits into from Jul 1, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Implement LIST command

  • Loading branch information...
spaceone committed Jan 9, 2019
commit 9608d77d072371e9ef58e31c71cfdc31d493fd5b
@@ -138,6 +138,10 @@ def RPL_WHOISCHANNELS(nick, channels):
return _M(u("319"), nick, u(":{0}".format(u(" ").join(channels))))


def RPL_LISTSTART(header=None):
return _M(u("321"), header or u("Channels :Users Name"))


def RPL_LIST(channel, nvisible, topic):
return _M(u("322"), channel, u("{0}").format(nvisible), topic)

@@ -24,7 +24,7 @@
ERR_NICKNAMEINUSE, ERR_NOMOTD, ERR_NOSUCHCHANNEL, ERR_NOSUCHNICK,
ERR_UNKNOWNCOMMAND, RPL_ENDOFNAMES, RPL_ENDOFWHO, RPL_NAMEREPLY,
RPL_NOTOPIC, RPL_TOPIC, RPL_WELCOME, RPL_WHOREPLY, RPL_YOURHOST,
RPL_CHANNELMODEIS,
RPL_CHANNELMODEIS, RPL_LISTSTART, RPL_LIST, RPL_LISTEND,
)

__version__ = "0.0.1"
@@ -358,6 +358,12 @@ def mode(self, sock, source, mask, mode=None, params=None):
elif mask not in self.users:
return self.fire(reply(sock, ERR_NOSUCHNICK(mask)))

def list(self, sock, source):
self.fire(reply(sock, RPL_LISTSTART()))
for channel in self.channels.values():
self.fire(reply(sock, RPL_LIST(channel, str(len(channel.users)), channel.topic or '')))
self.fire(reply(sock, RPL_LISTEND()))

@property
def commands(self):
exclude = {"ready", "connect", "disconnect", "read", "write"}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.