Example #1
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)
        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler('message', self.message)
        self.add_event_handler("alert", self.alert)
        self.add_event_handler('wait_presence', self.wait_presence)
        self.add_event_handler('new_user_add', self.new_user_add)
        self.add_event_handler('online', self.online)

        self.user = jid[0:-14]
        self.received = set()
        self.contacts = []
        self.presedence = threading.Event()
        self.rooms = {}
        self.counter = 1

        self.register_plugin('xep_0030') # Service Discovery
        self.register_plugin('xep_0199') # XMPP Ping
        self.register_plugin('xep_0045') # Mulit-User Chat (MUC)
        self.register_plugin('xep_0004') # Data forms
        self.register_plugin('xep_0077') # In-band Registration
        self.register_plugin('xep_0066') # Out-of-band Data
        self.register_plugin('xep_0096') # File transfer 
        self.register_plugin('xep_0047', {
            'auto_accept': True
        })
Example #2
0
 def __init__(self, jid, password):
     ClientXMPP.__init__(self, jid, password)
     self.add_event_handler('session_start', self.start)
     self.add_event_handler('message', self.message)
     self.schedule('Check mail', 10, self._check_mail, repeat=True)
     self.register_plugin('xep_0030')
     self.register_plugin('xep_0199')
Example #3
0
 def __init__(self, jid, password, filename, shorten_url):
     ClientXMPP.__init__(self, jid, password)
     self.add_event_handler("session_start", self.session_start)
     self.register_plugin('xep_0030')  # Service Discovery
     self.register_plugin("xep_0363")  # HTTP File Upload
     self.filename = filename
     self.shorten_url = shorten_url
Example #4
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)

        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message)
        self.last_state = False
        self.last_check = 0
    def __init__(self, jid, password, username):
        ClientXMPP.__init__(self, jid, password)
        self.nick = username

        #Eventos a utilizar
        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler('message', self.message)
        self.add_event_handler("changed_status", self.wait_for_presences)
        self.add_event_handler('presence_subscribe', self.new_user_suscribed)
        self.add_event_handler("changed_subscription",
                               self.friend_notification)

        self.received = set()
        self.contacts = []
        self.presences_received = threading.Event()

        #Plugins
        self.register_plugin('xep_0030')  # Service Discovery
        self.register_plugin('xep_0199')  # XMPP Ping
        self.register_plugin('xep_0045')  # Mulit-User Chat (MUC)
        self.register_plugin('xep_0004')  # Data forms
        self.register_plugin('xep_0077')  # In-band Registration
        self.register_plugin('xep_0066')  # Out-of-band Data
        self.register_plugin('xep_0096')  # File transfer
        self.register_plugin('xep_0030')
        self.register_plugin('xep_0047', {'auto_accept': True})
Example #6
0
    def __init__(self, jid, password, bot):
        ClientXMPP.__init__(self, jid, password)

        self.bot = bot
        #self.recipient = RECIPIENT
        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message)
Example #7
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)
        self.timeout = 45
        self.my_jid = jid.lower()
        self.usuarios = []
        self.rooms = {}
        self.contador_rooms = 1

        # Manage all events
        self.add_event_handler('session_start', self.session_start)
        self.add_event_handler('message', self.message)
        self.add_event_handler('changed_status', self.on_presence)
        self.add_event_handler("presence_unsubscribe",
                               self.presence_unsubscribe)
        self.add_event_handler("presence_subscribe", self.presence_subscribe)
        self.add_event_handler("got_offline", self.got_offline)
        self.add_event_handler("got_online", self.got_online)

        # Register all plug-ins
        self.register_plugin('xep_0030')  # Service Discovery
        self.register_plugin('xep_0199')  # XMPP Ping
        self.register_plugin('xep_0004')  # Data forms
        self.register_plugin('xep_0077')  # In-band Registration
        self.register_plugin('xep_0045')  # Mulit-User Chat (MUC)
        self.register_plugin('xep_0096')  # File transfer

        import ssl
        self.ssl_version = ssl.PROTOCOL_TLS
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)

        self.add_event_handler("session_start",
                               self.session_start,
                               threaded=True)
        self.add_event_handler("message", self.message)
