diff --git a/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy b/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy index 298a782a..29f46484 100644 --- a/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy +++ b/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy @@ -11,6 +11,7 @@ class MuWireSettings { final boolean isLeaf boolean allowUntrusted + boolean searchExtraHop boolean allowTrustLists int trustListInterval Set trustSubscriptions @@ -38,6 +39,7 @@ class MuWireSettings { MuWireSettings(Properties props) { isLeaf = Boolean.valueOf(props.get("leaf","false")) allowUntrusted = Boolean.valueOf(props.getProperty("allowUntrusted","true")) + searchExtraHop = Boolean.valueOf(props.getProperty("searchExtraHop","false")) allowTrustLists = Boolean.valueOf(props.getProperty("allowTrustLists","true")) trustListInterval = Integer.valueOf(props.getProperty("trustListInterval","1")) crawlerResponse = CrawlerResponse.valueOf(props.get("crawlerResponse","REGISTERED")) @@ -76,6 +78,7 @@ class MuWireSettings { Properties props = new Properties() props.setProperty("leaf", isLeaf.toString()) props.setProperty("allowUntrusted", allowUntrusted.toString()) + props.setProperty("searchExtraHop", String.valueOf(searchExtraHop)) props.setProperty("allowTrustLists", String.valueOf(allowTrustLists)) props.setProperty("trustListInterval", String.valueOf(trustListInterval)) props.setProperty("crawlerResponse", crawlerResponse.toString()) diff --git a/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy b/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy index 6b286ebe..286f0342 100644 --- a/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy +++ b/gui/griffon-app/controllers/com/muwire/gui/MainFrameController.groovy @@ -86,7 +86,8 @@ class MainFrameController { terms.each { if (it.length() > 0) nonEmpty << it } searchEvent = new SearchEvent(searchTerms : nonEmpty, uuid : uuid, oobInfohash: true) } - core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : true, + boolean firstHop = core.muOptions.allowUntrusted || core.muOptions.searchExtraHop + core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : firstHop, replyTo: core.me.destination, receivedOn: core.me.destination, originator : core.me)) } diff --git a/gui/griffon-app/controllers/com/muwire/gui/OptionsController.groovy b/gui/griffon-app/controllers/com/muwire/gui/OptionsController.groovy index c42c99a9..1dbba07e 100644 --- a/gui/griffon-app/controllers/com/muwire/gui/OptionsController.groovy +++ b/gui/griffon-app/controllers/com/muwire/gui/OptionsController.groovy @@ -96,6 +96,10 @@ class OptionsController { model.onlyTrusted = onlyTrusted settings.setAllowUntrusted(!onlyTrusted) + boolean searchExtraHop = view.searchExtraHopCheckbox.model.isSelected() + model.searchExtraHop = searchExtraHop + settings.searchExtraHop = searchExtraHop + boolean trustLists = view.allowTrustListsCheckbox.model.isSelected() model.trustLists = trustLists settings.allowTrustLists = trustLists diff --git a/gui/griffon-app/models/com/muwire/gui/OptionsModel.groovy b/gui/griffon-app/models/com/muwire/gui/OptionsModel.groovy index 72888edc..634b2511 100644 --- a/gui/griffon-app/models/com/muwire/gui/OptionsModel.groovy +++ b/gui/griffon-app/models/com/muwire/gui/OptionsModel.groovy @@ -38,6 +38,7 @@ class OptionsModel { // trust options @Observable boolean onlyTrusted + @Observable boolean searchExtraHop @Observable boolean trustLists @Observable String trustListInterval @@ -73,6 +74,7 @@ class OptionsModel { } onlyTrusted = !settings.allowUntrusted() + searchExtraHop = settings.searchExtraHop trustLists = settings.allowTrustLists trustListInterval = String.valueOf(settings.trustListInterval) } diff --git a/gui/griffon-app/views/com/muwire/gui/OptionsView.groovy b/gui/griffon-app/views/com/muwire/gui/OptionsView.groovy index f7502dd5..093c9589 100644 --- a/gui/griffon-app/views/com/muwire/gui/OptionsView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/OptionsView.groovy @@ -55,6 +55,7 @@ class OptionsView { def outBwField def allowUntrustedCheckbox + def searchExtraHopCheckbox def allowTrustListsCheckbox def trustListIntervalField @@ -138,11 +139,13 @@ class OptionsView { gridBagLayout() label(text : "Allow only trusted connections", constraints : gbc(gridx: 0, gridy : 0)) allowUntrustedCheckbox = checkBox(selected : bind {model.onlyTrusted}, constraints : gbc(gridx: 1, gridy : 0)) - label(text : "Allow others to view my trust list", constraints : gbc(gridx: 0, gridy : 1)) - allowTrustListsCheckbox = checkBox(selected : bind {model.trustLists}, constraints : gbc(gridx: 1, gridy : 1)) - label(text : "Update trust lists every ", constraints : gbc(gridx:0, gridy:2)) - trustListIntervalField = textField(text : bind {model.trustListInterval}, constraints:gbc(gridx:1, gridy:2)) - label(text : "hours", constraints : gbc(gridx: 2, gridy:2)) + label(text : "Search extra hop", constraints : gbc(gridx:0, gridy:1)) + searchExtraHopCheckbox = checkBox(selected : bind {model.searchExtraHop}, constraints : gbc(gridx: 1, gridy : 1)) + label(text : "Allow others to view my trust list", constraints : gbc(gridx: 0, gridy : 2)) + allowTrustListsCheckbox = checkBox(selected : bind {model.trustLists}, constraints : gbc(gridx: 1, gridy : 2)) + label(text : "Update trust lists every ", constraints : gbc(gridx:0, gridy:3)) + trustListIntervalField = textField(text : bind {model.trustListInterval}, constraints:gbc(gridx:1, gridy:3)) + label(text : "hours", constraints : gbc(gridx: 2, gridy:3)) }