From d0a0a4edae2fa2aad6d88c7bc77b6549399b4837 Mon Sep 17 00:00:00 2001
From: mcmlxxix <>
Date: Mon, 26 Mar 2012 23:43:02 +0000
Subject: [PATCH] clear chat window on /clear

---
 exec/load/json-chat.js | 9 ++++++++-
 exec/load/layout.js    | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/exec/load/json-chat.js b/exec/load/json-chat.js
index 2ed2576075..d8bf90e96a 100644
--- a/exec/load/json-chat.js
+++ b/exec/load/json-chat.js
@@ -51,7 +51,12 @@ function JSONChat(usernum,jsonclient,host,port) {
 		var chan = this.channels[target.toUpperCase()];
 		this.client.write("chat","channels." + chan.name + ".history",[],2);
 		chan.messages = [];
-	}
+		if(this.view) {
+			var tab =  this.view.getTab(target)
+			if(tab)
+				tab.frame.clear();
+		}
+	} 
 	
 	this.join = function(target,str) {
 		this.client.subscribe("chat","channels." + target + ".messages");
@@ -146,12 +151,14 @@ function JSONChat(usernum,jsonclient,host,port) {
 			
 		cmdstr = cmdstr.split(" ");
 		switch(cmdstr[0].toUpperCase()) {
+		case "J":
 		case "JOIN":
 			cmdstr.shift();
 			var chan = cmdstr.shift();
 			if(chan)
 				this.join(chan,cmdstr.join(" "));
 			break;
+		case "P":
 		case "PART":
 			cmdstr.shift();
 			var chan = cmdstr.shift();
diff --git a/exec/load/layout.js b/exec/load/layout.js
index 76e7977187..1ea0f0033c 100644
--- a/exec/load/layout.js
+++ b/exec/load/layout.js
@@ -333,7 +333,7 @@ function LayoutView(title,frame,parent) {
 	this.getTab=function(title_or_index) {
 		if(isNaN(title_or_index)) {
 			for each(var t in properties.tabs) {
-				if(t.title.toUpperCase() == title.toUpperCase())
+				if(t.title.toUpperCase() == title_or_index.toUpperCase())
 					return t;
 			}
 		}
-- 
GitLab