kiwi.model.Application = Backbone.Model.extend(new (function () {\r
var that = this;\r
\r
+ /** Instance of kiwi.model.PanelList */\r
+ this.panels = null;\r
+\r
this.initialize = function () {\r
// Update `that` with this new Model object\r
that = this;\r
\r
\r
this.initializeClient = function () {\r
- this.view = new kiwi.view.Application({model: this, el: this.get('container')})\r
+ this.view = new kiwi.view.Application({model: this, el: this.get('container')});\r
\r
\r
/**\r
\r
\r
gw.on('onjoin', function (event) {\r
- console.log(event);\r
var c, members, user;\r
c = that.panels.getByName(event.channel);\r
if (!c) {\r
kiwi.gateway.changeNick(ev.params[0]);\r
});\r
\r
+ controlbox.on('command_topic', this.topicCommand);\r
+\r
controlbox.on('command_css', function (ev) {\r
var queryString = '?reload=' + new Date().getTime();\r
$('link[rel="stylesheet"]').each(function () {\r
//kiwi.app.panels.remove(kiwi.current_panel);\r
};\r
\r
+ this.topicCommand = function (ev) {\r
+ var channel_name;\r
+\r
+ if (ev.params.length === 0) return;\r
+\r
+ if (that.isChannelName(ev.params[0])) {\r
+ channel_name = ev.params[0];\r
+ ev.params.shift();\r
+ } else {\r
+ channel_name = kiwi.current_panel.get('name');\r
+ }\r
+\r
+ kiwi.gateway.topic(channel_name, ev.params.join(' '));\r
+ };\r
+\r
\r
\r
\r
$('#topic input').val(new_topic);\r
};\r
\r
+ this.isChannelName = function (channel_name) {\r
+ var channel_prefix = kiwi.gateway.get('channel_prefix');\r
+\r
+ if (!channel_name || !channel_name.length) return false;\r
+ return (channel_prefix.indexOf(channel_name[0]) > -1);\r
+ };\r
+\r
})());
\ No newline at end of file