Example #9
0
    def __init__(self, jid, password, server_jid):
        ClientXMPP.__init__(self, jid, password)

        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message)
        self.server_jid = server_jid
        self.msgcallback = {}
Example #10
0
    def start_xmpp_client(self):
        ClientXMPP.__init__(self, settings.WILL_USERNAME, settings.WILL_PASSWORD)
        self.rooms = []

        self.default_room = settings.WILL_DEFAULT_ROOM

        # Property boostraps the list
        self.available_rooms
        for r in settings.WILL_ROOMS:
            if r != "":
                if not hasattr(self, "default_room"):
                    self.default_room = r

                self.rooms.append(self.available_rooms[r])

        self.nick = settings.WILL_NAME
        self.handle = settings.WILL_HANDLE
        self.handle_regex = re.compile("@%s" % self.handle)
        
        self.whitespace_keepalive = True
        self.whitespace_keepalive_interval = 30

        self.add_event_handler("roster_update", self.join_rooms)
        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message_recieved)
        self.add_event_handler("groupchat_message", self.room_message)
        
        self.register_plugin('xep_0045') # MUC
Example #11
0
    def __init__(self, message, host= None, servicename= None):
        # global scope of ahenk
        scope = Scope().get_instance()

        self.logger = scope.get_logger()
        self.configuration_manager = scope.get_configuration_manager()
        self.registration = scope.get_registration()
        self.event_manager = scope.get_event_manager()

        if host is not None and servicename is not None:
            self.host = str(host)
            self.service = str(servicename)
            self.port = str(self.configuration_manager.get('CONNECTION', 'port'))

        # self.host = str(socket.gethostbyname(self.configuration_manager.get('CONNECTION', 'host')))
        # self.service = str(self.configuration_manager.get('CONNECTION', 'servicename'))
        # self.port = str(self.configuration_manager.get('CONNECTION', 'port'))

        ClientXMPP.__init__(self, self.service, None)

        self.message = message
        self.receiver_resource = self.configuration_manager.get('CONNECTION', 'receiverresource')
        self.receiver = self.configuration_manager.get('CONNECTION','receiverjid') + '@' + self.configuration_manager.get('CONNECTION', 'servicename')
        if self.receiver_resource:
            self.receiver += '/' + self.receiver_resource

        if self.configuration_manager.get('CONNECTION', 'use_tls').strip().lower() == 'true':
            self.use_tls = True
        else:
            self.use_tls = False

        self.logger.debug('XMPP Receiver parameters were set')

        self.add_listeners()
        self.register_extensions()
Example #12
0
 def __init__(self, jid, password):
     ClientXMPP.__init__(self, jid, password)
     self.ssl_version = ssl.PROTOCOL_SSLv3
     self.add_event_handler("session_start",
                            self.session_start,
                            threaded=True)
     self.add_event_handler("message", self.message)
Example #13
0
    def __init__(self, username, password, owner):

        # Store the username, password and nickname as local attributes.
        self.nickname = username.split("@")[0].capitalize()

        # Register the bot's owner.
        self.owner = owner

        logging.debug("Username: "******"Password: "******"Construct's XMPP nickname: " + self.nickname)
        logging.debug("Construct's owner: " + self.owner)

        # Log into the server.
        logging.debug("Logging into the XMPP server...")
        ClientXMPP.__init__(self, username, password)

        # Register event handlers to process different event types.  A single
        # event can be processed by multiple event handlers...
        self.add_event_handler("failed_auth", self.failed_auth, threaded=True)
        self.add_event_handler("no_auth", self.no_auth, threaded=True)
        self.add_event_handler("session_start",
                               self.session_start,
                               threaded=True)
        self.add_event_handler("message", self.message, threaded=True)
        self.add_event_handler("disconnected",
                               self.on_disconnect,
                               threaded=True)

        # Start the /replies processing thread.
        self.schedule("replies_processor",
                      1,
                      self.process_replies_queue,
                      repeat=True)
