public void RegisterMember(string user,string email, string pass) { client = new MetaBuilders.Irc.Client("irc.freenode.net", user); this.email = email; this.pass = pass; // Once I'm welcomed, I can start register client.Messages.Welcome += new EventHandler<IrcMessageEventArgs<WelcomeMessage>>(welcomed); client.Messages.Chat += new EventHandler<IrcMessageEventArgs<TextMessage>>(chatting); client.Messages.TimeRequest += new EventHandler<IrcMessageEventArgs<TimeRequestMessage>>(timeRequested); client.DataReceived += new EventHandler<ConnectionDataEventArgs>(dataGot); client.DataSent += new EventHandler<ConnectionDataEventArgs>(dataSent); client.Connection.Disconnected += new EventHandler<ConnectionDataEventArgs>(logDisconnected); client.EnableAutoIdent = false; // Since I'm a Windows.Forms application, i pass in this form to the Connect method so it can sync with me. try { client.Connection.Connect(this); textBox1.Text += "Connecting to Freenode..." + Environment.NewLine; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Creates a new instance of the <see cref="Query"/> class on the given client with the given User. /// </summary> public ServerQuery( Client client ) { this.client = client; this.journal.CollectionChanged += new NotifyCollectionChangedEventHandler( journal_CollectionChanged ); }
void welcomed(Object sender, IrcMessageEventArgs<WelcomeMessage> e, Client client) { client.SendJoin(m_channel); }
bool TryGetClient(UUID uUID, out Client client) { return clients.TryGetValue(uUID, out client); }
void timeRequested(Object sender, IrcMessageEventArgs<TimeRequestMessage> e, Client client) { TimeReplyMessage reply = new TimeReplyMessage(); reply.CurrentTime = DateTime.Now.ToLongTimeString(); reply.Target = e.Message.Sender.Nick; client.Send(reply); }
void HookUpClientEvents(string channel, UUID groupID, Client client) { // Once I'm welcomed, I can start joining channels client.Messages.Welcome += delegate(Object sender, IrcMessageEventArgs<WelcomeMessage> e) { welcomed (sender, e, client, channel); }; // People are chatting, pay attention so I can be a lame echobot :) client.Messages.Chat += delegate(Object sender, IrcMessageEventArgs<TextMessage> e) { UUID mystupiduuid = (UUID)"4fec5721-6980-40ca-815c-aba0264b175a"; // debug only?? chatting (mystupiduuid, e, groupID); MainConsole.Instance.InfoFormat ("got " + groupID + " and " + e.Message.Text + " From: " + sender); }; client.Messages.TimeRequest += delegate(Object sender, IrcMessageEventArgs<TimeRequestMessage> e) { timeRequested (sender, e, client); }; client.DataReceived += dataGot; client.DataSent += dataSent; client.Connection.Disconnected += logDisconnected; }
/// <summary> /// Creates a new instance of the <see cref="ClientManager"/> class with the given client. /// </summary> /// <param name="client"></param> public ClientManager( Client client ) : this() { AddClient( client ); }
private static Boolean IsMe( String nick, Client source ) { return ( MessageUtil.IsIgnoreCaseMatch( source.User.Nick, nick ) ); }
private void HookUpClientEvents(string channel, UUID groupID, Client client) { // Once I'm welcomed, I can start joining channels client.Messages.Welcome += delegate(Object sender, IrcMessageEventArgs<WelcomeMessage> e) { welcomed(sender, e, client, channel); }; // People are chatting, pay attention so I can be a lame echobot :) client.Messages.Chat += delegate(Object sender, IrcMessageEventArgs<TextMessage> e) { chatting(sender, e, groupID); }; client.Messages.TimeRequest += delegate(Object sender, IrcMessageEventArgs<TimeRequestMessage> e) { timeRequested(sender, e, client); }; client.DataReceived += new EventHandler<ConnectionDataEventArgs>(dataGot); client.DataSent += new EventHandler<ConnectionDataEventArgs>(dataSent); client.Connection.Disconnected += new EventHandler<ConnectionDataEventArgs>(logDisconnected); }
private void CreateIRCConnection(string network, string nick, string channel, UUID groupID) { // Create a new client to the given address with the given nick Client client = new Client(network, nick); Ident.Service.User = client.User; HookUpClientEvents(channel, groupID, client); client.EnableAutoIdent = false; client.Connection.Connect(); clients[groupID] = client; }
private void welcomed(Object sender, IrcMessageEventArgs<WelcomeMessage> e, Client client, IScenePresence sp) { string channel; if(m_channel.TryGetValue(sp.CurrentParcel.LandData.GlobalID, out channel)) JoinChannel(client, channel, sp); }
private void SwitchChannels(IScenePresence presence, ILandObject oldParcel, Client client) { string channel; string oldchannel; m_channel.TryGetValue(presence.CurrentParcel.LandData.GlobalID, out channel); m_channel.TryGetValue(oldParcel.LandData.GlobalID, out oldchannel); JoinChannel(client, channel, presence); client.SendPart(oldchannel); }
private static void JoinChannel(Client client, string channel, IScenePresence presence) { client.SendJoin(channel); Aurora.Framework.IChatModule chatModule = presence.Scene.RequestModuleInterface<Aurora.Framework.IChatModule>(); if(chatModule != null) { chatModule.TrySendChatMessage(presence, presence.AbsolutePosition, presence.AbsolutePosition, UUID.Zero, "System", ChatTypeEnum.Say, "You joined " + channel, ChatSourceType.Agent, 20); } }
/// <summary> /// Adds the given <see cref="T:Client"/> to the <see cref="P:Clients"/> collection. /// </summary> public void AddClient( Client client ) { if ( client == null ) { throw new ArgumentNullException( "client" ); } this._clients.Add( client ); this.ServerQueries[client] = new ServerQuery( client ); this.Channels[client] = new ChannelCollection(); this.Users[client] = new UserCollection(); this.Contacts[client] = new ContactList(); this.Queries[client] = new QueryCollection(); AttachHandlers( client ); }
private void welcomed(Object sender, IrcMessageEventArgs<WelcomeMessage> e, Client client, string channel) { client.SendJoin(channel); }
/// <summary> /// Removes the given <see cref="T:Client"/> from the <see cref="P:Clients"/> collection. /// </summary> public void RemoveClient( Client client ) { if ( client == null ) { throw new ArgumentNullException( "client" ); } this.ServerQueries.Remove( client ); this.Channels.Remove( client ); this.Users.Remove( client ); this.Contacts.Remove( client ); this.Queries.Remove( client ); DetachHandlers( client ); this._clients.Remove( client ); }
void CreateIRCConnection(IScenePresence presence) { // Create a new client to the given address with the given nick Client client = new Client(m_network, presence.Name.Replace(' ', '_')); Ident.Service.User = client.User; HookUpClientEvents(client, presence); client.EnableAutoIdent = false; client.Connection.Connect(); clients[presence.UUID] = client; }
private void AttachHandlers( Client client ) { client.MessageParsed += new EventHandler<IrcMessageEventArgs<IrcMessage>>( client_MessageParsed ); client.Messages.Join += new EventHandler<IrcMessageEventArgs<JoinMessage>>( routeJoins ); client.Messages.Kick += new EventHandler<IrcMessageEventArgs<KickMessage>>( routeKicks ); client.Messages.Kill += new EventHandler<IrcMessageEventArgs<KillMessage>>( routeKills ); client.Messages.Part += new EventHandler<IrcMessageEventArgs<PartMessage>>( routeParts ); client.Messages.Quit += new EventHandler<IrcMessageEventArgs<QuitMessage>>( routeQuits ); client.Messages.TopicNoneReply += new EventHandler<IrcMessageEventArgs<TopicNoneReplyMessage>>( routeTopicNones ); client.Messages.TopicReply += new EventHandler<IrcMessageEventArgs<TopicReplyMessage>>( routeTopics ); client.Messages.TopicSetReply += new EventHandler<IrcMessageEventArgs<TopicSetReplyMessage>>( routeTopicSets ); client.Messages.ChannelModeIsReply += new EventHandler<IrcMessageEventArgs<ChannelModeIsReplyMessage>>( client_ChannelModeIsReply ); client.Messages.ChannelProperty += new EventHandler<IrcMessageEventArgs<ChannelPropertyMessage>>( client_ChannelProperty ); client.Messages.ChannelPropertyReply += new EventHandler<IrcMessageEventArgs<ChannelPropertyReplyMessage>>( client_ChannelPropertyReply ); client.Messages.NamesReply += new EventHandler<IrcMessageEventArgs<NamesReplyMessage>>( routeNames ); client.Messages.NickChange += new EventHandler<IrcMessageEventArgs<NickChangeMessage>>( routeNicks ); client.Messages.WhoReply += new EventHandler<IrcMessageEventArgs<WhoReplyMessage>>( routeWhoReplies ); client.Messages.WhoIsOperReply += new EventHandler<IrcMessageEventArgs<WhoIsOperReplyMessage>>( client_WhoIsOperReply ); client.Messages.WhoIsServerReply += new EventHandler<IrcMessageEventArgs<WhoIsServerReplyMessage>>( client_WhoIsServerReply ); client.Messages.WhoIsUserReply += new EventHandler<IrcMessageEventArgs<WhoIsUserReplyMessage>>( client_WhoIsUserReply ); client.Messages.UserHostReply += new EventHandler<IrcMessageEventArgs<UserHostReplyMessage>>( client_UserHostReply ); client.Messages.OperReply += new EventHandler<IrcMessageEventArgs<OperReplyMessage>>( client_OperReply ); client.Messages.UserMode += new EventHandler<IrcMessageEventArgs<UserModeMessage>>( client_UserMode ); client.Messages.UserModeIsReply += new EventHandler<IrcMessageEventArgs<UserModeIsReplyMessage>>( client_UserModeIsReply ); client.Messages.Away += new EventHandler<IrcMessageEventArgs<AwayMessage>>( client_Away ); client.Messages.Back += new EventHandler<IrcMessageEventArgs<BackMessage>>( client_Back ); client.Messages.SelfAway += new EventHandler<IrcMessageEventArgs<SelfAwayMessage>>( client_SelfAway ); client.Messages.SelfUnAway += new EventHandler<IrcMessageEventArgs<SelfUnAwayMessage>>( client_SelfUnAway ); client.Messages.UserAway += new EventHandler<IrcMessageEventArgs<UserAwayMessage>>( client_UserAway ); client.Messages.NoSuchChannel += new EventHandler<IrcMessageEventArgs<NoSuchChannelMessage>>( client_NoSuchChannel ); client.Messages.NoSuchNick += new EventHandler<IrcMessageEventArgs<NoSuchNickMessage>>( client_NoSuchNick ); }
void HookUpClientEvents(Client client, IScenePresence sp) { // Once I'm welcomed, I can start joining channels client.Messages.Welcome += delegate(Object sender, IrcMessageEventArgs<WelcomeMessage> e) { welcomed(sender, e, client); }; // People are chatting, pay attention so I can be a lame echobot :) client.Messages.Chat += delegate(Object sender, IrcMessageEventArgs<TextMessage> e) { chatting(sender, e, sp); //MainConsole.Instance.RunCommand("alert user general "+sender+ " : " +e); }; client.Messages.TimeRequest += delegate(Object sender, IrcMessageEventArgs<TimeRequestMessage> e) { timeRequested(sender, e, client); }; client.DataReceived += dataGot; client.DataSent += dataSent; client.Connection.Disconnected += logDisconnected; }
private void DetachHandlers( Client client ) { client.MessageParsed -= client_MessageParsed; client.Messages.Join -= new EventHandler<IrcMessageEventArgs<JoinMessage>>( routeJoins ); client.Messages.Kick -= new EventHandler<IrcMessageEventArgs<KickMessage>>( routeKicks ); client.Messages.Kill -= new EventHandler<IrcMessageEventArgs<KillMessage>>( routeKills ); client.Messages.Part -= new EventHandler<IrcMessageEventArgs<PartMessage>>( routeParts ); client.Messages.Quit -= new EventHandler<IrcMessageEventArgs<QuitMessage>>( routeQuits ); client.Messages.TopicNoneReply -= new EventHandler<IrcMessageEventArgs<TopicNoneReplyMessage>>( routeTopicNones ); client.Messages.TopicReply -= new EventHandler<IrcMessageEventArgs<TopicReplyMessage>>( routeTopics ); client.Messages.TopicSetReply -= new EventHandler<IrcMessageEventArgs<TopicSetReplyMessage>>( routeTopicSets ); client.Messages.ChannelModeIsReply -= client_ChannelModeIsReply; client.Messages.ChannelProperty -= client_ChannelProperty; client.Messages.ChannelPropertyReply -= client_ChannelPropertyReply; client.Messages.NamesReply -= new EventHandler<IrcMessageEventArgs<NamesReplyMessage>>( routeNames ); client.Messages.NickChange -= new EventHandler<IrcMessageEventArgs<NickChangeMessage>>( routeNicks ); client.Messages.WhoReply -= new EventHandler<IrcMessageEventArgs<WhoReplyMessage>>( routeWhoReplies ); client.Messages.WhoIsOperReply -= client_WhoIsOperReply; client.Messages.WhoIsServerReply -= client_WhoIsServerReply; client.Messages.WhoIsUserReply -= client_WhoIsUserReply; client.Messages.UserHostReply -= client_UserHostReply; client.Messages.OperReply -= client_OperReply; client.Messages.UserMode -= client_UserMode; client.Messages.UserModeIsReply -= client_UserModeIsReply; client.Messages.Away -= new EventHandler<IrcMessageEventArgs<AwayMessage>>( client_Away ); client.Messages.Back -= new EventHandler<IrcMessageEventArgs<BackMessage>>( client_Back ); client.Messages.SelfAway -= new EventHandler<IrcMessageEventArgs<SelfAwayMessage>>( client_SelfAway ); client.Messages.SelfUnAway -= new EventHandler<IrcMessageEventArgs<SelfUnAwayMessage>>( client_SelfUnAway ); client.Messages.UserAway -= new EventHandler<IrcMessageEventArgs<UserAwayMessage>>( client_UserAway ); client.Messages.NoSuchChannel -= client_NoSuchChannel; client.Messages.NoSuchNick -= client_NoSuchNick; }
/// <summary> /// Creates a new instance of the <see cref="Query"/> class on the given client with the given User. /// </summary> public Query( Client client, User user ) { this.client = client; this.journal.CollectionChanged += new NotifyCollectionChangedEventHandler( journal_CollectionChanged ); this.User = user; }