ToString() public method

public ToString ( ) : string
return string
Example #1
0
        public UserInfoDialog(Window parent, Network network, Node node)
            : base(parent, "UserInfoDialog")
        {
            this.node    = node;
            this.network = network;

            base.Window.Title = node.ToString();

            avatarImage.Pixbuf = Gui.AvatarManager.GetAvatar(node);

            nickNameLabel.Markup = String.Format("<span weight=\"bold\" size=\"x-large\">{0}</span> on <i>{1}</i>\n<span font=\"monospace\" size=\"small\">{2}</span>",
                                                 node.NickName, network.NetworkName, Common.FormatFingerprint(node.NodeID, 4));

            realNameLabel.Text = node.RealName;
            emailLabel.Text    = node.Email;

            TreeViewColumn column;

            column = addressesTreeView.AppendColumn("Protocol", new CellRendererText(), "text", 0);

            column = addressesTreeView.AppendColumn("Address Details", new CellRendererText(), "text", 1);
            column.Expand = true;

            addressesTreeView.AppendColumn("Supported", new CellRendererText(), "text", 2);
            addressesTreeView.AppendColumn("Open Externally", new CellRendererText(), "text", 3);
            addressesTreeView.AppendColumn("Connectable", new CellRendererText(), "text", 4);

            addressListStore = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));

            IDestination[] destinations = null;
            DestinationInfo[] destinationInfos;
            if (node.IsMe) {
                destinationInfos = Core.DestinationManager.DestinationInfos;
            } else {
                destinationInfos = node.GetTrustedNode().DestinationInfos.ToArray();
                destinations = node.GetTrustedNode().Destinations;
            }

            if (destinations != null) {
                foreach (IDestination destination in destinations) {
                    addressListStore.AppendValues(destination.FriendlyTypeName, destination.ToString(), "True", destination.IsOpenExternally.ToString(), destination.CanConnect.ToString());
                }
            }

            foreach (DestinationInfo info in destinationInfos) {
                if ((!info.Supported) || destinations == null) {
                    if (node.IsMe) {
                        addressListStore.AppendValues(info.FriendlyName, String.Join(", ", info.Data), info.Supported.ToString(), info.IsOpenExternally.ToString(), String.Empty);
                    } else {
                        addressListStore.AppendValues(info.FriendlyName, String.Join(", ", info.Data), "False", info.IsOpenExternally.ToString(), "False");
                    }
                }
            }

            addressesTreeView.Model = addressListStore;

            clientNameLabel.Text      = node.ClientName;
            clientVersionLabel.Text   = node.ClientVersion;
            operatingSystemLabel.Text = node.OperatingSystem;
        }
        public ChatRoomInvitationDialog(Network network, Node inviteFrom, ChatRoom room, ChatInviteInfo invitation)
            : base("ChatRoomInvitationDialog")
        {
            this.room = room;
            this.invitation = invitation;

            descLabel.Markup = String.Format(descLabel.Text, GLib.Markup.EscapeText(inviteFrom.ToString()), GLib.Markup.EscapeText(room.Name));

            messageContainer.Visible = !String.IsNullOrEmpty(invitation.Message);
            messageLabel.Text = GLib.Markup.EscapeText(invitation.Message);

            passwordInfoBox.Visible = room.HasPassword;

            passwordEntry.Text = invitation.Password;
            showPasswordCheck.Visible = !String.IsNullOrEmpty(invitation.Password);

            Validate();
        }
Example #3
0
        public void RemoveUser(Node node)
        {
            TreeIter iter;

            if (userListStore.GetIterFirst (out iter) == true) {
                do {
                    Node currentNode = (Node) userListStore.GetValue (iter, 0);
                    if (currentNode == node) {
                        userListStore.Remove (ref iter);
                        AddToChat (null, node.ToString() + " has left " + thisRoom.Name + ".");
                        return;
                    }
                } while (userListStore.IterNext (ref iter));
            }
        }
Example #4
0
 public void AddUser(Node node)
 {
     userListStore.AppendValues (node);
     AddToChat (null, node.ToString() + " has joined " + thisRoom.Name + ".");
 }
