ssl parameter added to conf file

This commit is contained in:
Volkan Şahin 2016-08-24 18:00:01 +03:00
parent 6a1e08cf18
commit 9b96a6e286
30 changed files with 17 additions and 10 deletions

View file

@ -2,8 +2,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# @author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com> # @author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
class EventBase():
class EventBase:
""" """
This is base event class for event management. This is base event class for event management.
""" """
@ -24,13 +24,14 @@ class EventBase():
self.listener_events.append({'event_name': event_name, 'callback_func': callback_func}) self.listener_events.append({'event_name': event_name, 'callback_func': callback_func})
class Event(): class Event:
""" """
This is event class. Takes two argument ; This is event class. Takes two argument ;
Args: Args:
event_name : name of event. event_name : name of event.
callback_args : arguments specified by user. This function will transmit args to callback function directly. callback_args : arguments specified by user. This function will transmit args to callback function directly.
""" """
def __init__(self, event_name, *callback_args): def __init__(self, event_name, *callback_args):
for listener in EventBase.listeners: for listener in EventBase.listeners:
for listener_cls in listener.listener_events: for listener_cls in listener.listener_events:

View file

@ -34,6 +34,11 @@ class Messenger(ClientXMPP):
self.hostname = self.configuration_manager.get('CONNECTION', 'host') self.hostname = self.configuration_manager.get('CONNECTION', 'host')
self.receiver_resource = self.configuration_manager.get('CONNECTION', 'receiverresource') self.receiver_resource = self.configuration_manager.get('CONNECTION', 'receiverresource')
if self.configuration_manager.get('CONNECTION', 'use_tls').split().lower() == 'true':
self.use_tls = True
else:
self.use_tls = False
self.receiver = self.configuration_manager.get('CONNECTION', self.receiver = self.configuration_manager.get('CONNECTION',
'receiverjid') + '@' + self.configuration_manager.get( 'receiverjid') + '@' + self.configuration_manager.get(
'CONNECTION', 'servicename') 'CONNECTION', 'servicename')
@ -67,7 +72,8 @@ class Messenger(ClientXMPP):
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:
self['feature_mechanisms'].unencrypted_plain = True self['feature_mechanisms'].unencrypted_plain = True
self.connect((self.hostname, 5222), use_tls=False)
self.connect((self.hostname, 5222), use_tls=self.use_tls)
self.process(block=False) self.process(block=False)
self.logger.debug('[Messenger] Connection were established successfully') self.logger.debug('[Messenger] Connection were established successfully')
return True return True

View file

@ -1,7 +1,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com> # Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
from base.model.enum.MessageType import MessageType from base.model.enum.message_type import MessageType
class MessageFactory(object): class MessageFactory(object):

View file

@ -3,7 +3,7 @@
# Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com> # Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com>
import json import json
from base.model.Plugin import Plugin from base.model.plugin import Plugin
class Profile(object): class Profile(object):

View file

@ -3,7 +3,7 @@
# Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com> # Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com>
import json import json
from base.model.PluginBean import PluginBean from base.model.plugin_bean import PluginBean
class ProfileBean(object): class ProfileBean(object):

View file

@ -4,7 +4,7 @@
# Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com> # Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com>
import json import json
from base.model.Plugin import Plugin from base.model.plugin import Plugin
class Task(object): class Task(object):

View file

@ -8,7 +8,7 @@ import uuid
from uuid import getnode as get_mac from uuid import getnode as get_mac
from base.Scope import Scope from base.Scope import Scope
from base.messaging.AnonymousMessenger import AnonymousMessenger from base.messaging.anonymous_messenger import AnonymousMessenger
from base.system.system import System from base.system.system import System
from base.timer.setup_timer import SetupTimer from base.timer.setup_timer import SetupTimer
from base.timer.timer import Timer from base.timer.timer import Timer

View file

@ -3,8 +3,8 @@
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com> # Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
from base.Scope import Scope from base.Scope import Scope
from base.model.MessageFactory import MessageFactory from base.model.message_factory import MessageFactory
from base.model.enum.MessageType import MessageType from base.model.enum.message_type import MessageType
class TaskManager(object): class TaskManager(object):