return(fnet);
}
-struct fnetnode *fnetinitconnect(wchar_t *name, char *addr)
+struct fnetnode *fnetinitconnect(wchar_t *name, char *addr, struct wcspair *args)
{
struct fnet *fnet;
struct fnetnode *fn;
+ struct wcspair *arg;
if((fnet = findfnet(name)) == NULL)
{
return(NULL);
}
fn = newfn(fnet);
+ for(arg = fn->args; arg != NULL; arg = arg->next)
+ {
+ if(!wcscmp(arg->key, L"nick"))
+ fnetsetnick(fn, arg->val);
+ }
getfnetnode(fn);
+ fn->args = args;
if(netresolve(addr, (void (*)(struct sockaddr *, int, void *))resolvecb, fn) < 0)
return(NULL);
return(fn);
void fnetsetstate(struct fnetnode *fn, int newstate);
int fnetsetnick(struct fnetnode *fn, wchar_t *newnick);
struct fnet *findfnet(wchar_t *name);
-struct fnetnode *fnetinitconnect(wchar_t *name, char *addr);
+struct fnetnode *fnetinitconnect(wchar_t *name, char *addr, struct wcspair *args);
void linkfnetnode(struct fnetnode *fn);
void unlinkfnetnode(struct fnetnode *fn);
void getfnetnode(struct fnetnode *fn);
} else {
freeargs = 0;
}
- if((newfn = fnetinitconnect(L"dc", args)) != NULL)
+ if((newfn = fnetinitconnect(L"dc", args, NULL)) != NULL)
{
linkfnetnode(newfn);
putfnetnode(newfn);
char *buf;
int err;
struct fnetnode *fn;
+ struct wcspair *args;
haveargs(3);
havepriv(PERM_FNETCTL);
sq(sk, 0, L"504", L"Could not convert data to locale charset", NULL);
return;
}
- fn = fnetinitconnect(argv[1], buf);
+ args = NULL;
+ for(i = 3; i < argc - 1; i += 2)
+ newwcspair(argv[i], argv[i + 1], &args);
+ fn = fnetinitconnect(argv[1], buf, args);
err = errno;
free(buf);
if(fn == NULL)
sq(sk, 0, L"509", L"Could not parse the address", L"%%s", strerror(err), NULL);
return;
}
- for(i = 3; i < argc - 1; i += 2)
- {
- if(!wcscmp(argv[i], L"nick"))
- fnetsetnick(fn, argv[i + 1]);
- }
linkfnetnode(fn);
fnetsetname(fn, argv[2]);
putfnetnode(fn);