aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/Chatroom.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-11-04 18:18:56 -0700
committerzotlabs <mike@macgirvin.com>2017-11-04 18:18:56 -0700
commit65bc146afa82f3f0f2e3921660189892af42c15b (patch)
treeafbe430a72f01a2ba02b05f4587cf42196c6a136 /Zotlabs/Lib/Chatroom.php
parent9630d2ef2c042c5531bf3a553317ae3bd115f3dc (diff)
parent6995d54a3cc162d87f881f6e206fa356230fd9e8 (diff)
downloadvolse-hubzilla-65bc146afa82f3f0f2e3921660189892af42c15b.tar.gz
volse-hubzilla-65bc146afa82f3f0f2e3921660189892af42c15b.tar.bz2
volse-hubzilla-65bc146afa82f3f0f2e3921660189892af42c15b.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge
Diffstat (limited to 'Zotlabs/Lib/Chatroom.php')
-rw-r--r--Zotlabs/Lib/Chatroom.php40
1 files changed, 24 insertions, 16 deletions
diff --git a/Zotlabs/Lib/Chatroom.php b/Zotlabs/Lib/Chatroom.php
index e1a9a10b3..e762620ae 100644
--- a/Zotlabs/Lib/Chatroom.php
+++ b/Zotlabs/Lib/Chatroom.php
@@ -2,22 +2,18 @@
namespace Zotlabs\Lib;
/**
- * @brief Chat related functions.
+ * @brief A class with chatroom related static methods.
*/
-
-
-
class Chatroom {
/**
* @brief Creates a chatroom.
*
* @param array $channel
* @param array $arr
- * @return An associative array containing:
- * - success: A boolean
- * - message: (optional) A string
+ * @return array An associative array containing:
+ * * \e boolean \b success - A boolean success status
+ * * \e string \b message - (optional) A string
*/
-
static public function create($channel, $arr) {
$ret = array('success' => false);
@@ -150,8 +146,8 @@ class Chatroom {
}
if(intval($x[0]['cr_expire'])) {
- $r = q("delete from chat where created < %s - INTERVAL %s and chat_room = %d",
- db_utcnow(),
+ $r = q("delete from chat where created < %s - INTERVAL %s and chat_room = %d",
+ db_utcnow(),
db_quoteinterval( intval($x[0]['cr_expire']) . ' MINUTE' ),
intval($x[0]['cr_id'])
);
@@ -225,10 +221,16 @@ class Chatroom {
}
/**
- * create a chat message via API.
+ * @brief Create a chat message via API.
+ *
* It is the caller's responsibility to enter the room.
- */
-
+ *
+ * @param int $uid
+ * @param int $room_id
+ * @param string $xchan
+ * @param string $text
+ * @return array
+ */
static public function message($uid, $room_id, $xchan, $text) {
$ret = array('success' => false);
@@ -245,12 +247,18 @@ class Chatroom {
if(! $r)
return $ret;
- $arr = array(
+ $arr = [
'chat_room' => $room_id,
'chat_xchan' => $xchan,
'chat_text' => $text
- );
-
+ ];
+ /**
+ * @hooks chat_message
+ * Called to create a chat message.
+ * * \e int \b chat_room
+ * * \e string \b chat_xchan
+ * * \e string \b chat_text
+ */
call_hooks('chat_message', $arr);
$x = q("insert into chat ( chat_room, chat_xchan, created, chat_text )