Display /me actions in IRC.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3365 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
fe765ed834
commit
7e85e9fd11
@ -169,7 +169,6 @@ function connect(id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
print(id, account);
|
||||
|
||||
if (account) {
|
||||
let self = {account: account};
|
||||
@ -431,14 +430,23 @@ function printMessage(message) {
|
||||
var now = message.timestamp || new Date().toString();
|
||||
var from = message.from || "unknown";
|
||||
|
||||
terminal.print(
|
||||
{class: "base0", value: niceTime(lastTimestamp, now)},
|
||||
" ",
|
||||
{class: "base00", value: "<"},
|
||||
{class: "base3", value: from},
|
||||
{class: "base00", value: ">"},
|
||||
" ",
|
||||
formatMessage(message.message));
|
||||
if (message.action) {
|
||||
terminal.print(
|
||||
{class: "base0", value: niceTime(lastTimestamp, now)},
|
||||
" * ",
|
||||
{class: "base3", value: from},
|
||||
" ",
|
||||
formatMessage(message.message));
|
||||
} else {
|
||||
terminal.print(
|
||||
{class: "base0", value: niceTime(lastTimestamp, now)},
|
||||
" ",
|
||||
{class: "base00", value: "<"},
|
||||
{class: "base3", value: from},
|
||||
{class: "base00", value: ">"},
|
||||
" ",
|
||||
formatMessage(message.message));
|
||||
}
|
||||
lastTimestamp = now;
|
||||
}
|
||||
|
||||
|
@ -73,11 +73,19 @@ class IrcService {
|
||||
} else if (prefix.indexOf('!') != -1) {
|
||||
conversation = prefix.split('!')[0];
|
||||
}
|
||||
this._service.notifyMessageReceived(conversation, {
|
||||
let message = {
|
||||
from: prefix.split('!')[0],
|
||||
message: parts[parts.length - 1],
|
||||
type: parts[0],
|
||||
});
|
||||
};
|
||||
if (message.message.length > 2 && message.message.charCodeAt(0) == 1 && message.message.charCodeAt(message.message.length - 1) == 1) {
|
||||
message.ctcp = true;
|
||||
if (message.message.substring(1, 1 + "ACTION ".length) == "ACTION ") {
|
||||
message.action = true;
|
||||
message.message = message.message.substring(1 + "ACTION ".length, message.message.length - 1);
|
||||
}
|
||||
}
|
||||
this._service.notifyMessageReceived(conversation, message);
|
||||
} else if (parts[0] == "PING") {
|
||||
parts[0] = "PONG";
|
||||
this._send(parts.join(" "));
|
||||
|
Loading…
Reference in New Issue
Block a user