private void ButtonOK_Click(object sender, EventArgs e) { OpLink link = Trust.GetLink(Core.UserID, ProjectID); //if (link != null) // link.Title = TitleBox.Text; Trust.SaveLocal(); Core.Locations.LocalAway = AwayCheckBox.Checked; if (LocationBox.Text != Core.User.Settings.Location || AwayMessage.Text != Core.User.Settings.AwayMessage) { Core.User.Settings.Location = LocationBox.Text; Core.User.Settings.AwayMessage = AwayMessage.Text; if (Core.User.Settings.AwayMessage.Length > 100) { Core.User.Settings.AwayMessage = Core.User.Settings.AwayMessage.Substring(0, 100); } Core.RunInCoreAsync(delegate() { Trust.Core.User.Save(); }); } if (Core.Network.Responsive) { Core.Locations.UpdateLocation(); } Close(); }
private LinkNode CreateNode(OpLink link) { LinkNode node = new LinkNode(link, this); NodeMap[link.UserID] = node; return(node); }
private PlanNode CreateNode(OpLink link) { PlanNode node = new PlanNode(this, link, link.UserID == UserID); NodeMap[link.UserID] = node; return(node); }
public LinkNode(OpLink link, LinkTree parent) { Link = link; ParentView = parent; Trust = parent.Trust; Locations = parent.Core.Locations; UpdateStatus(); }
private OpLink GetTreeHigher(OpLink link) { if (link.LoopRoot != null) { return(link.LoopRoot); } return(link.GetHigher(false)); }
private void EditLink_Load(object sender, EventArgs e) { LocationBox.Text = Trust.Core.User.Settings.Location; OpLink link = Trust.GetLink(Core.UserID, ProjectID); //if (link != null) // TitleBox.Text = link.Title; }
private void SetupRoot(OpLink root) { LinkNode node = CreateNode(root); LoadRoot(node); List <ulong> uplinks = Trust.GetUnconfirmedUplinkIDs(Core.UserID, Project); uplinks.Add(Core.UserID); ExpandPath(node, uplinks); node.Expand(); // expand first level of roots regardless }
public void GetMenuInfo(InterfaceMenuType menuType, List <MenuItemInfo> menus, ulong user, uint project) { if (menuType != InterfaceMenuType.Quick) { return; } bool unlink = false; OpLink remoteLink = Trust.GetLink(user, project); OpLink localLink = Trust.LocalTrust.GetLink(project); if (remoteLink == null) { return; } // linkup if (Core.UserID != user && (localLink == null || localLink.Uplink == null || localLink.Uplink.UserID != user)) // not already linked to { menus.Add(new MenuItemInfo("Trust", LinkRes.linkup, new EventHandler(Menu_Linkup))); } if (localLink == null) { return; } // confirm if (localLink.Downlinks.Contains(remoteLink)) { unlink = true; if (!localLink.Confirmed.Contains(user)) // not already confirmed { menus.Add(new MenuItemInfo("Accept Trust", LinkRes.linkup, new EventHandler(Menu_ConfirmLink))); } } // unlink if ((unlink && localLink.Confirmed.Contains(user)) || (localLink.Uplink != null && localLink.Uplink.UserID == user)) { menus.Add(new MenuItemInfo("Revoke Trust", LinkRes.unlink, new EventHandler(Menu_Unlink))); } }
public PlanNode(ScheduleView view, OpLink link, bool local) { View = view; Link = link; if (local) { Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); } SubItems.Add(new BlockRow(this)); UpdateName(); UpdateBlock(); }
public static string FleshTemplate(ProfileService service, ulong id, uint project, string template, Dictionary <string, string> textFields, Dictionary <string, string> fileFields) { string final = template; // get link OpLink link = service.Core.Trust.GetLink(id, project); if (link == null) { return(""); } // replace fields while (final.Contains("<?")) { // get full tag name int start = final.IndexOf("<?"); int end = final.IndexOf("?>"); if (end == -1) { break; } string fulltag = final.Substring(start, end + 2 - start); string tag = fulltag.Substring(2, fulltag.Length - 4); string[] parts = tag.Split(new char[] { ':' }); bool tagfilled = false; if (parts.Length == 2) { if (parts[0] == "text" && textFields.ContainsKey(parts[1])) { final = final.Replace(fulltag, textFields[parts[1]]); tagfilled = true; } else if (parts[0] == "file" && fileFields != null && fileFields.ContainsKey(parts[1])) { string path = fileFields[parts[1]]; if (File.Exists(path)) { path = "file:///" + path; path = path.Replace(Path.DirectorySeparatorChar, '/'); final = final.Replace(fulltag, path); tagfilled = true; } } // load default photo if none in file else if (parts[0] == "file" && fileFields != null && parts[1] == "Photo") { string path = service.ExtractPath; // create if needed, clear of pre-existing data if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } path += Path.DirectorySeparatorChar + "DefaultPhoto.jpg"; ProfileRes.DefaultPhoto.Save(path); if (File.Exists(path)) { path = "file:///" + path; path = path.Replace(Path.DirectorySeparatorChar, '/'); final = final.Replace(fulltag, path); tagfilled = true; } } else if (parts[0] == "link" && link != null) { tagfilled = true; if (parts[1] == "name") { final = final.Replace(fulltag, service.Core.GetName(id)); } else if (parts[1] == "title") { if (link.Uplink != null && link.Uplink.Titles.ContainsKey(id)) { final = final.Replace(fulltag, link.Uplink.Titles[id]); } else { final = final.Replace(fulltag, ""); } } else { tagfilled = false; } } else if (parts[0] == "motd") { if (parts[1] == "start") { string motd = FleshMotd(service, template, link.UserID, project); int startMotd = final.IndexOf("<?motd:start?>"); int endMotd = final.IndexOf("<?motd:end?>"); if (endMotd > startMotd) { endMotd += "<?motd:end?>".Length; final = final.Remove(startMotd, endMotd - startMotd); final = final.Insert(startMotd, motd); } } if (parts[1] == "next") { return(final); } } } if (!tagfilled) { final = final.Replace(fulltag, ""); } } return(final); }
public void UpdateStatus() { // reset Font = ParentView.OnlineFont; ForeColor = Color.Black; string txt = ""; txt += Trust.Core.GetName(Link.UserID); if (Link.IsLoopRoot) { txt = "Trust Loop"; } OpLink parent = Link.GetHigher(false); if (parent != null) { bool confirmed = false; //bool requested = false; if (parent.Confirmed.Contains(Link.UserID)) { confirmed = true; } if (!confirmed) { ForeColor = Color.Red; } /*foreach (UplinkRequest request in parent.Requests) * if (request.KeyID == Link.UserID) * requested = true; * * * if (confirmed) * { } * else if (requested && parent.UserID == Trust.Core.UserID) * txt += " (Accept Trust?)"; * else if (requested) * txt += " (Trust Requested)"; * else if (parent.UserID == Trust.Core.UserID) * txt += " (Trust Denied)"; * else * txt += " (Trust Unconfirmed)";*/ } else if (!Link.Active) { txt += " (Left Project)"; } txt += " "; // tree bug not showing all text if (Text != txt) { Text = txt; } // bold selected if (ParentView.SelectedLink == Link.UserID && ParentView.Project == ParentView.SelectedProject) { Font = ParentView.SelectedFont; } // if not else, can override above if (Link.UserID == Trust.Core.UserID && Trust.Core.User.Settings.Invisible) { Font = ParentView.OfflineFont; ForeColor = Color.Gray; } }
private void RefreshOperationTree() { BeginUpdate(); // save selected LinkNode selected = GetSelected(); // save visible while unloading List <ulong> visible = new List <ulong>(); foreach (TreeListNode node in Nodes) { if (node.GetType() == typeof(LinkNode)) { UnloadNode((LinkNode)node, visible); } } NodeMap.Clear(); Nodes.Clear(); // white space if (FirstLineBlank) { Nodes.Add(new LabelNode("")); } if (!Trust.ProjectRoots.SafeContainsKey(Project)) { EndUpdate(); return; } string rootname = Core.User.Settings.Operation; if (Project != 0) { rootname = Trust.GetProjectName(Project); } // operation ProjectNode = new ProjectNode(rootname, Project); ProjectNode.Font = TrustedFont; Nodes.Add(ProjectNode); // white space Nodes.Add(new LabelNode("")); // unlinked UnlinkedNode = new ProjectNode("Untrusted", 0); UnlinkedNode.Font = UntrustedFont; Nodes.Add(UnlinkedNode); // if forced, load specific node as root if (ForceRootID != 0) { OpLink root = Trust.GetLink(ForceRootID, Project); if (root != null) { SetupRoot(root); } } // get roots for specific project else { ThreadedList <OpLink> roots = null; if (Trust.ProjectRoots.SafeTryGetValue(Project, out roots)) { roots.LockReading(delegate() { foreach (OpLink root in roots) { SetupRoot(root); } }); } } // show unlinked if there's something to show if (Nodes.IndexOf(UnlinkedNode) + 1 == Nodes.Count) { UnlinkedNode.Text = ""; } else { UnlinkedNode.Text = "Untrusted"; } // restore visible foreach (ulong id in visible) { foreach (TreeListNode node in Nodes) { if (node.GetType() == typeof(LinkNode)) { List <ulong> uplinks = Trust.GetUnconfirmedUplinkIDs(id, Project); uplinks.Add(id); VisiblePath((LinkNode)node, uplinks); } } } // restore selected if (selected != null) { if (NodeMap.ContainsKey(selected.Link.UserID)) { Select(NodeMap[selected.Link.UserID]); } } EndUpdate(); }
public void Link_Update(OpTrust trust) { // update command/live rooms Trust.ProjectRoots.LockReading(delegate() { foreach (uint project in Trust.ProjectRoots.Keys) { OpLink localLink = Trust.LocalTrust.GetLink(project); OpLink remoteLink = trust.GetLink(project); if (localLink == null || remoteLink == null) { continue; } OpLink uplink = localLink.GetHigher(true); List <OpLink> downlinks = localLink.GetLowers(true); // if local link updating if (trust == Trust.LocalTrust) { // if we are in the project if (localLink.Active) { JoinCommand(project, RoomKind.Command_High); JoinCommand(project, RoomKind.Command_Low); JoinCommand(project, RoomKind.Live_High); JoinCommand(project, RoomKind.Live_Low); } // else leave any command/live rooms for this project else { LeaveRooms(project); } } // else if remote user updating else { if (uplink != null) { if (uplink.Trust == trust || uplink.GetLowers(true).Contains(remoteLink)) { RefreshCommand(project, RoomKind.Command_High); RefreshCommand(project, RoomKind.Live_High); } } if (downlinks.Contains(remoteLink)) { RefreshCommand(project, RoomKind.Command_Low); RefreshCommand(project, RoomKind.Live_Low); } } Core.RunInGuiThread(Refresh); } }); // refresh member list of any commmand/live room this person is apart of // link would already be added above, this ensures user is removed foreach (ChatRoom room in FindRoom(trust.UserID)) { if (IsCommandRoom(room.Kind)) { RefreshCommand(room); } else if (room.Members.SafeContains(trust.UserID)) { Core.RunInGuiThread(room.MembersUpdate); } } }
void Trust_Update(ulong key) { // update OpLink link = Trust.GetLink(key, Project); if (link == null) { if (NodeMap.ContainsKey(key)) { RemoveNode(NodeMap[key]); } return; } ProjectNode.Text = Trust.GetProjectName(Project); /* taken care of above * if (!link.Projects.Contains(Project) && !link.Downlinks.ContainsKey(Project)) * { * if (NodeMap.ContainsKey(key)) * RemoveNode(NodeMap[key]); * * return; * }*/ if (ForceRootID != 0) { // root must be a parent of the updating node if (link.UserID != ForceRootID && !Trust.IsUnconfirmedHigher(link.UserID, ForceRootID, Project)) { return; } } LinkNode node = null; if (NodeMap.ContainsKey(key)) { node = NodeMap[key]; node.Link = link; // links reset and re-loaded from file } TreeListNode parent = null; OpLink uplink = GetTreeHigher(link); if (uplink == null) { parent = virtualParent; } else if (NodeMap.ContainsKey(uplink.UserID)) { parent = NodeMap[uplink.UserID]; } else if (uplink.IsLoopRoot) { parent = new TreeListNode(); // ensures that tree is refreshed } // if nodes status unchanged if (node != null && parent != null && node.Parent == parent) { node.UpdateStatus(); Invalidate(); return; } // only if parent is visible if (parent != null) { RefreshOperationTree(); } }
public void RefreshCommand(ChatRoom room) // sends status updates to all members of room { if (!IsCommandRoom(room.Kind)) { Debug.Assert(false); return; } // remember connection status from before // nodes we arent connected to do try connect // if socket already active send status request OpLink localLink = Trust.LocalTrust.GetLink(room.ProjectID); if (localLink == null) { return; } OpLink uplink = localLink.GetHigher(true); // updates room's member list if (room.Kind == RoomKind.Command_High) { room.Members = new ThreadedList <ulong>(); if (uplink != null) { if (localLink.LoopRoot != null) { uplink = localLink.LoopRoot; room.Host = uplink.UserID; // use loop id cause 0 is reserved for no root room.IsLoop = true; } else { room.Host = uplink.UserID; room.IsLoop = false; room.AddMember(room.Host); } foreach (OpLink downlink in uplink.GetLowers(true)) { room.AddMember(downlink.UserID); } } } else if (room.Kind == RoomKind.Command_Low) { room.Members = new ThreadedList <ulong>(); room.Host = Core.UserID; room.AddMember(room.Host); foreach (OpLink downlink in localLink.GetLowers(true)) { room.AddMember(downlink.UserID); } } else if (room.Kind == RoomKind.Live_High) { // find highest thats online and make that the host, // if host changes, clear members // higher should send live lowers which members are conneted to it so everyone can sync up // location update should trigger a refresh of the live rooms } else if (room.Kind == RoomKind.Live_Low) { // just add self, dont remove members } // update dispaly that members has been refreshed Core.RunInGuiThread(room.MembersUpdate); }
void Trust_Update(ulong key) { // copied from linkTree's source OpLink link = Trust.GetLink(key, ProjectID); if (link == null) { if (NodeMap.ContainsKey(key)) { RemoveNode(NodeMap[key]); } return; } /*above should do this now * if (!link.Projects.Contains(ProjectID) && !link.Downlinks.ContainsKey(ProjectID)) * { * if (NodeMap.ContainsKey(key)) * RemoveNode(NodeMap[key]); * * return; * }*/ PlanNode node = null; if (NodeMap.ContainsKey(key)) { node = NodeMap[key]; } TreeListNode parent = null; OpLink uplink = GetTreeHigher(link); if (uplink == null) { parent = PlanStructure.virtualParent; } else if (NodeMap.ContainsKey(uplink.UserID)) { parent = NodeMap[uplink.UserID]; } else if (uplink.IsLoopRoot) { parent = new TreeListNode(); // ensures that tree is refreshed } // if nodes status unchanged if (node != null && parent != null && node.Parent == parent) { node.UpdateName(); Invalidate(); return; } // only if parent is visible if (parent != null) { RefreshUplinks(); RefreshStructure(); } //////////////////////////////////////////////////////////////////// /* * // update uplinks * if (key == DhtID || Uplinks.Contains(key)) * RefreshUplinks(); * * * // create a node item, or get the current one * PlanNode node = null; * * if (NodeMap.ContainsKey(key)) * node = NodeMap[key]; * else * node = new PlanNode(this, link, key == DhtID); * * * // get the right parent node for this item * TreeListNode parent = null; * * OpLink parentLink = link.GetHigher(ProjectID, false); * * if (parentLink == null) // dont combine below, causes next if to fail * parent = Uplinks.Contains(key) ? PlanStructure.virtualParent : null; * * else if (NodeMap.ContainsKey(parentLink.DhtID)) * parent = NodeMap[parentLink.DhtID]; * * else * parent = null; // branch this link is apart of is not visible in current display * * * // remember settings * bool selected = node.Selected; * * * if (node.Parent != parent) * { * List<ulong> visible = new List<ulong>(); * * // remove previous instance of node * if (node.Parent != null) * { * if (node.IsVisible()) * visible.Add(link.DhtID); * * UnloadNode(node, visible); * NodeMap.Remove(link.DhtID); * node.Remove(); * } * * * // if node changes to be sub of another root 3 levels down, whole branch must be reloaded * if (parent == null || parent == PlanStructure.virtualParent) * { * if(Uplinks.Contains(key)) * RefreshStructure(); * * return; * } * * // if new parent is hidden, dont bother adding till user expands * PlanNode newParent = parent as PlanNode; // null if root * * if (newParent != null && newParent.AddSubs == false) * return; * * * // copy node to start fresh * PlanNode newNode = CreateNode(node.Link); * * * // check if parent should be moved to project header * if (newParent != null) * { * Utilities.InsertSubNode(newParent, newNode); * * // if we are a visible child, must load hidden sub nodes * if (newParent.IsVisible() && newParent.IsExpanded) * LoadNode(newNode); * } * * // if node itself is the root * else * { * LoadNode(newNode); * * // remove previous * foreach (PlanNode old in PlanStructure.Nodes) * UnloadNode(old, visible); * * PlanStructure.Nodes.Clear(); * PlanStructure.Nodes.Add(newNode); * } * * node = newNode; * * * // recurse to each previously visible node * foreach (ulong id in visible) * { * List<ulong> uplinks = Links.GetUplinkIDs(id, ProjectID); * * foreach (PlanNode root in PlanStructure.Nodes) // should only be one root * VisiblePath(root, uplinks); * } * } * * node.UpdateName(); * * * node.Selected = selected;*/ }
private void UpdateOperation(LinkNode node) { OpLink link = node.Link; TreeListNode parent = null; OpLink uplink = GetTreeHigher(link); if (uplink == null) { parent = virtualParent; } else if (NodeMap.ContainsKey(uplink.UserID)) { parent = NodeMap[uplink.UserID]; } else if (uplink.IsLoopRoot) { parent = CreateNode(uplink); LoadRoot((LinkNode)parent); } // else branch this link is apart of is not visible in current display // self is changing ensure it's visible if (node.Link.UserID == Core.UserID) { if (parent == null) { List <ulong> uplinks = Trust.GetUnconfirmedUplinkIDs(Core.UserID, Project); uplinks.Add(Core.UserID); ExpandPath(node, uplinks); // check nodeMap again now that highers added if (NodeMap.ContainsKey(uplink.UserID)) { parent = NodeMap[uplink.UserID]; } } if (parent != null) { parent.Expand(); } } // remember settings bool selected = node.Selected; bool expanded = node.IsExpanded; bool loadsubs = node.AddSubs; // update parent node if (node.Parent != parent) { List <ulong> visible = new List <ulong>(); // remove previous instance of node if (node.Parent != null) { if (node.IsVisible()) { visible.Add(link.UserID); } LinkNode oldParent = node.Parent as LinkNode; LinkNode unload = (oldParent != null && oldParent.Link.IsLoopRoot) ? oldParent : node; // if old parent is a loop node, the loop is made obsolete by change UnloadNode(unload, visible); unload.Remove(); } if (parent == null) { return; } // if new parent is hidden, dont bother adding till user expands LinkNode newParent = parent as LinkNode; // null if virtual parent (root) if (newParent != null && newParent.AddSubs == false) { return; } // copy node to start fresh LinkNode newNode = CreateNode(node.Link); if (newParent != null) { GuiUtils.InsertSubNode(newParent, newNode); } else { LoadRoot(newNode); } ArrangeRoots(); // arrange nodes can cause newNode to become invalid, retrieve updated copy if (!NodeMap.ContainsKey(link.UserID)) { return; } newNode = NodeMap[link.UserID]; if (loadsubs) // if previous node set to add kids { LoadNode(newNode); if (expanded) // if previous node set expanded { newNode.Expand(); } } node = newNode; // recurse to each previously visible node List <LinkNode> roots = new List <LinkNode>(); foreach (TreeListNode treeNode in Nodes) { if (treeNode.GetType() == typeof(LinkNode)) { if (((LinkNode)treeNode).Section == ProjectNode) { roots.Add(treeNode as LinkNode); } } } foreach (ulong id in visible) { List <ulong> uplinks = Trust.GetUnconfirmedUplinkIDs(id, Project); foreach (LinkNode root in roots) { VisiblePath(root, uplinks); } } // show unlinked if there's something to show if (Nodes.IndexOf(UnlinkedNode) + 1 == Nodes.Count) { UnlinkedNode.Text = ""; } else { UnlinkedNode.Text = "Untrusted"; } } node.UpdateStatus(); if (selected) { node.Selected = true; } Invalidate(); }
private void ArrangeRoots() { List <ulong> uplinks = Trust.GetUnconfirmedUplinkIDs(Core.UserID, Project); uplinks.Add(Core.UserID); OpLink highest = Trust.GetLink(uplinks[uplinks.Count - 1], Project); if (highest.LoopRoot != null) { uplinks.Add(highest.LoopRoot.UserID); } List <LinkNode> makeUntrusted = new List <LinkNode>(); List <LinkNode> makeProject = new List <LinkNode>(); // look for nodes to switch foreach (TreeListNode entry in Nodes) { LinkNode node = entry as LinkNode; if (node == null) { continue; } if (entry == ProjectNode && !uplinks.Contains(node.Link.UserID)) { makeUntrusted.Add(node); } else if (entry == UnlinkedNode && uplinks.Contains(node.Link.UserID)) { makeProject.Add(node); } } // remove, recreate, insert, expand root, expand to self foreach (LinkNode delNode in makeUntrusted) { RemoveNode(delNode); if (HideUnlinked) { continue; } LinkNode node = CreateNode(delNode.Link); LoadNode(node); InsertRootNode(UnlinkedNode, node); node.Expand(); } Debug.Assert(makeProject.Count <= 1); foreach (LinkNode delNode in makeProject) { RemoveNode(delNode); LinkNode node = CreateNode(delNode.Link); LoadNode(node); InsertRootNode(ProjectNode, node); node.Expand(); ExpandPath(node, uplinks); } }
public void ShowUser(ulong user, uint project) { CurrentMode = StatusModeType.User; UserID = user; ProjectID = project; string header = ""; string content = ""; // get trust info OpLink link = null, parent = null; if (Core.Trust != null) { link = Core.Trust.GetLink(user, project); if (link != null) { parent = link.GetHigher(false); } } // if loop root if (link != null && link.IsLoopRoot) { content = "<b>Order</b><br>"; content += "<div style='padding-left: 10;'>"; if (link.Downlinks.Count > 0) { foreach (OpLink downlink in link.Downlinks) { string entry = ""; if (downlink.UserID == Core.UserID) { entry += "<b>" + Core.GetName(downlink.UserID) + "</b> <i>trusts</i>"; } else { entry += Core.GetName(downlink.UserID) + " <i>trusts</i>"; } if (downlink.GetHigher(true) == null) { entry = "<font style='color: red;'>" + entry + "</font>"; } content += entry + "<br>"; } content += Core.GetName(link.Downlinks[0].UserID) + "<br>"; } content += "</div>"; UpdateHeader("MediumSlateBlue", "Trust Loop"); StatusBrowser.SafeInvokeScript("SetElement", new String[] { "content", content }); return; } // add icons on right content += "<div style='float: right;'>"; Func <string, string, string> getImgLine = (url, path) => "<a href='http://" + url + "'><img style='margin:2px;' src='" + path + "' border=0></a><br>"; if (UserID != Core.UserID && Core.GetService(ServiceIDs.IM) != null && Core.Locations.ActiveClientCount(UserID) > 0) { content += getImgLine("im", IMImg); } if (UserID != Core.UserID && Core.GetService(ServiceIDs.Mail) != null) { content += getImgLine("mail", MailImg); } content += getImgLine("buddy_who", BuddyWhoImg); if (UserID != Core.UserID && link != null) { OpLink local = Core.Trust.GetLink(Core.UserID, ProjectID); if (local != null && local.Uplink == link) { content += getImgLine("untrust", UntrustImg); } else { content += getImgLine("trust", TrustImg); } } content += "</div>"; // name string username = Core.GetName(user); header = "<a class='header' href='http://rename_user'>" + username + "</a>"; if (link != null) { // trust unconfirmed? if (parent != null && !parent.Confirmed.Contains(link.UserID)) { bool requested = parent.Requests.Any(r => r.KeyID == link.UserID); string msg = requested ? "Trust Requested" : "Trust Denied"; if (parent.UserID == Core.UserID) { msg = "<b><a class='untrusted' href='http://trust_accept'>" + msg + "</a></b>"; } msg = "<span class='untrusted'>" + msg + "</span>"; content += msg + "<br>"; } // title if (parent != null) { string title = parent.Titles.ContainsKey(UserID) ? parent.Titles[UserID] : "None"; if (parent.UserID == Core.UserID) { title = "<a href='http://change_title/" + title + "'>" + title + "</a>"; } content += "<b>Title: </b>" + title + "<br>"; } // projects string projects = ""; foreach (uint id in link.Trust.Links.Keys) { if (id != 0) { projects += "<a href='http://project/" + id.ToString() + "'>" + Core.Trust.GetProjectName(id) + "</a>, "; } } projects = projects.TrimEnd(new char[] { ' ', ',' }); if (projects != "") { content += "<b>Projects: </b>" + projects + "<br>"; } } if (Core.Buddies.IgnoreList.SafeContainsKey(user)) { content += "<span class='untrusted'><b><a class='untrusted' href='http://unignore'>Ignored</a></b></span><br>"; } //Locations: // Home: Online // Office: Away - At Home // Mobile: Online, Local Time 2:30pm // Server: Last Seen 10/2/2007 string aliases = ""; string locations = ""; foreach (ClientInfo info in Core.Locations.GetClients(user)) { string name = Core.Locations.GetLocationName(user, info.ClientID); bool local = Core.Network.Local.Equals(info); if (info.Data.Name != username) { aliases += AddAlias(info.Data.Name); } if (local) { name = "<a href='http://edit_location'>" + name + "</a>"; } locations += "<b>" + name + ": </b>"; string status = "Online"; if (local && Core.User.Settings.Invisible) { status = "Invisible"; } else if (info.Data.Away) { status = "Away - " + info.Data.AwayMessage; } if (local) { locations += "<a href='http://edit_status'>" + status + "</a>"; } else { locations += status; } if (info.Data.GmtOffset != System.TimeZone.CurrentTimeZone.GetUtcOffset(Core.TimeNow).TotalMinutes) { locations += ", Local Time " + Core.TimeNow.ToUniversalTime().AddMinutes(info.Data.GmtOffset).ToString("t"); } locations += "<br>"; } if (locations == "") { content += "<b>Offline</b><br>"; } else { content += "<b>Locations</b><br>"; content += "<div style='padding-left: 10; line-height: normal'>"; content += locations; content += "</div>"; } // add aliases if (Core.Trust != null) { OpTrust trust = Core.Trust.GetTrust(user); if (trust != null && trust.Name != username) { aliases += AddAlias(trust.Name); } } OpBuddy buddy; if (Core.Buddies.BuddyList.SafeTryGetValue(user, out buddy)) { if (buddy.Name != username) // should be equal unless we synced our buddy list with ourselves somewhere else { aliases += AddAlias(buddy.Name); } } if (aliases != "") { content += "<b>Aliases: </b>" + aliases.Trim(',', ' ') + "<br>"; } UpdateHeader("MediumSlateBlue", header); StatusBrowser.SafeInvokeScript("SetElement", new String[] { "content", content }); }