On Sun, May 07, 2006 at 11:42:58AM +0200, Florent Daigni?re (NextGen$) wrote:
> * Matthew Toseland <toad at amphibian.dyndns.org> [2006-05-06 18:03:53]:
>
> > There HAS to be a better way to do this! :) There probably already is...
> > have a close look at the API...
>
> I haven't seen any :$
Well make one, but I thought there was something on SubConfig to set a
particular option?
>
> Method Summary
> void finishedInit()
> Finished initialization
> SubConfig[] getConfigs()
> Fetch all the SubConfig's.
> void onRegister(SubConfig config, Option o)
>
> void register(SubConfig sc)
>
> void store()
> Write current
> config to disk
>
> no Subconfig get(String) yet
>
> I don't think that exporting a FieldSet, mangling it and re-inserting is
> a better idea ;)
>
> Will commit something.
>
> NextGen$
>
> >
> > On Sat, May 06, 2006 at 11:41:42AM +0000, nextgens at freenetproject.org
> > wrote:
> > > Modified: trunk/freenet/src/freenet/node/TextModeClientInterface.java
> > > ===================================================================
> > > --- trunk/freenet/src/freenet/node/TextModeClientInterface.java
> > > 2006-05-06 10:54:28 UTC (rev 8619)
> > > +++ trunk/freenet/src/freenet/node/TextModeClientInterface.java
> > > 2006-05-06 11:40:33 UTC (rev 8620)
> > > @@ -27,6 +27,8 @@
> > > import freenet.client.InsertBlock;
> > > import freenet.client.InserterException;
> > > import freenet.client.events.EventDumper;
> > > +import freenet.config.Option;
> > > +import freenet.config.SubConfig;
> > > import freenet.crypt.RandomSource;
> > > import freenet.io.comm.Peer;
> > > import freenet.io.comm.PeerParseException;
> > > @@ -564,7 +566,27 @@
> > > while(key.length() > 0 && key.charAt(key.length()-1) == ' ')
> > > key = key.substring(0, key.length()-2);
> > > outsb.append("New name: "+key);
> > > - n.setName(key);
> > > + SubConfig[] sc=n.config.getConfigs();
> > > +
> > > + for(int i=0; i<sc.length ; i++){
> > > + Option[] o = sc[i].getOptions();
> > > + String prefix = new String(sc[i].getPrefix());
> > > + String configName;
> > > +
> > > + for(int j=0; j<o.length; j++){
> > > + configName=o[j].getName();
> > > + // we look for node.name
> > > + if(prefix.equals("node") &&
> > > configName.equals("name")){
> > > + Logger.minor(this,
> > > "Setting "+prefix+"."+configName+" to "+key);
> > > + try{
> > > +
> > > o[j].setValue(key);
> > > + }catch(Exception e){
> > > +
> > > Logger.error(this, "Error setting node's name");
> > > + }
> > > + }
> > > + }
> > > + }
> > > + n.config.store();
> > > } else if(uline.startsWith("DISCONNECT:")) {
> > > String ipAndPort = line.substring("DISCONNECT:".length());
> > > disconnect(ipAndPort.trim());
> > >
> > > _______________________________________________
> > > cvs mailing list
> > > cvs at freenetproject.org
> > > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> > >
> >
> > --
> > Matthew J Toseland - toad at amphibian.dyndns.org
> > Freenet Project Official Codemonkey - http://freenetproject.org/
> > ICTHUS - Nothing is impossible. Our Boss says so.
>
>
>
> > _______________________________________________
> > cvs mailing list
> > cvs at freenetproject.org
> > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> _______________________________________________
> cvs mailing list
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
--
Matthew J Toseland - toad at amphibian.dyndns.org
Freenet Project Official Codemonkey - http://freenetproject.org/
ICTHUS - Nothing is impossible. Our Boss says so.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL:
<https://emu.freenetproject.org/pipermail/devl/attachments/20060508/8e2c822b/attachment.pgp>