From 73b5b0f3f9e07ba6ed44084678f8f4fea451fd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Qu=C3=A8ze?= Date: Mon, 5 Nov 2007 04:13:39 +0100 Subject: [PATCH] Make it possible to join an IRC chan --- im/base/content/instantbird/addbuddy.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/im/base/content/instantbird/addbuddy.js b/im/base/content/instantbird/addbuddy.js index 103ad141b9..560ea31f40 100644 --- a/im/base/content/instantbird/addbuddy.js +++ b/im/base/content/instantbird/addbuddy.js @@ -76,7 +76,23 @@ var addBuddy = { create: function ab_create() { var account = this.pcs.getAccountById(this.getValue("accountlist")); var tag = this.pcs.getTagById(this.getValue("taglist")); - this.pcs.addBuddy(account, tag, this.getValue("name")); + var name = this.getValue("name") + + // For now this will allow to join an IRC chan. It should be removed later + if (name[0] == "#" && account.protocol.id == "prpl-irc") { + var conv = account.joinChat(name); + if (!conv) + return; + var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] + .getService(Components.interfaces.nsIWindowMediator); + var convWindow = wm.getMostRecentWindow("Messenger:convs"); + if (convWindow) { + convWindow.msgObserver.focusConv(conv); + convWindow.focus(); + } + } + else + this.pcs.addBuddy(account, tag, name); }, getAccounts: function ab_getAccounts() {