mirror of
https://codeberg.org/emersion/gamja
synced 2025-03-15 00:47:46 +01:00
Implement /me
This commit is contained in:
parent
15c51d9ec7
commit
59b98d38ac
@ -441,6 +441,16 @@ export default class App extends Component {
|
|||||||
var text = args.slice(1).join(" ");
|
var text = args.slice(1).join(" ");
|
||||||
this.client.send({ command: "PRIVMSG", params: [target, text] });
|
this.client.send({ command: "PRIVMSG", params: [target, text] });
|
||||||
break;
|
break;
|
||||||
|
case "me":
|
||||||
|
var action = args.join(" ");
|
||||||
|
var target = this.state.activeBuffer;
|
||||||
|
if (!target) {
|
||||||
|
console.error("Not in a buffer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var text = `\x01ACTION ${action}\x01`;
|
||||||
|
this.privmsg(target, text);
|
||||||
|
break;
|
||||||
case "nick":
|
case "nick":
|
||||||
var newNick = args[0];
|
var newNick = args[0];
|
||||||
this.client.send({ command: "NICK", params: [newNick] });
|
this.client.send({ command: "NICK", params: [newNick] });
|
||||||
@ -458,6 +468,21 @@ export default class App extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
privmsg(target, text) {
|
||||||
|
if (target == SERVER_BUFFER) {
|
||||||
|
console.error("Cannot send message in server buffer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var msg = { command: "PRIVMSG", params: [target, text] };
|
||||||
|
this.client.send(msg);
|
||||||
|
|
||||||
|
if (!this.client.enabledCaps["echo-message"]) {
|
||||||
|
msg.prefix = { name: this.client.nick };
|
||||||
|
this.addMessage(target, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleComposerSubmit(text) {
|
handleComposerSubmit(text) {
|
||||||
if (!text) {
|
if (!text) {
|
||||||
return;
|
return;
|
||||||
@ -471,17 +496,11 @@ export default class App extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var target = this.state.activeBuffer;
|
var target = this.state.activeBuffer;
|
||||||
if (!target || target == SERVER_BUFFER) {
|
if (!target) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var msg = { command: "PRIVMSG", params: [target, text] };
|
this.privmsg(target, text);
|
||||||
this.client.send(msg);
|
|
||||||
|
|
||||||
if (!this.client.enabledCaps["echo-message"]) {
|
|
||||||
msg.prefix = { name: this.client.nick };
|
|
||||||
this.addMessage(target, msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBufferListClick(name) {
|
handleBufferListClick(name) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user