Ejemplo n.º 1
0
        private void joinButton_Clicked(object sender, EventArgs e)
        {
            Network selectedNetwork = GetSelectedNetwork();

            if (selectedNetwork == null)
            {
                Gui.ShowMessageDialog("No network selected.", Dialog, Gtk.MessageType.Error, Gtk.ButtonsType.Ok);
                return;
            }

            try {
                string roomName = roomNameCombo.Entry.Text.Trim();
                string password = passwordEntry.Text;

                string roomId = (passwordCheck.Active) ? Common.SHA512Str(roomName + password) : Common.SHA512Str(roomName);

                ChatRoom room = selectedNetwork.GetChatRoom(roomId);
                if (room != null && room.InRoom)
                {
                    // Already in here!
                    ChatRoomSubpage window = (ChatRoomSubpage)room.Properties["Window"];
                    window.GrabFocus();
                }
                else
                {
                    if (passwordCheck.Active == true)
                    {
                        selectedNetwork.JoinOrCreateChat(roomName, passwordEntry.Text);
                    }
                    else
                    {
                        selectedNetwork.JoinOrCreateChat(roomName, null);
                    }
                }
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowMessageDialog(ex.Message, Dialog);
                Dialog.Respond(ResponseType.None);
                return;
            }
            Dialog.Respond(ResponseType.Ok);
        }
Ejemplo n.º 2
0
        private void network_JoinedChat(Network network, ChatEventArgs args)
        {
            try {
                if (chatTreeStore.ContainsItem(network, args.Room) == false)
                {
                    TreeIter iter = chatTreeStore.AddItem(network, args.Room);
                    if (args.Node.IsMe)
                    {
                        chatList.Selection.SelectIter(iter);
                        chatList.GrabFocus();
                    }
                }

                if (args.Room.InRoom == true)
                {
                    if (args.Room.Properties.ContainsKey("Window") == false)
                    {
                        Widget labelWidget = CreateTabLabel(args.Room.Name);


                        ChatRoomSubpage w = new ChatRoomSubpage(args.Room);
                        AppendPage(w, labelWidget);
                        args.Room.Properties.Add("Window", w);
                        w.GrabFocus();

                        tabLabelPages[labelWidget] = w;
                    }
                    else
                    {
                        (args.Room.Properties["Window"] as ChatRoomSubpage).AddUser(args.Node);
                    }
                }

                chatList.QueueDraw();
                Gui.MainWindow.RefreshCounts();
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
            }
        }
Ejemplo n.º 3
0
        private void network_JoinedChat(Network network, ChatEventArgs args)
        {
            try {
                if (chatTreeStore.ContainsItem (network, args.Room) == false) {
                    TreeIter iter = chatTreeStore.AddItem (network, args.Room);
                    if (args.Node.IsMe) {
                        chatList.Selection.SelectIter (iter);
                        chatList.GrabFocus();
                    }
                }

                if (args.Room.InRoom == true) {
                    if (args.Room.Properties.ContainsKey("Window") == false) {
                        Widget labelWidget = CreateTabLabel(args.Room.Name);

                        ChatRoomSubpage w = new ChatRoomSubpage(args.Room);
                        AppendPage(w, labelWidget);
                        args.Room.Properties.Add("Window", w);
                        w.GrabFocus();

                        tabLabelPages[labelWidget] = w;
                    } else {
                        (args.Room.Properties["Window"] as ChatRoomSubpage).AddUser (args.Node);
                    }
                }

                chatList.QueueDraw ();
                Gui.MainWindow.RefreshCounts();

            } catch (Exception ex) {
                LoggingService.LogError(ex);
            }
        }