aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaZderMind2015-03-01 12:02:11 +0100
committerMaZderMind2015-03-01 12:02:11 +0100
commit787b5b657f6fa3251f8b0b4a770784f0ddaed407 (patch)
treef73c41e3107adfa617ae585efe0ce016094dc2e5 /lib
parent810f165a10910a0497503bc4bb79f03c14332120 (diff)
Chat-Panel
Diffstat (limited to '')
-rw-r--r--lib/helper.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/helper.php b/lib/helper.php
index 647d657..fdd472e 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -184,6 +184,45 @@ function room_has_hls($room)
return count(array_intersect(array('hls-hd', 'hls-sd'), $formats)) > 0;
}
+function room_has_irc($room)
+{
+ return get("ROOMS.$room.IRC") && has("IRC");
+}
+
+function room_has_twitter($room)
+{
+ return get("ROOMS.$room.TWITTER") && has("TWITTER");
+}
+
+function room_has_chat($room)
+{
+ return room_has_irc($room) || room_has_twitter($room);
+}
+
+function room_get_irc_url($room)
+{
+ $cfg = get("ROOMS.$room.IRC_CONFIG", get("IRC"));
+ return sprintf($cfg['URL'], rawurlencode($room));
+}
+
+function room_get_irc_display($room)
+{
+ $cfg = get("ROOMS.$room.IRC_CONFIG", get("IRC"));
+ return sprintf($cfg['DISPLAY'], $room);
+}
+
+function room_get_twitter_hashtag($room)
+{
+ $cfg = get("ROOMS.$room.TWITTER_CONFIG", get("TWITTER"));
+ return sprintf($cfg['TEXT'], $room);
+}
+
+function room_get_twitter_display($room)
+{
+ $cfg = get("ROOMS.$room.TWITTER_CONFIG", get("TWITTER"));
+ return sprintf($cfg['DISPLAY'], $room);
+}
+
function startswith($needle, $haystack)
{
return substr($haystack, 0, strlen($needle)) == $needle;