Missed some locations
[theonering] / src / null_backend.py
1 #!/usr/bin/python
2
3 """
4 DialCentral - Front end for Google's Grand Central service.
5 Copyright (C) 2008  Eric Warnke ericew AT gmail DOT com
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20 """
21
22
23 class NullDialer(object):
24
25         def __init__(self):
26                 pass
27
28         def is_authed(self, force = False):
29                 return False
30
31         def login(self, username, password):
32                 return self.is_authed()
33
34         def logout(self):
35                 self.clear_caches()
36
37         def dial(self, number):
38                 return True
39
40         def send_sms(self, number, message):
41                 raise NotImplementedError("SMS Is Not Supported")
42
43         def clear_caches(self):
44                 pass
45
46         def is_valid_syntax(self, number):
47                 """
48                 @returns If This number be called ( syntax validation only )
49                 """
50                 return False
51
52         def get_account_number(self):
53                 """
54                 @returns The grand central phone number
55                 """
56                 return ""
57
58         def set_sane_callback(self):
59                 pass
60
61         def get_callback_numbers(self):
62                 return {}
63
64         def set_callback_number(self, callbacknumber):
65                 return True
66
67         def get_callback_number(self):
68                 return ""
69
70         def get_recent(self):
71                 return ()
72
73         def get_addressbooks(self):
74                 return ()
75
76         def open_addressbook(self, bookId):
77                 return self
78
79         @staticmethod
80         def contact_source_short_name(contactId):
81                 return "ERROR"
82
83         @staticmethod
84         def factory_name():
85                 return "ERROR"
86
87         def get_contacts(self):
88                 return ()
89
90         def get_contact_details(self, contactId):
91                 return ()
92
93         def get_messages(self):
94                 return ()
95
96
97 class NullAddressBook(object):
98         """
99         Minimal example of both an addressbook factory and an addressbook
100         """
101
102         def clear_caches(self):
103                 pass
104
105         def get_addressbooks(self):
106                 """
107                 @returns Iterable of (Address Book Factory, Book Id, Book Name)
108                 """
109                 yield self, "", "None"
110
111         def open_addressbook(self, bookId):
112                 return self
113
114         @staticmethod
115         def contact_source_short_name(contactId):
116                 return ""
117
118         @staticmethod
119         def factory_name():
120                 return ""
121
122         @staticmethod
123         def get_contacts():
124                 """
125                 @returns Iterable of (contact id, contact name)
126                 """
127                 return []
128
129         @staticmethod
130         def get_contact_details(contactId):
131                 """
132                 @returns Iterable of (Phone Type, Phone Number)
133                 """
134                 return []