Example #14
0
    def __init__(self, source, config):
        super(XMPPPublisher, self).__init__(source, config)

        jid = self.config['jid']
        password = self.config['pwd']
        
        ClientXMPP.__init__(self, jid, password)
        
        self.node = self.config['pubsub_node']
        self.pubsubjid = self.config['pubsub_jid']
        
	"""
        print "Testing connection to %s..." % (self.node)
        s = socket.socket()
        port = 80
        try:
            s.connect((self.node, port)) 
        except Exception, e:
            print "Cannnot connect to: %s:%d." % (self.node, port)
            exit(-1)
	"""
        
	self.register_plugin('xep_0030') #discovery
        self.ready = False
        self.add_event_handler("session_start", self.session_start)
        self.register_plugin('xep_0060') # PubSub
       
        print "Connecting to %s as %s" % (self.node, jid)
        sys.stdout.flush()
        self.connect()
        self.process(block=True)
Example #15
0
    def __init__(self):

        ClientXMPP.__init__(self, config['user']['jid'],
                            config['user']['passwd'])

        self.register_plugin('xep_0060')  # PubSub
        self.register_plugin('xep_0065')  # Socks5 Bytestreams
        self.pubsub_addr = config['server']['pubsub']
        self.working_dir = config['server']['working_dir']

        # Some shortcuts
        self.pubsub = self.plugin['xep_0060']
        self.streamer = self.plugin['xep_0065']

        self.disconnected = Event()
        self.pending_rsyncs = {}  # {SID => RsyncTask}
        self.pending_git_init_tasks = {}  # {BID => GitInitTask}

        # Bind all handlers to corresponding events.
        self._bind()

        # Start the XMPP connection.
        self.use_ipv6 = False
        if self.connect(use_ssl=False, use_tls=False):
            self.disconnected.clear()
            self.process()
Example #16
0
    def __init__(self, jid, password, recipient, message):
        ClientXMPP.__init__(self, jid, password)

        self.recipient = recipient
        self.msg = message

        self.add_event_handler("session_start", self.start, threaded=True)
Example #17
0
File: chat.py Project: hw233/test-2
    def __init__(self, jid, password, roomname, roompasswd):
        logger.debug("Init ChatRoomDestroyer"
                     "[jid=%s][passwd=%s][roomname=%s][roompasswd=%s]" %
                     (jid, password, roomname, roompasswd))

        ClientXMPP.__init__(self, jid, password)

        self.roomname = roomname
        self.roompasswd = roompasswd

        self.add_event_handler("session_start", self.session_start)
        #self.add_event_handler("message", self.message)

        # If you wanted more functionality, here's how to register plugins:
        self.register_plugin('xep_0030')  # Service Discovery
        self.register_plugin('xep_0045')  # Multi-User Chat
        self.register_plugin('xep_0199')  # XMPP Ping

        # Here's how to access plugins once you've registered them:
        # self['xep_0030'].add_feature('echo_demo')

        # If you are working with an OpenFire server, you will
        # need to use a different SSL version:
        # import ssl
        self.ssl_version = ssl.PROTOCOL_SSLv3
Example #18
0
 def __init__(self, jid, password, filename, shorten_url):
     ClientXMPP.__init__(self, jid, password)
     self.add_event_handler("session_start", self.session_start)
     self.register_plugin('xep_0030') # Service Discovery
     self.register_plugin("xep_0363") # HTTP File Upload
     self.filename = filename
     self.shorten_url = shorten_url
Example #19
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)

        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.onmessage)
        self.add_event_handler("diconnected", self.ondisconnect)
        self.add_event_handler("connected", self.onconnect)
    def __init__(self, message):
        # global scope of ahenk
        scope = Scope().get_instance()

        self.logger = scope.get_logger()
        self.configuration_manager = scope.get_configuration_manager()
        self.registration = scope.get_registration()
        self.event_manager = scope.get_event_manager()

        self.host = str(socket.gethostbyname(self.configuration_manager.get('CONNECTION', 'host')))
        self.service = str(self.configuration_manager.get('CONNECTION', 'servicename'))
        self.port = str(self.configuration_manager.get('CONNECTION', 'port'))

        ClientXMPP.__init__(self, self.service, None)

        self.message = message
        self.receiver_resource = self.configuration_manager.get('CONNECTION', 'receiverresource')
        self.receiver = self.configuration_manager.get('CONNECTION',
                                                       'receiverjid') + '@' + self.configuration_manager.get(
            'CONNECTION', 'servicename')
        if self.receiver_resource:
            self.receiver += '/' + self.receiver_resource

        if self.configuration_manager.get('CONNECTION', 'use_tls').strip().lower() == 'true':
            self.use_tls = True
        else:
            self.use_tls = False

        self.logger.debug('XMPP Receiver parameters were set')

        self.add_listeners()
        self.register_extensions()
