diff -urN tiarra-20031012/ChangeLog tiarra-20031014/ChangeLog
--- tiarra-20031012/ChangeLog	2003-10-12 21:16:23.000000000 +0900
+++ tiarra-20031014/ChangeLog	2003-10-14 13:49:08.000000000 +0900
@@ -1,3 +1,18 @@
+2003-10-14  Topia  <topia@clovery.jp>
+
+	* main/Multicast.pm (distribute_to_servers):
+	hijack_forward_to_server を適用(nickで使う)
+
+	* main/RunLoop.pm (_multi_server_mode_changed):
+	nick 変更を追加。
+
+	* main/IrcIO/Server.pm (_receive_while_logging_in):
+	single-server-mode 時の NICK 処理を追加。
+
+	* main/IrcIO/Server.pm (_receive_after_logged_in):
+	single-server-mode 時の NICK 処理に RunLoop/set_current_nick を追加。
+	437 での if 条件であほなミスをしていたので修正。
+
 2003-10-12  phonohawk  <phonohawk@lycos.co.uk>
 
 	* main/IRCMessage.pm (serialize):
@@ -947,7 +962,7 @@
 
 	* これ以前のログは書いていません。
 
-#       Id: $Id: ChangeLog,v 1.106 2003/10/12 12:08:57 admin Exp $
-#   Author: $Author: admin $
-#     Date: $Date: 2003/10/12 12:08:57 $
-# Revision: $Revision: 1.106 $
+#       Id: $Id: ChangeLog,v 1.107 2003/10/14 04:47:59 topia Exp $
+#   Author: $Author: topia $
+#     Date: $Date: 2003/10/14 04:47:59 $
+# Revision: $Revision: 1.107 $
diff -urN tiarra-20031012/NEWS tiarra-20031014/NEWS
--- tiarra-20031012/NEWS	2003-10-12 21:16:23.000000000 +0900
+++ tiarra-20031014/NEWS	2003-10-14 13:49:08.000000000 +0900
@@ -1,3 +1,8 @@
+2003-10-14  Topia  <topia@clovery.jp>
+
+	* single-server-mode の bugfix です。
+	single-server-mode を使う予定が無い場合は再起動は不要です。
+
 2003-09-28  phonohawk  <phonohawk@lycos.co.uk>
 
 	* tiarra-conf.el:
diff -urN tiarra-20031012/main/IrcIO/Server.pm tiarra-20031014/main/IrcIO/Server.pm
--- tiarra-20031012/main/IrcIO/Server.pm	2003-10-12 21:16:24.000000000 +0900
+++ tiarra-20031014/main/IrcIO/Server.pm	2003-10-14 13:49:08.000000000 +0900
@@ -1,5 +1,5 @@
 # -----------------------------------------------------------------------------
-# $Id: Server.pm,v 1.46 2003/09/26 12:07:13 topia Exp $
+# $Id: Server.pm,v 1.47 2003/10/14 04:47:59 topia Exp $
 # -----------------------------------------------------------------------------
 # IrcIO::ServerはIRCサーバーに接続し、IRCメッセージをやり取りするクラスです。
 # このクラスはサーバーからメッセージを受け取ってチャンネル情報や現在のnickなどを保持しますが、
@@ -351,6 +351,17 @@
     if ($reply eq '001') {
 	# 成功した。
 	$this->{current_nick} = $first_msg->param(0);
+	if (!RunLoop->shared->multi_server_mode_p &&
+		RunLoop->shared_loop->current_nick ne $this->{current_nick}) {
+	    RunLoop->shared->broadcast_to_clients(
+		IRCMessage->new(
+		    Command => 'NICK',
+		    Param => $first_msg->param(0),
+		    Remarks => {'fill-prefix-when-sending-to-client' => 1
+			       }));
+
+	    RunLoop->shared_loop->set_current_nick($first_msg->param(0));
+	}
 	$this->{logged_in} = 1;
 	$this->person($this->{current_nick},
 		      $this->{user_shortname},
@@ -420,6 +431,8 @@
 					   $this->{network_name}.
 					       " is currently '".$this->{current_nick}."'."]));
 		}
