summaryrefslogtreecommitdiff
path: root/apps/mm/plugins
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-01-08 17:45:50 -0800
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-01-08 17:45:50 -0800
commit4c58c41d818918b1690b56f05876d9af642354c0 (patch)
treeb07c0f2925a5753ab3c34379db5c90c5dc38bad1 /apps/mm/plugins
parent83e460cdc3fc09867a3adb48c3d0894579dd3050 (diff)
parent3d64793a1ee45857856be1cd71c3a0a040a3e869 (diff)
add message manager back as another app depending on umummm
Diffstat (limited to 'apps/mm/plugins')
-rw-r--r--apps/mm/plugins/SenderGVSMS.class.php34
-rw-r--r--apps/mm/plugins/SenderIdentica.class.php35
2 files changed, 69 insertions, 0 deletions
diff --git a/apps/mm/plugins/SenderGVSMS.class.php b/apps/mm/plugins/SenderGVSMS.class.php
new file mode 100644
index 0000000..76db208
--- /dev/null
+++ b/apps/mm/plugins/SenderGVSMS.class.php
@@ -0,0 +1,34 @@
+<?php
+require_once('Plugin.class.php');
+require_once('GoogleVoice.class.php');
+
+class SenderGVSMS extends Plugin {
+ 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 sendPrivate($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);
+ }
+}
diff --git a/apps/mm/plugins/SenderIdentica.class.php b/apps/mm/plugins/SenderIdentica.class.php
new file mode 100644
index 0000000..ab55eb9
--- /dev/null
+++ b/apps/mm/plugins/SenderIdentica.class.php
@@ -0,0 +1,35 @@
+<?php
+require_once('Plugin.class.php');
+require_once('Identica.class.php');
+
+class SenderIdentica extends Plugin {
+ protected $config = array('username'=>'',
+ 'password'=>'',
+ 'length'=>140);
+ private $obj;
+
+ public static function description() {
+ return 'Dent messages to Identi.ca.';
+ }
+
+ public static function configList() {
+ return array('username'=>'text',
+ 'password'=>'password',
+ 'length'=>'int');
+ }
+
+ public function init() {
+ $this->obj = new Identica($this->config['username'],
+ $this->config['password']);
+ }
+
+ public function sendBroadcast($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->updateStatus($subject.' '.$url);
+ }
+}