# Path: classes/gmailbot.py
# class GmailBot:
# 	def __init__(self, GMAIL_USERNAME,GMAIL_PASSWORD,recipient):
# 		self.SMTP_SERVER = 'smtp.gmail.com'
# 		self.SMTP_PORT = 587
# 		self.GMAIL_USERNAME = GMAIL_USERNAME
# 		self.GMAIL_PASSWORD = GMAIL_PASSWORD
# 		self.recipient = recipient
# 
# 	def send(self,subject,body ):
# 		msg = MIMEText(body)
# 		msg['Subject'] = subject
# 		msg['From'] = self.GMAIL_USERNAME
# 		msg['To'] = self.recipient
# 		session = smtplib.SMTP(self.SMTP_SERVER, self.SMTP_PORT)
# 		session.starttls()
# 		session.login(self.GMAIL_USERNAME, self.GMAIL_PASSWORD)
# 		session.sendmail(self.GMAIL_USERNAME, self.recipient, msg.as_string())
# 		session.quit()
# 
# Path: classes/twitterbot.py
# class TwitterBot:
# 
# 	def __init__(self, apiKey, apiSecret, accessToken, accessTokenSecret):
# 		self._apiKey = apiKey
# 		self._apiSecret = apiSecret
# 		self._accessToken = accessToken
# 		self._accessTokenSecret = accessTokenSecret
# 	
# 	def send(self, tweetStr):
# 		self.tweetStr = tweetStr
# 		api = Twython(self._apiKey,self._apiSecret,self._accessToken,self._accessTokenSecret)
# 		api.update_status(status=self.tweetStr)


import gammu, platform, subprocess, time, json, requests, socket, re
import paho.mqtt.publish as publish
	import RPi.GPIO as GPIO
	import emulator.GPIO as GPIO
from classes.gmailbot import GmailBot
from classes.twitterbot import TwitterBot
				body += i[1]+': '+str(i[2])+_('\nsource: ')+i[0]+_('\ntimestamp: ')+i[7]+'\n\n'
			GMAIL_USERNAME = conf.get('GMAIL', 'gmail')
			GMAIL_PASSWORD = conf.get('GMAIL', 'password')
			recipient = conf.get('GMAIL', 'recipient')
			if not body: body = time.strftime("%H:%M:%S") + ' ' + subject
			try:
				msg = GmailBot(GMAIL_USERNAME, GMAIL_PASSWORD, recipient)
				msg.send(subject, body)
			except Exception,e: print 'ERROR gmail action: '+str(e)
		elif option == 'ACT15':
			subprocess.Popen(['mpg123', '-q', text])
		elif option == 'ACT16':
			subprocess.Popen(['pkill', '-9', 'mpg123'])
		elif option == 'ACT17':
			subprocess.Popen(['python', self.currentpath + '/message.py', text, conf.get('GENERAL', 'lang')])
		elif option == 'ACT18':
			subprocess.Popen(['pkill', '-f', 'message.py'])
		elif option == 'ACT19':
			subprocess.Popen(['python', self.currentpath+'/ctrl_actions.py', '1'])
		elif option == 'ACT20':
			subprocess.Popen(['python', self.currentpath + '/ctrl_actions.py', '0'])
		elif option == 'ACT21':
			try:
				sm = gammu.StateMachine()
				sm.ReadConfig()
				sm.Init()
				message = {
					'Text': text,
					'SMSC': {'Location': 1},
					'Number': conf.get('SMS', 'phone'),

# Path: classes/gmailbot.py
# class GmailBot:
# 	def __init__(self, GMAIL_USERNAME,GMAIL_PASSWORD,recipient):
# 		self.SMTP_SERVER = 'smtp.gmail.com'
# 		self.SMTP_PORT = 587
# 		self.GMAIL_USERNAME = GMAIL_USERNAME
# 		self.GMAIL_PASSWORD = GMAIL_PASSWORD
# 		self.recipient = recipient
# 
# 	def send(self,subject,body ):
# 		msg = MIMEText(body)
# 		msg['Subject'] = subject
# 		msg['From'] = self.GMAIL_USERNAME
# 		msg['To'] = self.recipient
# 		session = smtplib.SMTP(self.SMTP_SERVER, self.SMTP_PORT)
# 		session.starttls()
# 		session.login(self.GMAIL_USERNAME, self.GMAIL_PASSWORD)
# 		session.sendmail(self.GMAIL_USERNAME, self.recipient, msg.as_string())
# 		session.quit()
# 
# Path: classes/twitterbot.py
# class TwitterBot:
# 
# 	def __init__(self, apiKey, apiSecret, accessToken, accessTokenSecret):
# 		self._apiKey = apiKey
# 		self._apiSecret = apiSecret
# 		self._accessToken = accessToken
# 		self._accessTokenSecret = accessTokenSecret
# 	
# 	def send(self, tweetStr):
# 		self.tweetStr = tweetStr
# 		api = Twython(self._apiKey,self._apiSecret,self._accessToken,self._accessTokenSecret)
# 		api.update_status(status=self.tweetStr)


# Path: classes/actions.py
import gammu, platform, subprocess, time, json, requests, socket, re
import paho.mqtt.publish as publish
	import RPi.GPIO as GPIO
	import emulator.GPIO as GPIO
from classes.gmailbot import GmailBot
from classes.twitterbot import TwitterBot

				body += i[1]+': '+str(i[2])+_('\nsource: ')+i[0]+_('\ntimestamp: ')+i[7]+'\n\n'
			GMAIL_USERNAME = conf.get('GMAIL', 'gmail')
			GMAIL_PASSWORD = conf.get('GMAIL', 'password')
			recipient = conf.get('GMAIL', 'recipient')
			if not body: body = time.strftime("%H:%M:%S") + ' ' + subject
			try:
				msg = GmailBot(GMAIL_USERNAME, GMAIL_PASSWORD, recipient)
				msg.send(subject, body)
			except Exception,e: print 'ERROR gmail action: '+str(e)
		elif option == 'ACT15':
			subprocess.Popen(['mpg123', '-q', text])
		elif option == 'ACT16':
			subprocess.Popen(['pkill', '-9', 'mpg123'])
		elif option == 'ACT17':
			subprocess.Popen(['python', self.currentpath + '/message.py', text, conf.get('GENERAL', 'lang')])
		elif option == 'ACT18':
			subprocess.Popen(['pkill', '-f', 'message.py'])
		elif option == 'ACT19':
			subprocess.Popen(['python', self.currentpath+'/ctrl_actions.py', '1'])
		elif option == 'ACT20':
			subprocess.Popen(['python', self.currentpath + '/ctrl_actions.py', '0'])
		elif option == 'ACT21':
			try:
				sm = gammu.StateMachine()
				sm.ReadConfig()
				sm.Init()
				message = {
					'Text': text,
					'SMSC': {'Location': 1},
					'Number': conf.get('SMS', 'phone'),

				}