Пример #1
0
 def pm_command(self, message=None):
     if self.set_chat_and_user(message):
         arg = message.arg.strip()
         space = arg.find(' ')
         to = arg[:space]
         msg = arg[space+1:]
         user = User.user(to)
         if user == None:
             user = User.user_from_nick(to)
         if user != None:
             xmpp.send_message(user.address, messages.PRIVATE_MESSAGE % (self.sender.nickname, msg), message.to)
         else:
             logging.info("Failed PM from '%s' to '%s' in channel '%s'." % (self.sender.nickname, to, self.chat))
             message.reply(messages.SYSTEM_MESSAGE % "No such user")
Пример #2
0
 def pm_command(self, message=None):
     if self.set_chat_and_user(message):
         arg = message.arg.strip()
         space = arg.find(' ')
         to = arg[:space]
         msg = arg[space + 1:]
         user = User.user(to)
         if user == None:
             user = User.user_from_nick(to)
         if user != None:
             xmpp.send_message(
                 user.address,
                 messages.PRIVATE_MESSAGE % (self.sender.nickname, msg),
                 message.to)
         else:
             logging.info("Failed PM from '%s' to '%s' in channel '%s'." %
                          (self.sender.nickname, to, self.chat))
             message.reply(messages.SYSTEM_MESSAGE % "No such user")
Пример #3
0
 def test_user_from_nick(self):
     '''Retrieve a user using the nick name'''
     self.assertEqual(self.user.key(),
                      User.user_from_nick(self.user.nickname).key())