Various bug fixes and tweaks found through 0, 1, and 2
[gc-dialer] / src / null_backend.py
index 795a4b7..c07f724 100644 (file)
@@ -1,21 +1,23 @@
 #!/usr/bin/python
 
-# DialCentral - Front end for Google's Grand Central service.
-# Copyright (C) 2008  Eric Warnke ericew AT gmail DOT com
-# 
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-# 
-# This library 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
-# Lesser General Public License for more details.
-# 
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"""
+DialCentral - Front end for Google's Grand Central service.
+Copyright (C) 2008  Eric Warnke ericew AT gmail DOT com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"""
 
 
 class NullDialer(object):
@@ -35,6 +37,9 @@ class NullDialer(object):
        def dial(self, number):
                return True
 
+       def send_sms(self, number, message):
+               raise NotImplementedError("SMS Is Not Supported")
+
        def clear_caches(self):
                pass
 
@@ -84,3 +89,46 @@ class NullDialer(object):
 
        def get_contact_details(self, contactId):
                return ()
+
+       def get_messages(self):
+               return ()
+
+
+class NullAddressBook(object):
+       """
+       Minimal example of both an addressbook factory and an addressbook
+       """
+
+       def clear_caches(self):
+               pass
+
+       def get_addressbooks(self):
+               """
+               @returns Iterable of (Address Book Factory, Book Id, Book Name)
+               """
+               yield self, "", "None"
+
+       def open_addressbook(self, bookId):
+               return self
+
+       @staticmethod
+       def contact_source_short_name(contactId):
+               return ""
+
+       @staticmethod
+       def factory_name():
+               return ""
+
+       @staticmethod
+       def get_contacts():
+               """
+               @returns Iterable of (contact id, contact name)
+               """
+               return []
+
+       @staticmethod
+       def get_contact_details(contactId):
+               """
+               @returns Iterable of (Phone Type, Phone Number)
+               """
+               return []