Ticket #3910: t.w.p.irc-action.patch
File t.w.p.irc-action.patch, 2.5 KB (added by , 12 years ago) |
---|
-
twisted/words/test/test_irc.py
class ClientTests(TestCase): 723 723 username, hostname, servername, self.protocol.realname), 724 724 ''] 725 725 self.assertEquals(self.transport.value().split('\r\n'), expected) 726 727 def test_describe(self): 728 target = 'foo' 729 channel = 'bar' 730 action = 'waves' 731 self.protocol.describe(target, action) 732 self.protocol.describe(channel, action) 733 expected = [ 734 'PRIVMSG %s :\01ACTION %s\01' % (target, action), 735 'PRIVMSG %s :\01ACTION %s\01' % (channel, action), 736 ''] 737 self.assertEquals(self.transport.value().split('\r\n'), expected) -
twisted/words/protocols/irc.py
Test coverage needs to be better. 30 30 31 31 import errno, os, random, re, stat, struct, sys, time, types, traceback 32 32 import string, socket 33 import warnings 33 34 from os import path 34 35 35 36 from twisted.internet import reactor, protocol … … class IRCClient(basic.LineReceiver): 1067 1068 1068 1069 ### user input commands, client->client 1069 1070 1071 def describe(self, channel, action): 1072 """ 1073 Strike a pose. 1074 1075 @type channel: C{str} 1076 @param channel: The name of the channel to have an action on. If it 1077 has no prefix, it is sent to the user of that name. 1078 @type action: C{str} 1079 @param action: The action to preform. 1080 """ 1081 self.ctcpMakeQuery(channel, [('ACTION', action)]) 1082 1070 1083 def me(self, channel, action): 1071 1084 """ 1072 1085 Strike a pose. 1073 1086 1087 This function is deprecated. Use describe(). 1088 1074 1089 @type channel: C{str} 1075 1090 @param channel: The name of the channel to have an action on. If it 1076 1091 has no prefix, C{'#'} will to prepended to it. 1077 1092 @type action: C{str} 1078 1093 @param action: The action to preform. 1079 1094 """ 1095 warnings.warn("me() is deprecated. Use IRCClient.describe().", 1096 DeprecationWarning, stacklevel=2) 1097 1080 1098 if channel[0] not in '&#!+': channel = '#' + channel 1081 self. ctcpMakeQuery(channel, [('ACTION', action)])1099 self.describe(channel, action) 1082 1100 1083 1101 _pings = None 1084 1102 _MAX_PINGRING = 12