summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authormisdre <misdre@gmail.com>2013-02-24 23:04:48 +0100
committermisdre <misdre@gmail.com>2013-02-24 23:04:48 +0100
commit6db9a8636628cfbccf0b40dfaca6b84ac17fdb41 (patch)
tree592604fb1c1292e8ddbfda11ca3378ca372d75dc /src
parentf16646f4461787ac7b84d29871d974877c5760ac (diff)
focus the channel if it's already open (issue #406)
Diffstat (limited to 'src')
-rw-r--r--src/common/outbound.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/common/outbound.c b/src/common/outbound.c
index cc2d0e3e..c146c2ac 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -2348,17 +2348,26 @@ static int
 cmd_join (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 {
 	char *chan = word[2];
+	session *sess_find;
 	if (*chan)
 	{
 		char *po, *pass = word[3];
-		sess->server->p_join (sess->server, chan, pass);
-		if (sess->channel[0] == 0 && sess->waitchannel[0])
+
+		sess_find = find_channel (sess->server, chan);
+		if (!sess_find)
 		{
-			po = strchr (chan, ',');
-			if (po)
-				*po = 0;
-			safe_strcpy (sess->waitchannel, chan, CHANLEN);
+			sess->server->p_join (sess->server, chan, pass);
+			if (sess->channel[0] == 0 && sess->waitchannel[0])
+			{
+				po = strchr (chan, ',');
+				if (po)
+					*po = 0;
+				safe_strcpy (sess->waitchannel, chan, CHANLEN);
+			}
 		}
+		else
+			fe_ctrl_gui (sess_find, 2, 0);	/* bring-to-front */
+		
 		return TRUE;
 	}
 	return FALSE;