Example #21
0
    def __init__(self, jid, password, server, server_port, friend_pattern, group, room, nick, auto_login):
        """
        The constructor of the XMPP Client
        """

        ClientXMPP.__init__(self, jid, password)
        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message, threaded=True)
        self.add_event_handler('presence_subscribe',
                               self.subscribe)
        self._password = password
        self._server = server
        self._server_port = server_port
        self._friend_pattern= friend_pattern 
        self._friend_default_group = group 
        self._connection = None
        self._auth = None
        self.loggedin = False
        self.joinmuc = False
        self._log = logging.getLogger("cement:app:xmpp")
        self.ssl_version = ssl.PROTOCOL_SSLv3
        self._log.info('XMPP client initialized...', extra={'namespace' : 'xmpp'})
        if self._server_port != 5222:
            self._log.info('server_port:%s is not default value!'%(self._server_port), extra={'namespace' : 'xmpp'})
        
        self.register_plugin('xep_0030') # Service Discovery
        self.register_plugin('xep_0045') # Multi-User Chat
        self.register_plugin('xep_0199') # XMPP Ping
        #Adapt the value of self.room when you test the conference
        self.room = room 
        self.nick = nick
        self.auto_login = auto_login
        if self.auto_login == True:
            self.login()
Example #22
0
    def __init__(self, jid, password, sensor_bot_jid, pubsub_server_jid, node, trigger, action):
        ClientXMPP.__init__(self, jid, password)

        # Setting the sender jid and the receiver jid
        self.sender_jid = jid
        self.sensor_bot_jid = sensor_bot_jid
        self.trigger = trigger
        self.action = action
        self.stopped = threading.Event()
        self.action_thread = None

        # Setting the session_start event handler to a method that prints "Started" at session start
        self.add_event_handler("session_start", self.session_start)

        self.register_plugin('xep_0060')
        self.node = node
        self.pubsub_server = pubsub_server_jid
        self.add_event_handler('pubsub_publish', self._publish)

        try:
            # Connecting bot
            self.connect()

            # Sending bot presence
            self.send_presence()

            self.subscribe()

            # Starting to process incoming messages
            self.process(block=False)

        except KeyboardInterrupt:
            self.send_thread.cancel()
Example #23
0
    def __init__(self, jid, password, sensor_bot_jid, pubsub_server_jid,
                 trigger, action, node):
        ClientXMPP.__init__(self, jid, password)

        # Set reciver jid and sender jid
        self.sender_jid = jid
        self.sensor_bot_jid = sensor_bot_jid

        # Start sesion and print a succes mesage
        self.add_event_handler("session_start", self.session_start)

        # Connecting bot
        self.connect()

        # Sending bot presence
        self.send_presence()

        self.register_plugin('xep_0060')
        self.node = node
        self.pubsub_server = pubsub_server_jid
        self.add_event_handler('pubsub_publish', self._publish)
        self.trigger = trigger
        self.action = action

        try:
            self.subscribe()
            #self.unsubscribe()

            # Starting to process incoming messages
            self.process(block=True)
        except KeyboardInterrupt:
            self.send_thread.cancel()
Example #24
0
    def __init__(self, jid='[email protected]/monitor18', password='******', address=(), debug=False, **conf):
        """
        address must be a (ip, port) tuple
        """
        ClientXMPP.__init__(self, jid, password)
        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("presence_probe", self.handle_probe)
        self.add_event_handler("roster_update", self.handle_roster)
        self.add_event_handler("message", self.handle_message)
        self.add_event_handler("changed_status", self.handle_changed_status)
        self.add_event_handler("presence_unavailable", self.handle_availability)
        self.add_event_handler("presence_available", self.handle_availability)

        # auto subscription management
        self.auto_authorize = True
        self.auto_subscribe = True
        self.conf = conf
        self.auto_reconnect = True
        self.address = address
        self.jid = jid
        self.nickname = jid.split("@")[0]
        self.muc_status = False
        if debug:
            self.log = logging.basicConfig(level=logging.DEBUG,
                                           format='%(levelname)-8s %(message)s')
        self.redis_thread = AsyncAlarmThread(**self.conf)
        self.redis_thread.start()
