From: Luke Fitzgerald Date: Fri, 9 Jul 2010 08:25:18 +0000 (-0700) Subject: Add StatusNet Phergie plugin to pass messages received to IM architecture X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2f585076c009ae575d94d6161fb036f770718ecc;p=quix0rs-gnu-social.git Add StatusNet Phergie plugin to pass messages received to IM architecture --- diff --git a/plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet_Callback.php b/plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet_Callback.php new file mode 100644 index 0000000000..d5d2bfcaa0 --- /dev/null +++ b/plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet_Callback.php @@ -0,0 +1,63 @@ +. + * + * Calls the given Statusnet IM architecture enqueuing method to enqueue + * a new incoming message + * + * @category Phergie + * @package Phergie_Plugin_Statusnet_Callback + * @author Luke Fitzgerald config['statusnet_callback.callback']; + if (is_callable($callback)) { + $this->callback = $callback; + } else { + $this->callback = NULL; + } + } + + /** + * Passes incoming messages to StatusNet + * + * @return void + */ + public function onPrivmsg() { + if ($this->callback !== NULL) { + $event = $this->getEvent(); + $source = $event->getSource(); + $message = trim($event->getText()); + + call_user_func($this->callback, array('sender' => $source, 'message' => $message); + } + } +}