Skip to content

Commit

Permalink
Merge pull request #190 from jpneverwas/commas
Browse files Browse the repository at this point in the history
Allow comma-separated chans in server userlist JOIN
  • Loading branch information
gawel authored Feb 16, 2021
2 parents 79ac499 + 3c3eca5 commit 2d7d65c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
21 changes: 12 additions & 9 deletions irc3d/plugins/userlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,18 @@ def JOIN(self, client, args=None, **kwargs):
%%JOIN <channel>
"""
if args['<channel>'] in client.channels:
return
message = ':{mask} JOIN {<channel>}'
kwargs.update(
broadcast=message.format(mask=client.mask, **args),
channel=args['<channel>'])
self.join(client.nick, client.mask, client=client, **kwargs)
client.channels.add(args['<channel>'])
self.NAMES(client=client, **kwargs)
for channel in args['<channel>'].split(','):
if channel in client.channels:
continue
message = ':{mask} JOIN {<channel>}'
kwargs.update(
broadcast=message.format(
mask=client.mask, **dict(args, **{'<channel>': channel})
),
channel=channel)
self.join(client.nick, client.mask, client=client, **kwargs)
client.channels.add(channel)
self.NAMES(client=client, **kwargs)

@irc3d.command
def PART(self, client, args=None, **kwargs):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_irc3d_userlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_userlist(self):
self.assertSent(s.client2, ':[email protected] NICK irc3')
self.assertNotSent(s.client3, ':[email protected] NICK irc3')

s.client3.dispatch('JOIN #irc')
s.client3.dispatch('JOIN #irc,#irc3')
s.client1.dispatch('NICK client1')
self.assertSent(s.client1, ':[email protected] NICK client1')
self.assertSent(s.client2, ':[email protected] NICK client1')
Expand Down Expand Up @@ -116,6 +116,7 @@ def test_userlist(self):
self.assertSent(s.client1, ':irc.com 319 client1 :#irc3')

s.client3.dispatch('PART #irc :Bye')
s.client3.dispatch('PART #irc3 :Bye')
self.assertSent(s.client3, ':{mask} PART #irc :Bye', s.client3)
self.assertSent(s.client1, ':{mask} PART #irc :Bye', s.client3)
self.assertNotSent(s.client2, ':{mask} PART #irc :Bye', s.client3)
Expand Down

0 comments on commit 2d7d65c

Please sign in to comment.