Commit c53da4c1 authored by JC Brand's avatar JC Brand

Store the user's xmpp status in the browser's session storage.

parent c15a2e25
......@@ -131,11 +131,19 @@ var xmppchat = (function ($, console) {
obj.prepNewChat = function (chat, jid) {
// Some operations that need to be applied on a chatbox
// after it has been created.
var chat_content = $(chat).find('.chat-content');
$(chat).find(".chat-textarea").focus();
if (chat_content.length > 0) {
chat_content.scrollTop(chat_content[0].scrollHeight);
var chat_content,
value;
if (jid === 'online-users-container') {
value = jarnxmpp.Storage.get('xmpp-status') || 'online';
$(chat).find('#select-xmpp-status').val(value);
} else {
chat_content = $(chat).find('.chat-content');
$(chat).find(".chat-textarea").focus();
if (chat_content.length > 0) {
chat_content.scrollTop(chat_content[0].scrollHeight);
}
}
if (!(jid in this.oc(this.chats))) {
this.chats.push(jid);
}
......@@ -417,16 +425,12 @@ $(document).ready(function () {
}
});
$('a.user-details-toggle').live('click', function (e) {
var $field = $('[name="message"]:input', $(this).parent()[0]),
jid = $field.attr('data-recipient');
e.preventDefault();
xmppchat.getChatbox(jid, function() {});
});
$('ul.tabs').tabs('div.panes > div');
$('select#select-xmpp-status').bind('change', function (event) {
var jid = jarnxmpp.connection.jid;
$(document).trigger('xmppchat.send_presence', [jid, event.target.value]);
var jid = jarnxmpp.connection.jid,
value = event.target.value;
$(document).trigger('xmppchat.send_presence', [jid, value]);
jarnxmpp.Storage.set('xmpp-status', value);
});
});
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