[IRC]Quassel で IRC
Linux で使える IRC クライアントはいろいろあるけれど、使いやすいと感じるものは人それぞれだろう。僕の場合、今まで XChat でそれなりに満足していたのだけど、hig.rb *1 とは相性が悪いらしく、以下のような遺言とともに XChat が落ちてしまう。
*** XCHAT WARNING: Buffer overflow - shit server! (snip) *** XCHAT WARNING: Buffer overflow - shit server! (xchat:7957): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text() (xchat:7957): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text() *** stack smashing detected ***: xchat terminated [1] 7957 segmentation fault xchat
もちろん Emacs で動く Riece *2 を使えばいいのだが、Riece だと ElScreen のバックグラウンドで動かすような形になってしまい、IRC をリアルタイムで追いにくかったりする。でも、フレームを複数にすればいいのか。今、気がついた。
Quassel の起動までのやり方を書こうと思ったところで、現状の不満な点を解消する案を思いついてしまい、このエントリの意味がなくなりつつあるが、下書きがあるので最後までまとめておこう。
XChat が満足に使えない現状は不便で仕方ないため、新しい IRC クライアントを試すことにした。それが Quassel だ。Momonga Linux の開発版にはパッケージが存在する。
Quassel というのは IRC クライアントなのだが、設計はリッチなものになっている。分かりやすくいうと、IRC クライアントと IRC プロキシが一緒になったようなものだ。Quassel では、それぞれを client と core と呼んでいる。
Quassel の client が IRC サーバへ接続するには core を介さなければならない (よね?)。なので、まず core の設定をした。なんと core は PostgreSQL を使う。IRC クライアントのくせに PostgreSQL とは、本当にリッチである。なんの設定もしないで quassel を実行すると以下のようなエラーを出すだろう。
% quassel 2009-11-21 22:25:13 Warning: SslServer: Certificate file /home/toshiharu/.config/quassel-irc.org/quasselCert.pem does not exist 2009-11-21 22:25:13 Warning: SslServer: Unable to set certificate file Quassel Core will still work, but cannot provide SSL for client connections. Please see http://quassel-irc.org/faq/cert to learn how to enable SSL support. 2009-11-21 22:25:13 Warning: SslServer: Certificate file /home/toshiharu/.config/quassel-irc.org/quasselCert.pem does not exist Core is currently not configured! Please connect with a Quassel Client for basic setup. Unable to open database "PostgreSQL" for thread QThread(0x93e8f0) - "could not connect to server: そのようなファイルやディレクトリはありません Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.0"? QPSQL: 接続できません" QSqlDatabasePrivate::database: unable to open database: "could not connect to server: そのようなファイルやディレクトリはありません Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.0"? QPSQL: 接続できません" Selected storage backend is not available: "PostgreSQL" Core::setupInternalClientSession(): You're trying to run monolithic Quassel with an unusable Backend! Go fix it!
まず PostgreSQL を起動させた。
% /sbin/chkconfig --list postgresql postgresql 0:off 1:off 2:off 3:off 4:off 5:off 6:off % sudo /sbin/chkconfig --level 2345 postgresql on % sudo /etc/init.d/postgresql start /var/lib/pgsql/data is missing. Use "service postgresql initdb" to initialize the cluster first. [失敗] [1] 6836 exit 1 sudo /etc/init.d/postgresql start % sudo /sbin/service postgresql initdb Initializing database: [ OK ] % sudo /etc/init.d/postgresql start postgresql サービスを開始中: [ OK ]
次に PostgreSQL に適当なデータベースを作成した。ここは以下のページを参考にした。
ユーザを postgres にして実行した。
# su - postgres -bash-4.0$ createuser -A -D -P -E -U postgres -W quassel Enter password for new role: Enter it again: Shall the new role be allowed to create more new roles? (y/n) n Password: -bash-4.0$ createdb -U postgres -O quassel -E UTF8 quassel -bash-4.0$ psql -l List of databases Name | Owner | Encoding -----------+----------+---------- postgres | postgres | UTF8 quassel | quassel | UTF8 template0 | postgres | UTF8 template1 | postgres | UTF8 (4 rows)
さらに PostgreSQL へ接続するための設定が必要だった。いきなりだと次のようなエラーが出るだろう。
% quasselcore --select-backend=PostgreSQL 2009-11-21 22:48:43 Warning: SslServer: Certificate file /home/toshiharu/.config/quassel-irc.org/quasselCert.pem does not exist 2009-11-21 22:48:43 Warning: SslServer: Unable to set certificate file Quassel Core will still work, but cannot provide SSL for client connections. Please see http://quassel-irc.org/faq/cert to learn how to enable SSL support. 2009-11-21 22:48:43 Warning: SslServer: Certificate file /home/toshiharu/.config/quassel-irc.org/quasselCert.pem does not exist Default values are in brackets Username (quassel): Password: Hostname (localhost): Port (5432): Database (quassel): Unable to open database "PostgreSQL" for thread QThread(0x739c20) - "FATAL: Ident authentication failed for user "quassel" QPSQL: 接続できません" QSqlDatabasePrivate::database: unable to open database: "FATAL: Ident authentication failed for user "quassel" QPSQL: 接続できません" Backend is not available: PostgreSQL
そこで、単純に /var/lib/pgsql/data/pg_hba.conf を以下のように変更してしまった。
--- /var/lib/pgsql/data/pg_hba.conf.orig +++ /var/lib/pgsql/data/pg_hba.conf @@ -64,8 +64,8 @@ # TYPE DATABASE USER CIDR-ADDRESS METHOD # "local" is for Unix domain socket connections only -local all all ident sameuser +local all all trust # IPv4 local connections: -host all all 127.0.0.1/32 ident sameuser +host all all 127.0.0.1/32 trust # IPv6 local connections: -host all all ::1/128 ident sameuser +host all all ::1/128 trust
一応 PostgreSQL を再起動して、core の設定を再開した。ユーザ名などは適当である。
% quasselcore --select-backend=PostgreSQL 2009-11-21 23:17:00 Warning: SslServer: Certificate file /home/toshiharu/.config/quassel-irc.org/quasselCert.pem does not exist 2009-11-21 23:17:00 Warning: SslServer: Unable to set certificate file Quassel Core will still work, but cannot provide SSL for client connections. Please see http://quassel-irc.org/faq/cert to learn how to enable SSL support. 2009-11-21 23:17:00 Warning: SslServer: Certificate file /home/toshiharu/.config/quassel-irc.org/quasselCert.pem does not exist Default values are in brackets Username (quassel): Password: Hostname (localhost): Port (5432): Database (quassel): Storage Schema is missing! NOTICE: CREATE TABLE will create implicit sequence "quasseluser_userid_seq" for serial column "quasseluser.userid" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "quasseluser_pkey" for table "quasseluser" NOTICE: CREATE TABLE / UNIQUE will create implicit index "quasseluser_username_key" for table "quasseluser" NOTICE: CREATE TABLE will create implicit sequence "sender_senderid_seq" for serial column "sender.senderid" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "sender_pkey" for table "sender" NOTICE: CREATE TABLE / UNIQUE will create implicit index "sender_sender_key" for table "sender" NOTICE: CREATE TABLE will create implicit sequence "identity_identityid_seq" for serial column "identity.identityid" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "identity_pkey" for table "identity" NOTICE: CREATE TABLE / UNIQUE will create implicit index "identity_userid_key" for table "identity" NOTICE: CREATE TABLE will create implicit sequence "identity_nick_nickid_seq" for serial column "identity_nick.nickid" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "identity_nick_pkey" for table "identity_nick" NOTICE: CREATE TABLE / UNIQUE will create implicit index "identity_nick_identityid_key" for table "identity_nick" NOTICE: CREATE TABLE will create implicit sequence "network_networkid_seq" for serial column "network.networkid" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "network_pkey" for table "network" NOTICE: CREATE TABLE / UNIQUE will create implicit index "network_userid_key" for table "network" NOTICE: CREATE TABLE will create implicit sequence "buffer_bufferid_seq" for serial column "buffer.bufferid" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "buffer_pkey" for table "buffer" NOTICE: CREATE TABLE / UNIQUE will create implicit index "buffer_userid_key" for table "buffer" NOTICE: CREATE TABLE will create implicit sequence "backlog_messageid_seq" for serial column "backlog.messageid" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "backlog_pkey" for table "backlog" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "coreinfo_pkey" for table "coreinfo" NOTICE: CREATE TABLE will create implicit sequence "ircserver_serverid_seq" for serial column "ircserver.serverid" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "ircserver_pkey" for table "ircserver" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "user_setting_pkey" for table "user_setting" 2009-11-21 23:17:05 Info: PostgreSQL Storage Backend is ready. Quassel Schema Version: 14 Switched backend to: PostgreSQL No currently active backend. Skipping migration. New backend does not support migration: PostgreSQL Add a new user: Username: toshiharu Password: Repeat Password: Added user toshiharu successfully!
これで core の設定はできたので、さっそく quassel を実行した。よくある雰囲気のタイアログが出てくるので、それに従って IRC の設定を進めるだけだ。文字コードは注意が必要かもしれない。Configure Networks の Networks の設定で Encoding タブを開き、「Receive fallback」と「Server encoding」を UTF-8 にしておいた。