Commit 5d084db9 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

1. Added "naturalLanguageRoom" property.

2. Removed #setName(String).
3. Removed unused code related to RoomHistory.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@215 b35dd754-fafc-0310-a699-88a17e54d16e
parent df22cdbb
...@@ -128,6 +128,11 @@ public class MUCRoomImpl implements MUCRoom { ...@@ -128,6 +128,11 @@ public class MUCRoomImpl implements MUCRoom {
*/ */
private List<String> outcasts = new ArrayList<String>(); private List<String> outcasts = new ArrayList<String>();
/**
* The natural language name of the room.
*/
private String naturalLanguageName;
/** /**
* Description of the room. The owner can change the description using the room configuration * Description of the room. The owner can change the description using the room configuration
* form. * form.
...@@ -237,12 +242,12 @@ public class MUCRoomImpl implements MUCRoom { ...@@ -237,12 +242,12 @@ public class MUCRoomImpl implements MUCRoom {
MUCRoomImpl(MultiUserChatServer chatserver, String roomname, PacketRouter packetRouter) { MUCRoomImpl(MultiUserChatServer chatserver, String roomname, PacketRouter packetRouter) {
this.server = chatserver; this.server = chatserver;
this.name = roomname; this.name = roomname;
this.naturalLanguageName = roomname;
this.description = roomname; this.description = roomname;
this.router = packetRouter; this.router = packetRouter;
this.startTime = System.currentTimeMillis(); this.startTime = System.currentTimeMillis();
// TODO Allow to set the history strategy from the configuration form? // TODO Allow to set the history strategy from the configuration form?
roomHistory = new MUCRoomHistory(this, new HistoryStrategy(server.getHistoryStrategy())); roomHistory = new MUCRoomHistory(this, new HistoryStrategy(server.getHistoryStrategy()));
roomHistory.setStartTime(startTime);
role = new RoomRole(this); role = new RoomRole(this);
this.iqOwnerHandler = new IQOwnerHandler(this, packetRouter); this.iqOwnerHandler = new IQOwnerHandler(this, packetRouter);
this.iqAdminHandler = new IQAdminHandler(this, packetRouter); this.iqAdminHandler = new IQAdminHandler(this, packetRouter);
...@@ -463,14 +468,6 @@ public class MUCRoomImpl implements MUCRoom { ...@@ -463,14 +468,6 @@ public class MUCRoomImpl implements MUCRoom {
joinRole = new MUCRoleImpl(server, this, nickname, role, affiliation, joinRole = new MUCRoleImpl(server, this, nickname, role, affiliation,
(MUCUserImpl) user, router); (MUCUserImpl) user, router);
// Handle ChatRoomHistory
if (roomHistory.getUserID() == null) {
roomHistory.setUserID(nickname);
}
else {
roomHistory.userJoined(user, new java.util.Date());
}
// Send presence of existing occupants to new occupant // Send presence of existing occupants to new occupant
Iterator iter = occupants.values().iterator(); Iterator iter = occupants.values().iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
...@@ -584,17 +581,8 @@ public class MUCRoomImpl implements MUCRoom { ...@@ -584,17 +581,8 @@ public class MUCRoomImpl implements MUCRoom {
// (if provided) as defined under the "Destroying a Room" use case. // (if provided) as defined under the "Destroying a Room" use case.
if (occupants.isEmpty()) { if (occupants.isEmpty()) {
// Adding new ChatTranscript logic.
endTime = System.currentTimeMillis(); endTime = System.currentTimeMillis();
// Update RoomHistory with HistoryStrategy
roomHistory.setEndTime(System.currentTimeMillis());
// Update ChatManager
//ChatManager cManager = ChatManager.getInstance();
//cManager.addChatHistory(roomHistory);
//cManager.fireChatRoomClosed(server.getChatRoom(name));
server.removeChatRoom(name); server.removeChatRoom(name);
} }
} }
...@@ -638,8 +626,6 @@ public class MUCRoomImpl implements MUCRoom { ...@@ -638,8 +626,6 @@ public class MUCRoomImpl implements MUCRoom {
} }
} }
occupantsByFullJID.remove(user.getAddress().toStringPrep()); occupantsByFullJID.remove(user.getAddress().toStringPrep());
roomHistory.userLeft(user, new java.util.Date());
} }
public void destroyRoom(String alternateJID, String reason) throws UnauthorizedException { public void destroyRoom(String alternateJID, String reason) throws UnauthorizedException {
...@@ -680,18 +666,8 @@ public class MUCRoomImpl implements MUCRoom { ...@@ -680,18 +666,8 @@ public class MUCRoomImpl implements MUCRoom {
} }
} }
} }
// Adding new ChatTranscript logic.
endTime = System.currentTimeMillis(); endTime = System.currentTimeMillis();
// Update RoomHistory with HistoryStrategy
roomHistory.setEndTime(System.currentTimeMillis());
// Update ChatAuditManager
//ChatAuditManager cManager = ChatAuditManager.getInstance();
//cManager.addChatHistory(roomHistory);
//cManager.fireChatRoomClosed(server.getChatRoom(name));
MUCPersistenceManager.deleteFromDB(this); MUCPersistenceManager.deleteFromDB(this);
server.removeChatRoom(name); server.removeChatRoom(name);
} }
...@@ -1625,6 +1601,14 @@ public class MUCRoomImpl implements MUCRoom { ...@@ -1625,6 +1601,14 @@ public class MUCRoomImpl implements MUCRoom {
this.canOccupantsInvite = canOccupantsInvite; this.canOccupantsInvite = canOccupantsInvite;
} }
public String getNaturalLanguageName() {
return naturalLanguageName;
}
public void setNaturalLanguageName(String naturalLanguageName) {
this.naturalLanguageName = naturalLanguageName;
}
public String getDescription() { public String getDescription() {
return description; return description;
} }
...@@ -1728,18 +1712,6 @@ public class MUCRoomImpl implements MUCRoom { ...@@ -1728,18 +1712,6 @@ public class MUCRoomImpl implements MUCRoom {
return "none".equals(roleToBroadcast) || rolesToBroadcastPresence.contains(roleToBroadcast); return "none".equals(roleToBroadcast) || rolesToBroadcastPresence.contains(roleToBroadcast);
} }
public void setName(String name) {
if (name == null || name.length() == 0) {
return;
}
if (!this.name.equals(name)) {
String oldName = this.name;
this.name = name;
// Notify the server that the name of this room has changed
server.roomRenamed(oldName, name);
}
}
public void unlockRoom(MUCRole senderRole) { public void unlockRoom(MUCRole senderRole) {
roomLocked = false; roomLocked = false;
this.lockedTime = 0; this.lockedTime = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment