private void _Event_JOIN(IrcMessageData ircdata) { string who = ircdata.Nick; string channelname = ircdata.Channel; if (IsMe(who)) { _JoinedChannels.Add(channelname); } if (ActiveChannelSyncing) { Channel channel; if (IsMe(who)) { // we joined the channel #if LOG4NET Logger.ChannelSyncing.Debug("joining channel: "+channelname); #endif if (SupportNonRfc) { channel = new NonRfcChannel(channelname); } else { channel = new Channel(channelname); } _Channels.Add(channelname, channel); // request channel mode RfcMode(channelname); // request wholist RfcWho(channelname); // request banlist Ban(channelname); } else { // someone else joined the channel // request the who data RfcWho(who); } #if LOG4NET Logger.ChannelSyncing.Debug(who+" joins channel: "+channelname); #endif channel = GetChannel(channelname); IrcUser ircuser = GetIrcUser(who); if (ircuser == null) { ircuser = new IrcUser(who, this); ircuser.Ident = ircdata.Ident; ircuser.Host = ircdata.Host; _IrcUsers.Add(who, ircuser); } ChannelUser channeluser; if (SupportNonRfc) { channeluser = new NonRfcChannelUser(channelname, ircuser); } else { channeluser = new ChannelUser(channelname, ircuser); } channel.UnsafeUsers.Add(who, channeluser); } if (OnJoin != null) { OnJoin(this, new JoinEventArgs(ircdata, channelname, who)); } }
protected internal static string GetFullUser(Network n, string nick) { Irc.IrcUser u = n.GetIrcUser(nick); return(u.Nick + "!" + u.Ident + "@" + u.Host); }
private void _Event_RPL_NAMREPLY(IrcMessageData ircdata) { string channelname = ircdata.Channel; string[] userlist = ircdata.MessageArray; if (ActiveChannelSyncing && IsJoined(channelname)) { string nickname; bool op; bool halfop; bool voice; foreach (string user in userlist) { if (user.Length <= 0) { continue; } op = false; halfop = false; voice = false; switch (user[0]) { case '@': op = true; nickname = user.Substring(1); break; case '+': voice = true; nickname = user.Substring(1); break; // RFC VIOLATION // some IRC network do this and break our channel sync... case '&': nickname = user.Substring(1); break; case '%': halfop = true; nickname = user.Substring(1); break; case '~': nickname = user.Substring(1); break; default: nickname = user; break; } IrcUser ircuser = GetIrcUser(nickname); ChannelUser channeluser = GetChannelUser(channelname, nickname); if (ircuser == null) { #if LOG4NET Logger.ChannelSyncing.Debug("creating IrcUser: "******" because he doesn't exist yet"); #endif ircuser = new IrcUser(nickname, this); _IrcUsers.Add(nickname, ircuser); } if (channeluser == null) { #if LOG4NET Logger.ChannelSyncing.Debug("creating ChannelUser: "******" for Channel: "+channelname+" because he doesn't exist yet"); #endif channeluser = new ChannelUser(channelname, ircuser); Channel channel = GetChannel(channelname); channel.UnsafeUsers.Add(nickname, channeluser); if (op) { channel.UnsafeOps.Add(nickname, channeluser); #if LOG4NET Logger.ChannelSyncing.Debug("added op: "+nickname+" to: "+channelname); #endif } if (SupportNonRfc && halfop) { ((NonRfcChannel)channel).UnsafeHalfops.Add(nickname, channeluser); #if LOG4NET Logger.ChannelSyncing.Debug("added halfop: "+nickname+" to: "+channelname); #endif } if (voice) { channel.UnsafeVoices.Add(nickname, channeluser); #if LOG4NET Logger.ChannelSyncing.Debug("added voice: "+nickname+" to: "+channelname); #endif } } channeluser.IsOp = op; channeluser.IsVoice = voice; if (SupportNonRfc) { ((NonRfcChannelUser)channeluser).IsHalfop = halfop; } } } if (OnNames != null) { OnNames(this, new NamesEventArgs(ircdata, channelname, userlist)); } }