Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bigbluebutton/bigbluebutton
Browse files Browse the repository at this point in the history
  • Loading branch information
ritzalam committed Sep 25, 2010
2 parents 17b3f3b + 84bc11a commit bda8019
Show file tree
Hide file tree
Showing 65 changed files with 1,304 additions and 86 deletions.
83 changes: 50 additions & 33 deletions bbb-api-examples/PHP/bbb_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
*/

function bbb_wrap_simplexml_load_file($url){

if(function_exists("curl_init()")){
if (extension_loaded('curl')) {
$ch = curl_init() or die ( curl_error() );
$timeout = 10;
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
Expand All @@ -37,13 +37,18 @@ function bbb_wrap_simplexml_load_file($url){
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec( $ch );
curl_close( $ch );
return (new SimpleXMLElement($data));
}
else{
return (simplexml_load_file($url));

if($data)
return (new SimpleXMLElement($data));
else
return false;
}

return (simplexml_load_file($url));
}



/*
@param
$userName = userName AND meetingID (string)
Expand Down Expand Up @@ -122,10 +127,38 @@ public function __construct() {
*/
public function joinURL( $meetingID, $userName, $PW, $SALT, $URL ) {
$url_join = $URL."api/join?";
$params = 'meetingID='.urlencode($meetingID).'&fullName='.urlencode($userName).'&password='.$PW;
$params = 'meetingID='.urlencode($meetingID).'&fullName='.urlencode($userName).'&password='.urlencode($PW);
return ($url_join.$params.'&checksum='.sha1("join".$params.$SALT) );
}


/**
*This method returns the url to join the specified meeting.
*
*@param name -- a name fot the meeting
*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
*@param attendeePW -- the attendee of the meeting
*@param moderatorPW -- the moderator of the meeting
*@param welcome -- the welcome message that gets displayed on the chat window
*@param logoutURL -- the URL that the bbb client will go to after users logouut
*@param SALT -- the security salt of the bigbluebutton server
*@param URL -- the url of the bigbluebutton server
*
*@return The url to join the meeting
*/
public function createMeetingURL($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL ) {
$url_create = $URL."api/create?";
$voiceBridge = 70000 + rand(0, 9999);

$params = 'name='.urlencode($name).'&meetingID='.urlencode($meetingID).'&attendeePW='.urlencode($attendeePW).'&moderatorPW='.urlencode($moderatorPW).'&voiceBridge='.$voiceBridge.'&logoutURL='.urlencode($logoutURL);

if( trim( $welcome ) )
$params .= '&welcome='.urlencode($welcome);

return ( $url_create.$params.'&checksum='.sha1("create".$params.$SALT) );
}


/**
*This method returns the url to check if the specified meeting is running.
*
Expand Down Expand Up @@ -153,7 +186,7 @@ public function isMeetingRunningURL( $meetingID, $URL, $SALT ) {
*/
public function getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) {
$base_url = $URL."api/getMeetingInfo?";
$params = 'meetingID='.urlencode($meetingID).'&password='.$modPW;
$params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW);
return ( $base_url.$params.'&checksum='.sha1("getMeetingInfo".$params.$SALT));
}

Expand Down Expand Up @@ -183,7 +216,7 @@ public function getMeetingsURL($URL, $SALT) {
*/
public function endMeetingURL( $meetingID, $modPW, $URL, $SALT ) {
$base_url = $URL."api/end?";
$params = 'meetingID='.urlencode($meetingID).'&password='.$modPW;
$params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW);
return ( $base_url.$params.'&checksum='.sha1("end".$params.$SALT) );
}

