# 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
			subprocess.Popen(['pkill', '-9', 'kplex'])
		elif option == 'ACT6':
			subprocess.call(['pkill', '-9', 'kplex'])
			subprocess.Popen('kplex')
		elif option == 'ACT7':
			subprocess.Popen(['startup', 'stop'])
		elif option == 'ACT8':
			subprocess.Popen(['startup', 'restart'])
		elif option == 'ACT9':
			subprocess.Popen(['sudo', 'python', self.currentpath +'/wifi_server.py', '0'])
			conf.set('WIFI', 'enable', '0')
		elif option == 'ACT10':
			subprocess.Popen(['sudo', 'python', self.currentpath+'/wifi_server.py', '1'])
			conf.set('WIFI', 'enable', '1')
		#elif option == 'ACT11':
		#elif option == 'ACT12':
		elif option == 'ACT13':
			now = time.strftime("%H:%M:%S")
			tweetStr = now + ' ' + text
			apiKey = conf.get('TWITTER', 'apiKey')
			apiSecret = conf.get('TWITTER', 'apiSecret')
			accessToken = conf.get('TWITTER', 'accessToken')
			accessTokenSecret = conf.get('TWITTER', 'accessTokenSecret')
			if len(tweetStr) > 140: tweetStr = tweetStr[0:140]
			try:
				msg = TwitterBot(apiKey, apiSecret, accessToken, accessTokenSecret)
				msg.send(tweetStr)
			except Exception,e: print 'ERROR Twitter action: '+str(e)
		elif option == 'ACT14':
			subject = text

# 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

			subprocess.Popen(['pkill', '-9', 'kplex'])
		elif option == 'ACT6':
			subprocess.call(['pkill', '-9', 'kplex'])
			subprocess.Popen('kplex')
		elif option == 'ACT7':
			subprocess.Popen(['startup', 'stop'])
		elif option == 'ACT8':
			subprocess.Popen(['startup', 'restart'])
		elif option == 'ACT9':
			subprocess.Popen(['sudo', 'python', self.currentpath +'/wifi_server.py', '0'])
			conf.set('WIFI', 'enable', '0')
		elif option == 'ACT10':
			subprocess.Popen(['sudo', 'python', self.currentpath+'/wifi_server.py', '1'])
			conf.set('WIFI', 'enable', '1')
		#elif option == 'ACT11':
		#elif option == 'ACT12':
		elif option == 'ACT13':
			now = time.strftime("%H:%M:%S")
			tweetStr = now + ' ' + text
			apiKey = conf.get('TWITTER', 'apiKey')
			apiSecret = conf.get('TWITTER', 'apiSecret')
			accessToken = conf.get('TWITTER', 'accessToken')
			accessTokenSecret = conf.get('TWITTER', 'accessTokenSecret')
			if len(tweetStr) > 140: tweetStr = tweetStr[0:140]
			try:
				msg = TwitterBot(apiKey, apiSecret, accessToken, accessTokenSecret)
				msg.send(tweetStr)
			except Exception,e: print 'ERROR Twitter action: '+str(e)
		elif option == 'ACT14':
			subject = text

			body = ''