# Path: surveilr/config.py
# def defaults_file():
# def config_files():
# def load_default_config():
# def get_str(section, option):
# def get_int(section, option):
# def get_bool(section, option):
# 
# Path: surveilr/drivers.py
# def register_driver(driver_type, name, driver):
# def unregister_driver(driver_type, name):
# def get_driver(driver_type, name):


from surveilr import config
from surveilr import drivers
import BulkSMS
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public
    License along with this program.  If not, see
    <http://www.gnu.org/licenses/>.

    BulkSMS driver
"""



class BulkSMSMessaging(object):
    def __init__(self):
        username = config.get_str('sms', 'username')
        password = config.get_str('sms', 'password')
        kwargs = {}
        try:
            kwargs['server'] = config.get_str('sms', 'server')
        except config.NoOptionError:
            pass

        self.client = BulkSMS.Server(username, password, **kwargs)

    def send(self, recipient, info):
        sender = config.get_str('sms', 'sender')
        self.client.send_sms(recipients=[recipient.messaging_address],
                             sender=sender,
                             text=str(info))



# Path: surveilr/config.py
# def defaults_file():
# def config_files():
# def load_default_config():
# def get_str(section, option):
# def get_int(section, option):
# def get_bool(section, option):
# 
# Path: surveilr/drivers.py
# def register_driver(driver_type, name, driver):
# def unregister_driver(driver_type, name):
# def get_driver(driver_type, name):


# Path: surveilr/messaging/sms/bulksms_driver.py
from surveilr import config
from surveilr import drivers
import BulkSMS

    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public
    License along with this program.  If not, see
    <http://www.gnu.org/licenses/>.

    BulkSMS driver
"""



class BulkSMSMessaging(object):
    def __init__(self):
        username = config.get_str('sms', 'username')
        password = config.get_str('sms', 'password')
        kwargs = {}
        try:
            kwargs['server'] = config.get_str('sms', 'server')
        except config.NoOptionError:
            pass

        self.client = BulkSMS.Server(username, password, **kwargs)

    def send(self, recipient, info):
        sender = config.get_str('sms', 'sender')
        self.client.send_sms(recipients=[recipient.messaging_address],
                             sender=sender,
                             text=str(info))



drivers.register_driver('sms', 'bulksms', BulkSMSMessaging())