Twisted IRCClient - 使用原始数据而不破坏类方法?
我正在使用 Twisted IRCClient 模块开发一个程序,但遇到了一些问题。该类中有多个可以重载的方法,例如当客户端登录到服务器时,或者当客户端从服务器接收 MOTD 时。然而,似乎没有任何方法可以处理来自服务器本身的消息,或者响应具有需要发送回服务器的随机数的 ping 查询。
理想情况下,我可以使用类的 lineReceived 方法,使用来自服务器的原始数据自己实现这些方法。然而,似乎当 lineReceived 方法被传入线路调用时,它会吞噬该线路,并且其他类回调永远不会触发。有办法解决这个问题吗?谢谢。
I'm working on a program using the Twisted IRCClient module, and am having a bit of a problem. There are several methods in the class that can be overloaded, for say when the client signs on to a server, or when the client receives a MOTD from a server. However, there don't seem to be any methods to deal with messages from the server itself, or to respond to ping queries that have a random number that needs to be sent back to the server.
Ideally I could implement these methods myself with the raw data from the server, using the lineReceived method of the class. However, it seems that when the lineReceived method is called by an incoming line, it gobbles up the line and the other class callbacks never fire. Is there a way around this problem? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,请参阅 'METHODNAME' 作为客户端方法与 irc_'METHODNAME'在twisted 中了解了
IRCClient
如何调度消息。然后,看一下irc_PING
(它已经实现,并且已经做了正确的事情)。其他服务器消息通过其他类似的回调方法进行处理。
First, see 'METHODNAME' as Client method versus irc_'METHODNAME' in twisted for an explanation of how
IRCClient
dispatches messages. Then, take a look atirc_PING
(which is already implemented, and already does the right thing).Other server messages are handled via other similar callback methods.