minor bug fixes

This commit is contained in:
Volkan Şahin 2016-03-31 18:21:24 +03:00
parent dca5a2d720
commit 80079685b5
3 changed files with 11 additions and 6 deletions

View file

@ -41,8 +41,8 @@ class ExecutionManager(object):
policy = Policy(json.loads(arg))
# TODO get username and machine uid
username = 'volkan'
machine_uid='616161616161'
username = 'lider'
machine_uid = self.db_service.select_one_result('registration', 'jid', 'registered=1')
ahenk_policy_ver = self.db_service.select_one_result('policy', 'version', 'type = \'A\'')
user_policy_version = self.db_service.select_one_result('policy', 'version', 'type = \'U\' and name = \'' + username + '\'')

View file

@ -15,6 +15,9 @@ from base.Scope import Scope
class Messager(slixmpp.ClientXMPP):
global loop
def __init__(self):
# global scope of ahenk
scope = Scope().getInstance()
@ -41,6 +44,7 @@ class Messager(slixmpp.ClientXMPP):
def add_listeners(self):
self.add_event_handler('session_start', self.session_start)
self.add_event_handler('session_end', self.session_end)
self.add_event_handler('message', self.recv_direct_message)
self.add_event_handler('socks5_connected', self.stream_opened)
@ -72,6 +76,9 @@ class Messager(slixmpp.ClientXMPP):
self.get_roster()
self.send_presence()
def session_end(self):
print("disconnect")
# TODO need check
def send_file(self, file_path):
self.file = open(file_path, 'rb')

View file

@ -57,8 +57,7 @@ class Plugin(threading.Thread):
# TODO create response message from context and item_obj. item_obj is task
#TODO Message Code keep
#item_obj.id ??
response = Response(type=MessageType.TASK_STATUS, id='id', code=MessageCode.TASK_PROCESSED, message='__message__', data=self.context.get('data'), content_type=self.context.get('content_type'))
response = Response(type=MessageType.TASK_STATUS, id=item_obj.id, code=MessageCode.TASK_PROCESSED, message='__message__', data=self.context.get('data'), content_type=self.context.get('content_type'))
#self.response_queue.put(self.messaging.response_msg(response)) #TODO DEBUG
Scope.getInstance().getMessager().send_direct_message(self.messaging.response_msg(response)) #TODO REMOVE
@ -74,8 +73,7 @@ class Plugin(threading.Thread):
policy_module.handle_policy(profile_data, self.context)
#TODO Message Code keep
#item_obj.id ??
response = Response(type=MessageType.POLICY_STATUS, id='id', code=MessageCode.POLICY_PROCESSED, message='__message__', data=self.context.get('data'), content_type=self.context.get('content_type'))
response = Response(type=MessageType.POLICY_STATUS, id=item_obj.id, code=MessageCode.POLICY_PROCESSED, message='__message__', data=self.context.get('data'), content_type=self.context.get('content_type'))
#self.response_queue.put(self.messaging.response_msg(response)) #TODO DEBUG
Scope.getInstance().getMessager().send_direct_message(self.messaging.response_msg(response))#TODO REMOVE