" + this.userChannelInput.text); this.userChannelInput.text = ""; } //Event handler, invoked when you select from the menu. private function channelMenuClickHandler(event:MenuEvent):void { if (event.item.@method == "setTopic") { this.setChannelTopicDialog = new SetChannelTopicDialog(); setChannelTopicDialog.flexIrcClient = this.flexIrcClient; setChannelTopicDialog.channel = this.channel; PopUpManager.addPopUp(setChannelTopicDialog,this, true); } else if (event.item.@method == "lockTopic") { this._flexIrcClient.setMode(this._channel,"+t"); } else if (event.item.@method == "unlockTopic") { this._flexIrcClient.setMode(this._channel,"-t"); } else if (event.item.@method == "leaveChannel") { this._flexIrcClient.partChannel(this._channel); } else if (event.item.@method == "setChannelPassword" || event.item.@method == "removeChannelPassword") { this.setChannelPasswordDialog = new SetChannelPasswordDialog(); setChannelPasswordDialog.flexIrcClient = this.flexIrcClient; setChannelPasswordDialog.channel = this.channel; PopUpManager.addPopUp(setChannelPasswordDialog,this, true); } else { Alert.show("Menu label: " + event.label + " \n menu item index within parent menu: " + event.index + " has no action associated with it."); } } private function userMenuClickHandler(event:MenuEvent):void { var channelGuiEvent:ChannelGuiEvent = null; if (event.item.@method == "kickUser") { channelGuiEvent = new ChannelGuiEvent(ChannelGuiEvent.KICK_USER_EVENT); channelGuiEvent.username = this.selectedUser; } else if (event.item.@method == "banUser") { channelGuiEvent = new ChannelGuiEvent(ChannelGuiEvent.BAN_USER_EVENT); channelGuiEvent.username = this.selectedUser; } else if (event.item.@method == "kickAndBanUser") { channelGuiEvent = new ChannelGuiEvent(ChannelGuiEvent.KICK_AND_BAN_USER_EVENT); channelGuiEvent.username = this.selectedUser; } else if (event.item.@method == "opUser") { channelGuiEvent = new ChannelGuiEvent(ChannelGuiEvent.OP_USER_EVENT); channelGuiEvent.username = this.selectedUser; } else if (event.item.@method == "deOpUser") { channelGuiEvent = new ChannelGuiEvent(ChannelGuiEvent.DE_OP_USER_EVENT); channelGuiEvent.username = this.selectedUser; } else if (event.item.@method == "voiceUser") { channelGuiEvent = new ChannelGuiEvent(ChannelGuiEvent.VOICE_USER_EVENT); channelGuiEvent.username = this.selectedUser; } else if (event.item.@method == "deVoiceUser") { channelGuiEvent = new ChannelGuiEvent(ChannelGuiEvent.DE_VOICE_USER_EVENT); channelGuiEvent.username = this.selectedUser; } else { Alert.show("Menu label: " + event.label + " \n menu item index within parent menu: " + event.index + " has no action associated with it."); return; } dispatchEvent(channelGuiEvent); } internal function kickUser(event:ChannelGuiEvent):void { trace ("kicking user"); this._flexIrcClient.kick(this._channel,event.username); } internal function banUser(event:ChannelGuiEvent):void { this._flexIrcClient.ban(this._channel,event.hostmask); } internal function kickAndBanUser(event:ChannelGuiEvent):void { this._flexIrcClient.kick(this._channel,event.username); this._flexIrcClient.ban(this._channel,event.hostmask); } internal function opUser(event:ChannelGuiEvent):void { this._flexIrcClient.op(this._channel,event.username); } internal function deOpUser(event:ChannelGuiEvent):void { this._flexIrcClient.deOp(this._channel,event.username); } internal function voiceUser(event:ChannelGuiEvent):void { this._flexIrcClient.voice(this._channel,event.username); } internal function deVoiceUser(event:ChannelGuiEvent):void { this._flexIrcClient.deVoice(this._channel,event.username); } /* END OF Channel Input Event Handlers */ /* START OF IRC Event Handlers */ protected function onInvite(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} /* event.targetNick event.sender event.login event.hostname event.channel */ } protected function onUserList(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} var users:Array = event.users; for (var i:int ; i < users.length ; i++) { addNewUserToGui((users[i] as User).getNick()); } } protected function onMessage( event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog(event.sender + "> " + event.message); } protected function onJoin(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} addNewUserToGui(event.sender); this.writeLineToChannelLog("User Joined: " + event.sender + "(" + event.login + ")"); } protected function onPart(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User Left: " + event.sender + "(" + event.login + ")"); removeUserFromGui(event.sender); if (event.sender == this.flexIrcClient.getNick()) deactivateChannel(); } protected function onKick(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.targetNick+ " was kicked by " + event.sender + " (" + event.message + ")"); removeUserFromGui(event.targetNick); if (event.sender == this.flexIrcClient.getNick()) deactivateChannel(); } protected function onTopic(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} if (event.changed || this.title == "") { if (event.sender != null) this.writeLineToChannelLog("User: " + event.sender + " sets topic to: " + event.message); else this.writeLineToChannelLog("Topic: " + event.message); this.title = this.channel + " - " + event.message.substr(0,50); } } protected function onChannelInfo( event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("Channel: " + event.channel + " (" + event.userCount + ") Topic: " + event.message); } protected function onMode(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " Changes channel mode to: " + event.mode); } protected function onOp(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.targetNick + " received Op status (conferred by: " + event.sender + ")"); } protected function onDeop(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.targetNick + " sees Op status revoked (by: " + event.sender + ")"); } protected function onVoice(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.targetNick + " is given a voice (by: " + event.sender + ")"); } protected function onDeVoice(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.targetNick + " sees his voice muted (by: " + event.sender + ")"); } protected function onSetChannelKey(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " sets channel key: " + event.message ); } protected function onRemoveChannelKey(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " removes channel key: " + event.message ); } protected function onSetChannelLimit(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " sets channel limit: " + event.limit ); } protected function onRemoveChannelLimit(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " removes channel limit" ); } protected function onSetChannelBan(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " sets channel ban for hostmask: " + event.hostmask); } protected function onRemoveChannelBan(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " removes channel ban for hostmask: " + event.hostmask); } protected function onSetTopicProtection(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " turns topic protection on"); } protected function onRemoveTopicProtection(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " removes topic protection"); } protected function onSetNoExternalMessages(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} var log:String = ("User: " as String); log = log + (event.sender as String); log = log + (" turns external messages off" as String); this.writeLineToChannelLog(log); } protected function onRemoveNoExternalMessages(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " allows external messages"); } protected function onSetInviteOnly(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " sets channel to invite only"); } protected function onRemoveInviteOnly(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " removes invite only from channel"); } protected function onSetModerated(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " sets channel to moderated"); } protected function onRemoveModerated(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " removes channel moderation"); } protected function onSetPrivate(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " sets channel to private"); } protected function onRemovePrivate(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " removes channel's private setting"); } protected function onSetSecret(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " makes channel secret"); } protected function onRemoveSecret(event:ChannelEvent):void { if (!channelCheck(event.channel)){return;} this.writeLineToChannelLog("User: " + event.sender + " removes channel's secret setting"); } /* END OF IRC Event Handlers */ ]]>