Esempio n. 1
0
File: component.py Progetto: dax/jmc
 def __init__(
     self,
     jid,
     secret,
     server,
     port,
     config,
     config_file,
     lang=Lang(),
     account_manager_class=MailAccountManager,
     command_manager_class=MailCommandManager,
 ):
     """Use FeederComponent behavior and setup feeder and sender
     attributes.
     """
     FeederComponent.__init__(
         self,
         jid,
         secret,
         server,
         port,
         config,
         config_file,
         lang=lang,
         account_manager_class=account_manager_class,
         command_manager_class=command_manager_class,
     )
     self.tick_handlers = [MailFeederHandler(MailFeeder(self), MailSender(self))]
     self.account_manager.account_classes = (IMAPAccount, POP3Account, SMTPAccount)
     self.msg_handlers[0] += [SendMailMessageHandler(self), RootSendMailMessageHandler(self)]
     self.presence_subscribe_handlers += [[MailSubscribeHandler(self)]]
     self.presence_unsubscribe_handlers += [[MailUnsubscribeHandler(self)]]
     self.presence_available_handlers += [[MailPresenceHandler(self)]]
     self.presence_unavailable_handlers += [[MailPresenceHandler(self)]]
     self.disco_get_items_handlers[0] += [IMAPAccountDiscoGetItemsHandler(self)]
     jabber.replace_handlers(
         self.disco_get_info_handlers, CommandRootDiscoGetInfoHandler, MailRootDiscoGetInfoHandler(self)
     )
     jabber.replace_handlers(
         self.disco_get_info_handlers, AccountTypeDiscoGetInfoHandler, MailAccountTypeDiscoGetInfoHandler(self)
     )
     jabber.replace_handlers(
         self.disco_get_info_handlers, AccountDiscoGetInfoHandler, IMAPAccountDiscoGetInfoHandler(self)
     )