Example #25
0
 def __init__(self, jid, password, send_message, logger):
     ClientXMPP.__init__(self, jid, password)
     self.add_event_handler("session_start", self.session_start)
     self.add_event_handler("message", self.message_logging)
     self.logger = logger
     self.logger.info("XMPP connected")
     self.send_message = send_message
Example #26
0
 def __init__(self, jid, password):
     ClientXMPP.__init__(self, jid, password)
     self.add_event_handler('session_start', self.start)
     self.add_event_handler('message', self.message)
     self.schedule('Check mail', 10, self._check_mail, repeat=True)
     self.register_plugin('xep_0030')
     self.register_plugin('xep_0199')
Example #27
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)
        self.add_event_handler("session_start", self.start)
        self.add_event_handler('message', self.receive_message)

        self.register_plugin('xep_0030') # Service Discovery
        self.register_plugin('xep_0199') # XMPP Ping
Example #28
0
    def start_xmpp_client(self):
        logger = logging.getLogger(__name__)
        ClientXMPP.__init__(self, "%s/bot" % settings.WILL_USERNAME, settings.WILL_PASSWORD)
        self.rooms = []

        self.default_room = settings.WILL_DEFAULT_ROOM

        # Property boostraps the list
        self.available_rooms
        for r in settings.WILL_ROOMS:
            if r != "":
                if not hasattr(self, "default_room"):
                    self.default_room = r

                try:
                    self.rooms.append(self.available_rooms[r])
                except KeyError:
                    logger.error(
                        u'"{0}" is not an available room, ask'
                        ' "@{1} what are the rooms?" for the full list.'
                        .format(r, settings.WILL_HANDLE))

        self.nick = settings.WILL_NAME
        self.handle = settings.WILL_HANDLE
        self.handle_regex = re.compile("@%s" % self.handle)

        self.whitespace_keepalive = True
        self.whitespace_keepalive_interval = 30

        self.add_event_handler("roster_update", self.join_rooms)
        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message_recieved)
        self.add_event_handler("groupchat_message", self.room_message)

        self.register_plugin('xep_0045') # MUC
Example #29
0
    def __init__(self, jid, password, server_jid):
        ClientXMPP.__init__(self, jid, password)

        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message)
        self.server_jid = server_jid
        self.msgcallback = {}
Example #30
0
 def __init__(self, jid, password, send_message, logger):
     ClientXMPP.__init__(self, jid, password)
     self.add_event_handler("session_start", self.session_start)
     self.add_event_handler("message", self.message_logging)
     self.logger = logger
     self.logger.info("XMPP connected")
     self.send_message = send_message
        def __init__(self,jid,password,objects,objectl):
                ClientXMPP.__init__(self,jid,password)
                self.add_event_handler("session_start", self.session_start)
                self.add_event_handler("message",self.message_logging)
		self.collectorl=objectl
		self.collectorl.info("XMPP connected")
		self.collectors=objects
Example #32
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)

        # Nickname para grupos
        self.nick = "mynickname"

        # Plugins utilizados
        self.register_plugin('xep_0030')  # Service Discovery
        self.register_plugin('xep_0004')  # Data forms
        self.register_plugin('xep_0066')  # Out-of-band Data
        self.register_plugin('xep_0077')  # In-band Registration
        self.register_plugin('xep_0047',
                             {'auto_accept': True})  # In-band Bytestreams
        self.register_plugin('xep_0045')  # Multi-User Chat
        self.register_plugin('xep_0060')  # PubSub
        self.register_plugin('xep_0199')  # XMPP Ping

        # Handler de eventos
        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("register", self.register)
        self.add_event_handler("message", self.receive_message)
        self.add_event_handler("presence_subscribe", self.presence_subscribe)
        self.add_event_handler('presence_available', self.handle_available_new)
        self.add_event_handler('presence_dnd', self.handle_available)
        self.add_event_handler('presence_xa', self.handle_available)
        self.add_event_handler('presence_chat', self.handle_available)
        self.add_event_handler('presence_away', self.handle_available)
        self.add_event_handler('presence_unavailable', self.handle_unavailable)
        self.add_event_handler("groupchat_message", self.muc_message_receive)

        self.add_event_handler("ibb_stream_start",
                               self.stream_opened,
                               threaded=True)
        self.add_event_handler("ibb_stream_data", self.stream_data)
