Various works in progress.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3376 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
15f3a3351e
commit
63361ec1f8
@ -219,8 +219,8 @@ function updateWindows() {
|
||||
for (let j in conversations) {
|
||||
terminal.print({
|
||||
command: "/command " + JSON.stringify({action: "window", account: account.id, conversation: j}),
|
||||
value: j ? j : "<service>",
|
||||
style: (conversations[j] == gCurrentConversation ? "font-weight: bold; " : "") + "color: white",
|
||||
value: (j ? j : "<service>") + (conversations[j].unread ? " (" + conversations[j].unread + ")" : ""),
|
||||
style: (conversations[j] == gCurrentConversation ? "background-color: white; color: black" : ""),
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -252,15 +252,16 @@ function updateConversation() {
|
||||
terminal.clear();
|
||||
printToConversation(gCurrentConversation, ["[", gCurrentConversation.name, "]"]);
|
||||
if (history) {
|
||||
let previous = Promise.resolve();
|
||||
for (let message of history) {
|
||||
previous = previous.then(x => printToConversation(gCurrentConversation, message));
|
||||
printToConversation(gCurrentConversation, message);
|
||||
}
|
||||
}
|
||||
updateUsers();
|
||||
} finally {
|
||||
terminal.uncork();
|
||||
}
|
||||
gCurrentConversation.unread = 0;
|
||||
updateWindows();
|
||||
}).catch(function(error) {
|
||||
terminal.print(error);
|
||||
});
|
||||
@ -313,6 +314,7 @@ function getConversation(session, conversationName) {
|
||||
return session.sendMessage(key, message);
|
||||
},
|
||||
participants: [],
|
||||
unread: 0,
|
||||
};
|
||||
updateWindows();
|
||||
}
|
||||
@ -342,6 +344,9 @@ function printToConversation(conversation, message, notify) {
|
||||
} else {
|
||||
terminal.print(message);
|
||||
}
|
||||
} else {
|
||||
conversation.unread++;
|
||||
updateWindows();
|
||||
}
|
||||
if (notify && !gFocus) {
|
||||
gUnread++;
|
||||
|
@ -32,6 +32,7 @@ class IrcService {
|
||||
self._service = new ChatService(options.callback);
|
||||
self._name = options.name;
|
||||
self._nick = options.nick;
|
||||
self._autoJoinChannels = options.autoJoinChannels;
|
||||
self._nameReplies = {};
|
||||
|
||||
network.newConnection().then(function(socket) {
|
||||
@ -103,6 +104,10 @@ class IrcService {
|
||||
for (let i in conversations) {
|
||||
this._service.notifyPresenceChanged(conversations[i], person, "unavailable");
|
||||
}
|
||||
} else if (parts[0] == "001") { // RPL_WELCOME
|
||||
if (this._autoJoinChannels) {
|
||||
this._send("JOIN " + this._autoJoinChannels);
|
||||
}
|
||||
} else if (parts[0] == "353") { // RPL_NAMREPLY
|
||||
if (!this._nameReplies[parts[3]]) {
|
||||
this._nameReplies[parts[3]] = [];
|
||||
|
@ -8,6 +8,9 @@
|
||||
list feed:username,url {id, title, modified, read, ...}
|
||||
*/
|
||||
|
||||
// [ ] New news article is posted.
|
||||
// [ ] Existing news article is updated.
|
||||
|
||||
let http = require("libhttp");
|
||||
let liblist = require("liblist");
|
||||
let xml = require("libxml");
|
||||
@ -198,16 +201,18 @@ class TestInterface {
|
||||
terminal.select("headlines");
|
||||
terminal.clear();
|
||||
this.news.forEach((article, index) => {
|
||||
let color = "";
|
||||
if (this.selectedIndex == index) {
|
||||
color = "red";
|
||||
} else if (article.read) {
|
||||
color = "gray";
|
||||
if (Math.abs(index - this.selectedIndex) < 5) {
|
||||
let color = "";
|
||||
if (this.selectedIndex == index) {
|
||||
color = "red";
|
||||
} else if (article.read) {
|
||||
color = "gray";
|
||||
}
|
||||
terminal.print(article.modified.toString(), " ", {
|
||||
style: color ? ("color: " + color) : "",
|
||||
value: article.title,
|
||||
});
|
||||
}
|
||||
terminal.print(article.modified.toString(), " ", {
|
||||
style: color ? ("color: " + color) : "",
|
||||
value: article.title,
|
||||
});
|
||||
});
|
||||
terminal.select("view");
|
||||
terminal.clear();
|
||||
@ -242,7 +247,7 @@ class TestInterface {
|
||||
async activate() {
|
||||
let self = this;
|
||||
terminal.split([
|
||||
{name: "headlines", basis: "30%", grow: 0, shrink: 1},
|
||||
{name: "headlines", basis: "11rem", grow: 0, shrink: 1},
|
||||
{name: "view", style: "display: flex", basis: "70%", grow: 2, shrink: 0},
|
||||
]);
|
||||
self.refreshNews().then(self.redisplay.bind(self)).catch(terminal.print);
|
||||
|
Loading…
Reference in New Issue
Block a user