Logging sms/dial; logging device info; added Ctrl+r; fixing a bug with shutdown/settings
[gc-dialer] / src / backends / 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_quick_login_possible(self):
29                 return False
30
31         def is_authed(self, force = False):
32                 return False
33
34         def login(self, username, password):
35                 return self.is_authed()
36
37         def logout(self):
38                 self.clear_caches()
39
40         def dial(self, number):
41                 return True
42
43         def send_sms(self, number, message):
44                 raise NotImplementedError("SMS Is Not Supported")
45
46         def clear_caches(self):
47                 pass
48
49         def is_valid_syntax(self, number):
50                 """
51                 @returns If This number be called ( syntax validation only )
52                 """
53                 return False
54
55         def get_account_number(self):
56                 """
57                 @returns The grand central phone number
58                 """
59                 return ""
60
61         def set_sane_callback(self):
62                 pass
63
64         def get_callback_numbers(self):
65                 return {}
66
67         def set_callback_number(self, callbacknumber):
68                 return True
69
70         def get_callback_number(self):
71                 return ""
72
73         def get_recent(self):
74                 return ()
75
76         def get_addressbooks(self):
77                 return ()
78
79         def open_addressbook(self, bookId):
80                 return self
81
82         @staticmethod
83         def contact_source_short_name(contactId):
84                 return "ERROR"
85
86         @staticmethod
87         def factory_name():
88                 return "ERROR"
89
90         def get_contacts(self):
91                 return ()
92
93         def get_contact_details(self, contactId):
94                 return ()
95
96         def get_messages(self):
97                 return ()
98
99
100 class NullAddressBook(object):
101         """
102         Minimal example of both an addressbook factory and an addressbook
103         """
104
105         def clear_caches(self):
106                 pass
107
108         def get_addressbooks(self):
109                 """
110                 @returns Iterable of (Address Book Factory, Book Id, Book Name)
111                 """
112                 yield self, "", "None"
113
114         def open_addressbook(self, bookId):
115                 return self
116
117         @staticmethod
118         def contact_source_short_name(contactId):
119                 return ""
120
121         @staticmethod
122         def factory_name():
123                 return ""
124
125         @staticmethod
126         def get_contacts():
127                 """
128                 @returns Iterable of (contact id, contact name)
129                 """
130                 return []
131
132         @staticmethod
133         def get_contact_details(contactId):
134                 """
135                 @returns Iterable of (Phone Type, Phone Number)
136                 """
137                 return []