Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix https://github.com/martynsmith/node-irc/issues/499 (bug) #500

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ If you want to run the latest version (i.e. later than the version available via
Of course, you can just clone this, and manually point at the library itself,
but we really recommend using [npm](http://github.com/isaacs/npm)!

Note that as of version 0.3.8, node-irc supports character set detection using
[icu](http://site.icu-project.org/). You'll need to install libiconv (if
necessary; Linux systems tend to ship this in their glibc) and libicu (and its
headers, if necessary, [install instructions](https://github.com/mooz/node-icu-charset-detector#installing-icu)) in order to use this feature. If you do not have these
libraries or their headers installed, you will receive errors when trying to
build these dependencies. However, node-irc will still install (assuming
nothing else failed) and you'll be able to use it, just not the character
set features.

## Basic Usage

This library provides basic IRC client functionality. In the simplest case you
Expand Down
7 changes: 5 additions & 2 deletions lib/irc.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ function Client(server, nick, opt) {
// TODO better way of finding what channels a user is in?
Object.keys(self.chans).forEach(function(channame) {
var channel = self.chans[channame];
if (!channel.users.hasOwnProperty(message.nick)) {
return;
}
channel.users[message.args[0]] = channel.users[message.nick];
delete channel.users[message.nick];
channels.push(channame);
Expand Down Expand Up @@ -1138,9 +1141,9 @@ Client.prototype.convertEncoding = function(str) {

if (self.opt.encoding) {
try {
var charsetDetector = require('node-icu-charset-detector');
var charsetDetector = require('detect-character-encoding');
var Iconv = require('iconv').Iconv;
var charset = charsetDetector.detectCharset(str);
var charset = charsetDetector(str);
var converter = new Iconv(charset.toString(), self.opt.encoding);

out = converter.convert(str);
Expand Down
Loading