_kiwi.model = {};\r
_kiwi.view = {};\r
_kiwi.applets = {};\r
+_kiwi.utils = {};\r
\r
\r
/**\r
rpc: undefined, // Instance of WebsocketRpc\r
utils: {}, // References to misc. re-usable helpers / functions\r
\r
+ // Make public some internal utils for plugins to make use of\r
initUtils: function() {\r
this.utils.randomString = randomString;\r
this.utils.secondsToTime = secondsToTime;\r
this.utils.formatIRCMsg = formatIRCMsg;\r
this.utils.styleText = styleText;\r
this.utils.hsl2rgb = hsl2rgb;\r
+\r
+ this.utils.notifications = _kiwi.utils.notifications;\r
+ this.utils.formatDate = _kiwi.utils.formatDate;\r
},\r
\r
addMediaMessageType: function(match, buildHtml) {\r
kiwi: 'kiwi', raw: 'raw', kick: 'kick', topic: 'topic',\r
part: 'part', join: 'join', action: 'action', ctcp: 'ctcp',\r
ctcpRequest: 'ctcpRequest', ctcpResponse: 'ctcpResponse',\r
- notice: 'notice', msg: 'privmsg', changeNick: 'changeNick',\r
- channelInfo: 'channelInfo', mode: 'mode', quit: 'quit'\r
+ notice: 'notice', msg: 'privmsg', say: 'privmsg',\r
+ changeNick: 'changeNick', channelInfo: 'channelInfo',\r
+ mode: 'mode', quit: 'quit'\r
};\r
\r
_.each(funcs, function(gateway_fn, func_name) {\r
};\r
});\r
\r
+ // Now for some network related functions...\r
+ obj.createQuery = function(nick) {\r
+ var network, restricted_keys;\r
+\r
+ network = getNetwork();\r
+ if (!network) {\r
+ return;\r
+ }\r
+\r
+ return network.createQuery(nick);\r
+ };\r
+\r
// Add the networks getters/setters\r
obj.get = function(name) {\r
var network, restricted_keys;\r
};\r
});\r
\r
+ // Give access to the control input textarea\r
+ obj.input = _kiwi.app.controlbox.$('.inp');\r
+\r
return obj;\r
}\r
},\r
\r
// Entry point to start the kiwi application\r
init: function (opts, callback) {\r
- var localePromise, themePromise,\r
+ var locale_promise, theme_promise,\r
that = this;\r
+\r
opts = opts || {};\r
\r
this.initUtils();\r
// Set the window title\r
window.document.title = opts.server_settings.client.window_title || 'Kiwi IRC';\r
\r
- localePromise = new Promise(function (resolve) {\r
+ locale_promise = new Promise(function (resolve) {\r
var locale = _kiwi.global.settings.get('locale') || 'magic';\r
$.getJSON(opts.base_path + '/assets/locales/' + locale + '.json', function (locale) {\r
if (locale) {\r
});\r
});\r
\r
- themePromise = new Promise(function (resolve) {\r
+ theme_promise = new Promise(function (resolve) {\r
var text_theme = opts.server_settings.client.settings.text_theme || 'default';\r
$.getJSON(opts.base_path + '/assets/text_themes/' + text_theme + '.json', function(text_theme) {\r
opts.text_theme = text_theme;\r
});\r
\r
\r
- Promise.all([localePromise, themePromise]).then(function () {\r
+ Promise.all([locale_promise, theme_promise]).then(function () {\r
_kiwi.app = new _kiwi.model.Application(opts);\r
\r
// Start the client up\r
_kiwi.global.plugins = new _kiwi.model.PluginManager();\r
\r
callback();\r
+\r
+ }).then(null, function(err) {\r
+ console.error(err.stack);\r
});\r
},\r
\r