+	    } else {
+		RunLoop->shared_loop->set_current_nick($msg->param(0));
 	    }
 	}
 	$this->_NICK($msg);
@@ -435,7 +448,7 @@
     }
     elsif ($msg->command eq '437') {
 	# nick/channel temporary unavaliable
-	if (Multicast::nick_p && RunLoop->shared->multi_server_mode_p) {
+	if (Multicast::nick_p($msg->param(1)) && RunLoop->shared->multi_server_mode_p) {
 	    $this->_set_to_next_nick($msg->param(1));
 
 	    # これもクライアントには伝えない。
diff -urN tiarra-20031012/main/Multicast.pm tiarra-20031014/main/Multicast.pm
--- tiarra-20031012/main/Multicast.pm	2003-10-12 21:16:25.000000000 +0900
+++ tiarra-20031014/main/Multicast.pm	2003-10-14 13:49:08.000000000 +0900
@@ -1,5 +1,5 @@
 # -----------------------------------------------------------------------------
-# $Id: Multicast.pm,v 1.18 2003/09/26 12:07:13 topia Exp $
+# $Id: Multicast.pm,v 1.19 2003/10/14 04:47:59 topia Exp $
 # -----------------------------------------------------------------------------
 # サーバーからクライアントにメッセージが流れるとき、このクラスはフィルタとして
 # ネットワーク名を付加します。
@@ -588,9 +588,16 @@
 }
 
 sub distribute_to_servers {
+    no strict;
     my $msg = shift;
     foreach my $server (values %{$runloop->networks}) {
-	$server->send_message($msg);
+	if (defined $hijack_forward_to_server) {
+	    #::printmsg("forward_to_server HIJACKED");
+	    $hijack_forward_to_server->($msg, $server->network_name);
+	}
+	else {
+	    $server->send_message($msg);
+	}
     }
 }
 
diff -urN tiarra-20031012/main/RunLoop.pm tiarra-20031014/main/RunLoop.pm
--- tiarra-20031012/main/RunLoop.pm	2003-10-12 21:16:25.000000000 +0900
+++ tiarra-20031014/main/RunLoop.pm	2003-10-14 13:49:08.000000000 +0900
@@ -1,5 +1,5 @@
 # -----------------------------------------------------------------------------
-# $Id: RunLoop.pm,v 1.45 2003/09/20 11:06:19 admin Exp $
+# $Id: RunLoop.pm,v 1.46 2003/10/14 04:47:59 topia Exp $
 # -----------------------------------------------------------------------------
 # このクラスはTiarraのメインループを実装します。
 # select()を実行し、サーバーやクライアントとのI/Oを行うのはこのクラスです。
@@ -194,7 +194,7 @@
 sub _multi_server_mode_changed {
     my $this = shift;
     # 一旦全てのチャンネルについてPARTを発行した後、
-    # モードを変え接続中ネットワークを更新し、今度はJOINを発行する。
+    # モードを変え接続中ネットワークを更新し、NICKとJOINを発行する。
     my $new = !$this->{multi_server_mode};
 
     foreach my $string (
@@ -243,6 +243,17 @@
        );
     $this->{multi_server_mode} = $new;
     $this->update_networks;
+    my $global_nick = (($this->networks_list)[0])->current_nick;
+    if ($global_nick ne $this->current_nick) {
+	$this->broadcast_to_clients(
+	    IRCMessage->new(
+		Command => 'NICK',
+		Param => $global_nick,
+		Remarks => {'fill-prefix-when-sending-to-client' => 1
+			   }));
+
+	$this->set_current_nick($global_nick);
+    }
     foreach my $client ($this->clients_list) {
 	$client->inform_joinning_channels;
     }
