This repository was archived by the owner on Aug 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseProvider.py
More file actions
60 lines (46 loc) · 1.42 KB
/
BaseProvider.py
File metadata and controls
60 lines (46 loc) · 1.42 KB
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
from Status import Status
from copy import copy
__author__ = 'JuniorJPDJ'
class BaseProvider(object):
auth = False
visible_name = ''
name = ''
desc = ''
logo = 'http://svg2stl.com/api/preview/567908aa9f2e1c6c3904b58c'
color = 'ce4847'
features = ()
def __init__(self, client):
self.client = client
self._contacts = []
self.send_status(Status())
self.update_contacts()
@classmethod
def get_info(cls):
return {'visibleName': cls.visible_name, 'name': cls.name, 'desc': cls.desc, 'logo': cls.logo,
'auth': cls.auth, 'features': cls.features, 'color': int(cls.color, 16)}
@property
def id(self):
return self.client.get_provider_id(self)
@property
def contacts(self):
'''returns list with Contact() objects'''
return copy(self._contacts)
def update_contacts(self):
'''downloads contacts from provider's server'''
return True
def send_status(self, status):
self.status = status
return True
def send_message(self, msg):
'''sends message'''
return True
def login(self):
return True
def logout(self):
return True
def get_contact(self, id):
for i in self._contacts:
if i.id == id:
return i
raise ValueError('There is no contact with that id')
__provider__ = BaseProvider # main class