Ejemplo n.º 1
0
    def get_passwd(self, jid):
        """Get the password from the config or user.

        @param jid: The JID this password is for.
        @type jid: C{pyxmpp.jid.JID}

        """
        passw = _conf.xmpp["password"]
        if not passw:
            try:
                msg = u"Please enter the password for %s: " % unicode(jid)
                passw = c.getpass(msg)
            except (EOFError, IOError):
                passw = u""
                c.stdout_block("\n")
        return passw
Ejemplo n.º 2
0
    def run(self):
        """Take over the stdin and do nifty stuff... etc.

        This method is called as a seperate thread from the main script so it
        must be thread-safe.

        """
        c.stdout_block(USAGE)
        self.idnty.set_AI(aihandler.get_oneonone(self.def_AI)(self.idnty))
        try:
            while not self.halt:
                # The AI can change at run-time.
                ai = self.idnty.get_AI()
                ai.handle(c.stdin(u"<%s> " % self.idnty))
        except EOFError:
            c.stdout_block(u"\n")