Example #33
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)
        self.users = []

        self.received = set()
        self.presences_received = threading.Event()
        
        # Handlers
        self.add_event_handler("session_start", self.start)
        self.add_event_handler("message", self.message)

        # Notif handlers
        self.add_event_handler("changed_status", self.wait_for_presences)
        self.add_event_handler("presence_unsubscribe", self.presence_unsubscribe)
        self.add_event_handler("presence_subscribe", self.presence_subscribe)

        # Plugins
        # Registration order doesnt matter so...
        self.register_plugin('xep_0004') # Data forms
        self.register_plugin('xep_0030') # Service Disc
        self.register_plugin('xep_0077') # In-band Register
        self.register_plugin('xep_0066') # Ping
        self.register_plugin('xep_0045') # MUC

        import ssl
        self.ssl_version = ssl.PROTOCOL_TLS
Example #34
0
    def __init__(self):

        ClientXMPP.__init__(self, config['user']['jid'], config['user'][
            'passwd'])

        self.register_plugin('xep_0060')  # PubSub
        self.register_plugin('xep_0065')  # Socks5 Bytestreams
        self.pubsub_addr = config['server']['pubsub']
        self.working_dir = config['server']['working_dir']

        # Some shortcuts
        self.pubsub = self.plugin['xep_0060']
        self.streamer = self.plugin['xep_0065']

        self.disconnected = Event()
        self.pending_rsyncs = {}   # {SID => RsyncTask}
        self.pending_git_init_tasks = {}  # {BID => GitInitTask}

        # Bind all handlers to corresponding events.
        self._bind()

        # Start the XMPP connection.
        self.use_ipv6 = False
        if self.connect(use_ssl=False, use_tls=False):
            self.disconnected.clear()
            self.process()
Example #35
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)
        
        # Handlers
        self.add_event_handler("session_start", self.start)
        self.add_event_handler("register", self.register)

        self.register_plugin('xep_0077') # In-band Registration
Example #36
0
    def __init__(self, bot_configuration):
        ClientXMPP.__init__(self, bot_configuration.jid,
                            bot_configuration.password)

        self.add_event_handler("session_start", self.on_session_start)
        self.add_event_handler("message", self.on_message)

        self.blabler_bot_jid = bot_configuration.blabler_bot_jid
Example #37
0
 def __init__(self):
     logger = logging.getLogger("sleekxmpp")
     logger.setLevel(logging.ERROR)
     ClientXMPP.__init__(self, config.xmpp_jid, config.xmpp_password)
     self.add_event_handler("session_start", self.session_start)
     self.add_event_handler("message", self.message)
     self.connect()
     self.process(block=False)
Example #38
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)
        self.register_plugin('xep_0054')
        self.register_plugin('xep_0084')
        self.register_plugin('xep_0153')

        self.connect()
        self.process(block=False)
Example #39
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)

        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message)

        # In BaseXMPP.py
        self.send_message('*****@*****.**', '你好nihao.')
Example #40
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)

        self.add_event_handler('session_start', self.session_start)
        self.add_event_handler('message', self.message)

        self._jid = jid
        self._password = password
Example #41
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)

        self.add_event_handler('session_start', self.session_start)
        self.add_event_handler('message', self.message)

        self._jid = jid
        self._password = password
Example #42
0
 def __init__(self, jid, password):
     ClientXMPP.__init__(self, jid, password)
     self.register_plugin('xep_0332')  # HTTP over XMPP Transport
     self.add_event_handler('session_start',
                            self.session_start,
                            threaded=True)
     self.add_event_handler('http_request', self.http_request_received)
     self.add_event_handler('http_response', self.http_response_received)
Example #43
0
 def __init__(self, jid, password):
     ClientXMPP.__init__(self, jid, password)
     self.register_plugin('xep_0332')    # HTTP over XMPP Transport
     self.add_event_handler(
         'session_start', self.session_start, threaded=True
     )
     self.add_event_handler('http_request', self.http_request_received)
     self.add_event_handler('http_response', self.http_response_received)
