Commit 9e5dc21a authored by JC Brand's avatar JC Brand

Refactor showing of chat room status messages.

onChatRoomPresence and showStatusMessages have been refactored to give more
detailed information and to also show the reasons given to actions taken by
moderators.
parent e8a70abc
......@@ -2312,6 +2312,28 @@
this.$el.find('.chat-body').append($('<p>'+msg+'</p>'));
},
/* http://xmpp.org/extensions/xep-0045.html
* ----------------------------------------
* 100 message Entering a room Inform user that any occupant is allowed to see the user's full JID
* 101 message (out of band) Affiliation change Inform user that his or her affiliation changed while not in the room
* 102 message Configuration change Inform occupants that room now shows unavailable members
* 103 message Configuration change Inform occupants that room now does not show unavailable members
* 104 message Configuration change Inform occupants that a non-privacy-related room configuration change has occurred
* 110 presence Any room presence Inform user that presence refers to one of its own room occupants
* 170 message or initial presence Configuration change Inform occupants that room logging is now enabled
* 171 message Configuration change Inform occupants that room logging is now disabled
* 172 message Configuration change Inform occupants that the room is now non-anonymous
* 173 message Configuration change Inform occupants that the room is now semi-anonymous
* 174 message Configuration change Inform occupants that the room is now fully-anonymous
* 201 presence Entering a room Inform user that a new room has been created
* 210 presence Entering a room Inform user that the service has assigned or modified the occupant's roomnick
* 301 presence Removal from room Inform user that he or she has been banned from the room
* 303 presence Exiting a room Inform all occupants of new room nickname
* 307 presence Removal from room Inform user that he or she has been kicked from the room
* 321 presence Removal from room Inform user that he or she is being removed from the room because of an affiliation change
* 322 presence Removal from room Inform user that he or she is being removed from the room because the room has been changed to members-only and the user is not a member
* 332 presence Removal from room Inform user that he or she is being removed from the room because of a system shutdown
*/
infoMessages: {
100: __('This room is not anonymous'),
102: __('This room now shows unavailable members'),
......@@ -2323,7 +2345,14 @@
173: __('This room is now semi-anonymous'),
174: __('This room is now fully-anonymous'),
201: __('A new room has been created'),
210: __('Your nickname has been changed')
},
disconnectMessages: {
301: __('You have been banned from this room'),
307: __('You have been kicked from this room'),
321: __("You have been removed from this room because of an affiliation change"),
322: __("You have been removed from this room because the room has changed to members-only and you're not a member"),
332: __("You have been removed from this room because the MUC (Multi-user chat) service is being shut down.")
},
actionInfoMessages: {
......@@ -2338,54 +2367,74 @@
* strings are picked up by the translation machinery.
*/
301: ___("<strong>%1$s</strong> has been banned"),
303: ___("<strong>%1$s</strong>'s nickname has changed"),
307: ___("<strong>%1$s</strong> has been kicked out"),
321: ___("<strong>%1$s</strong> has been removed because of an affiliation change"),
322: ___("<strong>%1$s</strong> has been removed for not being a member")
},
disconnectMessages: {
301: __('You have been banned from this room'),
307: __('You have been kicked from this room'),
321: __("You have been removed from this room because of an affiliation change"),
322: __("You have been removed from this room because the room has changed to members-only and you're not a member"),
332: __("You have been removed from this room because the MUC (Multi-user chat) service is being shut down.")
newNicknameMessages: {
210: ___('Your nickname has been automatically changed to: <strong>%1$s</strong>'),
303: ___('Your nickname has been changed to: <strong>%1$s</strong>')
},
showStatusMessages: function ($el, is_self) {
/* Check for status codes and communicate their purpose to the user
/* Check for status codes and communicate their purpose to the user.
* Allow user to configure chat room if they are the owner.
* See: http://xmpp.org/registrar/mucstatus.html
*/
var $chat_content = this.$el.find('.chat-content'),
$stats = $el.find('status'),
var $chat_content,
disconnect_msgs = [],
info_msgs = [],
action_msgs = [],
msgs, i;
for (i=0; i<$stats.length; i++) {
var stat = $stats[i].getAttribute('code');
if (is_self && _.contains(_.keys(this.disconnectMessages), stat)) {
disconnect_msgs.push(this.disconnectMessages[stat]);
} else if (!is_self && _.contains(_.keys(this.actionInfoMessages), stat)) {
action_msgs.push(
__(this.actionInfoMessages[stat], Strophe.unescapeNode(Strophe.getResourceFromJid($el.attr('from'))))
msgs = [],
reasons = [];
$el.find('x[xmlns="'+Strophe.NS.MUC_USER+'"]').each($.proxy(function (idx, x) {
var $item = $(x).find('item');
if (Strophe.getBareJidFromJid($item.attr('jid')) === converse.bare_jid && $item.attr('affiliation') === 'owner') {
this.$el.find('a.configure-chatroom-button').show();
}
$(x).find('item reason').each(function (idx, reason) {
if ($(reason).text()) {
reasons.push($(reason).text());
}
});
$(x).find('status').each($.proxy(function (idx, stat) {
var code = stat.getAttribute('code');
if (is_self && _.contains(_.keys(this.newNicknameMessages), code)) {
this.model.save({'nick': Strophe.getResourceFromJid($el.attr('from'))});
msgs.push(__(this.newNicknameMessages[code], $item.attr('nick')));
} else if (is_self && _.contains(_.keys(this.disconnectMessages), code)) {
disconnect_msgs.push(this.disconnectMessages[code]);
} else if (!is_self && _.contains(_.keys(this.actionInfoMessages), code)) {
msgs.push(
__(this.actionInfoMessages[code], Strophe.unescapeNode(Strophe.getResourceFromJid($el.attr('from'))))
);
} else if (_.contains(_.keys(this.infoMessages), stat)) {
info_msgs.push(this.infoMessages[stat]);
} else if (_.contains(_.keys(this.infoMessages), code)) {
msgs.push(this.infoMessages[code]);
} else if (code !== '110') {
if ($(stat).text()) {
msgs.push($(stat).text()); // Sometimes the status contains human readable text and not a code.
}
}
}, this));
}, this));
if (disconnect_msgs.length > 0) {
for (i=0; i<disconnect_msgs.length; i++) {
this.showDisconnectMessage(disconnect_msgs[i]);
}
for (i=0; i<reasons.length; i++) {
this.showDisconnectMessage(__('The reason given is: "'+reasons[i]+'"'), true);
}
this.model.set('connected', false);
return;
}
this.renderChatArea();
for (i=0; i<info_msgs.length; i++) {
$chat_content.append(converse.templates.info({message: info_msgs[i]}));
$chat_content = this.$el.find('.chat-content');
for (i=0; i<msgs.length; i++) {
$chat_content.append(converse.templates.info({message: msgs[i]}));
}
for (i=0; i<action_msgs.length; i++) {
$chat_content.append(converse.templates.info({message: action_msgs[i]}));
for (i=0; i<reasons.length; i++) {
this.showStatusNotification(__('The reason given is: "'+reasons[i]+'"'), true);
}
return this.scrollDown();
},
......@@ -2424,39 +2473,14 @@
},
onChatRoomPresence: function (presence, room) {
var nick = room.nick,
$presence = $(presence),
from = $presence.attr('from'),
is_self = ($presence.find("status[code='110']").length) || (from == room.name+'/'+Strophe.escapeNode(nick)),
$item;
var $presence = $(presence), is_self;
if ($presence.attr('type') === 'error') {
this.model.set('connected', false);
this.showErrorMessage($presence.find('error'), room);
} else {
is_self = ($presence.find("status[code='110']").length) || ($presence.attr('from') == room.name+'/'+Strophe.escapeNode(room.nick));
this.model.set('connected', true);
this.showStatusMessages($presence, is_self);
if (!this.model.get('connected')) {
return true;
}
if ($presence.find("status[code='201']").length) {
// This is a new chatroom. We create an instant
// chatroom, and let the user manually set any
// configuration setting.
converse.connection.muc.createInstantRoom(room.name);
}
if (is_self) {
$item = $presence.find('item');
if ($item.length) {
if ($item.attr('affiliation') == 'owner') {
this.$el.find('a.configure-chatroom-button').show();
}
}
if ($presence.find("status[code='210']").length) {
// check if server changed our nick
this.model.set({'nick': Strophe.getResourceFromJid(from)});
}
}
}
return true;
},
......
......@@ -12,33 +12,12 @@
beforeEach(function () {
runs(function () {
test_utils.closeAllChatBoxes();
test_utils.openControlBox();
});
waits(150);
runs(function () {
test_utils.openRoomsPanel();
});
waits(200);
runs(function () {
// Open a new chatroom
var roomspanel = converse.chatboxviews.get('controlbox').roomspanel;
var $input = roomspanel.$el.find('input.new-chatroom-name');
var $nick = roomspanel.$el.find('input.new-chatroom-nick');
var $server = roomspanel.$el.find('input.new-chatroom-server');
$input.val('lounge');
$nick.val('dummy');
$server.val('muc.localhost');
roomspanel.$el.find('form').submit();
});
waits(250);
runs(function () {
test_utils.closeControlBox();
});
runs(function () {});
});
it("shows users currently present in the room", $.proxy(function () {
var chatroomview = this.chatboxviews.get('lounge@muc.localhost'),
test_utils.openChatRoom('lounge', 'localhost', 'dummy');
var chatroomview = this.chatboxviews.get('lounge@localhost'),
$participant_list;
var roster = {}, room = {}, i;
for (i=0; i<mock.chatroom_names.length-1; i++) {
......@@ -53,7 +32,8 @@
}, converse));
it("indicates moderators by means of a special css class and tooltip", $.proxy(function () {
var chatroomview = this.chatboxviews.get('lounge@muc.localhost');
test_utils.openChatRoom('lounge', 'localhost', 'dummy');
var chatroomview = this.chatboxviews.get('lounge@localhost');
var roster = {}, idx = mock.chatroom_names.length-1;
roster[mock.chatroom_names[idx]] = {};
roster[mock.chatroom_names[idx]].role = 'moderator';
......@@ -66,12 +46,13 @@
}, converse));
it("allows the user to invite their roster contacts to enter the chat room", $.proxy(function () {
test_utils.openChatRoom('lounge', 'localhost', 'dummy');
spyOn(converse, 'emit');
spyOn(window, 'prompt').andCallFake(function () {
return null;
});
var roster = {}, $input;
var view = this.chatboxviews.get('lounge@muc.localhost');
var view = this.chatboxviews.get('lounge@localhost');
view.$el.find('.chat-area').remove();
view.renderChatArea(); // Will init the widget
test_utils.createContacts('current'); // We need roster contacts, so that we have someone to invite
......@@ -95,11 +76,12 @@
}, converse));
it("can be joined automatically, based upon a received invite", $.proxy(function () {
test_utils.openChatRoom('lounge', 'localhost', 'dummy');
spyOn(window, 'confirm').andCallFake(function () {
return true;
});
test_utils.createContacts('current'); // We need roster contacts, who can invite us
var view = this.chatboxviews.get('lounge@muc.localhost');
var view = this.chatboxviews.get('lounge@localhost');
view.close();
var name = mock.cur_names[0];
var from_jid = name.replace(/ /g,'.').toLowerCase() + '@localhost';
......@@ -122,13 +104,14 @@
}, converse));
it("shows received groupchat messages", $.proxy(function () {
test_utils.openChatRoom('lounge', 'localhost', 'dummy');
spyOn(converse, 'emit');
var view = this.chatboxviews.get('lounge@muc.localhost');
var view = this.chatboxviews.get('lounge@localhost');
if (!view.$el.find('.chat-area').length) { view.renderChatArea(); }
var nick = mock.chatroom_names[0];
var text = 'This is a received message';
var message = $msg({
from: 'lounge@muc.localhost/'+nick,
from: 'lounge@localhost/'+nick,
id: '1',
to: 'dummy@localhost',
type: 'groupchat'
......@@ -141,8 +124,9 @@
}, converse));
it("shows sent groupchat messages", $.proxy(function () {
test_utils.openChatRoom('lounge', 'localhost', 'dummy');
spyOn(converse, 'emit');
var view = this.chatboxviews.get('lounge@muc.localhost');
var view = this.chatboxviews.get('lounge@localhost');
if (!view.$el.find('.chat-area').length) { view.renderChatArea(); }
var nick = mock.chatroom_names[0];
var text = 'This is a sent message';
......@@ -151,7 +135,7 @@
expect(converse.emit).toHaveBeenCalledWith('messageSend', text);
var message = $msg({
from: 'lounge@muc.localhost/dummy',
from: 'lounge@localhost/dummy',
id: '2',
to: 'dummy@localhost.com',
type: 'groupchat'
......@@ -164,7 +148,85 @@
expect(converse.emit.callCount, 1);
}, converse));
it("informs users if their nicknames has been changed.", $.proxy(function () {
/* The service then sends two presence stanzas to the full JID
* of each occupant (including the occupant who is changing his
* or her room nickname), one of type "unavailable" for the old
* nickname and one indicating availability for the new
* nickname.
*
* See: http://xmpp.org/extensions/xep-0045.html#changenick
*
* <presence
* from='coven@localhost/thirdwitch'
* id='DC352437-C019-40EC-B590-AF29E879AF98'
* to='hag66@shakespeare.lit/pda'
* type='unavailable'>
* <x xmlns='http://jabber.org/protocol/muc#user'>
* <item affiliation='member'
* jid='hag66@shakespeare.lit/pda'
* nick='oldhag'
* role='participant'/>
* <status code='303'/>
* <status code='110'/>
* </x>
* </presence>
*
* <presence
* from='coven@localhost/oldhag'
* id='5B4F27A4-25ED-43F7-A699-382C6B4AFC67'
* to='hag66@shakespeare.lit/pda'>
* <x xmlns='http://jabber.org/protocol/muc#user'>
* <item affiliation='member'
* jid='hag66@shakespeare.lit/pda'
* role='participant'/>
* <status code='110'/>
* </x>
* </presence>
*/
test_utils.openChatRoom('lounge', 'localhost', 'oldnick');
var presence = $pres().attrs({
from:'lounge@localhost/oldnick',
id:'DC352437-C019-40EC-B590-AF29E879AF98',
to:'dummy@localhost/pda',
type:'unavailable'
})
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc#user'})
.c('item').attrs({
affiliation: 'member',
jid: 'dummy@localhost/pda',
nick: 'newnick',
role: 'participant'
}).up()
.c('status').attrs({code:'303'}).up()
.c('status').attrs({code:'110'}).nodeTree;
var view = this.chatboxviews.get('lounge@localhost');
view.onChatRoomPresence(presence, {'nick': 'lounge'});
var $chat_content = view.$el.find('.chat-content');
expect($chat_content.find('div.chat-info').length).toBe(1);
expect($chat_content.find('div.chat-info').html()).toBe('Your nickname has been changed to: <strong>newnick</strong>');
// The second presence shouldn't do anything...
presence = $pres().attrs({
from:'lounge@localhost/newnick',
id:'5B4F27A4-25ED-43F7-A699-382C6B4AFC67',
to:'dummy@localhost/pda'
})
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc#user'})
.c('item').attrs({
affiliation: 'member',
jid: 'dummy@localhost/pda',
role: 'participant'
}).up()
.c('status').attrs({code:'110'}).nodeTree;
view.onChatRoomPresence(presence, {'nick': 'lounge'});
expect($chat_content.find('div.chat-info').length).toBe(1);
expect($chat_content.find('div.chat-info').html()).toBe('Your nickname has been changed to: <strong>newnick</strong>');
}, converse));
it("can be saved to, and retrieved from, browserStorage", $.proxy(function () {
test_utils.openChatRoom('lounge', 'localhost', 'dummy');
// We instantiate a new ChatBoxes collection, which by default
// will be empty.
spyOn(this.chatboxviews, 'trimChats');
......@@ -192,7 +254,8 @@
}, converse));
it("can be minimized by clicking a DOM element with class 'toggle-chatbox-button'", function () {
var view = this.chatboxviews.get('lounge@muc.localhost'),
test_utils.openChatRoom('lounge', 'localhost', 'dummy');
var view = this.chatboxviews.get('lounge@localhost'),
trimmed_chatboxes = this.minimized_chats;
spyOn(view, 'minimize').andCallThrough();
spyOn(view, 'maximize').andCallThrough();
......@@ -224,7 +287,8 @@
it("can be closed again by clicking a DOM element with class 'close-chatbox-button'", $.proxy(function () {
var view = this.chatboxviews.get('lounge@muc.localhost'), chatroom = view.model, $el;
test_utils.openChatRoom('lounge', 'localhost', 'dummy');
var view = this.chatboxviews.get('lounge@localhost'), chatroom = view.model, $el;
spyOn(view, 'close').andCallThrough();
spyOn(converse, 'emit');
spyOn(converse.connection.muc, 'leave');
......@@ -260,12 +324,12 @@
it("will show an error message if the room requires a password", $.proxy(function () {
var presence = $pres().attrs({
from:'coven@chat.shakespeare.lit/thirdwitch',
from:'lounge@localhost/thirdwitch',
id:'n13mt3l',
to:'hag66@shakespeare.lit/pda',
to:'dummy@localhost/pda',
type:'error'})
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'auth'})
.c('error').attrs({by:'lounge@localhost', type:'auth'})
.c('not-authorized').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
var view = this.chatboxviews.get('problematic@muc.localhost');
......@@ -284,12 +348,12 @@
it("will show an error message if the room is members-only and the user not included", $.proxy(function () {
var presence = $pres().attrs({
from:'coven@chat.shakespeare.lit/thirdwitch',
from:'lounge@localhost/thirdwitch',
id:'n13mt3l',
to:'hag66@shakespeare.lit/pda',
to:'dummy@localhost/pda',
type:'error'})
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'auth'})
.c('error').attrs({by:'lounge@localhost', type:'auth'})
.c('registration-required').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
......@@ -299,12 +363,12 @@
it("will show an error message if the user has been banned", $.proxy(function () {
var presence = $pres().attrs({
from:'coven@chat.shakespeare.lit/thirdwitch',
from:'lounge@localhost/thirdwitch',
id:'n13mt3l',
to:'hag66@shakespeare.lit/pda',
to:'dummy@localhost/pda',
type:'error'})
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'auth'})
.c('error').attrs({by:'lounge@localhost', type:'auth'})
.c('forbidden').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
......@@ -314,12 +378,12 @@
it("will show an error message if no nickname was specified for the user", $.proxy(function () {
var presence = $pres().attrs({
from:'coven@chat.shakespeare.lit/thirdwitch',
from:'lounge@localhost/thirdwitch',
id:'n13mt3l',
to:'hag66@shakespeare.lit/pda',
to:'dummy@localhost/pda',
type:'error'})
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'modify'})
.c('error').attrs({by:'lounge@localhost', type:'modify'})
.c('jid-malformed').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
......@@ -329,12 +393,12 @@
it("will show an error message if the user is not allowed to have created the room", $.proxy(function () {
var presence = $pres().attrs({
from:'coven@chat.shakespeare.lit/thirdwitch',
from:'lounge@localhost/thirdwitch',
id:'n13mt3l',
to:'hag66@shakespeare.lit/pda',
to:'dummy@localhost/pda',
type:'error'})
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
.c('error').attrs({by:'lounge@localhost', type:'cancel'})
.c('not-allowed').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
......@@ -344,12 +408,12 @@
it("will show an error message if the user's nickname doesn't conform to room policy", $.proxy(function () {
var presence = $pres().attrs({
from:'coven@chat.shakespeare.lit/thirdwitch',
from:'lounge@localhost/thirdwitch',
id:'n13mt3l',
to:'hag66@shakespeare.lit/pda',
to:'dummy@localhost/pda',
type:'error'})
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
.c('error').attrs({by:'lounge@localhost', type:'cancel'})
.c('not-acceptable').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
......@@ -359,12 +423,12 @@
it("will show an error message if the user's nickname is already taken", $.proxy(function () {
var presence = $pres().attrs({
from:'coven@chat.shakespeare.lit/thirdwitch',
from:'lounge@localhost/thirdwitch',
id:'n13mt3l',
to:'hag66@shakespeare.lit/pda',
to:'dummy@localhost/pda',
type:'error'})
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
.c('error').attrs({by:'lounge@localhost', type:'cancel'})
.c('conflict').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
......@@ -374,12 +438,12 @@
it("will show an error message if the room doesn't yet exist", $.proxy(function () {
var presence = $pres().attrs({
from:'coven@chat.shakespeare.lit/thirdwitch',
from:'lounge@localhost/thirdwitch',
id:'n13mt3l',
to:'hag66@shakespeare.lit/pda',
to:'dummy@localhost/pda',
type:'error'})
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
.c('error').attrs({by:'lounge@localhost', type:'cancel'})
.c('item-not-found').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
......@@ -389,12 +453,12 @@
it("will show an error message if the room has reached it's maximum number of occupants", $.proxy(function () {
var presence = $pres().attrs({
from:'coven@chat.shakespeare.lit/thirdwitch',
from:'lounge@localhost/thirdwitch',
id:'n13mt3l',
to:'hag66@shakespeare.lit/pda',
to:'dummy@localhost/pda',
type:'error'})
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
.c('error').attrs({by:'lounge@localhost', type:'cancel'})
.c('service-unavailable').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
......
......@@ -40,6 +40,9 @@ require([
window.converse_api = converse;
window.localStorage.clear();
window.sessionStorage.clear();
// XXX: call this to initialize Strophe plugins
new Strophe.Connection('localhost');
converse.initialize({
prebind: false,
xhr_user_search: false,
......
......@@ -89,6 +89,18 @@
return converse.roster.get(jid).trigger("open");
};
utils.openChatRoom = function (room, server, nick) {
// Open a new chatroom
this.openControlBox();
this.openRoomsPanel();
var roomspanel = converse.chatboxviews.get('controlbox').roomspanel;
roomspanel.$el.find('input.new-chatroom-name').val(room);
roomspanel.$el.find('input.new-chatroom-nick').val(nick);
roomspanel.$el.find('input.new-chatroom-server').val(server);
roomspanel.$el.find('form').submit();
this.closeControlBox();
};
utils.removeRosterContacts = function () {
var model;
while (converse.rosterview.model.length) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment