示例#1
0
        public Channel(Server parent, string name)
        {
            Server = parent;
            Name = name;

            Users = new UserList();
        }
示例#2
0
 // Data structure management
 public static void AddLoggable(Server network)
 {
     // Add value to Network key to hold the different loggables
     LogFiles.Add(network.Url, new Dictionary<string, LoggedItem>());
     // Add the network log
     LogFiles[network.Url].Add('!' + network.Url, new LoggedItem('!' + network.Url, network.Url));
 }
示例#3
0
        public Server Create(ConnectionArgs args)
        {
            var newServer = new Server(args);
            ServerList.Add(newServer);

            ServerAdded.Fire(this, new ServerEventArgs(newServer));

            return newServer;
        }
 public ServerTreeNode GetServerNode(Server server)
 {
     foreach (ServerTreeNode serverNode in ServerNodes)
     {
         if (serverNode.ServerWindow.Server == server)
             return serverNode;
     }
     return null;
 }
示例#5
0
 /// <summary>
 /// Parts the specified channel with the specified message
 /// </summary>
 /// <param name="context"></param>
 /// <param name="channel"></param>
 /// <param name="message"></param>
 public void Execute(Server context, ChannelInfo channel, string message)
 {
     if (context.InChannel(channel.Name))
     {
         context.Channels[channel.Name].Part(message);
     }
     else
     {
         //TODO: Error?
     }
 }
示例#6
0
        public static void RemoveLoggable(Server network)
        {
            if (!NetworkExists(network)) return;

            foreach (LoggedItem log in LogFiles[network.Url].Values)
            {
                log.Close();
            }

            LogFiles[network.Url].Clear();
            LogFiles.Remove(network.Url);
        }
示例#7
0
        public void Execute(Server context, string server, string port)
        {
            var args = new ConnectionArgs(Settings.Default.FirstNick, server, false);
            try
            {
                args.Port = int.Parse(port);
            }
            catch (Exception)
            {
                args.Port = 6667;
            }

            context.ChangeServer(args);
            context.Connect();
        }
示例#8
0
        public ServerViewModel(Server newServer)
        {
            System.Windows.DependencyObject dep = new System.Windows.DependencyObject();
            if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(dep))
                return;

            server = newServer;
            Name = server.Url;
            //server.RawMessageReceived += Server_RawMessageReceived;
            server.Registered += Server_Registered;
            server.ConnectFailed += Server_ConnectFailed;
            server.PrivateNotice += Server_PrivateNotice;
            server.ErrorMessageRecieved += Server_ErrorMessageRecieved;
            server.Connecting += Server_Connecting;
            server.Disconnected += Server_Disconnected;
            server.ConnectionLost += Server_ConnectionLost;
            server.ConnectCancelled += Server_ConnectCancelled;
            server.NickError += Server_NickError;
            server.PartSelf += Server_PartSelf;
        }
示例#9
0
 public void Execute(Server context, char[] switches, string server, string port)
 {
     foreach (char c in switches)
     {
         switch (c)
         {
             case 'n': //New window and connect
                 var args = new ConnectionArgs(Settings.Default.FirstNick, server, false);
                 try
                 {
                     args.Port = int.Parse(port);
                 }
                 catch (Exception)
                 {
                     args.Port = 6667;
                 }
                 var svr = ServerManager.Instance.Create(args);
                 svr.Connect();
                 return;
         }
     }
 }
示例#10
0
 public static void TextEntry(Server network, User person, String text)
 {
     WriteText(LogFiles[network.Url][person.Nick], text);
 }
示例#11
0
 public static void TextEntry(Server network, User person, String text)
 {
     if (LoggerActive)
         TextLogger.TextEntry(network, person, text);
 }
示例#12
0
 /// <summary>
 /// Changes your nick
 /// </summary>
 /// <param name="server"></param>
 /// <param name="nick"></param>
 public void Execute(Server server, string nick)
 {
     server.ChangeNick(nick);
 }
示例#13
0
        public static void RemoveLoggable(Server network, User person)
        {
            if (!PersonExists(network, person)) return;

            LogFiles[network.Url][person.Nick].Close();
            LogFiles[network.Url].Remove(person.Nick);
        }
示例#14
0
 public ServerEventArgs(Server server)
 {
     Server = server;
 }
 public PrivateMessageSession(Server parentServer, User user)
 {
     Server = parentServer;
     User = user;
 }
示例#16
0
 public void DisableAutoConnect(Server server)
 {
     var settings = GetServer(server);
     settings.AutoConnect = false;
 }
示例#17
0
 private void CreateServerPanel(Server server)
 {
     Panels.Add(new ServerViewModel(server));
 }
示例#18
0
 public void Teardown()
 {
     _server = null;
 }
示例#19
0
 /// <summary>
 /// Joins you to the specified channel.
 /// </summary>
 public void Execute(Server context, ChannelInfo channelToJoin)
 {
     context.JoinChannel(channelToJoin.Name);
 }
示例#20
0
 // Logging functions
 public static void TextEntry(Server network, String text)
 {
     WriteText(LogFiles[network.Url]['!' + network.Url], text);
 }
示例#21
0
 /// <summary>
 /// Summary of command with these specific parameters
 /// </summary>
 public void Execute(Server context, char[] switches, string server)
 {
     Execute(context, switches, server, "6667");
 }
示例#22
0
 /// <summary>
 /// Connect to a server in the same window
 /// </summary>
 public void Execute(Server context, string server)
 {
     context.ChangeServer(Settings.Default.FirstNick, server, false);
     context.Connect();
 }
示例#23
0
 public void Setup()
 {
     var args = new ConnectionArgs("test", "irc.fake.com", false);
     var connMock = A.Fake<Connection>(x => x.WithArgumentsForConstructor(() => new Connection(args, false, false)));
     _server = new Server(connMock);
 }
示例#24
0
 private static bool NetworkExists(Server network)
 {
     return LogFiles.ContainsKey(network.Url);
 }
示例#25
0
 /// <summary>
 /// Parts the specified channel
 /// </summary>
 /// <param name="context"></param>
 /// <param name="channel"></param>
 public void Execute(Server context, ChannelInfo channel)
 {
     Execute(context, channel, defaultMessage);
 }
示例#26
0
 private static bool PersonExists(Server network, User person)
 {
     return (NetworkExists(network) && LogFiles[network.Url].ContainsKey(person.Nick));
 }
示例#27
0
 private ServerSettings GetServer(Server server)
 {
     foreach (NetworkSettings networkSettings in Networks)
     {
         foreach (ServerSettings serverSettings in networkSettings.Servers)
         {
             if (server.Url == serverSettings.Url)
             {
                 return serverSettings;
             }
         }
     }
     return null;
 }
示例#28
0
 public void Remove(Server ntw)
 {
     if (ServerList.Remove(ntw))
         ServerRemoved.Fire(this, new ServerEventArgs(ntw));
 }
示例#29
0
 public NetworkSettings GetNetwork(Server server)
 {
     foreach (NetworkSettings networkSettings in Networks)
     {
         foreach (ServerSettings serverSettings in networkSettings.Servers)
         {
             if (server.Url == serverSettings.Url)
             {
                 return networkSettings;
             }
         }
     }
     return null;
 }
示例#30
0
 public static void AddLoggable(Server network, User person)
 {
     // Add pmsg log to the data struture
     LogFiles[network.Url].Add(person.Nick, new LoggedItem(person.Nick, network.Url));
 }