[polari] ircParser: Use pastebin for long input
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] ircParser: Use pastebin for long input
- Date: Thu, 8 Aug 2013 13:13:34 +0000 (UTC)
commit cb156516d62866632c5421b2119de4c8513bf9c2
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Jul 29 01:48:34 2013 +0200
ircParser: Use pastebin for long input
With the new pasteManager in place, use it as well from the normal
input entry if the entered text spans more than a certain number
of lines.
src/ircParser.js | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/ircParser.js b/src/ircParser.js
index 615d7ae..f03b298 100644
--- a/src/ircParser.js
+++ b/src/ircParser.js
@@ -1,3 +1,4 @@
+const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
const Pango = imports.gi.Pango;
@@ -7,9 +8,11 @@ const AppNotifications = imports.appNotifications;
const ChatroomManager = imports.chatroomManager;
const Lang = imports.lang;
const Signals = imports.signals;
+const Utils = imports.utils;
const _ = imports.gettext.gettext;
+const MAX_LINES = 5;
const TP_CURRENT_TIME = GLib.MAXUINT32;
const knownCommands = {
@@ -70,9 +73,14 @@ const IrcParser = new Lang.Class({
return;
if (text[0] != '/') {
- let type = Tp.ChannelTextMessageType.NORMAL;
- let message = Tp.ClientMessage.new_text(type, text);
- this._sendMessage(message);
+ 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);
+ }
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]