Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/PherricOxide/node-irc into …

…PherricOxide-master

Conflicts:
	docs/API.rst
	lib/irc.js
  • Loading branch information...
commit b360d7a2fc410987a77c5c9c6a27542ed32f8902 2 parents ecec980 + 1061adc
@martynsmith authored
Showing with 12 additions and 4 deletions.
  1. +5 −1 docs/API.rst
  2. +7 −3 lib/irc.js
View
6 docs/API.rst
@@ -30,7 +30,8 @@ Client
floodProtection: false,
floodProtectionDelay: 1000,
stripColors: false,
- channelPrefixes: "&#"
+ channelPrefixes: "&#",
+ messageSplit: 512
}
`secure` (SSL connection) can be a true value or an object (the kind of object
@@ -46,6 +47,9 @@ Client
`floodProtectionDelay` sets the amount of time that the client will wait
between sending subsequent messages when `floodProtection` is enabled.
+ `messageSplit` will split up large messages sent with the `say` method
+ into multiple messages of length fewer than `messageSplit` characters.
+
`stripColors` removes mirc colors (0x03 followed by one or two ascii
numbers for foreground,background) and ircII "effect" codes (0x02
bold, 0x1f underline, 0x16 reverse, 0x0f reset) from the entire
View
10 lib/irc.js
@@ -49,7 +49,8 @@ function Client(server, nick, opt) {
floodProtection: false,
floodProtectionDelay: 1000,
stripColors: false,
- channelPrefixes: "&#"
+ channelPrefixes: "&#",
+ messageSplit: 512
};
if (typeof arguments[2] == 'object') {
@@ -681,8 +682,11 @@ Client.prototype.say = function(target, text) { // {{{
text.toString().split(/\r?\n/).filter(function(line) {
return line.length > 0;
}).forEach(function(line) {
- self.send('PRIVMSG', target, line);
- self.emit('selfMessage', target, line);
+ var r = new RegExp(".{1," + self.opt.messageSplit + "}", "g");
+ while ((messagePart = r.exec(line)) != null) {
+ self.send('PRIVMSG', target, messagePart);
+ self.emit('selfMessage', target, messagePart);
+ }
});
}
} // }}}
Please sign in to comment.
Something went wrong with that request. Please try again.