Channel CreateChannel(IrcChannelID id,bool person) { var channel = new Channel(id,library,ClientSize) { IsPerson = person }; AddHistory( channel, person?"PERSON":"CHANNEL", "", id.Channel, normal ); Views.Add( id, channel ); if ( CurrentView == null ) CurrentView = channel; return channel; }
public Channel( IrcChannelID id, Font.Library Library, Size ClientSize ) { ID = id; History = new ChatHistory() { Bounds = new Rectangle( Margin, Margin, ClientSize.Width-2*Margin, ClientSize.Height-2*Margin ) }; Input = new TextBox() { MaxBounds = new Rectangle( 1*Margin, ClientSize.Height-100-Margin, ClientSize.Width-2*Margin, 100 ) , Font = new Font( Library, "Uber Console", 5 ) { Color = Color.Black } , Text = "" , VerticalAlignment = VerticalAlignment.Bottom }; }
Channel ViewOf( IrcConnection connection, Irc.Actor who, string channel ) { bool pm = channel == connection.ActualNickname; var id = new IrcChannelID() { Connection = connection, Channel = pm?who.Nickname:channel }; if (!Views.ContainsKey(id)) CreateChannel(id,pm); return Views[id]; }
void Join( string url ) { if ( url.Contains("/") ) { irc.Join(url); } else if ( CurrentView != null ) foreach ( var chan in url.Split(',') ) { CurrentView.ID.Connection.Join(chan); var chid = new IrcChannelID() { Connection=CurrentView.ID.Connection, Channel=chan }; if (Views.ContainsKey(chid)) Views[chid].IsHidden = false; } else { // lol we can't do anything } }