Example #1
0
    def __init__(self, options = None, extra_args = None):
        """
        Create a new aMSN Core. It takes an options class as argument
        which has a variable for each option the core is supposed to received.
        This is easier done using optparse.
        The options supported are :
           options.account = the account's username to use
           options.password = the account's password to use
           options.front_end = the front end's name to use
           options.debug_protocol = whether or not to enable protocol debug output
           options.debug_amsn2 = whether or not to enable amsn2 debug output
           options.auto_login = whether to autologin with the credentials given
        """
        self.__dict__ = self.__shared_state
        if options:
            self.extra_args = extra_args
            self.p2s = {papyon.Presence.ONLINE:"online",
                        papyon.Presence.BUSY:"busy",
                        papyon.Presence.IDLE:"idle",
                        papyon.Presence.AWAY:"away",
                        papyon.Presence.BE_RIGHT_BACK:"brb",
                        papyon.Presence.ON_THE_PHONE:"phone",
                        papyon.Presence.OUT_TO_LUNCH:"lunch",
                        papyon.Presence.INVISIBLE:"hidden",
                        papyon.Presence.OFFLINE:"offline"}
            self.Presence = papyon.Presence

            self._options = options
            self._ui_name = None
            self._loop = None
            self._main = None
            self._account = None

            self._event_manager = aMSNEventManager(self)
            self._backend_manager = aMSNBackendManager(self)
            self._account_manager = aMSNAccountManager(self, options)
            self._theme_manager = aMSNThemeManager(self)
            self._smiley_manager = aMSNSmileyManager(self)
            self._contactlist_manager = aMSNContactListManager(self)
            self._oim_manager = aMSNOIMManager(self)
            self._conversation_manager = aMSNConversationManager(self)
            self._personalinfo_manager = aMSNPersonalInfoManager(self)
            self._ui_manager = aMSNUserInterfaceManager(self)

            # TODO: redirect the logs somewhere, something like ctrl-s ctrl-d for amsn-0.9x
            logging.basicConfig(level=logging.WARNING)

            if self._options.debug_protocol:
                papyon_logger.setLevel(logging.DEBUG)
            else:
                papyon_logger.setLevel(logging.WARNING)

            if self._options.debug_amsn2:
                logger.setLevel(logging.DEBUG)
            else:
                logger.setLevel(logging.WARNING)

            self.load_UI(self._options.front_end)
Example #2
0
    def __init__(self, options):
        """
        Create a new aMSN Core. It takes an options class as argument
        which has a variable for each option the core is supposed to received.
        This is easier done using optparse.
        The options supported are :
           options.account = the account's username to use
           options.password = the account's password to use
           options.front_end = the front end's name to use
           options.debug = whether or not to enable debug output
        """
        self.p2s = {
            papyon.Presence.ONLINE: "online",
            papyon.Presence.BUSY: "busy",
            papyon.Presence.IDLE: "idle",
            papyon.Presence.AWAY: "away",
            papyon.Presence.BE_RIGHT_BACK: "brb",
            papyon.Presence.ON_THE_PHONE: "phone",
            papyon.Presence.OUT_TO_LUNCH: "lunch",
            papyon.Presence.INVISIBLE: "hidden",
            papyon.Presence.OFFLINE: "offline"
        }
        self.Presence = papyon.Presence

        self._event_manager = aMSNEventManager(self)
        self._options = options

        self._gui_name = None
        self._gui = None
        self._loop = None
        self._main = None
        self._account = None
        self.loadUI(self._options.front_end)

        self._backend_manager = aMSNBackendManager(self)
        self._account_manager = aMSNAccountManager(self, options)
        self._theme_manager = aMSNThemeManager(self)
        self._contactlist_manager = aMSNContactListManager(self)
        self._oim_manager = aMSNOIMManager(self)
        self._conversation_manager = aMSNConversationManager(self)
        self._personalinfo_manager = aMSNPersonalInfoManager(self)

        # TODO: redirect the logs somewhere, something like ctrl-s ctrl-d for amsn-0.9x
        logging.basicConfig(level=logging.WARNING)

        if self._options.debug_protocol:
            papyon_logger.setLevel(logging.DEBUG)
        else:
            papyon_logger.setLevel(logging.WARNING)

        if self._options.debug_amsn2:
            logger.setLevel(logging.DEBUG)
        else:
            logger.setLevel(logging.WARNING)
Example #3
0
    def __init__(self, options):
        """
        Create a new aMSN Core. It takes an options class as argument
        which has a variable for each option the core is supposed to received.
        This is easier done using optparse.
        The options supported are :
           options.account = the account's username to use
           options.password = the account's password to use
           options.front_end = the front end's name to use
           options.debug = whether or not to enable debug output
        """
        self._event_manager = aMSNEventManager(self)
        self._options = options

        self._gui_name = None
        self._gui = None
        self._loop = None
        self._main = None
        self.loadUI(self._options.front_end)

        self._backend_manager = aMSNBackendManager()
        self._account_manager = aMSNAccountManager(self, options)
        self._account = None
        self._theme_manager = aMSNThemeManager()
        self._contactlist_manager = aMSNContactListManager(self)
        self._oim_manager = aMSNOIMManager(self)
        self._conversation_manager = aMSNConversationManager(self)
        self._personalinfo_manager = aMSNPersonalInfoManager(self)

        self.p2s = {
            papyon.Presence.ONLINE: "online",
            papyon.Presence.BUSY: "busy",
            papyon.Presence.IDLE: "idle",
            papyon.Presence.AWAY: "away",
            papyon.Presence.BE_RIGHT_BACK: "brb",
            papyon.Presence.ON_THE_PHONE: "phone",
            papyon.Presence.OUT_TO_LUNCH: "lunch",
            papyon.Presence.INVISIBLE: "hidden",
            papyon.Presence.OFFLINE: "offline",
        }

        import logging

        if self._options.debug:
            logging.basicConfig(level=logging.DEBUG)
        else:
            logging.basicConfig(level=logging.WARNING)