本文整理汇总了Python中sleekxmpp.ClientXMPP类的典型用法代码示例。如果您正苦于以下问题:Python ClientXMPP类的具体用法?Python ClientXMPP怎么用?Python ClientXMPP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ClientXMPP类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
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
开发者ID:helderfernandes1279,项目名称:intelmq_first_version,代码行数:7,代码来源:collector.py
示例2: __init__
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
开发者ID:janisstreib,项目名称:c3pb_xmpp_status,代码行数:7,代码来源:bot.py
示例3: start_xmpp_client
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
开发者ID:Bengt,项目名称:will,代码行数:35,代码来源:listener.py
示例4: __init__
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 = {}
开发者ID:HotSushi,项目名称:IPOP-client,代码行数:7,代码来源:clientxmpp.py
示例5: __init__
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()
开发者ID:PinetTech,项目名称:RestXMPP,代码行数:34,代码来源:client.py
示例6: __init__
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
开发者ID:ana-balica,项目名称:ocdoctor-server,代码行数:7,代码来源:xmpp_client.py
示例7: __init__
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()
开发者ID:AdrianXyZ,项目名称:cydonix,代码行数:33,代码来源:workflow.py
示例8: __init__
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)
开发者ID:sunapi386,项目名称:pennapps13s,代码行数:7,代码来源:app.py
示例9: __init__
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')
开发者ID:andyhd,项目名称:imap-jabber,代码行数:7,代码来源:imapbot.py
示例10: __init__
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()
开发者ID:jplana,项目名称:baboon,代码行数:26,代码来源:transport.py
示例11: __init__
def __init__(self, jid='[email protected]/monitor18', password='Mq77aszdkd', 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()
开发者ID:qinguoan,项目名称:rambo,代码行数:27,代码来源:xmpp.py
示例12: start_xmpp_client
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
开发者ID:adamgilman,项目名称:will,代码行数:28,代码来源:listener.py
示例13: __init__
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()
开发者ID:Pardus-Kurumsal,项目名称:ahenk,代码行数:32,代码来源:anonymous_messenger.py
示例14: __init__
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
开发者ID:certbe,项目名称:intelmq,代码行数:7,代码来源:collector.py
示例15: __init__
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)
开发者ID:pedak,项目名称:resdbp,代码行数:31,代码来源:publisher.py
示例16: __init__
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
开发者ID:sezuan,项目名称:uploadr,代码行数:7,代码来源:uploadr.py
示例17: __init__
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)
开发者ID:Alie,项目名称:bitcoin-arbitrage,代码行数:8,代码来源:xmppmessager.py
示例18: __init__
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('[email protected]','你好nihao.')
开发者ID:LuoZijun,项目名称:pybot,代码行数:8,代码来源:xmpp_bot.py
示例19: __init__
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
开发者ID:forging2012,项目名称:Young,代码行数:8,代码来源:client.py
示例20: __init__
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
开发者ID:9thSenseRobotics,项目名称:bosh_server,代码行数:8,代码来源:talker.py
注:本文中的sleekxmpp.ClientXMPP类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论