Example #44
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)

        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message)
        
        # In BaseXMPP.py
        self.send_message('*****@*****.**','你好nihao.')
Example #45
0
    def __init__(self, jid, password):
        ClientXMPP.__init__(self, jid, password)
        self.rooms = []
        self.muc_host = 'chat-muc.aparkinson.net'
        self.nick = 'woody'

        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler('message', self.message)
Example #46
0
	def __init__(self, jid, password):
		ClientXMPP.__init__(self, jid, password)

		self.use_signals(signals=None)
		self.add_event_handler("session_start", self.session_start)

		self.register_plugin('xep_0030') # Service Discovery
		self.register_plugin('xep_0199') # XMPP Ping
Example #47
0
    def __init__(self, jid, password):
        
        ClientXMPP.__init__(self, jid, password)
        self.Recv_data = 0
        self.Send_data = 0

        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.recvMsg)
Example #48
0
    def __init__(self, jid, password, on_receive, rooms):
        ClientXMPP.__init__(self, jid, password)

        self.rooms = rooms
        self.rooms_by_name = {v: k for k, v in rooms.items()}
        self.on_receive = on_receive
        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message)
Example #49
0
 def __init__(self):
     logger = logging.getLogger("sleekxmpp")
     logger.setLevel(logging.ERROR)
     ClientXMPP.__init__(self, config.xmpp_jid, config.xmpp_password)
     self.add_event_handler("session_start", self.session_start)
     self.add_event_handler("message", self.message)
     self.connect()
     self.process(block=False)
 def __init__(self, jid, password, campfire_room):
     ClientXMPP.__init__(self, jid, password)
     self.room = JABBER_ROOM
     self.nick = JABBER_NICKNAME
     self.answer_to = BOT_NICKNAMES
     self.campfire_room = campfire_room
     
     self.add_event_handler("session_start", self.start)
     self.add_event_handler("groupchat_message", self.xmpp_incoming)
Example #51
0
    def __init__(self, *args, **kwargs):
        ClientXMPP.__init__(self, kwargs.get("jid"), kwargs.get("password"))

        self.room = kwargs.get("rooms").split(",")
        self.nick = kwargs.get("nickname")
        self.room_domain = kwargs.get("server")
        self.message_queue = kwargs.get("msg_queue")

        self.add_event_handler("session_start", self.start)
Example #52
0
 def __init__(self, jid, password):
     ClientXMPP.__init__(self, jid, password)
     #self.plugin.disable('feature_bind')
     #self.plugin.disable('feature_mechanisms')
     #self.plugin.disable('feature_session')
     self.add_event_handler("session_start", self.session_start)
     self.add_event_handler("message", self.message)
     self._count = 0
     self._begin_time = None
Example #53
0
	def __init__(self, jid, password, recipient):
		ClientXMPP.__init__(self, jid, password)
		self.recipient = recipient
		
		self.add_event_handler("session_start", self.session_start, threaded=True)
		self.add_event_handler("message", self.message)
		self.ssl_version = ssl.PROTOCOL_TLS

		self.xmppSex = XMMPPSex(jid)
Example #54
0
    def __init__(self, jid, oauth):
        ClientXMPP.__init__(self, jid, password=None)
        self.oauth = oauth
        self.msg_callback = None
        self.add_event_handler("session_start", self.session_started, threaded=True)
        self.add_event_handler("message", self.message_received)

        # Plugins
        self.register_plugin('xep_0030')  # Service Discovery
Example #55
0
    def __init__(self, jid, password, dispatcher=None):
        ClientXMPP.__init__(self, jid, password)

        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message)

        #self.register_plugin('xep_0071')
        #self.register_plugin('html-im')

        self.dispatcher = dispatcher
Example #56
0
    def __init__(self, jid, password, prefix):
        ClientXMPP.__init__(self, jid, password)
	self.room = "" 
	self.prefix = prefix
	self.nick = prefix + re.sub(r'[{}]','',os.popen('dohost "show hostname"').read()).rstrip('\n')[1:]
        self.add_event_handler("session_start", self.session_start)
        self.add_event_handler("message", self.message)
	self.add_event_handler("muc::%s::got_online" % self.room,self.muc_online)
	self.add_event_handler("groupchat_invite", self.accept_invite)
	self.add_event_handler("groupchat_message", self.muc_message)