[polari] ircParser: Paste multi-line /say input
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] ircParser: Paste multi-line /say input
- Date: Fri, 28 Feb 2014 01:21:00 +0000 (UTC)
commit 60f644370b2e015f96d3be14b822c5f1c6cbd9a9
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Feb 28 02:07:24 2014 +0100
ircParser: Paste multi-line /say input
The only difference between a normally sent message and one sent
via the /SAY command is that the latter may start with '/'. It
certainly does not make sense to treat long messages differently,
e.g. only use a paste service in the former case.
https://bugzilla.gnome.org/show_bug.cgi?id=719526
src/ircParser.js | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/src/ircParser.js b/src/ircParser.js
index 3baba35..441ee73 100644
--- a/src/ircParser.js
+++ b/src/ircParser.js
@@ -73,14 +73,7 @@ const IrcParser = new Lang.Class({
return;
if (text[0] != '/') {
- if (text.split('\n').length > MAX_LINES) {
- let app = Gio.Application.get_default();
- app.pasteManager.pasteText(text);
- } else {
- let type = Tp.ChannelTextMessageType.NORMAL;
- let message = Tp.ClientMessage.new_text(type, text);
- this._sendMessage(message);
- }
+ this._sendOrPasteText(text);
return;
}
@@ -254,10 +247,7 @@ const IrcParser = new Lang.Class({
output = this._createFeedbackUsage(cmd);
break;
}
- let raw = stripCommand(text);
- let type = Tp.ChannelTextMessageType.NORMAL;
- let message = Tp.ClientMessage.new_text(type, raw);
- this._sendMessage(message);
+ this._sendOrPasteText(stripCommand(text));
break;
}
case 'TOPIC': {
@@ -276,6 +266,17 @@ const IrcParser = new Lang.Class({
this._app.commandOutputQueue.addNotification(output);
},
+ _sendOrPasteText: function(text) {
+ if (text.split('\n').length > MAX_LINES) {
+ let app = Gio.Application.get_default();
+ app.pasteManager.pasteText(text);
+ } else {
+ let type = Tp.ChannelTextMessageType.NORMAL;
+ let message = Tp.ClientMessage.new_text(type, text);
+ this._sendMessage(message);
+ }
+ },
+
_sendMessage: function(message) {
this._room.channel.send_message_async(message, 0, Lang.bind(this,
function(c, res) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]