From 6cc8c29a6b2af58227f139e7defa938e9d158482 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 27 Jul 2004 09:52:14 +0000 Subject: [PATCH] Added dcc, to build dcc privmsgs. --- src/ircmsgs.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ircmsgs.py b/src/ircmsgs.py index 778d0fe5a..c4d300962 100644 --- a/src/ircmsgs.py +++ b/src/ircmsgs.py @@ -481,6 +481,16 @@ def privmsg(recipient, msg, prefix=''): assert msg, 'msg must not be empty.' return IrcMsg(prefix=prefix, command='PRIVMSG', args=(recipient, msg)) +def dcc(recipient, kind, *args, **kwargs): + # Stupid Python won't allow (recipient, kind, *args, prefix=''), so we have + # to use the **kwargs form. Blech. + assert ircutils.isNick(recipient), 'Can\'t DCC a channel.' + kind = kind.upper() + assert kind in ('SEND', 'CHAT', 'RESUME', 'ACCEPT'), 'Invalid DCC command.' + args.insert(0, kind) + return IrcMsg(prefix=kwargs.get('prefix', ''), command='PRIVMSG', + args=(recipient, ' '.join(args))) + def action(recipient, msg, prefix=''): """Returns a PRIVMSG ACTION to recipient with the message msg.""" if conf.supybot.protocols.irc.strictRfc():