Example #5
0
        public void AddToChat(Node messageFrom, string messageText)
        {
            TextIter iter = chatTextView.Buffer.GetIterAtOffset(chatTextView.Buffer.Text.Length);

            if (chatTextView.Buffer.Text != "")
                chatTextView.Buffer.Insert(ref iter, Environment.NewLine);

            if (messageFrom == null) {
                chatTextView.Buffer.InsertWithTagsByName(ref iter, "(" + DateTime.Now.ToShortTimeString() + ") *** ", new string[] {"NobodysTime"});
                chatTextView.Buffer.InsertWithTagsByName(ref iter, messageText, new string[] {"Bold"});
            } else {
                if (messageFrom.NodeID == Core.MyNodeID) {
                    chatTextView.Buffer.InsertWithTagsByName(ref iter,"(" + DateTime.Now.ToShortTimeString() + ") ", new string[] { "MyTime" });
                } else {
                    chatTextView.Buffer.InsertWithTagsByName(ref iter,"(" + DateTime.Now.ToShortTimeString() + ") ", new string[] { "OtherTime" });
                }

                if (messageText.StartsWith ("/me ") == true) {
                    if (messageFrom.NodeID == Core.MyNodeID) {
                        chatTextView.Buffer.InsertWithTagsByName(ref iter, "* " + messageFrom.ToString(), new string[] { "MyNickname" });
                    } else {
                        chatTextView.Buffer.InsertWithTagsByName(ref iter, "* " + messageFrom.ToString(), new string[] { "OtherNickname" });
                    }
                    chatTextView.Buffer.Insert(ref iter, messageText.Substring(3));
                } else {
                    if (messageFrom.NodeID == Core.MyNodeID) {
                        chatTextView.Buffer.InsertWithTagsByName(ref iter, messageFrom.ToString() + ": ", new string[] { "MyNickname" });
                    } else {
                        chatTextView.Buffer.InsertWithTagsByName(ref iter, messageFrom.ToString() + ": ", new string[] { "OtherNickname" });
                    }
                    chatTextView.Buffer.Insert(ref iter, messageText);
                }

                if (!IsActive) {
                    UrgencyHint = true;
                }
            }
            ScrollToBottom();
        }
        private void RenderNode(Context gc, Node n, double x, double y)
        {
            double xBelow, yBelow;
            xBelow = Math.Floor(x) + 0.5;
            yBelow = Math.Floor(y) + 0.5;

            Gdk.Pixbuf avatar = Gui.AvatarManager.GetAvatar(n);

            double avatarWidth = (avatar.Width < 40) ? avatar.Width : 40;
            double avatarHeight = (avatar.Height < 40) ? avatar.Height : 40;

            DrawRoundedRectThumb(gc, xBelow, yBelow, 40, 40, 10, 1, transparent, lightAlphaGray, avatar,
            avatarWidth, avatarHeight);

            if (selectedNode == n) {
                CreateRoundedRectPath(gc, xBelow, yBelow, 40, 40, 20);
                gc.Color = orangeOverlay;
                gc.Stroke();
            }

            // TODO: This is a mess...
            if (hoverNode == n) {
                Pango.Layout layout = new Pango.Layout (this.PangoContext);
                layout.SetText (n.ToString());

                Gdk.Size te = GetTextSize(layout);

                double textX = xBelow + 20 - (te.Width / 2.0);
                double textY = yBelow + 20 - (te.Height / 2.0);
                double padding = 3;

                CreateRoundedRectPath(gc, textX - padding, textY - padding, te.Width + (padding * 2.0), te.Height + (padding * 2.0), 20);
                gc.Color = darkGray;
                gc.Fill();

                CreateRoundedRectPath(gc, textX - padding, textY - padding, te.Width + (padding * 2.0), te.Height + (padding * 2.0), 20);
                gc.Color = lightGray;
                gc.Stroke();

                gc.Color = new Cairo.Color(255, 255, 255, 1);
                gc.MoveTo(textX, textY);

                Pango.CairoHelper.ShowLayout(gc, layout);
            }

            n.Properties["position"] = new PointD(x, y);
        }
Example #7
0
        internal void ProcessNewSessionKeyMessage(Node messageFrom, byte[] key)
        {
            string keyHash = FileFind.Common.SHA512Str(key);

            // This lets us create a brand new session key
            // if someone wants that for whatever reason.
            if (messageFrom.SessionKeyDataHash != String.Empty && keyHash != messageFrom.SessionKeyDataHash)
            {
                Core.LoggingService.LogInfo("MessageProcessor: Re-keying with: {0}.", messageFrom.ToString());
                messageFrom.ClearSessionKey();
            }

            if (messageFrom.FinishedKeyExchange == false)
            {
                Core.LoggingService.LogInfo("Received secure channel key from: {0}.", messageFrom.ToString());

                messageFrom.SessionKeyDataHash = keyHash;
                messageFrom.DecryptKeyExchange(key);

                if (messageFrom.RemoteHasKey == true)
                {
                    Core.LoggingService.LogInfo("Secure communication channel to {0} now avaliable.", messageFrom.ToString());
                    network.SendInfoToTrustedNode(messageFrom);
                }
                else
                {
                    messageFrom.CreateNewSessionKey();
                }
            }
            else
            {
                Core.LoggingService.LogWarning("Received secure communication key from: {0}, but key exchange was already finished!", messageFrom.ToString());
            }
        }
Example #8
0
 internal void ProcessRequestKeyMessage(Node messageFrom)
 {
     Core.LoggingService.LogInfo("MessageProcessor: {0} requested public key, sending.", messageFrom.ToString());
     network.SendMyKey(messageFrom);
 }
Example #9
0
 internal void ProcessRequestKeyMessage(Node messageFrom)
 {
     LoggingService.LogInfo("MessageProcessor: {0} requested public key, sending.", messageFrom.ToString());
     network.SendMyKey(messageFrom);
 }
Example #10
0
        internal void ProcessNewSessionKeyMessage(Node messageFrom, byte[] key)
        {
            string keyHash = FileFind.Common.SHA512Str(key);

            // This lets us create a brand new session key
            // if someone wants that for whatever reason.
            if (messageFrom.SessionKeyDataHash != String.Empty && keyHash != messageFrom.SessionKeyDataHash) {
                LoggingService.LogInfo("MessageProcessor: Re-keying with: {0}.", messageFrom.ToString());
                messageFrom.ClearSessionKey();
            }

            if (messageFrom.FinishedKeyExchange == false) {
                LoggingService.LogInfo("Received secure channel key from: {0}.", messageFrom.ToString());

                messageFrom.SessionKeyDataHash = keyHash;
                messageFrom.DecryptKeyExchange(key);

                if (messageFrom.RemoteHasKey == true) {
                    LoggingService.LogInfo("Secure communication channel to {0} now avaliable.", messageFrom.ToString());
                    network.SendInfoToTrustedNode(messageFrom);
                } else {
                    messageFrom.CreateNewSessionKey();
                }
            } else {
                LoggingService.LogWarning("Received secure communication key from: {0}, but key exchange was already finished!", messageFrom.ToString());
            }
        }