we do not expect requests for users or chathistory. These replies are automatically sent on successful validation

This commit is contained in:
Anton Georgiev 2014-05-28 18:44:19 +00:00
parent 77f5eaf6cf
commit 5bcd1e9dcd
2 changed files with 36 additions and 49 deletions

View File

@ -32,58 +32,50 @@ public class ChatMessageListener implements MessageHandler{
eventName = eventName.replace("\"", "");
if (eventName.equalsIgnoreCase("public_chat_message_event") ||
eventName.equalsIgnoreCase("send_public_chat_message") || //identical
eventName.equalsIgnoreCase("send_public_chat_message") ||
eventName.equalsIgnoreCase("private_chat_message_event") ||
eventName.equalsIgnoreCase("send_private_chat_message") ||//identical
eventName.equalsIgnoreCase("get_chat_history")){
eventName.equalsIgnoreCase("send_private_chat_message")){
String meetingID = payloadObject.get("meeting_id").toString().replace("\"", "");
String requesterID = payloadObject.get("requester_id").toString().replace("\"", "");
//case getChatHistory
if(eventName.equalsIgnoreCase("get_chat_history")) {
String replyTo = meetingID + "/" + requesterID;
bbbGW.getChatHistory(meetingID, requesterID, replyTo);
String chatType = messageObject.get("chat_type").toString().replace("\"", "");
String fromUserID = messageObject.get("from_userid").toString().replace("\"", "");
String fromUsername = messageObject.get("from_username").toString().replace("\"", "");
String fromColor = messageObject.get("from_color").toString().replace("\"", "");
String fromTime = messageObject.get("from_time").toString().replace("\"", "");
String fromTimezoneOffset = messageObject.get("from_tz_offset").toString().replace("\"", "");
String fromLang = messageObject.get("from_lang").toString().replace("\"", "");
String toUserID = messageObject.get("to_userid").toString().replace("\"", "");
String toUsername = messageObject.get("to_username").toString().replace("\"", "");
String chatText = messageObject.get("message").toString().replace("\"", "");
Map<String, String> map = new HashMap<String, String>();
map.put(ChatKeyUtil.CHAT_TYPE, chatType);
map.put(ChatKeyUtil.FROM_USERID, fromUserID);
map.put(ChatKeyUtil.FROM_USERNAME, fromUsername);
map.put(ChatKeyUtil.FROM_COLOR, fromColor);
map.put(ChatKeyUtil.FROM_TIME, fromTime);
map.put(ChatKeyUtil.FROM_TZ_OFFSET, fromTimezoneOffset);
map.put(ChatKeyUtil.FROM_LANG, fromLang);
map.put(ChatKeyUtil.TO_USERID, toUserID);
map.put(ChatKeyUtil.TO_USERNAME, toUsername);
map.put(ChatKeyUtil.MESSAGE, chatText);
//public message
if(eventName.equalsIgnoreCase("public_chat_message_event") || eventName.equalsIgnoreCase("send_public_chat_message")) //put this string into a constants file
{
System.out.println("I'm in the case for a public chat message" );
bbbGW.sendPublicMessage(meetingID, requesterID, map);
}
else {
String chatType = messageObject.get("chat_type").toString().replace("\"", "");
String fromUserID = messageObject.get("from_userid").toString().replace("\"", "");
String fromUsername = messageObject.get("from_username").toString().replace("\"", "");
String fromColor = messageObject.get("from_color").toString().replace("\"", "");
String fromTime = messageObject.get("from_time").toString().replace("\"", "");
String fromTimezoneOffset = messageObject.get("from_tz_offset").toString().replace("\"", "");
String fromLang = messageObject.get("from_lang").toString().replace("\"", "");
String toUserID = messageObject.get("to_userid").toString().replace("\"", "");
String toUsername = messageObject.get("to_username").toString().replace("\"", "");
String chatText = messageObject.get("message").toString().replace("\"", "");
Map<String, String> map = new HashMap<String, String>();
map.put(ChatKeyUtil.CHAT_TYPE, chatType);
map.put(ChatKeyUtil.FROM_USERID, fromUserID);
map.put(ChatKeyUtil.FROM_USERNAME, fromUsername);
map.put(ChatKeyUtil.FROM_COLOR, fromColor);
map.put(ChatKeyUtil.FROM_TIME, fromTime);
map.put(ChatKeyUtil.FROM_TZ_OFFSET, fromTimezoneOffset);
map.put(ChatKeyUtil.FROM_LANG, fromLang);
map.put(ChatKeyUtil.TO_USERID, toUserID);
map.put(ChatKeyUtil.TO_USERNAME, toUsername);
map.put(ChatKeyUtil.MESSAGE, chatText);
//private message
else if(eventName.equalsIgnoreCase("private_chat_message_event") || eventName.equalsIgnoreCase("send_private_chat_message")) //put this string into a constants file
{
System.out.println("I'm in the case for a private chat message" );
//public message
if(eventName.equalsIgnoreCase("public_chat_message_event") || eventName.equalsIgnoreCase("send_public_chat_message")) //put this string into a constants file
{
System.out.println("I'm in the case for a public chat message" );
bbbGW.sendPublicMessage(meetingID, requesterID, map);
}
//private message
else if(eventName.equalsIgnoreCase("private_chat_message_event") || eventName.equalsIgnoreCase("send_private_chat_message")) //put this string into a constants file
{
System.out.println("I'm in the case for a private chat message" );
bbbGW.sendPrivateMessage(meetingID, requesterID, map); //TODO not tested yet
}
bbbGW.sendPrivateMessage(meetingID, requesterID, map); //TODO not tested yet
}
}
}

View File

@ -32,7 +32,6 @@ public class ParticipantsListener implements MessageHandler{
if(eventName.equalsIgnoreCase("register_user_request") ||
eventName.equalsIgnoreCase("user_left_event") ||
eventName.equalsIgnoreCase("user_joined_event") ||
eventName.equalsIgnoreCase("get_users_request") ||
eventName.equalsIgnoreCase("raise_user_hand_request")){
String roomName = payloadObject.get("meeting_id").toString().replace("\"", "");
@ -54,10 +53,6 @@ public class ParticipantsListener implements MessageHandler{
bbbInGW.userJoin(roomName, userID);
}
else if(eventName.equalsIgnoreCase("get_users_request")){
String requesterID = payloadObject.get("requester_id").toString().replace("\"", "");
bbbInGW.getUsers(roomName, requesterID);
}
else if(eventName.equalsIgnoreCase("raise_user_hand_request")){
String userID = payloadObject.get("user_id").toString().replace("\"", "");
boolean raise = Boolean.parseBoolean(payloadObject.get("raise").toString().replace("\"", ""));