* Matthew Toseland <[EMAIL PROTECTED]> [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 :$

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, [EMAIL PROTECTED] 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
> > [email protected]
> > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> > 
> 
> -- 
> Matthew J Toseland - [EMAIL PROTECTED]
> Freenet Project Official Codemonkey - http://freenetproject.org/
> ICTHUS - Nothing is impossible. Our Boss says so.



> _______________________________________________
> cvs mailing list
> [email protected]
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Attachment: signature.asc
Description: Digital signature

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to