Exemplo n.º 1
0
        public Channel(Server parent, string name)
        {
            Server = parent;
            Name = name;

            Users = new UserList();
        }
Exemplo n.º 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));
 }
Exemplo n.º 3
0
        public Server Create(ConnectionArgs args)
        {
            var newServer = new Server(args);
            ServerList.Add(newServer);

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

            return newServer;
        }
Exemplo n.º 4
0
 public ServerTreeNode GetServerNode(Server server)
 {
     foreach (ServerTreeNode serverNode in ServerNodes)
     {
         if (serverNode.ServerWindow.Server == server)
             return serverNode;
     }
     return null;
 }
Exemplo n.º 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?
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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;
        }
Exemplo n.º 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;
         }
     }
 }
Exemplo n.º 10
0
 public static void TextEntry(Server network, User person, String text)
 {
     WriteText(LogFiles[network.Url][person.Nick], text);
 }
Exemplo n.º 11
0
 public static void TextEntry(Server network, User person, String text)
 {
     if (LoggerActive)
         TextLogger.TextEntry(network, person, text);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 14
0
 public ServerEventArgs(Server server)
 {
     Server = server;
 }
Exemplo n.º 15
0
 public PrivateMessageSession(Server parentServer, User user)
 {
     Server = parentServer;
     User = user;
 }
Exemplo n.º 16
0
 public void DisableAutoConnect(Server server)
 {
     var settings = GetServer(server);
     settings.AutoConnect = false;
 }
Exemplo n.º 17
0
 private void CreateServerPanel(Server server)
 {
     Panels.Add(new ServerViewModel(server));
 }
Exemplo n.º 18
0
 public void Teardown()
 {
     _server = null;
 }
Exemplo n.º 19
0
 /// <summary>
 /// Joins you to the specified channel.
 /// </summary>
 public void Execute(Server context, ChannelInfo channelToJoin)
 {
     context.JoinChannel(channelToJoin.Name);
 }
Exemplo n.º 20
0
 // Logging functions
 public static void TextEntry(Server network, String text)
 {
     WriteText(LogFiles[network.Url]['!' + network.Url], text);
 }
Exemplo n.º 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");
 }
Exemplo n.º 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();
 }
Exemplo n.º 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);
 }
Exemplo n.º 24
0
 private static bool NetworkExists(Server network)
 {
     return LogFiles.ContainsKey(network.Url);
 }
Exemplo n.º 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);
 }
Exemplo n.º 26
0
 private static bool PersonExists(Server network, User person)
 {
     return (NetworkExists(network) && LogFiles[network.Url].ContainsKey(person.Nick));
 }
Exemplo n.º 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;
 }
Exemplo n.º 28
0
 public void Remove(Server ntw)
 {
     if (ServerList.Remove(ntw))
         ServerRemoved.Fire(this, new ServerEventArgs(ntw));
 }
Exemplo n.º 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;
 }
Exemplo n.º 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));
 }