Expand All @@ -203,20 +236,11 @@ public function endMeetingURL( $meetingID, $modPW, $URL, $SALT ) {
*@return The joinURL if successful or an error message if unsuccessful
*/
public function createMeetingAndGetJoinURL( $username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL ) {
$url_create = $URL."api/create?";
$url_join = $URL."api/join?";
$voiceBridge = 70000 + rand(0, 9999);

$params = 'name='.urlencode($username).'&meetingID='.urlencode($meetingID).'&attendeePW='.$aPW.'&moderatorPW='.$mPW.'&voiceBridge='.$voiceBridge.'&logoutURL='.urlencode($logoutURL);

if( trim( $welcomeString ) )
$params .= '&welcome='.urlencode($welcomeString);

$xml = bbb_wrap_simplexml_load_file($url_create.$params.'&checksum='.sha1("create".$params.$SALT) );
$xml = bbb_wrap_simplexml_load_file( BigBlueButton::createMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL ) );

if( $xml && $xml->returncode == 'SUCCESS' ) {
$params = 'meetingID='.urlencode($meetingID).'&fullName='.urlencode($username).'&password='.$mPW.'&logoutURL='.urlencode($logoutURL);
return ($url_join.$params.'&checksum='.sha1("join".$params.$SALT) );
return ( BigBlueButton::joinURL( $meetingID, $username, $mPW, $SALT, $URL ) );
}
else if( $xml ) {
return ( $xml->messageKey.' : '.$xml->message );
Expand Down Expand Up @@ -244,16 +268,8 @@ public function createMeetingAndGetJoinURL( $username, $meetingID, $welcomeStrin
* - If success it returns an array containing a returncode, messageKey, message, meetingID, attendeePW, moderatorPW, hasBeenForciblyEnded.
*/
public function createMeetingArray( $username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL ) {
$url_create = $URL."api/create?";
$url_join = $URL."api/join?";
$voiceBridge = 70000 + rand(0, 9999);

$params = 'name='.urlencode($meetingID).'&meetingID='.urlencode($meetingID).'&attendeePW='.$aPW.'&moderatorPW='.$mPW.'&voiceBridge='.$voiceBridge.'&logoutURL='.urlencode($logoutURL);

if( trim( $welcomeString ) )
$params .= '&welcome='.urlencode($welcomeString);

$xml = bbb_wrap_simplexml_load_file($url_create.$params.'&checksum='.sha1("create".$params.$SALT) );
$xml = bbb_wrap_simplexml_load_file( BigBlueButton::createMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL ) );

if( $xml ) {
if($xml->meetingID) return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded );
Expand All @@ -279,7 +295,10 @@ public function createMeetingArray( $username, $meetingID, $welcomeString, $mPW,
*/
public function getMeetingInfo( $meetingID, $modPW, $URL, $SALT ) {
$xml = bbb_wrap_simplexml_load_file( BigBlueButton::getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
if($xml){
return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
}
return false;
}

/**
Expand All @@ -298,9 +317,7 @@ public function getMeetingInfo( $meetingID, $modPW, $URL, $SALT ) {
*/
public function getMeetingInfoArray( $meetingID, $modPW, $URL, $SALT ) {
$xml = bbb_wrap_simplexml_load_file( BigBlueButton::getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );

var_dump($xml);


if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null){//The meetings were returned
return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
}
Expand Down
Binary file modified bigbluebutton-apps/bin/HelloEvents.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

package org.bigbluebutton.conference.service.chat;

import java.util.List;

import org.slf4j.Logger;
import org.red5.logging.Red5LoggerFactory;
import org.bigbluebutton.conference.service.chat.ChatRoomsManager;
Expand Down Expand Up @@ -58,7 +60,7 @@ public boolean addRoomListener(String room, IChatRoomListener listener) {
return false;
}

public String getChatMessages(String room) {
public List<String> getChatMessages(String room) {
return roomsManager.getChatMessages(room);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import org.slf4j.Logger;
import org.red5.logging.Red5LoggerFactory;

import net.jcip.annotations.ThreadSafe;import java.util.concurrent.ConcurrentHashMap;import java.util.Iterator;
import net.jcip.annotations.ThreadSafe;import java.util.concurrent.ConcurrentHashMap;import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Contains information about a ChatRoom.
Expand All @@ -34,11 +36,12 @@ public class ChatRoom {

private final String name;
private final Map<String, IChatRoomListener> listeners;
String messages;
ArrayList<String> messages;

public ChatRoom(String name) {
this.name = name;
listeners = new ConcurrentHashMap<String, IChatRoomListener>();
this.messages = new ArrayList<String>();
}

public String getName() {
Expand All @@ -57,17 +60,13 @@ public void removeRoomListener(IChatRoomListener listener) {
listeners.remove(listener);
}

public String getChatMessages(){
public List<String> getChatMessages(){
return messages;
}

@SuppressWarnings("unchecked")
public void sendMessage(String msg){
if (messages == null) {
messages = msg;
} else {
messages += msg;
}
messages.add(msg);

for (Iterator iter = listeners.values().iterator(); iter.hasNext();) {
log.debug("calling on listener");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.slf4j.Logger;
import org.red5.logging.Red5LoggerFactory;
import net.jcip.annotations.ThreadSafe;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
Expand Down Expand Up @@ -62,13 +64,13 @@ private ChatRoom getRoom(String name) {
return rooms.get(name);
}

public String getChatMessages(String room) {
public List<String> getChatMessages(String room) {
ChatRoom r = getRoom(room);
if (r != null) {
return r.getChatMessages();
}
log.warn("Getting messages from a non-existing room {}", room);
return "";
return null;
}

public void sendMessage(String room, String message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.bigbluebutton.conference.service.chat;
import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.red5.logging.Red5LoggerFactory;
Expand All @@ -30,7 +31,7 @@ public class ChatService {

private ChatApplication application;

public String getChatMessages() {
public List<String> getChatMessages() {
String roomName = Red5.getConnectionLocal().getScope().getName();
return application.getChatMessages(roomName);
}
Expand Down
10 changes: 5 additions & 5 deletions bigbluebutton-client/src/ChatModule.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<maps:ChatEventMap id="chatLocalEventMap"/>

<mate:Listener type="{TranscriptLoadedEvent.TRANSCRIPT_EVENT}" method="handleTranscriptLoadedEvent"/>
<mate:Listener type="{TranscriptEvent.TRANSCRIPT_EVENT}" method="handleTranscriptLoadedEvent"/>

<mx:Script>
<![CDATA[
Expand All @@ -43,7 +43,7 @@
import org.bigbluebutton.modules.chat.events.PublicChatMessageEvent;
import org.bigbluebutton.modules.chat.events.StartChatModuleEvent;
import org.bigbluebutton.modules.chat.events.StopChatModuleEvent;
import org.bigbluebutton.modules.chat.events.TranscriptLoadedEvent;
import org.bigbluebutton.modules.chat.events.TranscriptEvent;
private var _moduleId:String = "ChatModule";
private var _moduleName:String = "Chat Module";
Expand Down Expand Up @@ -133,12 +133,12 @@
private function handleTranscriptLoadedEvent(event:Event):void {
LogUtil.debug("Handling TranscriptLoadedEvent");
var welcome:String = _attributes.welcome as String;
if (welcome != ""){
/*if (welcome != ""){
var welcomeEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT);
welcomeEvent.message = welcome;
welcomeEvent.message = welcome + "|" + " " + "|" + "0" + "|" + "00:00" + "|" + "en";
var globalDispatcher:Dispatcher = new Dispatcher();
globalDispatcher.dispatchEvent(welcomeEvent);
}
} */
}
]]>
</mx:Script>
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ package org.bigbluebutton.modules.chat.events
{
import flash.events.Event;

public class TranscriptLoadedEvent extends Event
public class TranscriptEvent extends Event
{
public static const LOAD_TRANSCRIPT:String = "LOAD_TRANSCRIPT";
public static const TRANSCRIPT_EVENT:String = 'TRANSCRIPT_EVENT';

public function TranscriptLoadedEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false)
public function TranscriptEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false)
{
super(type, bubbles, cancelable);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.bigbluebutton.modules.chat.events.SendPublicChatMessageEvent;
import org.bigbluebutton.modules.chat.events.StartChatModuleEvent;
import org.bigbluebutton.modules.chat.events.StopChatModuleEvent;
import org.bigbluebutton.modules.chat.events.TranscriptEvent;
import org.bigbluebutton.modules.chat.managers.ChatManager;
import org.bigbluebutton.modules.chat.services.PrivateChatService;
import org.bigbluebutton.modules.chat.services.PublicChatService;
Expand Down Expand Up @@ -71,6 +72,10 @@
<EventHandlers type="{ChatEvent.CHAT_EVENT}">
<MethodInvoker generator="{ChatManager}" method="receivedGlobalMessage" />
</EventHandlers>

<EventHandlers type="{TranscriptEvent.LOAD_TRANSCRIPT}" >
<MethodInvoker generator="{PublicChatService}" method="loadTranscript" />
</EventHandlers>

<!--EventHandlers type="{ConnectionEvent.CONNECT_EVENT}">
<MethodInvoker generator="{ChatManager}" method="receivedMessage" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ package org.bigbluebutton.modules.chat.services
chatSOService.leave();
}

public function loadTranscript():void{
chatSOService.getChatTranscript();
}

public function sendChatMessageEvent(event:SendPublicChatMessageEvent):void {
trace("Receive receivedSendPublicChatMessageEvent");
var newMessage:String;
Expand Down
Loading

0 comments on commit bda8019

Please sign in to comment.