mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-22 21:22:21 +03:00
message receiver action call way
This commit is contained in:
parent
390d1f3b12
commit
19e76a1b3a
1 changed files with 10 additions and 5 deletions
|
@ -7,6 +7,7 @@ sys.path.append('../..')
|
||||||
import slixmpp
|
import slixmpp
|
||||||
import asyncio
|
import asyncio
|
||||||
import threading
|
import threading
|
||||||
|
import json
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
from slixmpp.exceptions import IqError, IqTimeout
|
from slixmpp.exceptions import IqError, IqTimeout
|
||||||
|
@ -38,13 +39,14 @@ class MessageReceiver(slixmpp.ClientXMPP):
|
||||||
# configurationManager comes from ahenk deamon
|
# configurationManager comes from ahenk deamon
|
||||||
self.logger = scope.getLogger()
|
self.logger = scope.getLogger()
|
||||||
self.configurationManager = scope.getConfigurationManager()
|
self.configurationManager = scope.getConfigurationManager()
|
||||||
|
self.event_manger=scope.getEventManager()
|
||||||
|
|
||||||
self.full_jid =str(self.configurationManager.get('CONNECTION', 'uid'))+'@'+str(self.configurationManager.get('CONNECTION', 'host'))
|
self.full_jid =str(self.configurationManager.get('CONNECTION', 'uid'))+'@'+str(self.configurationManager.get('CONNECTION', 'host'))
|
||||||
#slixmpp.ClientXMPP.__init__(self, self.full_jid, 'pass')
|
slixmpp.ClientXMPP.__init__(self, self.full_jid, 'pass')
|
||||||
|
|
||||||
#TESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTEST
|
#TESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTEST
|
||||||
slixmpp.ClientXMPP.__init__(self, "volkan@localhost", "volkan")
|
#slixmpp.ClientXMPP.__init__(self, "volkan@localhost", "volkan")
|
||||||
self.receiver="caner@localhost"
|
self.receiver="lider_sunucu@localhost"
|
||||||
#TESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTEST
|
#TESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTEST
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -114,8 +116,11 @@ class MessageReceiver(slixmpp.ClientXMPP):
|
||||||
|
|
||||||
def recv_direct_message(self, msg):
|
def recv_direct_message(self, msg):
|
||||||
if msg['type'] in ('chat', 'normal'):
|
if msg['type'] in ('chat', 'normal'):
|
||||||
#self.disconnect()
|
print ("event will be fired - %s : %s" % (msg['from'], msg['body']))
|
||||||
print ("%s : %s" % (msg['from'], msg['body']))
|
j = json.loads(str(msg['body']))
|
||||||
|
type =j['type']
|
||||||
|
self.event_manger.fireEvent('type',str(msg['body']))
|
||||||
|
|
||||||
|
|
||||||
def connect_to_server(self):# Connect to the XMPP server and start processing XMPP stanzas.
|
def connect_to_server(self):# Connect to the XMPP server and start processing XMPP stanzas.
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue