public OpBuddy AddBuddy(string link) { IdentityLink ident = IdentityLink.Decode(link); if (!Utilities.MemCompare(ident.PublicOpID, Core.User.Settings.PublicOpID)) { throw new Exception("This buddy link is not for " + Core.User.Settings.Operation); } return(AddBuddy(ident.Name, ident.PublicKey)); }
private bool PreProcessLink(string arg) { try { arg = arg.TrimEnd('/'); // copy so modifications arent permanent if (arg.Contains("/file/")) { FileLink link = FileLink.Decode(arg, null); var ui = FindCoreUI(link.PublicOpID); if (ui != null) { ShareService share = ui.Core.GetService(DeOps.Services.ServiceIDs.Share) as ShareService; share.DownloadLink(arg); if (ui.GuiMain != null && !ui.GuiMain.ShowExistingView(typeof(SharingView))) { ui.ShowView(new SharingView(ui.Core, ui.Core.UserID), true); } return(true); } } else if (arg.Contains("/ident/")) { IdentityLink link = IdentityLink.Decode(arg); var target = FindCoreUI(link.PublicOpID); if (target != null) { BuddyView.AddBuddyDialog(target.Core, arg); return(true); } } } catch { } return(false); }