diff options
author | lassulus <lassulus@googlemail.com> | 2013-11-12 02:01:29 +0100 |
---|---|---|
committer | lassulus <lassulus@googlemail.com> | 2013-11-12 02:01:29 +0100 |
commit | 3531d46cc3644a64b990f904e40e4846b8242a07 (patch) | |
tree | a0289317e14a8011d7a6615010b70e5d21eff02c /webchat/public/functions.js | |
parent | c6a7cd9027150fca42500b3bbc78be01993856f6 (diff) |
webchat: refactor to rpc
Diffstat (limited to 'webchat/public/functions.js')
-rw-r--r-- | webchat/public/functions.js | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/webchat/public/functions.js b/webchat/public/functions.js index 45c8ad3f..244af67b 100644 --- a/webchat/public/functions.js +++ b/webchat/public/functions.js @@ -3,25 +3,11 @@ function inputParser (str) { if (match) { return { method: match[1], params: match[2] } } else { - return { method: 'say', params: str } + return { method: 'msg', params: str } } } -function methodDispatcher (settings, object) { - console.log('parser: ',object) - return (handler[object.method] || console.log)(settings, object.params) -}; - -function resultDispatcher (settings, object) { - console.log('parser: ',object) - var callback = settings.waiting_callbacks[object.id] - delete settings.waiting_callbacks[object.id] - if (typeof callback === 'function') { - callback(object.error, object.result) - } -}; - function replaceURLWithHTMLLinks (text) { var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; @@ -37,9 +23,9 @@ function setMaybeNick (input) { function sortNicklist () { }; -function getNicklistElement(name) { +function getNicklistElement(name, type) { var el; - $('.name').each(function (i,e) { + $('.'+type+'_name').each(function (i,e) { if (e.innerHTML === name) { if (typeof el !== 'undefined') { throw new Error('duplicate name: ' + name); |