-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyST.py
executable file
·69 lines (52 loc) · 2 KB
/
MyST.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
MyServerTalks! Project Beta | myservertalks.com / myservertalks.net
Andrei de Oliveira Mosman
mosman [at] myservertalks.net
Cleber Willian dos Santos
binho [at] myservertalks.net
This file is part of MyServerTalks.
MyServerTalks is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
MyServerTalks is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MyServerTalks; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
'''
#import os
import sys
from MySTBase import *
from MySTLog import *
from MySTConfig import *
from MySTUserHandler import *
from MySTConnection import *
from MySTModuleManager import *
class MyST:
def __init__(self):
self.config = MySTConfig()
if not self.config.get('config', 'account', 'user'):
print 'MyServerTalks is not configured. Try to setup config.ini'
sys.exit(1)
# Get user and pass from MyST jabber user
self.user = self.config.get('config', 'account', 'user')
self.password = self.config.get('config', 'account', 'pass')
self.user_handler = MySTUserHandler(self.config)
print 'MyServerTalks! '+MySTBase.getVersion()+' running...\n'
MySTLog.log('MyServerTalks! '+MySTBase.getVersion()+' running...')
# Connect MyST
def connect(self):
self.conn = MySTConnection(MySTModuleManager(self.config, self.user_handler))
self.conn.connect(self.user, self.password)
# Process informations and check connection state
def looping(self):
self.conn.loop()
if __name__ == '__main__':
myst = MyST()
myst.connect()
myst.looping()