From dffd7ec9dd715ff084b4e168df5f712fff06bf0d Mon Sep 17 00:00:00 2001
From: Ike
Date: Fri, 25 Oct 2019 21:24:31 +0200
Subject: Implement embedded webchat

---
 model/Room.php | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'model/Room.php')

diff --git a/model/Room.php b/model/Room.php
index e5163a5..1fdbf7b 100644
--- a/model/Room.php
+++ b/model/Room.php
@@ -154,9 +154,20 @@ class Room
 		);
 	}
 
+	public function hasWebchat() {
+		return $this->getConference()->get('ROOMS.'.$this->getSlug().'.WEBCHAT') && $this->getConference()->has('WEBCHAT_URL');
+	}
+
+	public function getWebchatUrl() {
+		return sprintf(
+			$this->getConference()->get('ROOMS.'.$this->getSlug().'.WEBCHAT_URL', $this->getConference()->get('WEBCHAT_URL')),
+			rawurlencode($this->getSlug())
+		);
+	}
+
 
 	public function hasChat() {
-		return $this->hasTwitter() || $this->hasIrc();
+		return $this->hasTwitter() || $this->hasIrc() || $this->hasWebchat();
 	}
 
 
-- 
cgit v1.2.3