diff --git a/opt/ahenk/base/config/ConfigManager.py b/opt/ahenk/base/config/config_manager.py similarity index 100% rename from opt/ahenk/base/config/ConfigManager.py rename to opt/ahenk/base/config/config_manager.py diff --git a/opt/ahenk/base/database/AhenkDbService.py b/opt/ahenk/base/database/ahenk_db_service.py similarity index 100% rename from opt/ahenk/base/database/AhenkDbService.py rename to opt/ahenk/base/database/ahenk_db_service.py diff --git a/opt/ahenk/base/deamon/BaseDeamon.py b/opt/ahenk/base/deamon/base_daemon.py similarity index 100% rename from opt/ahenk/base/deamon/BaseDeamon.py rename to opt/ahenk/base/deamon/base_daemon.py diff --git a/opt/ahenk/base/event/EventBase.py b/opt/ahenk/base/event/event_base.py similarity index 97% rename from opt/ahenk/base/event/EventBase.py rename to opt/ahenk/base/event/event_base.py index e2d3986..7c23cb1 100644 --- a/opt/ahenk/base/event/EventBase.py +++ b/opt/ahenk/base/event/event_base.py @@ -2,8 +2,8 @@ # -*- coding: utf-8 -*- # @author: İsmail BAŞARAN -class EventBase(): +class EventBase: """ 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}) -class Event(): +class Event: """ This is event class. Takes two argument ; Args: event_name : name of event. callback_args : arguments specified by user. This function will transmit args to callback function directly. """ + def __init__(self, event_name, *callback_args): for listener in EventBase.listeners: for listener_cls in listener.listener_events: diff --git a/opt/ahenk/base/event/EventManager.py b/opt/ahenk/base/event/event_manager.py similarity index 100% rename from opt/ahenk/base/event/EventManager.py rename to opt/ahenk/base/event/event_manager.py diff --git a/opt/ahenk/base/execution/ExecutionManager.py b/opt/ahenk/base/execution/execution_manager.py similarity index 100% rename from opt/ahenk/base/execution/ExecutionManager.py rename to opt/ahenk/base/execution/execution_manager.py diff --git a/opt/ahenk/base/logger/AhenkLogger.py b/opt/ahenk/base/logger/ahenk_logger.py similarity index 100% rename from opt/ahenk/base/logger/AhenkLogger.py rename to opt/ahenk/base/logger/ahenk_logger.py diff --git a/opt/ahenk/base/messaging/AnonymousMessenger.py b/opt/ahenk/base/messaging/anonymous_messenger.py similarity index 100% rename from opt/ahenk/base/messaging/AnonymousMessenger.py rename to opt/ahenk/base/messaging/anonymous_messenger.py diff --git a/opt/ahenk/base/messaging/MessageResponseQueue.py b/opt/ahenk/base/messaging/message_response_queue.py similarity index 100% rename from opt/ahenk/base/messaging/MessageResponseQueue.py rename to opt/ahenk/base/messaging/message_response_queue.py diff --git a/opt/ahenk/base/messaging/Messaging.py b/opt/ahenk/base/messaging/messaging.py similarity index 100% rename from opt/ahenk/base/messaging/Messaging.py rename to opt/ahenk/base/messaging/messaging.py diff --git a/opt/ahenk/base/messaging/Messenger.py b/opt/ahenk/base/messaging/messenger.py similarity index 94% rename from opt/ahenk/base/messaging/Messenger.py rename to opt/ahenk/base/messaging/messenger.py index edd309b..3bfbb9d 100644 --- a/opt/ahenk/base/messaging/Messenger.py +++ b/opt/ahenk/base/messaging/messenger.py @@ -34,6 +34,11 @@ class Messenger(ClientXMPP): self.hostname = self.configuration_manager.get('CONNECTION', 'host') 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', 'receiverjid') + '@' + self.configuration_manager.get( 'CONNECTION', 'servicename') @@ -67,7 +72,8 @@ class Messenger(ClientXMPP): def connect_to_server(self): # Connect to the XMPP server and start processing XMPP stanzas. try: 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.logger.debug('[Messenger] Connection were established successfully') return True diff --git a/opt/ahenk/base/model/enum/ContentType.py b/opt/ahenk/base/model/enum/content_type.py similarity index 100% rename from opt/ahenk/base/model/enum/ContentType.py rename to opt/ahenk/base/model/enum/content_type.py diff --git a/opt/ahenk/base/model/enum/MessageCode.py b/opt/ahenk/base/model/enum/message_code.py similarity index 100% rename from opt/ahenk/base/model/enum/MessageCode.py rename to opt/ahenk/base/model/enum/message_code.py diff --git a/opt/ahenk/base/model/enum/MessageType.py b/opt/ahenk/base/model/enum/message_type.py similarity index 100% rename from opt/ahenk/base/model/enum/MessageType.py rename to opt/ahenk/base/model/enum/message_type.py diff --git a/opt/ahenk/base/model/MessageFactory.py b/opt/ahenk/base/model/message_factory.py similarity index 90% rename from opt/ahenk/base/model/MessageFactory.py rename to opt/ahenk/base/model/message_factory.py index 42b7916..17732d8 100644 --- a/opt/ahenk/base/model/MessageFactory.py +++ b/opt/ahenk/base/model/message_factory.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: İsmail BAŞARAN -from base.model.enum.MessageType import MessageType +from base.model.enum.message_type import MessageType class MessageFactory(object): diff --git a/opt/ahenk/base/model/Plugin.py b/opt/ahenk/base/model/plugin.py similarity index 100% rename from opt/ahenk/base/model/Plugin.py rename to opt/ahenk/base/model/plugin.py diff --git a/opt/ahenk/base/model/PluginBean.py b/opt/ahenk/base/model/plugin_bean.py similarity index 100% rename from opt/ahenk/base/model/PluginBean.py rename to opt/ahenk/base/model/plugin_bean.py diff --git a/opt/ahenk/base/model/Policy.py b/opt/ahenk/base/model/policy.py similarity index 100% rename from opt/ahenk/base/model/Policy.py rename to opt/ahenk/base/model/policy.py diff --git a/opt/ahenk/base/model/PolicyBean.py b/opt/ahenk/base/model/policy_bean.py similarity index 100% rename from opt/ahenk/base/model/PolicyBean.py rename to opt/ahenk/base/model/policy_bean.py diff --git a/opt/ahenk/base/model/Profile.py b/opt/ahenk/base/model/profile.py similarity index 97% rename from opt/ahenk/base/model/Profile.py rename to opt/ahenk/base/model/profile.py index e492f68..48dc19d 100644 --- a/opt/ahenk/base/model/Profile.py +++ b/opt/ahenk/base/model/profile.py @@ -3,7 +3,7 @@ # Author: Volkan Şahin import json -from base.model.Plugin import Plugin +from base.model.plugin import Plugin class Profile(object): diff --git a/opt/ahenk/base/model/ProfileBean.py b/opt/ahenk/base/model/profile_bean.py similarity index 96% rename from opt/ahenk/base/model/ProfileBean.py rename to opt/ahenk/base/model/profile_bean.py index 09d185b..8757380 100644 --- a/opt/ahenk/base/model/ProfileBean.py +++ b/opt/ahenk/base/model/profile_bean.py @@ -3,7 +3,7 @@ # Author: Volkan Şahin import json -from base.model.PluginBean import PluginBean +from base.model.plugin_bean import PluginBean class ProfileBean(object): diff --git a/opt/ahenk/base/model/Response.py b/opt/ahenk/base/model/response.py similarity index 100% rename from opt/ahenk/base/model/Response.py rename to opt/ahenk/base/model/response.py diff --git a/opt/ahenk/base/model/Task.py b/opt/ahenk/base/model/task.py similarity index 97% rename from opt/ahenk/base/model/Task.py rename to opt/ahenk/base/model/task.py index 93c390b..93778af 100644 --- a/opt/ahenk/base/model/Task.py +++ b/opt/ahenk/base/model/task.py @@ -4,7 +4,7 @@ # Author: Volkan Şahin import json -from base.model.Plugin import Plugin +from base.model.plugin import Plugin class Task(object): diff --git a/opt/ahenk/base/model/TaskBean.py b/opt/ahenk/base/model/task_bean.py similarity index 100% rename from opt/ahenk/base/model/TaskBean.py rename to opt/ahenk/base/model/task_bean.py diff --git a/opt/ahenk/base/plugin/PluginQueue.py b/opt/ahenk/base/plugin/plugin_queue.py similarity index 100% rename from opt/ahenk/base/plugin/PluginQueue.py rename to opt/ahenk/base/plugin/plugin_queue.py diff --git a/opt/ahenk/base/registration/Registration.py b/opt/ahenk/base/registration/registration.py similarity index 99% rename from opt/ahenk/base/registration/Registration.py rename to opt/ahenk/base/registration/registration.py index 8aa9bd2..ee97496 100644 --- a/opt/ahenk/base/registration/Registration.py +++ b/opt/ahenk/base/registration/registration.py @@ -8,7 +8,7 @@ import uuid from uuid import getnode as get_mac 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.timer.setup_timer import SetupTimer from base.timer.timer import Timer diff --git a/opt/ahenk/base/Scope.py b/opt/ahenk/base/scope.py similarity index 100% rename from opt/ahenk/base/Scope.py rename to opt/ahenk/base/scope.py diff --git a/opt/ahenk/base/task/TaskInQueue.py b/opt/ahenk/base/task/task_in_queue.py similarity index 100% rename from opt/ahenk/base/task/TaskInQueue.py rename to opt/ahenk/base/task/task_in_queue.py diff --git a/opt/ahenk/base/task/TaskJob.py b/opt/ahenk/base/task/task_job.py similarity index 100% rename from opt/ahenk/base/task/TaskJob.py rename to opt/ahenk/base/task/task_job.py diff --git a/opt/ahenk/base/task/TaskManager.py b/opt/ahenk/base/task/task_manager.py similarity index 96% rename from opt/ahenk/base/task/TaskManager.py rename to opt/ahenk/base/task/task_manager.py index 86c5907..1e5aa0c 100644 --- a/opt/ahenk/base/task/TaskManager.py +++ b/opt/ahenk/base/task/task_manager.py @@ -3,8 +3,8 @@ # Author: İsmail BAŞARAN from base.Scope import Scope -from base.model.MessageFactory import MessageFactory -from base.model.enum.MessageType import MessageType +from base.model.message_factory import MessageFactory +from base.model.enum.message_type import MessageType class TaskManager(object):