}\r
\r
function partCommand (ev) {\r
- var that = this;\r
-\r
+ var that = this,\r
+ chans,\r
+ msg;\r
if (ev.params.length === 0) {\r
this.connections.active_connection.gateway.part(_kiwi.app.panels().active.get('name'));\r
} else {\r
- _.each(ev.params, function (channel) {\r
- that.connections.active_connection.gateway.part(channel);\r
+ chans = ev.params[0].split(',');\r
+ msg = ev.params[1];\r
+ _.each(chans, function (channel) {\r
+ that.connections.active_connection.gateway.part(channel, msg);\r
});\r
}\r
}\r
/**\r
* Leaves a channel\r
* @param {String} channel The channel to part\r
+ * @param {String} message Optional part message\r
* @param {Function} callback A callback function\r
*/\r
- this.part = function (connection_id, channel, callback) {\r
+ this.part = function (connection_id, channel, message, callback) {\r
+ "use strict";\r
+\r
+ // The message param is optional, so juggle args if it is missing\r
+ if (typeof arguments[2] === 'function') {\r
+ callback = arguments[2];\r
+ message = undefined;\r
+ }\r
var args = {\r
- channel: channel\r
+ channel: channel,\r
+ message: message\r
};\r
\r
this.rpcCall('irc.part', connection_id, args, callback);\r
part: function (irc_connection, callback, args) {\r
if (args.channel) {\r
_.each(args.channel.split(","), function (chan) {\r
- irc_connection.write('PART ' + chan, callback);\r
+ irc_connection.write('PART ' + chan + (args.message ? ' :' + args.message : ''), callback);\r
});\r
}\r
},\r