public UserNickChangeEvent(User user, string oldnick, string newnick) : base(user) { this.user = user; this.oldnick = oldnick; this.newnick = newnick; }
public void showCommandHelp(User user, String command) { if (HelpDict.ContainsKey (command)) { if (!HelpDict [command].onHelpCommand(user)) { client.noticeUser (user, "No help for " + command); } } }
public bool containsUser(User user) { if (Users.ContainsValue(user)) { return true; } return false; }
public static void registerAccount(User user, String password, String email) { NickEntry nickEntry = new NickEntry (); nickEntry.Nick = user.nickname.ToLower (); nickEntry.Email = email; nickEntry.Password = password; instance.getDB().Insert (nickEntry, selectIdentity: true); instance.debugServices (user.nickname + " registered account (" + email + ")"); }
public void removeFromChannel(User user) { if (Users.ContainsValue(user)) { Users.Remove(user.UID); return; } Console.WriteLine("Attempted to remove non-existant user from channel " + this.name); }
public static void showHelp(User user) { OperServ.os.noticeUser(user, Convert.ToChar(2) + "------ OperServ Help ------"); OperServ.os.noticeUser(user, "For information on a command type " + Convert.ToChar(2) + "/msg OperServ help <command>"); OperServ.os.noticeUser(user, " "); OperServ.os.noticeUser(user, "The follow commands are avaliable: "); foreach (KeyValuePair<string, string> key in HelpDict) { OperServ.os.noticeUser(user, Convert.ToChar(2) + key.Key + Convert.ToChar(2) + " " + key.Value); } OperServ.os.noticeUser(user, Convert.ToChar(2) + "------ End of Help ------"); }
public void showHelp(User user) { client.noticeUser(user, Convert.ToChar(2) + "------ " + client.nickname + " Help ------"); client.noticeUser(user, "For information on a command type " + Convert.ToChar(2) + "/msg " + client.nickname + " help <command>"); client.noticeUser(user, " "); client.noticeUser(user, "The follow commands are avaliable: "); foreach (KeyValuePair<string, CommandExecutor> key in HelpDict) { client.noticeUser(user, Convert.ToChar(2) + key.Key + Convert.ToChar(2) + " " + key.Value.HelpInfo); } client.noticeUser(user, Convert.ToChar(2) + "------ End of Help ------"); }
public override void noticeUser(Client sender, User sendee, string message) { Send(":" + sender.UID + " NOTICE " + sendee.UID + " :" + message); }
public override void msgUser(Client sender, User sendee, string message) { Send(":" + sender.UID + " PRIVMSG " + sendee.UID + " :" + message); }
public UserMessageEvent(User sender, User sendee, string message) { this.message = message; this.sender = sender; this.sendee = sendee; }
public KillEvent(User killer, User killee, string reason) { this.killer = killer; this.killee = killee; this.reason = reason; }
public void modeChannel(Channel channel, User dest, string mode) { Protocol.protocolPlugin.chanMode(this, channel, dest, mode); }
public void kill(User killee, string reason = "Killed by dreamskape") { //client kill user //problem? Protocol.protocolPlugin.killUser(this, killee, reason); }
public void joinChannelMode(Channel channel, User dest, string mode) { Protocol.protocolPlugin.joinChannelMode(this, channel, dest, mode); }
public UserEvent(User user) { this.user = user; }
public UserConnectEvent(User user) : base(user) { }
public ChannelAccountResult register(string password, User user) { try { /*NickManager instance = new NickManager(user.nickname, this.plugin); if (!instance.Registered) { return ChannelAccountResult.USER_NOT_LOGGED_IN; }*/ /*if (ChannelDatabase.ChannelAccounts.ContainsKey(Name.ToLower())) { return ChannelAccountResult.REGISTER_ALREADY_REGISTERED; }*/ Console.WriteLine("1"); Console.WriteLine("channel-name " + this.channel.name); var channelEntry = new ChannelEntry { Name = this.channel.name.ToLower(), /*Access = { {user.user.nickname, 5} },*/ }; return ChannelAccountResult.REGISTER_SUCESS; } catch (NullReferenceException e) { Console.WriteLine(e.ToString()); } return ChannelAccountResult.UNKNOWN; }
public bool ContainsUser(User user) { return channel.containsUser(user); }
public ChannelMessageEvent(User user, string message, Channel channel) { this.message = message; this.channel = channel; }
public void parseLine(string line) { string[] lineArray = line.Split(' '); string lineStart = lineArray[0]; if (lineStart == "PING") { Send("PONG " + lineArray[1]); if (burstComplete == false) { Console.WriteLine("calling hook burst_Complete ==="); ModuleManager.callHook(Hooks.SERVER_BURST_END, null, null); burstComplete = true; } } else if (lineArray[1].Length > 1) { switch (lineArray[1]) { case "QUIT": { string user_UID = lineArray[0].Remove(0, 1); //check if user exists. User user = getUserFromUID(user_UID); if (user == null) { Console.WriteLine("Warning : A user that wasn't introduced quit!"); return; } //get rid of this user. user = null; Program.Users.Remove(user_UID); //call plugins :o break; } case "PART": { Channel channel = getChannelFromName(lineArray[2]); if (channel == null) { Console.WriteLine("attempted to remove user from non-existant channel " + lineArray[2]); return; } User user = getUserFromUID(lineArray[0].Remove(0, 1)); channel.removeFromChannel(user); break; } case "SJOIN": { Channel channel = getChannelFromName(lineArray[3]); if (channel == null) { channel = new Channel(lineArray[3], int.Parse(lineArray[2])); } //get the user.. Regex users = new Regex(@":(.*) SJOIN (.*):(.*)"); Match match = users.Match(line); string[] userStringArray = match.Groups[3].Value.Split(' '); foreach (string user in userStringArray) { string usr; User u = null; if (user.StartsWith("@") || user.StartsWith("+")) { usr = user.Remove(0, 1); u = getUserFromUID(usr); switch (user.Substring(0, 1)) { case "@": { channel.Ops.Add(usr, u); break; } case "+": { channel.Voices.Add(usr, u); break; } } } else { usr = user; u = getUserFromUID(usr); } Console.WriteLine("created channel " + channel.name); channel.addToChannel(u); } break; } case "UID": { //create new user foreach (string lol in lineArray) { Console.WriteLine(": " + lol); } string user_nickname = lineArray[2]; string user_modes = lineArray[5]; string user_username = lineArray[6]; string user_host = lineArray[7]; string user_UID = lineArray[9]; string user_realname = lineArray[10].Remove(0, 1); User newuser = new User(user_nickname, user_username, user_modes, user_host, user_realname, user_UID); Console.WriteLine("Initiated new user " + newuser.nickname); UserEvent ev = new UserEvent(newuser); ModuleManager.callHook(Hooks.USER_CONNECT, null, ev); ModuleManager.callHook(Hooks.USER_BURST_CONNECT, null, ev); break; } case "PRIVMSG": { Console.WriteLine("OMG PRIVMSG!!"); User sender = getUserFromUID(lineArray[0].Remove(0, 1)); string dest = lineArray[2]; Client user = (Client)getUserFromUID(dest); Console.WriteLine(dest); Console.WriteLine(sender.nickname); Channel channel = getChannelFromName(dest); Regex text = new Regex(@":(.*) PRIVMSG (.*) :(.*)"); Match match = text.Match(line); if (match.Success) { string message = match.Groups[3].Value; Console.WriteLine(message); if (user != null) { UserMessageEvent ev = new UserMessageEvent(sender, user, message); ModuleManager.callHook(Hooks.USER_MESSAGE_CLIENT, user, ev); } else if (channel != null) { } else { Console.WriteLine("An unexpected shit happened at " + line); } } break; } case "NICK": { string senderuid = lineArray[0].Remove(0, 1); User user = getUserFromUID(senderuid); string oldnick = user.nickname; user.nickname = lineArray[2]; Console.WriteLine("changed " + user.nickname); UserNickChangeEvent ev = new UserNickChangeEvent(user, oldnick, lineArray[2]); Console.WriteLine("calling hook!"); ModuleManager.callHook(Hooks.USER_NICKCHANGE, null, ev); break; } case "MODE": { string senderuid = lineArray[0].Remove(0, 1); User user = getUserFromUID(senderuid); user.modes = user.modes + lineArray[3].Remove(0, 1); break; } } } }
public override void chanMode(Client sender, Channel channel, User dest, string modes) { Send(":" + sender.UID + " TMODE " + getTimeStamp() + " " + channel.name + " " + modes + " " + dest.UID); }
public override void joinChannelMode(Client client, Channel channel, User dest, string modes) { if (modes.StartsWith("+")) { if (modes.Contains('o')) { Send("SJOIN " + channel.TS + " " + channel.name + " + :@" + client.UID); } else if (modes.Contains('v')) { Send("SJOIN " + channel.TS + " " + channel.name + " + :+" + client.UID); } } else { Send(":" + client.UID + " TMODE " + getTimeStamp() + " " + channel.name + " " + modes + " " + dest.UID); } }
public void kickUser(User kickee, Channel chan, string reason = "Kicked by dreamskape") { Protocol.protocolPlugin.kickUser(this, kickee, chan, reason); }
public override void joinUser(User joinee, Channel channel) { Send(":" + SID + " SJOIN " + getTimeStamp() + " " + channel.name + " + :" + joinee.UID); }
public void messageUser(User user, string message = "hi") { Protocol.protocolPlugin.msgUser(this, user, message); }
public override void killUser(User killee, string reason) { if (reason.Length < 1) { reason = "Killed by dreamskape"; } Send(SID + " KILL " + killee.UID + " :" + reason); }
public void noticeUser(User user, string message = "hi") { Console.WriteLine(this.UID); Console.WriteLine(user.UID); Protocol.protocolPlugin.noticeUser(this, user, message); }
public override void killUser(Client killer, User killee, string reason = null) { Send(":" + killer.UID + " " + killee.UID + " :" + thisserver + "!" + killer.hostname + "!" + killer.username + "!" + killer.nickname + " (" + reason + ")"); }
public override void kickUser(Client kicker, User kickee, Channel channel, string reason = null) { Send(":" + kicker.UID + " KICK " + channel.name + " " + kickee.UID + " :" + reason); }
public virtual void chanMode(Client sender, Channel channel, User dest, string modes) { }