Exemple #1
0
 def _handle_command(self, command):
     cmd = wireproto.decode(command)
     if cmd.command in self._command_handlers:
         self._command_handlers[cmd.command](cmd)
     else:
         print 'Ignored %s' % cmd.command
     if cmd.command == '376':
         self._conn.output(wireproto.encode('QUIT'))
Exemple #2
0
 def testDecoding(self):
     """Message decoding"""
     self.checkMessage(
         wireproto.decode('PRIVMSG foo bar'),
         command='PRIVMSG', args=['foo', 'bar'])
     self.checkMessage(
         wireproto.decode('PRIVMSG foo :bar baz'),
         command='PRIVMSG', args=['foo', 'bar baz'], colon_arg=True)
     self.checkMessage(
         wireproto.decode(':irc.server.com 353 foo :bar baz'),
         hostmask='irc.server.com', host='irc.server.com',
         command='353', args=['foo', 'bar baz'], colon_arg=True)
     self.checkMessage(
         wireproto.decode(':Dave`[email protected] PRIVMSG #foo :Hi !'),
         hostmask='Dave`[email protected]', nick='Dave`', user='******',
         host='natulte.net', command='PRIVMSG', args=['#foo', 'Hi !'],
         colon_arg=True)