From 787b5b657f6fa3251f8b0b4a770784f0ddaed407 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 1 Mar 2015 12:02:11 +0100 Subject: Chat-Panel --- lib/helper.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'lib/helper.php') 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; -- cgit v1.2.3