Beispiel #1
0
        public ChatViewManager(QuasselClient client, ChatView debug)
            : base()
        {
            Client = client;

            if (debug == null) {
                throw new ArgumentException("debug");
            }

            Client.BufferSyncer.ActiveChanged += (obj) => {
                //Application.Refresh();
            };

            Client.BufferSyncer.Synced += delegate(Buffer[] buffers) {
                foreach (var buffer in buffers) {
                    Get(buffer.Id);
                }
            };

            Client.BufferSyncer.Message += (buffer, message) => {
                Get(buffer.Id).Add(new IrcMessageChatViewEntry(message));
            };

            DebugChatView = debug;
            DebugChatView.Add(new CenterChatViewEntry("Debug console"));
        }
Beispiel #2
0
        public StatusBarTemplate(QuasselClient client)
        {
            Client = client;

            Client.BufferSyncer.Synced += (obj) => {
                Invalid = true;
            };

            var timer = new UVTimer();
            timer.Tick += () => Invalid = true;
            timer.Start(TimeSpan.Zero, TimeSpan.FromSeconds(1));
        }
Beispiel #3
0
        public static void Main(string[] args)
        {
            string configfile = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/.config/quassel-irc.org/quasselclient.conf";
            var settings = new Settings(configfile);

            QuasselTypes.Init();

            var acc = settings.Accounts[settings.AutoConnectAccount];
            var coreConnection = new CoreConnection(acc.HostName, acc.Port, acc.User, acc.Password, false);

            Application.Init();

            var qc = new QuasselClient(coreConnection);

            ThemeManager = new ThemeManger();

            MainWindow = ThemeManager.Default.CreateMainWindow(qc);

            AsyncWatcher<QVariant> listnotifier = new AsyncWatcher<QVariant>((packet) => qc.Handle(packet));
            AsyncWatcher<Exception> excenotifier = new AsyncWatcher<Exception>((exce) => qc.Handle(exce));

            var nt = new Thread((obj) => {
                coreConnection.ReceivePacket += (packet) => {
                    listnotifier.Send(packet);
                };

                coreConnection.Exception += (exception) => {
                    excenotifier.Send(exception);
                };

                coreConnection.Connect();

                coreConnection.Loop();
            });

            nt.Start();

            Application.End += (() => {
                nt.Abort();
            });

            Application.Run(MainWindow);
        }
Beispiel #4
0
        public MainWindowTemplate(QuasselClient client, StatusBarTemplate bar, EntryTemplate entry)
        {
            Client = client;
            StatusBar = bar;
            Entry = entry;

            ChatViewManager = new ChatViewManager(client, new ChatView());

            SetPrefix("[syncing]");

            Entry.Enter += delegate {
                if (Entry.Text.Length == 0) {
                    return;
                }

                string text = Entry.Text.TrimEnd(new char [] { ' ', '\t' });

                if (text.StartsWith("/exit")) {
                    Application.Exit = true;
                } else if (text.StartsWith("/r")) {
                    Client.RequestBacklog(Client.BufferSyncer.Active.BufferInfo.Id);
                    return;
                }

                Client.BufferSyncer.Active.Send(text);

                Entry.AddHistory(text);

                Entry.Text = "";
                Entry.Position = 0;
            };

            Client.BufferSyncer.Synced += (list) => {
                SetPrefix(Client.BufferSyncer.Active);
            };

            Client.BufferSyncer.ActiveChanged += SetPrefix;

            this.Add(ChatViewManager, Box.Setting.Fill);
            this.Add(StatusBar, Box.Setting.Size);
            this.Add(Entry, Box.Setting.Size);
        }
Beispiel #5
0
        public MainWindowTemplate(QuasselClient client)
            : this(client,
				   new StatusBarTemplate(client) { Height = 1 },
				   new EntryTemplate() { Height = 1 })
        {
        }
Beispiel #6
0
 public MainWindowTemplate CreateMainWindow(QuasselClient client)
 {
     return new MainWindowTemplate(client);
 }
Beispiel #7
0
 public NetworkCollection(QuasselClient client)
 {
     Client = client;
 }
Beispiel #8
0
 public StatusBar(QuasselClient client)
     : base(client)
 {
 }
Beispiel #9
0
 public MainWindow(QuasselClient client)
     : base(client, new StatusBar(client) { Height = 1 }, new EntryTemplate() { Height = 1 })
 {
 }