From ec5ba068bba5a49ed87511b1b91c5ef26b5a225a Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Fri, 5 Oct 2012 11:29:00 +0000 Subject: [PATCH] Create JavaScript's Thread class --- src/messenger/webim/js/164/thread.js | 8 +++ src/messenger/webim/js/source/thread.js | 75 +++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 src/messenger/webim/js/164/thread.js create mode 100644 src/messenger/webim/js/source/thread.js diff --git a/src/messenger/webim/js/164/thread.js b/src/messenger/webim/js/164/thread.js new file mode 100644 index 00000000..fdd8e170 --- /dev/null +++ b/src/messenger/webim/js/164/thread.js @@ -0,0 +1,8 @@ +/* + This file is part of Mibew Messenger project. + http://mibew.org + + Copyright (c) 2005-2011 Mibew Messenger Community + License: http://mibew.org/license.php +*/ +var Thread=function(a){this.threadid=a.threadid||0;this.token=a.token||0;this.lastid=a.lastid||0;this.user=a.user||!1};Thread.prototype.KIND_USER=1;Thread.prototype.KIND_AGENT=2;Thread.prototype.KIND_FOR_AGENT=3;Thread.prototype.KIND_INFO=4;Thread.prototype.KIND_CONN=5;Thread.prototype.KIND_EVENTS=6;Thread.prototype.KIND_AVATAR=7; \ No newline at end of file diff --git a/src/messenger/webim/js/source/thread.js b/src/messenger/webim/js/source/thread.js new file mode 100644 index 00000000..295a435d --- /dev/null +++ b/src/messenger/webim/js/source/thread.js @@ -0,0 +1,75 @@ +/** + * @preserve This file is part of Mibew Messenger project. + * http://mibew.org + * + * Copyright (c) 2005-2011 Mibew Messenger Community + * License: http://mibew.org/license.php + */ + +/** + * Create an instance of thread + * @constructor + */ +var Thread = function(options) { + + /** + * Id of the thread + * @type Number + */ + this.threadid = options.threadid || 0; + + /** + * Thread's token. Uses for verify thread + * @type Number + */ + this.token = options.token || 0; + + /** + * Last message id received by the thread + * @type Number + */ + this.lastid = options.lastid || 0; + + /** + * Indicates if thread dispalys for user or for agent. + * + * Boolean true stands for user and boolean false stands for agent. + * @type Boolean + */ + this.user = options.user || false; +} + +/** Message kinds section */ + +/** + * Message sent by user + */ +Thread.prototype.KIND_USER = 1; +/** + * Message sent by operator + */ +Thread.prototype.KIND_AGENT = 2; +/** + * Hidden system message to operator + */ +Thread.prototype.KIND_FOR_AGENT = 3; +/** + * System messages for user and operator + */ +Thread.prototype.KIND_INFO = 4; +/** + * Message for user if operator have connection problems + */ +Thread.prototype.KIND_CONN = 5; +/** + * System message about some events (like rename). + */ +Thread.prototype.KIND_EVENTS = 6; +/** + * Message with operators avatar + * + * This kind of message leaved only for compatibility with core + */ +Thread.prototype.KIND_AVATAR = 7; + +/** End of Message kinds section */ \ No newline at end of file