From 2f585076c009ae575d94d6161fb036f770718ecc Mon Sep 17 00:00:00 2001 From: Luke Fitzgerald Date: Fri, 9 Jul 2010 01:25:18 -0700 Subject: [PATCH] Add StatusNet Phergie plugin to pass messages received to IM architecture --- .../Phergie/Plugin/Statusnet_Callback.php | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet_Callback.php 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); + } + } +} -- 2.39.5