def __init__(self, core, manager): IRCInterface.__init__(self, core, manager) self.jid = JID(self.getConfig('jid')) password = self.getConfig('pw') # if bare JID is provided add a resource -- it is required if not self.jid.resource: self.jid = JID(self.jid.node, self.jid.domain, "pyLoad") if self.getConfig('tls'): tls_settings = streamtls.TLSSettings(require=True, verify_peer=False) auth = ("sasl:PLAIN", "sasl:DIGEST-MD5") else: tls_settings = None auth = ("sasl:DIGEST-MD5", "digest") # setup client with provided connection information # and identity data JabberClient.__init__(self, self.jid, password, disco_name="pyLoad XMPP Client", disco_type="bot", tls_settings=tls_settings, auth_methods=auth) self.interface_providers = [ VersionHandler(self), self, ]
def __init__(self, jid, password, password_verifier, outbox_directory): # If a bare JID is provided add a resource if not jid.resource: jid = JID(jid.node, jid.domain, "gtalkbot") # Setup client with provided connection information and identity data, # this block also handles the SSL encryption using with Google Talk tls = streamtls.TLSSettings(require=True, verify_peer=False) auth = ['sasl:PLAIN'] print u'Logging into talk network as %s' % jid JabberClient.__init__(self, jid, password, disco_name="gtalkbot", disco_type="bot", tls_settings=tls, auth_methods=auth) # Register features to be announced via Service Discovery self.disco_info.add_feature("jabber:iq:version") # Initialize the client print u'Initialize client' self.jid = jid self.passwd = password_verifier self.outbox_directory = outbox_directory
def __init__(self, jid, secret, skypeuser, skypesecret, xmppujid): dbg( "creating bundle: jid:%s secret:%s skypeuser:%s skypesecret:%s xmppujid:%s" % (jid.as_utf8(), secret, skypeuser, skypesecret, xmppujid.as_utf8()), 3) self.running = True self.attached = False # skype self.connection = CONNECTION.idle # xmppp self.jid = jid self.secret = secret self.skypeuser = skypeuser self.skypesecret = CryptoAPI().decrypt(skypesecret) self.skype_ps = None self.xmppujid = xmppujid tls = streamtls.TLSSettings(require=False, verify_peer=False) auth = ['digest'] JabberClient.__init__(self, jid, secret, disco_name="Vipadia Skype Gateway Bundle", disco_type="bot", tls_settings=tls, auth_methods=auth) self.disco_info.add_feature("jabber:iq:version")
def __init__(self, jid, password, **options): if not isinstance(jid, JID): jid = JID(jid) self.jid = jid self.rooms = {} kwargs = { 'tls_settings': streamtls.TLSSettings(require=True, verify_peer=False), 'auth_methods': ('sasl:PLAIN',), 'disco_name': "pyjirc", 'disco_type': "bot" } kwargs.update(options) JabberClient.__init__(self, jid, password, **kwargs) self.disco_info.add_feature("jabber:iq:version")
def xmpp_do(self, function): class Client(JabberClient): def session_started(self): function(self.stream) self.disconnect() tls = streamtls.TLSSettings(require=True, verify_peer=False) auth = ['sasl:PLAIN'] gtalkClient = Client(self.sid, self.spwd, tls_settings=tls, auth_methods=auth) gtalkClient.connect() try: gtalkClient.loop(1) except KeyboardInterrupt: print u'disconnecting...' gtalkClient.disconnect()
def __init__(self, config): self.config = config self.connection = CONNECTION.idle self.running = True self.jid = JID("%s@%s/%s" % (config.register, config.domain, config.register)) log("register: jid:%s" % (self.jid.as_utf8(), )) tls = streamtls.TLSSettings(require=True, verify_peer=False) auth = ['digest'] JabberClient.__init__(self, self.jid, self.config.secret, disco_name="Vipadia Skype Gateway Register", disco_type="bot", tls_settings=tls, auth_methods=auth)