Пример #1
0
class YowsupAuth:
	def __init__(self, connection):
		self.connection = connection
		self.mechanism = AuthMechanism
		self.authenticated = False

		self.username = None
		self.password = None
		self.domain = None
		self.resource = None

		self.supportsReceiptAcks = True
		self.accountKind = None
		self.expireData = None

		self.authCallbacks = []

	def isAuthenticated(self):
		return self.authenticated

	def onAuthenticated(self, callback):
		self.authCallbacks.append(callback)

	def authenticationComplete(self):
		self.authenticated = True
		#should process callbacks

	def authenticationFailed(self):
		print "AUTH FAIL"

	def authenticate(self, username, password, domain, resource):
		print "Connecting to "+Constants.host
		#connection = ConnectionEngine()
		self.connection.connect((Constants.host, Constants.port));

		
		self.mechanism = AuthMechanism(self.connection)
		self.mechanism.setAuthObject(self)

		self.username = username
		self.password = password
		self.domain = domain
		self.resource = resource
		self.jid = "%s@%s"%(self.username,self.domain)
		
	
		
		connection = self.mechanism.login(username, password, domain, resource)
		return connection
Пример #2
0
class YowsupAuth:
	def __init__(self, connection):
		self.connection = connection
		self.mechanism = AuthMechanism
		self.authenticated = False

		self.username = None
		self.password = None
		self.domain = None
		self.resource = None

		self.supportsReceiptAcks = True
		self.accountKind = None
		self.expireData = None

		self.authCallbacks = []

	def isAuthenticated(self):
		return self.authenticated

	def onAuthenticated(self, callback):
		self.authCallbacks.append(callback)

	def authenticationComplete(self):
		self.authenticated = True
		#should process callbacks

	def authenticationFailed(self):
		print "AUTH FAIL"

	def authenticate(self, username, password, domain, resource):
		print "Connecting to "+Constants.host
		#connection = ConnectionEngine()
		self.connection.connect((Constants.host, Constants.port));

		
		self.mechanism = AuthMechanism(self.connection)
		self.mechanism.setAuthObject(self)

		self.username = username
		self.password = password
		self.domain = domain
		self.resource = resource
		self.jid = "%s@%s"%(self.username,self.domain)
		
	
		
		connection = self.mechanism.login(username, password, domain, resource)
		return connection
Пример #3
0
    def authenticate(self, username, password, domain, resource):
        print "Connecting to " + Constants.host
        #connection = ConnectionEngine()
        self.connection.connect((Constants.host, Constants.port))

        self.mechanism = AuthMechanism(self.connection)
        self.mechanism.setAuthObject(self)

        self.username = username
        self.password = password
        self.domain = domain
        self.resource = resource
        self.jid = "%s@%s" % (self.username, self.domain)

        connection = self.mechanism.login(username, password, domain, resource)
        return connection
Пример #4
0
    def authenticate(self, username, password, domain, resource):
        print "Connecting to " + Constants.host
        # connection = ConnectionEngine()
        self.connection.connect((Constants.host, Constants.port))

        self.mechanism = AuthMechanism(self.connection)
        self.mechanism.setAuthObject(self)

        self.username = username
        self.password = password
        self.domain = domain
        self.resource = resource
        self.jid = "%s@%s" % (self.username, self.domain)

        connection = self.mechanism.login(username, password, domain, resource)
        return connection