Backlog of miscellaneous fixes.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3234 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2016-06-02 23:01:55 +00:00
parent fb94e1cde9
commit dca3ad9b79
7 changed files with 96 additions and 26 deletions

View File

@ -11,6 +11,7 @@ function updateTitle() {
terminal.setTitle((gUnread ? "(" + gUnread.toString() + ") " : "") + "Chat");
}
let kMaxHistory = 32;
let kAccountsKey = JSON.stringify(["accounts", core.user.name]);
let kStateKey = JSON.stringify(["state", core.user.name]);
@ -218,6 +219,9 @@ function updateConversation() {
let history = data[0];
let participants = data[1];
gCurrentConversation.messages = history || [];
if (gCurrentConversation.messages.length > kMaxHistory) {
gCurrentConversation.messages.splice(0, gCurrentConversation.messages.length - kMaxHistory);
}
gCurrentConversation.participants = participants || [];
terminal.cork();
terminal.select("terminal");
@ -227,7 +231,7 @@ function updateConversation() {
if (message.action == "message") {
printMessage(message.message);
} else {
terminal.print(message);
terminal.print(message.message);
}
}
updateUsers();
@ -283,6 +287,7 @@ function getConversation(session, conversationName) {
sendMessage: function(message) {
return session.sendMessage(key, message);
},
participants: [],
};
updateWindows();
}