summaryrefslogtreecommitdiff
path: root/src/plugins/SenderGVSMS.class.php
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-08-01 01:22:36 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-08-01 01:22:36 -0400
commit09dfe32eb6b538225686fd6ed0220240010bc574 (patch)
tree29c1afc5e79519ba8689a3d5d170c312d3cf5033 /src/plugins/SenderGVSMS.class.php
initial commit.
Partway through a rewrite. I have some old files I didn't want to entirely delete.
Diffstat (limited to 'src/plugins/SenderGVSMS.class.php')
-rw-r--r--src/plugins/SenderGVSMS.class.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/plugins/SenderGVSMS.class.php b/src/plugins/SenderGVSMS.class.php
new file mode 100644
index 0000000..777586c
--- /dev/null
+++ b/src/plugins/SenderGVSMS.class.php
@@ -0,0 +1,35 @@
+<?php
+
+require_once('SenderPrivate.class.php');
+require_once('GoogleVoice.class.php');
+
+class SenderGVSMS extends SenderPrivate {
+ protected $config = array('username'=>'',
+ 'password'=>'',
+ 'length'=>160);
+ private $obj;
+
+ public static function description() {
+ return 'Send messages over SMS via GoogleVoice.';
+ }
+
+ public static function configList() {
+ return array('username'=>'text',
+ 'password'=>'password');
+ }
+
+ public function init() {
+ $this->obj = new GoogleVoice($this->config['username'],
+ $this->config['password']);
+ }
+
+ public function send($phoneNum, $id, $subject, $body) {
+ global $shorturl, $messenger;
+ $url = $shorturl->get($messenger->id2url($id));
+ $maxlen = $this->config['length']-(strlen($url)+1);
+ if($maxlen < strlen($subject)) {
+ $subject = substr($subject,0,$maxlen-3).'...';
+ }
+ $this->obj->sms($phoneNum, $subject.' '.$url);
+ }
+}