本文整理汇总了Python中twisted.words.protocols.irc.IRCClient.irc_RPL_WELCOME方法的典型用法代码示例。如果您正苦于以下问题:Python IRCClient.irc_RPL_WELCOME方法的具体用法?Python IRCClient.irc_RPL_WELCOME怎么用?Python IRCClient.irc_RPL_WELCOME使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.words.protocols.irc.IRCClient
的用法示例。
在下文中一共展示了IRCClient.irc_RPL_WELCOME方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: irc_RPL_WELCOME
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import irc_RPL_WELCOME [as 别名]
def irc_RPL_WELCOME(self, prefix, params):
"""
Called when we have received the welcome from the server.
"""
IRCClient.irc_RPL_WELCOME(self, prefix, params)
示例2: irc_RPL_WELCOME
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import irc_RPL_WELCOME [as 别名]
def irc_RPL_WELCOME(self, prefix, params):
"""
Called when we have received the welcome from the server.
"""
IRCClient.irc_RPL_WELCOME(self, prefix, params)
self._fire_event(irc.on_server_welcome, prefix=prefix, params=params)
示例3: ClientTests
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import irc_RPL_WELCOME [as 别名]
#.........这里部分代码省略.........
self.protocol.register(username, hostname, servername)
self.protocol.irc_ERR_NICKNAMEINUSE('prefix', ['param'])
lastLine = self.getLastLine(self.transport)
self.assertNotEquals(lastLine, 'NICK %s' % (username,))
# Keep chaining underscores for each collision
self.protocol.irc_ERR_NICKNAMEINUSE('prefix', ['param'])
lastLine = self.getLastLine(self.transport)
self.assertEquals(lastLine, 'NICK %s' % (username + '__',))
def test_overrideAlterCollidedNick(self):
"""
L{IRCClient.alterCollidedNick} determines how a nickname is altered upon
collision while a user is trying to change to that nickname.
"""
nick = 'foo'
self.protocol.alterCollidedNick = lambda nick: nick + '***'
self.protocol.register(nick)
self.protocol.irc_ERR_NICKNAMEINUSE('prefix', ['param'])
lastLine = self.getLastLine(self.transport)
self.assertEquals(
lastLine, 'NICK %s' % (nick + '***',))
def test_nickChange(self):
"""
When a NICK command is sent after signon, C{IRCClient.nickname} is set
to the new nickname I{after} the server sends an acknowledgement.
"""
oldnick = 'foo'
newnick = 'bar'
self.protocol.register(oldnick)
self.protocol.irc_RPL_WELCOME('prefix', ['param'])
self.protocol.setNick(newnick)
self.assertEquals(self.protocol.nickname, oldnick)
self.protocol.irc_NICK('%[email protected]' % (oldnick,), [newnick])
self.assertEquals(self.protocol.nickname, newnick)
def test_erroneousNick(self):
"""
Trying to register an illegal nickname results in the default legal
nickname being set, and trying to change a nickname to an illegal
nickname results in the old nickname being kept.
"""
# Registration case: change illegal nickname to erroneousNickFallback
badnick = 'foo'
self.assertEquals(self.protocol._registered, False)
self.protocol.register(badnick)
self.protocol.irc_ERR_ERRONEUSNICKNAME('prefix', ['param'])
lastLine = self.getLastLine(self.transport)
self.assertEquals(
lastLine, 'NICK %s' % (self.protocol.erroneousNickFallback,))
self.protocol.irc_RPL_WELCOME('prefix', ['param'])
self.assertEquals(self.protocol._registered, True)
self.protocol.setNick(self.protocol.erroneousNickFallback)
self.assertEquals(
self.protocol.nickname, self.protocol.erroneousNickFallback)
# Illegal nick change attempt after registration. Fall back to the old
# nickname instead of erroneousNickFallback.
oldnick = self.protocol.nickname
self.protocol.setNick(badnick)
self.protocol.irc_ERR_ERRONEUSNICKNAME('prefix', ['param'])
lastLine = self.getLastLine(self.transport)