this.set({"nick": nick, "modes": modes, "prefix": this.getPrefix(modes)}, {silent: true});\r
},\r
addMode: function (mode) {\r
- var modes, prefix;\r
+ var modes_to_add = mode.split(''),\r
+ modes, prefix;\r
+\r
modes = this.get("modes");\r
- modes.push(mode);\r
+ $.each(modes_to_add, function (index, item) {\r
+ modes.push(item);\r
+ });\r
+ \r
modes = this.sortModes(modes);\r
this.set({"prefix": this.getPrefix(modes), "modes": modes});\r
},\r
removeMode: function (mode) {\r
- var modes, prefix;\r
+ var modes_to_remove = mode.split(''),\r
+ modes, prefix;\r
+\r
modes = this.get("modes");\r
modes = _.reject(modes, function (m) {\r
- return m === mode;\r
+ return (modes_to_remove.indexOf(m) !== -1);\r
});\r
+ \r
this.set({"prefix": this.getPrefix(modes), "modes": modes});\r
},\r
getPrefix: function (modes) {\r
// Clear the temporary userlist\r
delete channel.temp_userlist;\r
});\r
+\r
+\r
+ gw.on('onmode', function (event) {\r
+ var channel, members, member;\r
+\r
+ if (!event.channel) return;\r
+ channel = that.panels.getByName(event.channel);\r
+ if (!channel) return;\r
+\r
+ members = channel.get('members');\r
+ if (!members) return;\r
+\r
+ member = members.getByNick(event.effected_nick);\r
+ if (!member) return;\r
+\r
+ if (event.mode[0] === '+') {\r
+ member.addMode(event.mode.substr(1));\r
+ } else if (event.mode[0] === '-') {\r
+ member.removeMode(event.mode.substr(1));\r
+ }\r
+\r
+ });\r
};\r
\r
\r